In this project we’re going to create an SMS notification system with the T-Call ESP32 SIM800L module that sends an SMS when sensor readings are above or below a certain threshold.

In this example, we’ll use a DS18B20 temperature sensor, and we’ll send a text message when the temperature is above 28ºC. Once the temperature has decreased below the threshold, we’ll send another SMS alert.
To send an SMS with the T-Call ESP32 SIM800L module, you just need to use modem.sendSMS(SMS_TARGET, smsMessage) after initializing a modem object for the SIM800L module (using the TinyGSM library).
Important: the SIM800L works on 2G networks, so it will only work in your country, if 2G networks are available. Check if you have 2G network in your country, otherwise it won’t work.
You can watch the video tutorial or continue reading for the complete project instructions.
This tutorial is divided into two sections:
You can modify this project for your specific case. For example, you may want to put the ESP32 in deep sleep mode and send an SMS every hour with the current temperature readings, etc.
You may also like: ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)
The TTGO T-Call is a new ESP32 development board that combines a SIM800L GSM/GPRS module. You can get if for approximately $11.

Besides Wi-Fi and Bluetooth, you can communicate with this ESP32 board using SMS, phone calls or you can connect it to the internet. In this tutorial, you’ll learn how to send an SMS notification.
For a complete overview of this board, you can read the following article: $11 TTGO T-Call ESP32 with SIM800L GSM/GPRS (Overview)
We’ll program the ESP32 using Arduino IDE. So, you need to have the ESP32 add-on installed in your Arduino IDE. Follow the next tutorial, if you haven’t already.
To use the TTGO T-Call ESP32 SIM800L board, you need a nano SIM card. We recommend using a SIM card with a prepaid or monthly plan, so that you know exactly how much you’ll spend.

For this project ,you also need to install the TinyGSM library to interface with the SIM800L module and the One Wire library by Paul Stoffregen and the Dallas Temperature library to get readings from the DS18B20 temperature sensor.
Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open. Search for TinyGSM. Select the TinyGSM library by Volodymyr Shymanskyy.

In the Arduino IDE Library Manager, type “onewire” in the search box and install OneWire library by Paul Stoffregen.

Then, search for “Dallas” and install DallasTemperature library by Miles Burton.

After installing the libraries, restart your Arduino IDE.

To follow this tutorial you need the following parts:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Note: we had some signal strength issues with the antenna that came with the board package, so we’ve used another antenna (as shown below) and all those connection problems were solved.

In this section, we’ll show you how to send an SMS with the T-Call ESP32 SIM800L board. Let’s build a simple example that sends an “Hello from ESP32!” message to your smartphone.
Copy the following code to your Arduino IDE. But don’t upload it yet, you need to insert the recipient’s phone number in the code.
/* Rui Santos Complete project details at https://RandomNerdTutorials.com/esp32-sim800l-send-text-messages-sms/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ // SIM card PIN (leave empty, if not defined) const char simPIN[] = ""; // Your phone number to send SMS: + (plus sign) and country code, for Portugal +351, followed by phone number // SMS_TARGET Example for Portugal +351XXXXXXXXX #define SMS_TARGET "+351XXXXXXXXX" // Configure TinyGSM library #define TINY_GSM_MODEM_SIM800 // Modem is SIM800 #define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb #include <Wire.h> #include <TinyGsmClient.h> // TTGO T-Call pins #define MODEM_RST 5 #define MODEM_PWKEY 4 #define MODEM_POWER_ON 23 #define MODEM_TX 27 #define MODEM_RX 26 #define I2C_SDA 21 #define I2C_SCL 22 // Set serial for debug console (to Serial Monitor, default speed 115200) #define SerialMon Serial // Set serial for AT commands (to SIM800 module) #define SerialAT Serial1 // Define the serial console for debug prints, if needed //#define DUMP_AT_COMMANDS #ifdef DUMP_AT_COMMANDS #include <StreamDebugger.h> StreamDebugger debugger(SerialAT, SerialMon); TinyGsm modem(debugger); #else TinyGsm modem(SerialAT); #endif #define IP5306_ADDR 0x75 #define IP5306_REG_SYS_CTL0 0x00 bool setPowerBoostKeepOn(int en){ Wire.beginTransmission(IP5306_ADDR); Wire.write(IP5306_REG_SYS_CTL0); if (en) { Wire.write(0x37); // Set bit1: 1 enable 0 disable boost keep on } else { Wire.write(0x35); // 0x37 is default reg value } return Wire.endTransmission() == 0; } void setup() { // Set console baud rate SerialMon.begin(115200); // Keep power when running from battery Wire.begin(I2C_SDA, I2C_SCL); bool isOk = setPowerBoostKeepOn(1); SerialMon.println(String("IP5306 KeepOn ") + (isOk ? "OK" : "FAIL")); // Set modem reset, enable, power pins pinMode(MODEM_PWKEY, OUTPUT); pinMode(MODEM_RST, OUTPUT); pinMode(MODEM_POWER_ON, OUTPUT); digitalWrite(MODEM_PWKEY, LOW); digitalWrite(MODEM_RST, HIGH); digitalWrite(MODEM_POWER_ON, HIGH); // Set GSM module baud rate and UART pins SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX); delay(3000); // Restart SIM800 module, it takes quite some time // To skip it, call init() instead of restart() SerialMon.println("Initializing modem..."); modem.restart(); // use modem.init() if you don't need the complete restart // Unlock your SIM card with a PIN if needed if (strlen(simPIN) && modem.getSimStatus() != 3 ) { modem.simUnlock(simPIN); } // To send an SMS, call modem.sendSMS(SMS_TARGET, smsMessage) String smsMessage = "Hello from ESP32!"; if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); } else{ SerialMon.println("SMS failed to send"); } } void loop() { delay(1); }
Insert you SIM card PIN in the following variable. If it’s not defined, you can leave this variable empty.
// SIM card PIN (leave empty, if not defined) const char simPIN[] = "";
Then, add the phone number you want to send the SMS to. The number should be in international format, otherwise, it won’t work: (plus sign) and country code, for Portugal +351, followed by phone number.
Example for Portugal +351XXXXXXXXX
#define SMS_TARGET "+351XXXXXXXXXXXX"Configure the TinyGSM library to work with the SIM800L modem:
#define TINY_GSM_MODEM_SIM800 // Modem is SIM800 #define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb
Include the following libraries:
#include <Wire.h> #include <TinyGsmClient.h>
The following lines define the pins used by the SIM800L module:
#define MODEM_RST 5 #define MODEM_PWKEY 4 #define MODEM_POWER_ON 23 #define MODEM_TX 27 #define MODEM_RX 26 #define I2C_SDA 21 #define I2C_SCL 22
Initialize a serial communication to interact with the Serial Monitor and another to interact with the SIM800L module.
// Set serial for debug console (to Serial Monitor, default speed 115200) #define SerialMon Serial // Set serial for AT commands (to SIM800 module) #define SerialAT Serial1
In the setup(), initialize the Serial Monitor.
SerialMon.begin(115200);
Setup the SIM800L pins in a proper state to operate:
pinMode(MODEM_PWKEY, OUTPUT); pinMode(MODEM_RST, OUTPUT); pinMode(MODEM_POWER_ON, OUTPUT); digitalWrite(MODEM_PWKEY, LOW); digitalWrite(MODEM_RST, HIGH); digitalWrite(MODEM_POWER_ON, HIGH);
Initialize a serial communication with the SIM800L module:
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
Initialize the SIM800L module and unlock the SIM card PIN if needed.
SerialMon.println("Initializing modem..."); modem.restart(); // use modem.init() if you don't need the complete restart // Unlock your SIM card with a PIN if needed if (strlen(simPIN) && modem.getSimStatus() != 3 ) { modem.simUnlock(simPIN); }
To send an SMS, you just need to use the sendSMS() method on the modem object and pass as arguments the recipient’s phone number and the message.
modem.sendSMS(SMS_TARGET, smsMessage);
In this case, the message is “Hello from ESP32!“, but it can be replaced with other info like sensor data.
String smsMessage = "Hello from ESP32!"; if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); } else{ SerialMon.println("SMS failed to send"); }
With the nano SIM card inserted in the module, upload the code to your T-Call ESP32 SIM800L board.
Go to Tools > Board and select ESP32 Dev Module. Go to Tools > Port and select the COM port your board is connected to. Finally, press the upload button to upload the code to your board.
Note: at the moment, there isn’t a board for the T-Call ESP32 SIM800L, but we’ve selected the ESP32 Dev Module and it’s been working fine.
After uploading the code, open the Serial Monitor at a baud rate of 115200 to see what’s going on.

After a few seconds, you should receive an SMS on the recipient’s phone number.

If at this point, you don’t receive an SMS, it can be caused by one of the following reasons:
In this section, we’ll show you how to build an SMS notification system that sends a text message when the sensor readings cross a predetermined threshold temperature value.
Before proceeding, connect the DS18B20 temperature sensor to the T-Call ESP32 SIM800L board as shown in the following schematic diagram. We’re connecting the DS18B20 data pin to GPIO 13.

Copy the following code to your Arduino IDE. Insert the recipient’s phone number and set the threshold value. Then, you can upload the code to the T-Call ESP32 SIM800L board.
/* Rui Santos Complete project details at https://RandomNerdTutorials.com/esp32-sim800l-send-text-messages-sms/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ // SIM card PIN (leave empty, if not defined) const char simPIN[] = ""; // Your phone number to send SMS: + (plus sign) and country code, for Portugal +351, followed by phone number // SMS_TARGET Example for Portugal +351XXXXXXXXX #define SMS_TARGET "+351XXXXXXXXX" // Define your temperature Threshold (in this case it's 28.0 degrees Celsius) float temperatureThreshold = 28.0; // Flag variable to keep track if alert SMS was sent or not bool smsSent = false; // Configure TinyGSM library #define TINY_GSM_MODEM_SIM800 // Modem is SIM800 #define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb #include <Wire.h> #include <TinyGsmClient.h> #include <OneWire.h> #include <DallasTemperature.h> // GPIO where the DS18B20 is connected to const int oneWireBus = 13; // Setup a oneWire instance to communicate with any OneWire devices OneWire oneWire(oneWireBus); // Pass our oneWire reference to Dallas Temperature sensor DallasTemperature sensors(&oneWire); // TTGO T-Call pins #define MODEM_RST 5 #define MODEM_PWKEY 4 #define MODEM_POWER_ON 23 #define MODEM_TX 27 #define MODEM_RX 26 #define I2C_SDA 21 #define I2C_SCL 22 // Set serial for debug console (to Serial Monitor, default speed 115200) #define SerialMon Serial // Set serial for AT commands (to SIM800 module) #define SerialAT Serial1 // Define the serial console for debug prints, if needed //#define DUMP_AT_COMMANDS #ifdef DUMP_AT_COMMANDS #include <StreamDebugger.h> StreamDebugger debugger(SerialAT, SerialMon); TinyGsm modem(debugger); #else TinyGsm modem(SerialAT); #endif #define IP5306_ADDR 0x75 #define IP5306_REG_SYS_CTL0 0x00 bool setPowerBoostKeepOn(int en){ Wire.beginTransmission(IP5306_ADDR); Wire.write(IP5306_REG_SYS_CTL0); if (en) { Wire.write(0x37); // Set bit1: 1 enable 0 disable boost keep on } else { Wire.write(0x35); // 0x37 is default reg value } return Wire.endTransmission() == 0; } void setup() { // Set console baud rate SerialMon.begin(115200); // Keep power when running from battery Wire.begin(I2C_SDA, I2C_SCL); bool isOk = setPowerBoostKeepOn(1); SerialMon.println(String("IP5306 KeepOn ") + (isOk ? "OK" : "FAIL")); // Set modem reset, enable, power pins pinMode(MODEM_PWKEY, OUTPUT); pinMode(MODEM_RST, OUTPUT); pinMode(MODEM_POWER_ON, OUTPUT); digitalWrite(MODEM_PWKEY, LOW); digitalWrite(MODEM_RST, HIGH); digitalWrite(MODEM_POWER_ON, HIGH); // Set GSM module baud rate and UART pins SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX); delay(3000); // Restart SIM800 module, it takes quite some time // To skip it, call init() instead of restart() SerialMon.println("Initializing modem..."); modem.restart(); // use modem.init() if you don't need the complete restart // Unlock your SIM card with a PIN if needed if (strlen(simPIN) && modem.getSimStatus() != 3 ) { modem.simUnlock(simPIN); } // Start the DS18B20 sensor sensors.begin(); } void loop() { sensors.requestTemperatures(); // Temperature in Celsius degrees float temperature = sensors.getTempCByIndex(0); SerialMon.print(temperature); SerialMon.println("*C"); // Temperature in Fahrenheit degrees /*float temperature = sensors.getTempFByIndex(0); SerialMon.print(temperature); SerialMon.println("*F");*/ // Check if temperature is above threshold and if it needs to send the SMS alert if((temperature > temperatureThreshold) && !smsSent){ String smsMessage = String("Temperature above threshold: ") + String(temperature) + String("C"); if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); smsSent = true; } else{ SerialMon.println("SMS failed to send"); } } // Check if temperature is below threshold and if it needs to send the SMS alert else if((temperature < temperatureThreshold) && smsSent){ String smsMessage = String("Temperature below threshold: ") + String(temperature) + String("C"); if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); smsSent = false; } else{ SerialMon.println("SMS failed to send"); } } delay(5000); }
In the previous example, we’ve already explained how to initialize the SIM800L and all the required configurations. So, let’s skip to the relevant parts for this project.
First, type your SIM card PIN. If it’s not defined, you can leave this variable empty.
const char simPIN[] = "";
Then, add the phone number you want to send the SMS to. The number should be in international format, otherwise it won’t work.
#define SMS_TARGET "+351XXXXXXXXXXX"Define your temperature threshold. We’ve set it to 28 degrees Celsius.
float temperatureThreshold = 28.0;
Create a variable to keep track if an SMS was sent or not.
bool smsSent = false;
The temperature sensor is connected to GPIO 13, but you can use any other GPIO.
const int oneWireBus = 13;
Related content: ESP32 DS18B20 Temperature Sensor with Arduino IDE (Single, Multiple, Web Server)
In the loop(), get the temperature readings.
sensors.requestTemperatures(); // Temperature in Celsius degrees float temperature = sensors.getTempCByIndex(0); SerialMon.print(temperature); SerialMon.println("*C");
By default, the temperature is in Celsius degrees, but you can uncomment the following lines to use the temperature in Fahrenheit degrees. Then, you should also adjust the threshold value to match your temperature units.
// Temperature in Fahrenheit degrees /*float temperature = sensors.getTempFByIndex(0); SerialMon.print(temperature); SerialMon.println("*F");*/
After that, there’s a condition that checks if the current temperature value is above the defined threshold and if an alert SMS hasn’t been sent.
if((temperature > temperatureThreshold) && !smsSent){
If that condition is true, send an SMS saying “Temperature above threshold: ” and the current temperature value.
String smsMessage = String("Temperature above threshold: ") + String(temperature) + String("C"); if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); smsSent = true; } else{ SerialMon.println("SMS failed to send"); }
As you can see, to send a text message, you use the sendSMS() method on the modem object. You just need to pass as arguments, the phone number you want to send the SMS to, and the message content.
if(modem.sendSMS(SMS_TARGET, smsMessage)){
After sending the message, set the smsSent variable to true to avoid multiple SMS alerts for the same threshold reached.
smsSent = true;
When the temperature goes below the threshold, we also receive an SMS.
else if((temperature < temperatureThreshold) && smsSent){ String smsMessage = String("Temperature below threshold: ") + String(temperature) + String("C"); if(modem.sendSMS(SMS_TARGET, smsMessage)){ SerialMon.println(smsMessage); smsSent = false; } else{ SerialMon.println("SMS failed to send"); } }
This time, set the smsSent variable to false, so that we stop receiving messages below the threshold.
These conditions are checked every 5 seconds, but you can change the delay time.
After inserting the recipient’s phone number and SIM card pin code, upload the sketch to your ESP32.
After a few seconds, the code should be successfully uploaded.
You can also open the Serial Monitor at a baud rate of 115200 to see the current sensor readings.
If I put my finger on top of the sensor, the temperature will start increasing.When it goes above 28ºC, it sends an SMS.

When the temperature goes below the threshold, I’ll receive another SMS.

Copyright ©2025. All Rights Reserved Emblab THE RAVE INNOVATION