4G Arduino With the Waveshare 7600
by mars91 in Circuits > Wireless
222 Views, 4 Favorites, 0 Comments
4G Arduino With the Waveshare 7600
How many bars does your Arduino have? :)
Connect a DIY circuit to a 4G network. Send alerts, data, alarms, and communicate around the world.
I dont like when you can't find your phone, you can't call it, so I decided to build a simple circuit to ring my phone when it's been misplaced.
This circuit is simple, using a neat 4G component that plugs into a chips UART (Universal Asynchronous Receiver Transmitter) protocol. This means many chips will work. Even if it simple, I wrote this quick guide because I could not find a lot of steps, examples, or code libraries for an Arduino like chip with Waveshare SIM7600 4G hat.
Supplies
Before I list parts, I want to mention two possible disclaimers!
- This circuit was tested in the North America region with the North America board. I recommend buying the correct board for your region. Do research. There is also the global version, SIM7600G-H 4G HAT LTE Cat-4, which seems to have more examples than the North America board I'm using. I can not promise these steps will 100% work for your boards and variations.
- I used a tello sim card. tello lets you check your zip code and confirms if there is coverage. You may need a different sim card. I found online chats about sim cards not working with this 4G component, so do research.
Parts:
- SIM7600A-H 4G HAT for Raspberry Pi, (North America (US, CA)) 4G part. Found on amazon.
- Pay as you go tello sim card, connects to a cellular network for mobile services.
- Adafruit ItsyBitsy M4, the chip. Other chips would probably work.
- Small Tactile Button, to send a call or text.
- LED, light up if call or text is successful. Other typical Arduino LEDs should work.
- Adafruit Quarter-sized Breadboard.
I also used some solder and wires.
SIM Card
I purchased a tello sim card from amazon and used a link where you can check coverage. Once the sim card arrived I activated it online with the activation details that came with the card. And now I have a new number!
I put 20 USD dollars on the card. I have sent many texts and made many calls over the last few days and have only used 2 of my 20 dollars.
Punch out the sim card. Mine had multiple size options (the cutout or bit around the actual card) and I used the biggest size cutout for the Waveshare 7600.
Waveshare SIM7600 HAT
This component will connect you to a 4G network. It also provides GPS positioning. I only used it for mobile services but check out other tutorials for the GPS features if you'd like!
SIM Card
On the Waveshare bottom insert the activated SIM card. The Waveshare has an easy SIM card locking system.
Push back the plastic SIM card locking system, put the SIM card in, and push the plastic lock back in. This should be done gently, if you find yourself forcing the SIM card to lock, something may be wrong.
Assembly
The cell antenna will screw into one of the u.FL Adapter Connectors (black cables with gold platted ends). The other open end will snap onto the Waveshare board. The u.FL cable snaps into the connection labeled main on the board. Place the open u.FL connector directly over the connection and press firmly. It is suppose to snap into place and should be difficult to remove. Be careful moving the board around now as the cable could get caught around something.
The board comes with some Yellow Jumper Caps for physically setting different modes. For this (a microcontroller) setup, use one of the yellow jumpers to connect 3V3 and PWR. The other two jumpers connect (side by side) pins B to C together on the Waveshare. See the above pictures.
Docs
I found people not happy with this boards documentation but I found it very useful and used it for everything else below. Here is a link to the docs, I recommend looking at it.
How the board communicates
The board uses self coined `AT` commands. When you want to call, text, GPS locate, etc... the board listens for an `AT` command. Here is a link to a PDF download for all the AT commands. I used this PDF to write the code below. For example, for SMS messaging commands I just searched (cntrl f) the PDF for SMS.
Your First Text
I want to share how I first worked with the board. You only need the chip and the Waveshare board connected. No need for buttons for now.
Connect the Waveshare's 5 volt pin to chip USB pin, connect ground with ground, the Waveshare's Tx to chip Rx, and Waveshare's RX to chip Tx. Thats it!
It takes a few seconds for the Waveshare to turn on. If powered on and connected to a network, the small LED above NET should blink a few times a second. This fast blink means it is ready!
Set it up the Arduino IDE. Upload the code below.
You now talk to Waveshare board through the serial monitor. Open your serial monitor and from the dropdown(s) select the correct baud rate and select Both NL and CR. See picture above. Enter and talk to your 4G board!
Note if the board expects a custom message, like a text, end the message by using *
To send a SMS use these commands
- AT+CMGF=1 sets the board to text mode
- AT+CMGS="number to text" sets the number to text
- your message * sends your message
The board should communicate back with you and send a text. Sometimes the SMS message takes a few seconds to send so be patient.
To make a call
- ATD<number_to_call>; calls the number (dont include the < >)
- AT+CHUP hangs up
Call My Phone Circuit
This simple circuit will call a phone and send a SMS (text) message from the click of a button. I do use the Adafruit ItsyBitsy M4 Express that has a great tutorial for getting it started in the Arduino IDE. Three buttons will call my phone, my girlfriends phone, and send me a text. You can hardcode any number or message you like.
I added some LEDs that show the Waveshare board (in code) is talking back. The Waveshare's `AT` commands (mentioned above) have responses that determine if our commands worked. If the job is done right, the LED lights up for a few seconds.
On the M4 Express board, pins 12, 9 ,22 will have buttons and pins 15 and 19 will have LEDs. All go to ground. These pins were chosen for minimal soldering with the Adafruit Quarter-sized Breadboard.
Code
This code uses the basic Waveshare commands and wraps them in some C++ classes. There is a header file that should be included in the Arduino project folder.
I'm not sure if I like the code so please feel free to change it or simplify it. In the Button7600 class there is a method that grabs the correct response from our commands to light up the LEDs. The Call and Text classes have comments showing the underline AT command sequence.
change lines 56,57,58 for your numbers and hardcoded text msg.
Demo
Thank you for checking it out!