Home / Tutorials / Arduino Tutorial / Arduino SIM800L Tutorial

Arduino SIM800L Tutorial

The SIM800L is a cheap and portable GSM breakout board with all the capabilities of the larger SIM900 shields. In this Arduino SIM800L tutorial, I will help you get started with this nifty device. Sending and receiving texts with your Arduino have never been easier!

Arduino sim800L breakout board

SIM800L Introduction

Here are the features of the SIM800L breakout board:

  • 2G quad-band @ 850/900/1800/1900 MHz
  • Receive and make calls using the speaker and microphone outputs
  • Receive and send SMS
  • Connect to the Internet via GPRS
  • Listen to FM radio broadcasts
  • Accepts AT Commands

Go to SIM900 Tutorial if you have that module instead

This SIM800L breakout board is ideal for projects that needs to save space. In fact, this is the one I used when I created my own cellphone. This board draws a maximum of 2 A with an input voltage of 3.7 V to 4.2 V. This means you must not connect its pins directly to a 5 V Arduino! It doesn't even run on 3.3 V.

SIM800L Pinout

The solution is either to use a regulator or just have the SIM800L draw from a Li-Po (cellphone) battery. That's what I did and it works!

If the power to the SIM800L is enough, the on-board LED starts blinking. The frequency of the blinking means something:

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

Antennas are essential for this kind of module especially if your project is indoors. Without an antenna, there would not be enough transmitting power for the SIM800L to perform GSM services such as calls and SMS. I decided to purchase this one:

SIM800L Antenna

I found this antenna to be more effective than the one that comes with the SIM800L module by default:

If you are still having trouble with the SIM800L, I suggest you try out my network test project. This helps you test out if the module is really connecting to a network or is getting enough power.

As for the code, we can use Adafruit's FONA library. Download it here and install it on the Arduino IDE.

Once the library is installed, you can now explore the features of the SIM800L. Let's start with sending SMS using this wiring diagram:

Arduino SIM800L Connection

SMS Sending

The FONA library has a simple sendSMS() function that accepts the number and message as parameters and returns true if the message was sent through the network successfully. Here's an example code:

Let's start with this:

This part declares that the RX, TX and RST pins of the SIM800L must be connected to pin 2, 3 and 4 of the Arduino.

The lines above assigns the RX and TX pins as software serial pins. This is done so that the Arduino's hardware serial port remains to be used with the serial monitor. The FONA object is then initialized with the RST pin as parameter. The readline() declaration is needed for that last function you see on the full sketch. This function is a nifty way to read inputs from the user via the serial monitor.

Check out my GPRS tutorial to learn how to use the SIM800 module to connect to the Internet

The SIM800L is checked using the following sequence:

If "FONA is OK" appears in your serial monitor screen then the SIM800L is now ready to accept commands!

This part is the SMS sending part. The code asks for the recipient's number first then asks for the message. If the message is successfully sent, a "Sent!" appears on the serial monitor. Otherwise, a "Failed" appears.

Reading SMS

To read SMS stored in the SIM card, we just change the portion of the code above with this:

The function getSMSSender() returns true and places the SMS sender number to the replybuffer, while the readSMS() function returns true and places the SMS to that same buffer.

You also need to add the following functions for reading sms:

The readnumber() function returns the number of the sender of the SMS you are reading. The readBlocking() function is necessary to avoid reading the serial port when nothing arrives.

Making a Call

To make a call, we must attached a speaker to the SPKRP and SPRKRN terminals of the SIM800L and an electret microphone to the MICP and MICN terminals. Then we can replace the portion of the code above with this:

Calling a number is done using the callPhone() function. This function returns true if the call is successfully made. The number to be called is the parameter for this function.

Receiving a Call

Receiving a call is a bit more complicated because whatever the Arduino is doing must be interrupted to acknowledge the call. This is what the example IncomingCall sketch does:

The first thing that is noticeable is the change in the pin assignments for RX, TX and RST. This is because the D2 pin of the Arduino is the default interrupt pin. The SIM800L uses this pin to interrupt the Arduino whenever there is an incoming call. Thus, the D2 pin and the SIM800L's RING pin (above the DTR pin, if its not visible in yours) must be connected.

There's also an option to enable or disable Caller ID notification. Cool.

There are other options in the FONA library including reading the signal level of the GSM network, scanning FM networks, and enabling GPRS to connect to the Internet! I'll explore these features on my next post so stay tuned!

Buy Chip SIM800L Modules at AliExpress

Check Also

Using an Arduino Turbidity Sensor

Turbidity refers to the haziness of a fluid caused by the increased number of very …


  1. Hello,thanks for your tutorial.
    I have a problem whit my madule, when I upload this code(for sending sms) in serial monitor appear "couldnt find fona"what is the problem?

  2. When I change the portion of the code to receive SMS I get this error "readnumber" was not declared in this scope, that's from uint8_t smsn = readnumber();

  3. hi sir. I am new in this sim800l module.. Can I use this module in Philippines?

    • Hello Gino,

      Yes it is usable in the Philippines. In fact, I am a Filipino using this device in the Philippines 🙂

      • char sendto[21], message[141];
        Serial.print(F("Send to #"));
        readline(sendto, 20);

        sir in this part, 11 numbers lang po yung dapat na iinput.
        tama po ba to ?

        char sendto[12], message[141];
        Serial.print(F("Send to #"));
        readline(sendto, 11);

  4. Hello dear,
    I am Reshad, from Bangladesh. I baught a SIM 800L and Arduino UNO R3. But I can not run SIM 800L. Would you please help me?

    Actually I want to make a little project. Like on/off a relay by sending SMS or DTMF system. Please help me. Thanks.

    • Hello Reshad,

      By "I can not run SIM 800L", do you mean you aren't getting any response from the module? Have you tried using the library I suggested in this post?

      • Thanks a lot for your kind reply dear. My SIM 800L run now. But serial monitor doesn't response. How can I do?? :-/

        • I am using this code as it is and wire connect SIM800L TXD, RXD, RST to UNO 3,2,4 pin. But serial monitor no response. Would you help me plz.

          #include "Adafruit_FONA.h"

          #define FONA_RX 2
          #define FONA_TX 3
          #define FONA_RST 4

          char replybuffer[255];

          SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

          Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

          uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

          void setup() {
          while (!Serial);
          Serial.println(F("FONA basic test"));
          Serial.println(F("Initializing....(May take 3 seconds)"));
          if (! fona.begin(fonaSS)) {
          Serial.println(F("Couldn't find FONA"));
          while (1);
          Serial.println(F("FONA is OK"));

          char sendto[21], message[141];
          Serial.print(F("Send to #"));
          readline(sendto, 20);
          Serial.print(F("Type out one-line message (140 char): "));
          readline(message, 140);
          if (!fona.sendSMS(sendto, message)) {
          } else {

          void loop() {}

          void flushSerial() {
          while (Serial.available())

          uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
          uint16_t buffidx = 0;
          boolean timeoutvalid = true;
          if (timeout == 0) timeoutvalid = false;

          while (true) {
          if (buffidx > maxbuff) {

          while(Serial.available()) {
          char c = Serial.read();

          if (c == '\r') continue;
          if (c == 0xA) {
          if (buffidx == 0) // the first 0x0A is ignored

          timeout = 0; // the second 0x0A is the end of the line
          timeoutvalid = true;
          buff[buffidx] = c;

          if (timeoutvalid && timeout == 0) {
          buff[buffidx] = 0; // null term
          return buffidx;

      • Yes I got SIM800L response. Now I need code to operate a relay by SMS and DTMF.

  5. I have the GSM800L you described above. What did you use for an antenna? I got a sim not registered error when i run get network status of ADAFRUIT FONA library. Can you help? I assumed it was an antenna error but i cant seem to fix it.

  6. whether the part

    Serial.print(F("Send to #"));
    readline(sendto, 20);
    Serial.print(F("Type out one-line message (140 char): "));

    should i change with the destination phone number and the message?

    • Hi Danny,

      No, you can't insert a number there unless other modifications are made. That code is for sending messages via the IDE's serial monitor. Thus, the number should be printed on the monitor rather than in-code.

  7. Hi Roland, pls i've been working on a sim800 project and been having some issues, would be glad if you could help out. The sim module sends sms normally using the example code, but for my project, it is meant to send a message to a number when the heart rate sensor detects an abnormality in the heart beat. the serial monitor shows the reading but when it is meant to send the message, it shows error CMGF. Pls i need help urgently.

  8. Hi, I really enjoyed your tutorial - thanks !
    I've purchased a SIM800L with the intention of repeating your project with my Arduino. I have two questions, please.
    What regulator would you choose for use with a 'normal' 5V power supply ?
    My package came with two antenna ( I think ) - the wound bronze wire type as seen in years ur picture, plus the plug in type with the small connector. Am I right that they are alternate antennae and that the curled wire type is not as useful ?

    Many thanks,


  9. Hi sir I got a sim not registered error when i run get network status of ADAFRUIT FONA library. Can you help?

    • Hi Theresa,

      I can think of a couple of reasons for that error:

      1. The SIM might have PIN enabled. Try running AT+CPIN? If it responds with +CPIN:SIM PIN or +CPIN: SIM PUK then you might need to unlock it with the PIN or PUK.
      2. There is no 2G coverage in your area. GSM (2G) technology is currently being wiped out on some countries in favor of newer technologies. Or, the cell signal can't reach your area.

  10. Hi Roland,

    I am new to Arduino and setup the following: 2 off Ultra-sonic sensor with a DHT22. The data is uploaded to Thingspeak using ESP8266. It took me a while, but eventually got it work and have uploaded more than 15k data points. I would like to use the SIM800L module to upload the data, but have been struggling for >2 weeks just to get AT commands run successfully via the serial monitor. I read that the power supply is critical, thus I am using a "LM2596S Voltage Regulator Adj [email protected]" with 12V input and feeding the SIM800L with 4V. GND is also bridged to the Arduino board. Could you please send me a basic sketch which I can use just to check my SIM800L and SIM card. I have bought 4 off modules thus far and are really lost!!

    • Hi Kobus,

      You can try the "Sending SMS" example sketch I gave above to test your module. I also had some trouble with giving the right power to the SIM800L module. After a couple or more tries, I was finally able to run it by using a 3.7V LiPo battery. I am currently working on a project that is very similar to yours. I'll update you once it's done via email.

      • Hi Roland,

        Although I thought I was OK using the Voltage Regulator, it was only when I changed to a 3.7V Lipo battery that I managed to get it working. I ran your sketch and also a different one to use AT commands. Everything seems to be OK connecting to the internet. I managed to use manual input to update Thingspeak successfully. The challenge is to write the code to upload the sensor values automatically. Would you be prepared to assist me with the coding please?

        Best regards,

Leave a Reply

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