Interfacing GSM Module with Arduino to send SMS and make Calls

Published  April 9, 2024   0
Sim800L GSM Module with Arduino Uno Interfacing and Troubleshooting

If you've ever worked with the SIM800L module, you know that it can be a powerful tool for various projects, including making calls, sending SMS, and even accessing the internet through GPRS. However, like any technology, it's not immune to issues. In this blog, we'll walk you through on how to interface sim800l with Arduino Uno and provide troubleshooting tips to help you get it up and running smoothly. Previously we have also interfaced sim800l with ESP32, you can also check that out if you are interested. Also once you know how to do this basic interfacing you can check out our other projects like GSM Based Home Automation , DIY IVR Phone call System, Portable internet for Raspberry Pi etc 

Before diving into troubleshooting, let's cover some fundamental aspects of the GSM module.

What is GSM?

GSM, which stands for Global System for Mobile, is a cellular standard primarily designed for mobile communication. GSM is a standard developed to facilitate communication between mobile devices. It's a digital cellular network technology that enables users to make calls, send texts, and access basic data services like SMS (Short Message Service) and MMS (Multimedia Messaging Service). GSM networks operate on various frequency bands globally, allowing for international roaming capabilities for mobile subscribers.

What is GPRS?

GPRS, which stands for General Packet Radio Service. GPRS is an enhancement of the GSM standard that enables mobile data transmission. It introduces packet-switched technology to GSM networks, allowing for faster data transfer rates compared to traditional circuit-switched methods. GPRS enables features like internet browsing, email access, and other data-intensive applications on mobile devices. It optimizes network resources by only using bandwidth when data is being transmitted, making it more efficient for data communication than its predecessor.

Feature

GSM

GPRS

Acronym

Global System for Mobile Communications

General Packet Radio Service

Technology

Circuit-switched

Packet-switched

Voice Communication

Primary focus, supports voice calls and SMS

Secondary, supports voice but is optimized for data

Data Transmission

Initially designed for voice, supports data with added functionality

Optimized for data transmission

Data Speed

Upto 9.6 kbps 

Typically up to 114 kbps (2.5G), later enhancements offer higher speeds

Connection Duration

Always-on connection for voice calls

On-demand connection, data sessions initiated as needed

Billing

Billed based on usage (calls and SMS)

Billed based on data transferred, usually in kilobytes or megabytes

Network Architecture

Traditional cellular network with a voice-centric focus

Overlay on GSM network, utilizing existing infrastructure for data services

Application

Voice calls, SMS, low-bandwidth data applications

Internet browsing, email, multimedia messaging, mobile apps, IoT connectivity

 

SIM800L Module Pinout

The SIM800L module is a GSM/GPRS module that offers a wide range of functionalities. It resembles a small chip with an antenna connector and various pins. The below image shows the sim800lpinout, this will later be useful when we are connecting the sim800l gsm module with arduino. 

SIM800L GSM Module Pinout

What we are particularly interested in are the pins on the left side of this including VCC, GND, TX and RX. These pins play a crucial role in its operation.

How to power sim800L GSM Module?

One essential aspect is providing a stable power supply. The SIM800L module requires an input voltage of 3.7V to 4.2V, which can be different from what you usually encounter in electronics. 

You can either use a buck converter with 2A or more max current  capacity which is set at 4 V or  a 3.7V li-ion battery to meet this requirement. 

Important notes: The current capacity of the buck converter is mentioned greater than or equal to 2A is because GSM module is a power hungry device specifically when sending messages or calls .Adding a capacitor between VCC and GND can further stabilize the power supply, but the module works without that too. 

Connecting Sim800L with Arduino UNO

The complete sim800L Arduino circuit is given below, if you're using the SIM800L with a microcontroller like an Arduino, you'll need to be mindful of voltage compatibility. The module operates at 3.3V, while many microcontrollers, like Arduino, work at 5V internally. Ensure proper level-shifting to prevent damage to the module. A voltage divider is often necessary when transmitting data from the microcontroller to the module. 

 

SIM800L GSM Module Interfacing with Arduino

You can see in the above sim800l arduino wiring diagram that I've used one 10k resistor and one 20k resistor in series to create a voltage divider and convert the 5V to 3.3V, but you can use different values too. I've used a voltage divider calculator to figure out the  resistor values. You can try changing the values too.

 

Sim800L Circuit

Create a proper circuit connection, including the necessary wiring between your microcontroller and the SIM800L module. Check for any loose connections, as even a small oversight can lead to issues.I’ve created a small circuit which looks like the image below, but this step is really not mandatory as it will work without soldering too. Just check the jumper connections properly.

Circuit Connection of SIM800L module
 

Sim800L Not Working?

At this point lets assume that you have made all the connections right and you powered the sim800l gsm module, but the module does not work. So, let's address common issues you might encounter while working with the SIM800L module when you power it on. 

Sim800L Network LED blinking

How to Insert SIM Card on SIM800L

Remember that the SIM800L is designed to work with 2G SIM cards. If your sim800l is not detecting SIM make sure your SIM card is compatible with this module and inserted correctly. It should look like this.

Inserting SIM Card in sim800l correct direction

 

Even after inserting it correcting if your sim800l is not detecting SIM card, the problem could be with power supply or your circuit connections. You can know if your SIM card is being detected by looking at the network status LED as shown below. 

SIM800L Network Status LED Indication

The SIM800L module features a network status indicator LED, which blinks at different rates to indicate the network state.

SIM800L LED Blinking Fast

Blink Every One Sec

SIM800L LED Status

Blink Every Two Sec

SIM800L LED Blinking

Blink Every Three Sec

  • A fast blink (once every second) suggests that the module is running but hasn't connected to the cellular network.
  • A slower blink (once every two seconds) indicates an active GPRS data connection. 
  • The desired state for this tutorial is one blink every three seconds, indicating that the module can send and receive voice and SMS.

Sim800L not connecting to Network

If the network status LED on sim800L is not blinking as explained above, it means that the sim800 gsm module is not connecting to the network. In this case follow these steps below:

  • Check if the 2G supported SIM card( with recharge for call and sms)  is correctly inserted and the sim connector or sim card is not damaged or broken.
  • Increase the voltage supplied by the buck converter, but don't exceed the module's maximum voltage of 4.2V.
  • Verify if other SIM cards from the same network have proper coverage in your location. If not, change the SIM Card and Retry.
  • If the problem persists, the SIM800L module might be faulty and should be replaced.

Another commonly asked question in regarding the sim800l module is that, does sim800l support 4g?

Well, the answer is NO. Sim800L module only supports 2G it does not provide support for 3G and 4G. Meaning if you are in India, the only two options you have are Airtel and Vodafone. 

Note:- Don't move beyond this point if you are not getting a blink every 3 seconds. Even after following all these steps if the sim800l module is not registering to network then there is something wrong with the module and you should try changing it. 

SIM800L AT Command Test 

Uploading an AT command test program to your Arduino allows you to communicate with the SIM800L module. The most easy way to text if your SIM800L GSM module is working or not is by using a simple AT command test, the below image shows how the SIM800L is powered and the LED blinks once every 3 seconds to indicate that it is ready with the network. Then by sending a simple AT command we can check if the GSM module is giving OK

 

Make sure you have uploaded the below code in in your Arduino before sending commands to the SIM800L module.  Alternatively you can also use a USB to TTL converter in place of Arduino and test for the same. 

// Create a SoftwareSerial object to communicate with the SIM800L module
SoftwareSerial mySerial(3, 2); // SIM800L Tx & Rx connected to Arduino pins #3 & #2
void setup()
{
  // Initialize serial communication with Arduino and the Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  // Initialize serial communication with Arduino and the SIM800L module
  mySerial.begin(9600);
  Serial.println("Initializing...");
  delay(1000);
  mySerial.println("AT"); // Handshake test, should return "OK" on success
  updateSerial();
  mySerial.println("AT+CSQ"); // Signal quality test, value range is 0-31, 31 is the best
  updateSerial();
  mySerial.println("AT+CCID"); // Read SIM information to confirm whether the SIM is inserted
  updateSerial();
  mySerial.println("AT+CREG?"); // Check if it's registered on the network
  updateSerial();
}
void loop()
{
  updateSerial();
}
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read()); // Forward data from Serial to Software Serial Port
  }
  while (mySerial.available()) 
  {
    Serial.write(mySerial.read()); // Forward data from Software Serial to Serial Port
  }
}

Ensure that the module responds with "OK" to confirm its responsiveness. If this is working for you and you are feeling adventures you can also test the Call and SMS capability in the same set-up by just typing in a different command 

 

If your sim800l is not responding, double-check the RX and TX connections, also try reversing them briefly to see if the serial monitor displays any changes.

sim800l At command testing

If you get the above results on your serial monitor. You can move forward to making calls and messages. If you are curious you can also visit the sim800l AT commands manual to check out all the possible AT commands available on SIM800L GSM Module. 

Sending SMS in SIM800L using Arduino

The SIM800L module supports making calls and messages.

Below is the arduino code for sending a message on SIM800L. You just need to change the phone number (+XXXXXXXXXXXX)and text which you need to send and upload the code.

sim800l sending sms arduino code

Here’s the complete sim800l SMS arduino code for the same.

#include <SoftwareSerial.h>
// Create a SoftwareSerial object to communicate with the SIM800L module
SoftwareSerial mySerial(3, 2); // SIM800L Tx & Rx connected to Arduino pins #3 & #2
void setup()
{
  // Initialize serial communication with Arduino and the Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  // Initialize serial communication with Arduino and the SIM800L module
  mySerial.begin(9600);
  Serial.println("Initializing..."); 
  delay(1000);
  mySerial.println("AT"); // Handshake test, should return "OK" on success
  updateSerial();
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"+ZZxxxxxxxxxx\""); // Change ZZ with the country code and xxxxxxxxxxx with the phone number to send an SMS to
  updateSerial();
  mySerial.print("Circuitdigest | circuitdigest.com"); // SMS text content
  updateSerial();
  mySerial.write(26); // Send the CTRL+Z character to terminate the SMS
}
void loop()
{
}
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read()); // Forward data from Serial to Software Serial Port
  }
  while (mySerial.available()) 
  {
    Serial.write(mySerial.read()); // Forward data from Software Serial to Serial Port
  }
}

sim800l sms arduio code working

If your sim800l is not sending SMS, check with the sim card network provider if 2G SMS is available on their network.  

Making Calls on SIM800L using Arduino

Now, let’s test the call feature. Copy and paste the code given below and change the phone number given in the code (+XXXXXXXXXXXX)  with your recipient number.

sim800l making calls arduino code

Here’s the complete sim800l call arduino code where you need to make the changes.

#include <SoftwareSerial.h>
// Create a SoftwareSerial object to communicate with the SIM800L module
SoftwareSerial mySerial(3, 2); // SIM800L Tx & Rx connected to Arduino pins #3 & #2
void setup()
{
  // Initialize serial communication with Arduino and the Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  // Initialize serial communication with Arduino and the SIM800L module
  mySerial.begin(9600);
  Serial.println("Initializing..."); 
  delay(1000);
  mySerial.println("AT"); // Handshake test, should return "OK" on success
  updateSerial();
  mySerial.println("ATD+ZZxxxxxxxxxx;"); // Change ZZ with the country code and xxxxxxxxxxx with the phone number to dial
  updateSerial();
  delay(20000); // Wait for 20 seconds...
  mySerial.println("ATH"); // Hang up the call
  updateSerial();
}
void loop()
{
}
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read()); // Forward data from Serial to Software Serial Port
  }
  while (mySerial.available()) 
  {
    Serial.write(mySerial.read()); // Forward data from Software Serial to Serial Port
  }
}

Now, upload the code and your recipient should receive a call. 

sim800l arduino code for making calls working

Note:- You can reset the Arduino to make the call again. The same goes for messages

Here’s the github repo where you can find the complete code and the circuit diagrams that we have used in this tutorial. 

With the right knowledge and troubleshooting techniques, you can make the SIM800L module work seamlessly for your projects. By understanding its basics and addressing common issues, you'll be well-equipped to harness the full potential of this versatile GSM/GPRS module.

Now that you have got your SIM800L module working you can check out the SMS Based Vehicle Tracking project, Automated Call Answering Machine, and Forest Fire warning Project that we built earlier. Happy tinkering!
 

Video

Have any question realated to this Article?

Ask Our Community Members