Home / Tutorials / Arduino Tutorial / Using SIM800L with Arduino (Updated 2020)

Using SIM800L with Arduino (Updated 2020)

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 with using this nifty device. Sending and receiving texts with your Arduino have never been easier!

Arduino sim800L breakout board

[the_ad id=”3059″]

Video Tutorial

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

Read more information from the SIM800L Datasheet.

SIM800L Pinout

Go to SIM900 Tutorial if you have that module instead

Powering the Board

Power requirements is probably the most common issue with the SIM800L. 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. However, its TX and RX pins are 5V tolerant.

Some YouTube videos power their modules from the Arduino UNO’s power pins which really doesn’t work for me. When on USB port, the Arduino’s 5V pin can supply a maximum of 450 mA and when on its DC Jack, about 800 mA. However, these might explain why their modules work:

  • their Arduino’s have internal regulators that drop the voltage to ~4.4-4.5 V when the SIM800L is connected
  • they are very close to mobile network transmitters, which means the SIM800L doesn’t need to draw too much power to establish a connection

Some also use a diode to drop the 5 V voltage to ~4.3 V (assuming a silicon diode). Maybe this would solve the voltage problem, but not the current problem.

The better approach is either to use a regulator or just have the SIM800L draw from a Li-Po battery.

If selecting a voltage regulator, I recommend the LM2596S regulator module.

The LM2596S can provide a maximum 3 A to its load. You simply use a higher voltage in its input then adjust the on-board potentiometer to have 3.7 to 4.4 V for the SIM800L. Take note that the input voltage must be at least 1.5 V higher than the output.

SIM800L and LM296S

A Li-Po battery works well too, since they provide 3.7 V. I recommend Li-Po battery with higher ampere-hour ratings so that it can provide the SIM800L’s current requirements. My network test project uses a battery to supply power to the SIM800L.

SIM800L and LiPo battery

Connecting the SIM800L to Network

If the power to the SIM800L is enough, the on-board LED starts blinking. If there’s not enough power, the LED blinks  for about three seconds, then turns off.

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.

Here’s a video showing these LED indications:

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.

SIM800L Antenna

The image above is an outdoor whip antenna and I found this antenna to be more effective than the indoor helical antenna that comes with the SIM800L module:

[the_ad id=”3059″]


Another type of antenna is the PCB antenna:

SIM800L PCB antenna

This type of antenna is cheaper and doesn’t take much space as that of the whip antenna. Performance wise, the PCB antenna can be as good as the whip if the design is correct.

My recommendation is to use both the indoor helical antenna and either the whip or PCB antenna.

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.

SIM800L and AT Commands

Like other modems, the SIM800L communicates through AT Commands. The Arduino sends these commands serially to the SIM800L and the latter replies via the same serial port.

The first command is the initial handshake command, which is simply:

If the SIM800L is good to go, it should reply with:

Other commands we can use to check the SIM800L is the signal quality test:

for which the module should reply something like this:

The first number is the Received Signal Strength Indicator (RSSI) which tells you about the network signal the module is receiving. A good RSSI is 31:

The second number is the Bit Error Rate (BER) which is the number of bit errors divided by the total number of bits received by the module. Possible values are 0 to 7 or 99:

The higher the BER, the more bit errors. Thus, the ideal BER value should be closer to 0.

The network registration test can tell you if the SIM800L is ready to send/receive SMS or make calls:

The module will reply with two numbers:

Where the 1st number is:

and the second number is:

The ideal reply from a SIM800L to function well (including data) is:

Note that results may vary with your location.

To begin sending commands to the SIM800L, wire it to the Arduino UNO as shown:

Arduino SIM800L Wiring Diagram

Here, I am using a Li-Po battery. If you can’t get one like this, use LM2596S instead as seen in the previous section.

The Arduino UNO has a hardware serial port but it’s the one used for sending code to it via USB. Instead, we use a serial port emulated through software.

First we include the library and then create a Software Serial object:

We need to know the reply of the SIM800L. So we initialize both hardware and serial ports in order to print the replies via serial monitor:

To send a command, we do:

Or we can just send the commands via serial monitor. To do that and also read the reply from the SIM800L, we place this inside loop():

Here is the full sketch for the AT command test:

Here’s how the SIM800L is responding with AT Commands:

View post on imgur.com

The FONA Library

While we can maximize the functions of the SIM800l through AT commands, it is much easier to use an existing library instead. The library I recommend is Adafruit’s FONA library. Download it here and extract it on Documents > Arduino > libraries. Or you can go to Sketch > Include Library > Manage Libraries and type “FONA” in the search bar.

The library comes with a number of examples. The FONA_test sketch gives us access to all the SIM800l functions! If you upload the sketch and use the same wiring diagram, you’ll see this on the serial monitor:

Here’s a short video showing how I sent an SMS using this library:

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 that sends one SMS:

Upload this sketch to your Arduino and open serial monitor to send SMS.

Let me explain the sketch above. 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 (gsm) is then initialized with the RST pin as parameter.

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 “Couldn’t find SIM800L!” appears in the serial monitor the program goes to an infinite loop and therefore will not continue.

[the_ad id=”3059″] This part is the SMS sending part. The message “Hello from SIM800L” will be sent to the number  “09171234567” when the Arduino starts.

Reading SMS

How about sending SMS to the SIM800L and reading it? We add a function for reading SMS:

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.

To use the function, specify which SMS you want to read:

This code reads the SMS at location #1. The disadvantage of this code is you can’t read the latest SMS because they are not indexed according to delivery time.  If your applications requires to read the latest SMS, I suggest you use the FONA_SMS_response example sketch from the FONA library.

Making a Call

[the_ad id=”3059″]

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.

SIM800L microphone and speaker

Then we add another function:

Calling a number is possible through the callPhone() function from the library. Moreover, this function returns true if the call is successfull. The number to be called is the parameter for this function.

To use this function, just pass the number to be called like this:

Receiving a Call

Receiving a call is a bit more complicated because there must be an interrupt trigger 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, connecting the D2 pin to the SIM800L’s RING pin (above the DTR pin, if its not visible in yours) is a must.

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

[the_ad id=”3059″]

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

MAX30102 black board

MAX30102: An Improved Heart Rate Sensor for Arduino

Have you read the MAX30100 tutorial and are still having trouble making that chip work? …


  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.

      • which libraries please tell

  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 35V@3A” 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,

  11. Should i connect rx tx and rest of sim800l directly with arduino without divide the 5v to 3.3v ??

  12. sir im from the philippines
    i have encountered error it say in the serial monitor +CPIN: NOT INSERTED
    what could be the problem in this situation

  13. +CPIN: READY

    —> AT+CPMS=”SM”,”SM”,”SM”
    <— ERROR
    FONA is OK
    Send to
    ganito nalabas sir

  14. Hi Roland,

    I just want to use the GSM for sending SMS. No calls or getting SMS back. Do I have to switch off these functions (with code or hardware) or can I use the GSM normally without any changings?

    I am worried about illogical conditions due to these functions which are never used. Like somebody calls this GSM and the whole system crashes because i havent catched these conditions.

    Maybe u can help me 🙂

    Many Thanks!

  15. hi sir, i am working on uno r3 with gsm sim800l i tried the code which is given above but sir i got this error

    Send to #+923483138265
    Type out one-line message (140 char): hi this is my msg
    —> AT+CMGF=1

    > hi this is my msg

    , i dont know how to solve it so kindly guide me.

  16. Hi Roland,

    Thanks very much for your excellent tutorial!
    I am struggeling with the incoming call example as I am not able to get a response from the SIM module.
    I am using a Nano with RX-4 TX-5 RST-3 and RING connected to pin 2. The sim module gets network connectivity as it flashes every 3 seconds.

    My code looks exactly like yours, only the pins are changed:

    #include “Adafruit_FONA.h”

    #define FONA_RX 4
    #define FONA_TX 5
    #define FONA_RST 3

    #define FONA_RI_INTERRUPT 0

    SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

    Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

    void setup() {
    Serial.println(F(“FONA incoming call example”));
    Serial.println(F(“Initializing….(May take 3 seconds)”));
    fonaSS.begin(4800); // if you’re using software serial
    if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
    Serial.println(F(“Couldn’t find FONA”));
    while (1);
    Serial.println(F(“FONA is OK”));

    if(fona.callerIdNotification(true, FONA_RI_INTERRUPT)) {
    Serial.println(F(“Caller id notification enabled.”));
    else {
    Serial.println(F(“Caller id notification disabled”));

    void loop(){
    char phone[32] = {0};
    Serial.print(F(“Phone Number: “));

    Could you give me a hint what I did wrong?

    Kind regards,


  17. Hello there.

    I have a question. I’ve used the adafruit fona library and sim800l. In the code I wrote, I used incomingcallnumber, sms write, sms read codes.

    No nagging program. However when it comes to sms serial port> incoming call .. and code if (fona.incomingCallNumber (phone)) {

    It stopped at this point.

    How can I solve the problem?

  18. I am having issues with the code above. Whenever I try to send a message, it says Failed. I connected SIM800L TX to Arduino pin 3, RX to pin 2, and RST to 4. Is there something wrong with my setup? I just copied and pasted your code directly to Arduino IDE. I also have the required libraries for this setup.

  19. Hello.
    This cod:
    “Receive call” can’t not run!
    Because the program stops while the program is running. So the code is breaking. How can we fix this?
    Please help…..

  20. Hi,
    My Names Supri, from Indonesia, I have jobs to make SMS Gateway with SIM800L V1.0 Module and Arduino Uno R3, but I can’t understand in your sketch, how to write SMS sender address/ phone number in your sketch?

  21. Hi. I have a problem propably with serial. It shows random symbols in seral monitor. I tryed to change baudrates but it doesn’t help. Do You know what can be the cause of this problem?

  22. Hello Sir, I have a problem powring my moduler i used a phone charger which output 3.7 v /355mA/1.3VA. after wiring my moduler blink every second without stopping after few minute while coding its stopped blink and get hot. whats happened did i burn it?

    • are you using 355 mA source? If you are, it’s not enough to make the module operate continuously especially if it’s looking for cellular signals.

  23. Hi Roland,
    First off,,Great job!
    2 questions if you wouldn’t mind:
    1) when i compile your code, its uses a lot of memory ( I am using a Nano, so it used 54% of the available 2K dynamic). Is there a way to use less,, or an alternative to using the library ( or a smaller one)?
    2) I am trying to add to the code so that it will respond(turn off/on a relay; check/send status; send when status changes) to commands received from SMS messages. Any ideas on the best and easiest way to add those capabilities?

  24. Hi,
    Great tutorial!
    I am having issues with SIM800l microphone. There’s be a weird noise as soon as a call starts, and it stops after about half a second. After it stops, I can hear the voice clearly and there’s no problem. Is there any way to fix this issue?

Leave a Reply

Your email address will not be published.