+233 20 936 2757 Same-day dispatch in Accra for orders before 14:00 · Free delivery over GH₵1000
Nauvitel Electronics
Tutorial

Send SMS alerts from your project with a SIM800L

No Wi-Fi at the site? Use a GSM module and any SIM card to text yourself when something needs attention.

The SIM800L is a tiny 2G GSM module that sends SMS and uses GPRS data. It is perfect for farms, boreholes and tanks where there is phone signal but no Wi-Fi.

Power it properly — this is the part people get wrong

The SIM800L needs 3.4–4.4 V and draws current peaks of up to 2 A when it transmits. A USB port or the ESP32's 3.3 V pin cannot supply that, and the module will keep rebooting.

  • Use an LM2596 buck converter set to about 4.0 V (adjust with a multimeter before connecting the module), fed from a 7–12 V supply.
  • Add a 1000 µF capacitor across the module's VCC and GND, close to the pins.
  • Connect the grounds of the converter, SIM800L and ESP32 together.

Wiring the serial lines

  • SIM800L TXD → ESP32 GPIO 16 (RX2).
  • SIM800L RXD → ESP32 GPIO 17 (TX2).

Insert a micro-SIM with SMS credit and its PIN lock turned off. The module's LED blinks quickly while searching and about once every 3 seconds once it has registered on the network.

The code

#define PHONE "+233XXXXXXXXX"   // the number to alert

void sendAT(const char* cmd, int waitMs = 1000) {
  Serial2.println(cmd);
  delay(waitMs);
  while (Serial2.available()) Serial.write(Serial2.read());
}

void sendSMS(const char* text) {
  sendAT("AT+CMGF=1");                    // text mode
  Serial2.print("AT+CMGS=\""); Serial2.print(PHONE); Serial2.println("\"");
  delay(500);
  Serial2.print(text);
  Serial2.write(26);                      // Ctrl+Z sends the message
  delay(5000);
}

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, 17);
  delay(10000);                           // give the module time to register
  sendAT("AT");                           // should reply OK
  sendAT("AT+CSQ");                       // signal quality, 10+ is good
  sendSMS("Nauvitel test: SIM800L is working!");
}

void loop() {}

Troubleshooting

  • No reply to AT: swap the TX/RX wires and check that the grounds are connected.
  • Module resets when sending: power problem — check the voltage under load and add the capacitor.
  • CSQ is 99: no signal; move the antenna or check that the network still offers 2G in your area.
Keep reading

More tutorials

All articles

New parts, restocks and project ideas

Join our list — one useful email a month, no spam.