SIM800L GSM Module with Arduino | AT Commands | Library

SIM800L GSM Module with Arduino | AT Commands | Library

SIM800L Module is a small GSM/GPRS Module and ideal for small ideal projects. The module supports quad-band GSM/GPRS network, available for SMS and GPRS message data remote transmission. SIM800L is advanced than its previous SIM900 modules.

There are other multiple versions of SIM800 is available. The choices of models depend upon the application needs. But SIM800L is used widely for common applications. The features of different models are given below.

  • SIM800L has FM functionality.
  • SIM800C has Bluetooth functionality.
  • SIM800F is pin compatible to the SIM900 module.
  • SIM868 is dual sim version with GNSS and small form factor.

The AT Commands are mostly the same for all GSM Modules based on SIMCOM AT Commands except its additional features like Bluetooth, FM will vary. Refer the datasheet for more details.

The SIM800L can work up to 2 Amps current at peak. It also has a low power consumption feature that consumes 1mA Current in sleep mode. You need to power the module from 3.7V to 4.4V as per the datasheet. More than that will damage the module. You can use a buck converter like LM2596 to achieve this voltage and current range.


  • 2G Quad-band 850/900/1800/1900MHz
  • Receive and make calls using the speaker and microphone outputs
  • Receive and send SMS
  • Listen to FM radio broadcasts
  • GPRS multi-slot class12 connectivity: max. 85.6kbps(download/upload)
  • GPRS mobile station class B
  • Controlled by AT Command (3GPP TS 27.007, 27.005 and SIMCOM enhanced AT Commands)
  • Supports Real Time Clock
  • Operating Voltage range 3.4V ~ 4.4V
  • Supports A-GPS
  • Low power consumption, 1mA in sleep mode
  • Micro SIM Card Support


LED Blinking status:

If the power to the SIM800L is enough, the onboard LED starts blinking according to its operation. If the power is not enough it will receive poor signal and search for network all the time (if still searching adjust the trimpot slightly but do not exceed much than 4.7v). The frequency of the blinking denotes the following:

  • Every second:  searching for a network.
  • Every three seconds: connected to a network.
  • Twice per second: connected through GPRS.

Note: The SIM800L accepts only 2G and 3G Networks (Not 4G)

In this tutorial, we will see how to use SIM800L GSM module with an Arduino.

Pin Details:

At the backside of the module, you can find the pin details printed on it. We will be using 5 Pins to connect with Arduino for basic operation. They are

NET – Antenna pin for the module (Spring Type included). You can use an external antenna via an uFL Connector available on the module for a better signal reception.

VCC – Power supply 3.4V to 4.4V with min 2 Amp. (LM2596 with a 9/12V 1Amp adapter input and it should be adjusted to 4.2V recommended).

RST – Reset

RXD – Receiver to the module (To be connected to Arduino TX Pin).

TXD – Transmitter from the module (To be connected to Arduino RX Pin).

GND – Ground.


Circuit Diagram:

Before making connections, make sure the LM2596 output is set to 4.4V by adjusting the potentiometer on the LM2596 module. You can use a Multi-meter to check the voltage (or) you can use the LM2596 Module with Display. As we know the SIM800L accepts 3.6V – 4.4V and 2Amps, the SIM800L module can draw much current as needed from the LM2596 with a fixed voltage.

The RX Pin of SIM800L Module Should connects to TX Pin of the Arduino. Similarly, the TX Pin of SIM800L should connect to RX Pin of Arduino. In simple logic, a receiver can receive some data only if it is transmitted from somewhere. Similarly for the transmitter side, when some data is sent, the other should receive it to make use of it.

SIM800L With Arduino_bb

Simple Code to send AT Commands and display data from GSM Module on Serial Monitor:

The following code will read the GSM data via Software Serial and print it on Serial Monitor. Similarly, it sends the user entered string from Serial Monitor to the GSM Module.


By using the serial monitor, we send AT Commands to the GSM Module to perform various functions. But we will see few AT commands in this tutorial. You can refer the AT Commands datasheet for various AT Commands.

If you send this, the GSM Module will reply ‘OK’. This means the GSM Module is communicating with Arduino.

This command is used to dial a number. You need to add a semicolon (;) after this command. The syntax is ATD<space><mobilenumber>;


SMS Function:

To send or read SMS from the module we need to set the module to SMS mode and then use the AT Commands for SMS.

To set the GSM Module in SMS mode, use the following code.

Once it returns OK, then use the second command to read the SMS.

To Send an SMS, set the GSM Modem to SMS mode using ‘AT+CMGF=1’ and then use the following command.

The modem will return an arrow to enter the message (>). Type the message and hit enter.


Note: To exit from SMS Mode we need to send ‘Ctrl+Z’ in ASCII Form. So after the SMS functions finished we need to send ’26’ to get back to normal mode. The ’26’ is the ASCII Character for ‘Ctrl+Z’.

Syntax to send the ASCII Character to GSM:

How to use SIM800L Library?

To simplify the operation, there is a library available on GitHub to use SIM800L GSM module. You can download the SIM800L Library zip file and install it on your Arduino IDE. Once downloaded you can open File>Examples>SIM800L and upload the code. In this library, the Software Serial pins are assigned to 10(RX), 11(TX) and 2 (RST) of Arduino by default. You can modify it on the library if you want.

Sample Code to send SMS using SIM800L Library:

We write the code only at the setup loop because it needs to be sent only once. Upload the code and you can receive the SMS on the number you entered on the code.

Share this post

Comments (8)

  • Bammidi Eswararao Reply

    Sir pls.. At command not working
    Uploaded no
    (Class softwareserial’has no member named’redstring’) errr

    Library send me

    September 25, 2018 at 11:37 AM
    • Sharath Reply

      Check this part of code. You might have deleted an ‘a’ in the readString();. Instead of readString() you mentioned redString()

      This is the correct part of the code.


      tempGSM = gsm.readString(); // Read from GSM and Store it in this variable.

      Serial.println(tempGSM); //Print the string from GSM to Serial Monitor.


      September 26, 2018 at 10:32 AM
  • Son Albea Reply

    I think this internet site has some really wonderful information for everyone : D.

    December 19, 2018 at 11:25 AM
  • Akash Kumar Reply

    Is there any AT command which can encode the DTMF signals?

    If yes, could you provide such library by which DTMF signals can be send through the gsm network to some other gsm module ( Library for sim800 and sim 900).

    February 1, 2019 at 9:13 PM
    • Sharath Reply

      The tinyGPS library has this function.

      #define CALL_TARGET "+91XXXXXXXXXX" //Target mobile number (Reciever)
      SoftwareSerial SerialAT(10, 11); // RX, TX
      TinyGsm modem(SerialAT); //Creating object for TinyGsm as modem

      Inside loop

      #if defined(CALL_TARGET)
      Serial.println("Calling:", CALL_TARGET);
      bool res = modem.callNumber(CALL_TARGET);
      Serial.println("Call:", res ? "OK" : "fail");

      if (res) {
      delay(1000L); //delay with long datatype

      // Encode DTMF 'A' tone, duration 1000ms
      modem.dtmfSend('A', 1000);

      // Encode DTMF 0 to 4, default duration (100ms)
      for (char tone='0'; tone< ='4'; tone++) { modem.dtmfSend(tone); }

      //Sending 1 code for 200ms
      modem.dtmfSend('1',200)// Encode and play 1 as DTMF tone for 200ms


      res = modem.callHangup();
      Serial.println("Hang up:", res ? "OK" : "fail");

      On the receiver side

      Set GSM Module in Auto answer mode and use AT+Commands to decode it. Check the AT Command datasheet manual.

      ATS0=2 //Command for auto answering (answers in 2 rings)
      AT+DDET=1 //Enabling DTMF Detection feature

      February 2, 2019 at 11:45 AM
  • Baha Reply

    how can i set the gsm into receive sms mode and do “if” with it
    if (>Here?<){
    //do things

    February 23, 2019 at 2:05 PM
    • Sharath Reply

      In AT Commands mode:
      You need to create a variable to store data temporarily from the GSM Module. Then use gsm.print(“AT+CMGR=1”); // Sending AT command for SMS Read mode.
      Next read the data from GSM Received buffer.
      Then do if with that. Refer AT Commands datasheet so that you can find any simpler command to do your desired operation with parameters.

      February 24, 2019 at 9:54 AM
      • collins Reply

        pls help me here

        March 13, 2019 at 1:47 PM

Leave a Reply

Your email address will not be published. Required fields are marked *