Waveshare SIM7600G-H 4G HAT for Raspberry Pi - Unlock Mobile Connectivity and GPS!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we're tapping into our mobile communication networks with our raspberry pi hey gang tim here at core electronics and we're gonna set up this wave share 4g hat with a raspberry pi single ball computer this will dramatically increase your sphere of connectivity providing you the ability to control your projects from the other side of the world so let's crack on in [Music] with this hat installed on your raspberry pi single ball computer it's going to be able to connect to 4g 3g 2g nb iot or cat m1 mobile networks you will need an activated sim card to be able to do this this hat also unlocks global navigation satellite system positioning so our raspberry pi is going to be able to pinpoint its gps location no matter where it is in this big wide world this module supports lte cap 4 connection with 150 megabits per second for downlink data transfer after setting up this system we will first send text messages and ring mobile phones with our raspberry pi single ball computer then we will pinpoint our device's location using gps and send that location data in an sms message to a mobile phone finally we're going to activate gpio connected hardware via an sms sent to our raspberry pi performing on the table is everything you need to set up your 4g pi system naturally you're going to need the wave share 4g hat and a raspberry pi we're using a raspberry pi 4 model b 2 gigabyte here you're going to need an activated standard size sim card that works on 4g networks if you want to forego phone calls the hologram global iot sim card could be the perfect solution for you there are also size adapters so if you have a small sim card that is no issue you're also going to need everything to run this raspberry pi as a desktop computer that means you're going to need a micro sd card flashed with the latest raspberry pi os a micro hdmi 2 hdmi cord to connect the system to a monitor and a raspberry pi power supply mouse and keyboard a usb microphone and audio headphones are optional extras if you want to use your raspberry pi as a legit phone just to be clear everything to the left of this antenna comes with the 4g hat preferably you're going to want a case that can hold up the 4g antenna in the upright position i have a 3d printed one here and the stl file is in the full written up guide so just check the description if you want to print one too start by installing your activated sim card to the wave share 4g hat be aware that you need to slide back the mechanism to unlock it then it will be able to swing open no major force is required in any step of this slip in the sim card into the cradle and be careful that the sim card does not fall out or shuffle around during installation connect the wires from the gps antenna and the 4g mobile network antenna to the ufl adapter connectors like so once complete connect the other side of the two ufl connectors to the top of the hat connect the gnss port to the gps antenna and the main port for the mobile network antenna line them up over the top of the connection and push down firmly and with commitment it will then pop firmly into place these connections are not easy to remove so double check the location you're attaching them to now be aware not to toggle accidentally pull off the antennas when you're moving around the setup once you have them connected having a case that holds the antenna upright securely and nearby is definitely advantageous now turn your attention to the yellow jumper caps on the top of the wave share 4g hat set the yellow jumper cap between power and the d6 pins also if you need to arrange the pair of yellow jumper caps so that they both start and go down from the pcb labelled b other jumper cap arrangements configure the hat to work with other boards like the arduino microcontrollers now we can mount this 4g hat to the raspberry pi board as we would any other hat using the included hardware make sure the gpio pins line up correctly and press the two boards firmly together then plug in usb micro power to the bottom usb 3.0 port of the raspberry pi then from here just set up the raspberry pi as you would a desktop computer i will also include a usb microphone which can be plugged directly into the usb 2.0 port and we'll add some headphones to the auxiliary port of the wave share 4g hat i 3d printed a mount to set everything onto it securely and make sure that the 4g antenna stands upright if you want one of these the print files are in the description this 4g wave share hat is a very clever bit of technology but it does require some software setup so it can communicate effectively and function with a raspberry pi single ball computer with our raspberry pi connected as a desktop computer and powered it will boot up to raspberry pi os once here we're going to open up a new terminal window by pressing the black button on the top left of the screen in this terminal window type and enter the following sudo raspy config soon as you press enter it's going to open up the configuration menu use the arrow keys to navigate to interface options and press enter this is going to take you into a deeper menu in this menu we want to enable serial port communication this is how the raspberry pi and the wave share 4g hat are going to communicate use the arrow keys to navigate down to serial port once there press enter this will open up a new menu page asking the question would you like a login shell to be accessible over serial navigate to no and type enter on no it will then open up another menu asking another question going would you like the serial port hardware to be enabled navigate to and type the enter key on yes with that complete navigate to and type enter on finish when the prompt asks you to reboot do so with the system rebooted and back to the desktop we will now install minicom to our raspberry pi system minicom is a serial communication program once again open up a terminal window type and enter the following into this new terminal window sudo apt-get install minicom if ever prompted with do you want to continue y no press y and then the enter key to continue the process next to install the demo codes and board drivers we're going to open up a new terminal window using that same black button and we're going to type and enter the following w get command it's easier to copy and paste it from the full article like i'm doing here this should only take a couple of minutes to complete when it finishes use the same terminal window to type and enter each following command that you can find in the full written up article the first line is going to install 7-zip software which we can use to unzip the downloaded file the second line will unzip our downloaded file into a specific location the third line will provide permissions so that the raspberry pi os doesn't block the wave share 4g hat from functioning the final will open up the rc.local file which we will edit so as you can see that last line when entered opened up a new page the rc.local file that you can navigate around by using the arrow keys on your keyboard you will need to add this command from the full write-up inside the rc.local file we're going to copy and paste it into exactly the same location as i'm doing here having done this with your keyboard press ctrl x y and then the enter key to lock in and save these changes completing this task will mean that the wave share 4g hat drivers will start on the boot up of the raspberry pi single ball computer finally open up one more new terminal window copy and paste these two last commands one by one the first one is going to direct focus to the downloaded bcm2835 folder which has the wave share 4g driver inside the second command will give access permissions and initialize the driver with that complete we have fully set up this wave share 4g hat to work with the raspberry pi single ball computer also we have some great example python scripts that we can jump into and start exploring so let's start by calling up a mobile phone using the raspberry pi system that we've set up open up the location of the script phone call.py you can find it in the directory slash home slash pi slash sim 7600x dash 4g dash hat dash demo slash raspberry slash python slash phone call we're going to right click this file and select open with funny ide funny ide is just a python interpreter software and you can use any that takes your preference with this file open adjust the default phone number to the one you want to call also double check that the line here looks the same on your system tty s0 is the user uart connection port of this raspberry pi 4 model b that number at the end is the default baud rate of the hat the baud rate is the rate at which information is transferred in a communication channel with that complete press save and then press the big green run button on the script give it a second or two to initialize and boom your target phone should be receiving a phone call from your raspberry pi if you choose to pick up the call it's going to last less than 20 seconds as decided in the python script great success an excellent confirmation that the waveshare 4g hat has connected correctly to the mobile network so now let's get our raspberry pi to pinpoint its exact location a great example script that we can dive our toes into this world with is called gps.py which you can find in the directory here this script will activate and utilize the gps antenna with the script open click the green run button allow it a couple of minutes to figure out where in the world the raspberry pi is if you're running into issues with connecting place the gps receiver stick aside face down and put it outside also note that it can have connectivity issues in particularly rainy weather it took about four minutes for me to receive the positioning signal after running this for the first time now this default python script is fantastic however it provides the location details in nme format nmea is a standard data format supported by all gps manufacturers but it isn't very human readable i created another script called gpshuman-readable.py to fix this you can download it from the written article along with all scripts utilized in this guide opening and running this script in the same way as before is going to result in two values latitude and longitude given in decimal degree format decimal degree format is a notation for expressing latitude and longitude geographic coordinates as a decimal fraction of a degree here are our latitude and longitude results these are nice as we can just copy and paste the results directly into google maps search bar it will refresh the web page to exactly where your raspberry pi device believes it is located and here we are in god's land newcastle so now that we know that our raspberry pi single ball computer is connected to both the mobile network and the gps specifically the glonass system let's use both i created a script that figures out the device's gps location and then sends an sms from our raspberry pi with that location data as the contents of the message this sms is written in a very human readable language to do this open up the script find gps then sms final dot py by right clicking like before and opening it with sony ide this python script was created by combining the two demo scripts talked about before you will need to customize the python script by adding your target phone number right here then with that done save it and press the green run button as soon as you do it will start the gps session and pinpoint its location in latitude and longitude formatted in decimal degrees once it finds the gps location it's going to swap to sms mode as you can see here and send the message through to your target phone ahaha and there it is we got our text and that's how that is done this python script could be easily scheduled to run on boot or at a certain point each day so long as you have constant power to your raspberry pi system it would make for a perfectly capable do-it-yourself gps tracking system for fleet management applications and it's not just gps that you could send if you had a particular sensor installed you could send the results of their measurements to your mobile phone in a very similar manner so let's take advantage of this and now use the sms receiving capabilities of our system to control the hardware attached to the gpio pins for today we're going to control a gpio connected led to turn on for a couple of seconds when a new text message which has the correct keyword inside is received by the device this table shows the default relationship between the sim 7600 control pins which is the brain box on top of the wave share 4g hat and the raspberry pi's i o this is important to know before attaching extra hardware to any gpio pins you won't be able to connect to gpio pins that already have communication or powering tasks to perform if you want a labeled gpio pin out guide for raspberry pi single ball computers check the description now that we know what gpio pins are free let's set up our led and connect it to our raspberry pi's gpio attach the negative side to the ground pin 39 and the positive side to the gpio21 pin 40 on the raspberry pi be aware that this led is a placeholder for whatever hardware you want to use via the servo solenoid engine or your garage door just as some examples turning our attention now to the gpio led control via text.py script we're going to open it up and we're going to run it this is a combination of the demo sms receive code and a simple led turn on or off script when run this is going to constantly update each couple of seconds looking for new sms messages when it gets a new one it's going to open it up print all the details of the sms message to the shell and scan the contents for the keyword red if it finds that keyword the led turns on briefly so let's send it a message right now hello raspberry pi i love you please turn on the red led we're going to send it through right now just like that the leds turned on if you want to change this keyword you can find it down here in the script it is part of this if statement recording buff is shorthand for the recording buffer this is the method used here to read the serial output of the hat as it talks to the raspberry pi this keyword can be altered to anything that you desire so long as we're within mobile connectivity which is darn near everywhere except for when you need it we can now get our raspberry pi to start stop and control almost any electronics hopefully this base will serve you well and that's it for today if you have any questions write me a message below we are full-time makers and we're here to help so with my wave share 4g hat functioning exactly how i want it to and you with all the information to do the same until next time stay cozy [Music]
Info
Channel: Core Electronics
Views: 116,096
Rating: undefined out of 5
Keywords: Mobile phone and Raspberry Pi, Use your Raspberry pi to ring up your phone, landline raspberry pi, IOT raspberry pi, GPS with RASPI, Glonass, process to get mobile connectivity onto a RASP PI, waveshare 4 G hat, how to set up SIM7600, SMS you pi, Send a text to control a pi to activate hardware, global control of a raspberrry pi 4 model b, make NMEA human readable, google maps your GPS location, Mobile Phone PI, Raspberry Pi Forever, 4g 3g 2g, antenna, connectivity, network
Id: ABnwz-IYzqA
Channel Id: undefined
Length: 18min 23sec (1103 seconds)
Published: Mon Jun 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.