4G Arduino With the Waveshare 7600

by mars91 in Circuits > Wireless

139 Views, 3 Favorites, 0 Comments

4G Arduino With the Waveshare 7600

giannis-the-greatest-skjVnb6BbG8-unsplash (1).jpg
Image (33).jpeg

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

sim7600a-h-4g-hat-1_1.jpg
Screen Shot 2024-10-07 at 12.40.50 AM.png
3800-00.jpg

Before I list parts, I want to mention two possible disclaimers!


  1. 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.
  2. 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:

  1. SIM7600A-H 4G HAT for Raspberry Pi, (North America (US, CA)) 4G part. Found on amazon.
  2. Pay as you go tello sim card, connects to a cellular network for mobile services.
  3. Adafruit ItsyBitsy M4, the chip. Other chips would probably work.
  4. Small Tactile Button, to send a call or text.
  5. LED, light up if call or text is successful. Other typical Arduino LEDs should work.
  6. Adafruit Quarter-sized Breadboard.

I also used some solder and wires.

SIM Card

15.png
Screen Shot 2024-10-07 at 3.13.06 PM.png

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

sim7600a-h-4g-hat-5_1.jpg
Image (29).jpeg
Image (31).jpeg
Image (32).jpeg
Screen Shot 2024-10-07 at 3.21.00 AM.png

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

Screen Shot 2024-10-07 at 4.43.12 PM.png
Screen Shot 2024-10-07 at 1.44.55 PM.png
Screen Shot 2024-10-07 at 1.50.31 PM.png
Screen Shot 2024-10-07 at 1.52.52 PM.png
Image (30).jpeg

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.

#define BAUD 9600
void setup()
{
Serial.begin(BAUD);Serial1.begin(BAUD);
}
void loop()
{
while (Serial.available() > 0)
{
char c = Serial.read();
if (c == '*'){Serial1.write(0x1A);}else{Serial1.write(c);}
}
while (Serial1.available() > 0)Serial.write(Serial1.read());
}


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


  1. AT+CMGF=1 sets the board to text mode
  2. AT+CMGS="number to text" sets the number to text
  3. 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


  1. ATD<number_to_call>; calls the number (dont include the < >)
  2. AT+CHUP hangs up

Call My Phone Circuit

Screen Shot 2024-10-07 at 5.11.48 PM.png

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

chris-ried-ieic5Tq8YMk-unsplash.jpg

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

waveshare demo

Thank you for checking it out!