GSM 2G Help Button
- VJ

- Jul 14, 2020
- 5 min read

Today I plan to create an easy-to-use help button for the elderly or disabled, that sends a distress message to anyone we code it for. This option will be cheap, customizable, and most importantly it can be used in locations outside of the US and Europe. I have noticed that it is very difficult to get help button services like life-alert outside of the United States. This will be an option for any family who cannot afford/buy a traditional help button.
Materials:
x1 sim card (mini) - 2G compatibility
Hardware: For this project we have two options. First we can make a prototype version by using a breadboard and jumper wires. Once that is established we can make a final version by soldering the hardware onto a PCB prototyping board. The second option is permanent, but much smaller and easier to use. First we can look at making the prototype. For this we will need a breadboard, jumper wires, a liPo battery, a GSM module, an Arduino, and a button.
First we can start by looking at a quick diagram on how the project will be wired:

Remember that the VDD pin has to connect to an antenna to work, and all of the grounds have to be the same. I ordered a different sim800l, so I would recommend searching for the specific pinout on google if you are confused. The sim800l that I bought can only handle a max of 4.4V, but a minimum of 3.7V. This makes the 3.7V liPo battery perfect for this usage, and it can be recharged using a TP4056 charger module. The way that this is wired makes the battery last, since we are using the button to activate the Arduino by completing the circuit. This method requires the user to hold down the button for a period of time until the connection is established, and then the SMS will be sent.
Software:
For this part, we can program the sim module so it can send an SMS so anyone we please. Be sure to pick a sim plan that allows for text messages. We will not be using any talk or data. I personally recommend a prepaid, or pay-as-you-go option on the sim card since they are generally cheap and easy to set up. If you are living in the US, I also recommend US Mobile as the carrier. You will know if you are connected if your GSM module is blinking once every three seconds. If it is blinking every second then it is still trying to find a connection.
In my program I also included two LED's. A red one that indicates if a signal is NOT connected, and a green LED that indicates if a signal IS connected. Green is pin 8, red is pin 5. These are optional, but an easy indicator for when the message is sent, so you can stop clicking the button. Keep in mind that if you stop clicking the button then the Arduino will turn off. The reason I built it that way is so the battery wont be unnecessarily drained. Here is the order of events in the program:
Boot-Up --> Red light turns on (searching for connection) --> Connection established --> SMS sent --> Green light turns on, red light off
First the program needs to define the GSM module using the built-in SoftwareSerial library:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(6, 7); // RX, TX
Here mySerial is the GSM module serial port, and we will be using it to send AT commands. Next is the setup function, which will be doing most of the work:
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pinMode(8 , OUTPUT);
pinMode(5 , OUTPUT);
digitalWrite(5 , HIGH);
delay(1000);
while(true){
char c = mySerial.read();
String myString = String(c);
myString.replace(" ", "");
if(myString == "0"){
sendMessage();
digitalWrite(5,LOW);
digitalWrite(8 , HIGH);
break;
}
mySerial.println("AT+CPAS");
}
}
Here, we are first starting the two serial monitors. After that, we define the two LED's and immediately turn on the red LED since it would be impossible for the signal to already have reached. Then we launch into an infinite while loop, which continually checks the status of the network. When the network is established, then myString will equal 0, and the message can be sent. From there the green light will turn on and the program will finish.
Lastly there are some methods that we used in the setup method:
void loop() // run over and over
{
}
void updateSerial()
{
delay(200);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
void sendMessage(){
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CMGS=\"+zzzzzzzzzzzz\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
updateSerial();
mySerial.print("Sent from an arduino device"); //text content
updateSerial();
mySerial.write(26);
}
Here the loop is empty, but be sure to include it or Arduino will crash. The updateSerial method just sends our instructions to the console, and reads what happened to us. The sendMessage method just outputs the AT commands necessary for sending a message. Make sure to include the country code and the phone number in place of "z".
Here is the full code to avoid confusion:
Don't forget about the second part of the process, making a permanent version! For me I just used a prototyping PCB board to create the final version. If you want to make one for yourself, you will need a soldering kit, quite an amount of solder, and some time. The code and the hardware can all be reused, it's just that we are changing the way that we wire it up, and also it becomes easier to use. For this part I used an Arduino pro mini, but you are free to use whichever you would like. Just make sure to keep the pins the same. The way this works is we will replace all of the jumper wires with solder, and we will use a PCB board that fits easier into our hand. Make sure to thoroughly plan out how the solder will be placed, because they cannot overlap. In my case I had to use a wire to get over a circuit, but that doesn't need to be the case.


If you want to do it this way, make sure to be careful which pins you connect, since solder would be difficult to remove. Also, take care not to fry anything, especially your sim card and/or module. I would recommend soldering the wires, and then adding the electronics.
I will most likely be making a 4G version for my grandparents shortly after this one. Keep in mind that 2G networks are leaving countries soon, and will not be around for much longer in America. Along with that 2G is generally slow, and not the best bet for a help button. That is why I will be using a 3G/4G module for the final product. This option would be available for people who cannot afford 4G products, since they generally cost about $60+ USD. This module will work best in developing countries that still use 2G frequently, and those are also the regions that need these the most. If you are having issues sending AT commands, try changing the baud rate. Good luck!



Comments