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.
Watch the Video Tutorial
You can watch the video tutorial or continue reading for the complete project instructions.
Project Overview
This tutorial is divided into two sections:
- Send an SMS with the TTGO T-Call ESP32 SIM800L: you’ll learn how to send a simple “Hello World” message.
- SMS Notification system with sensor readings: send a message every time the temperature readings cross the threshold value.
- The ESP32 gets new temperature readings every 5 seconds
- It checks if the temperature is above the threshold value
- If it’s above the threshold value, it sends an alert SMS with the current temperature value
- When the temperature goes below the threshold, it sends another alert
- The ESP32 sends only one SMS every time the temperature readings cross the threshold value
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)
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)
Prerequisites
1. ESP32 add-on Arduino IDE
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.
2. Prepaid SIM Card (SMS plan)
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.
3. Libraries
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.
Installing the TinyGSM Library
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.
Installing DS18B20 Libraries
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.
Parts Required
To follow this tutorial you need the following parts:
- TTGO T-Call ESP32 SIM800L
- Nano SIM card with SMS plan
- USB-C cable
- Antenna (optional)
- DS18B20 temperature sensor (Guide for DS18B20 sensor with ESP32)
- 4.7k Ohm resistor
- Breadboard
- Jumper wires
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.
Send SMS with T-Call ESP32 SIM800L
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);
}
How the Code Works
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");
}
Demonstration
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.
Troubleshooting
If at this point, you don’t receive an SMS, it can be caused by one of the following reasons:
- This module only works if 2G is supported in your country;
- The phone number might have a typo or it’s not properly formatted with the plus (+) sign and country code;
- The antenna might not be working properly. In our case, we’ve replaced the antenna with this one;
- You might need to go outside to get better signal coverage;
- Or you might not be supplying enough current to the module. If you’re connecting the module to your computer using a USB hub, it might not provide enough current to operate.
ESP32 SMS Notification System
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.
Schematic Diagram
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.
Code
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);
}
How the Code Works
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.
Upload the Code
After inserting the recipient’s phone number and SIM card pin code, upload the sketch to your ESP32.
- Go to Tools > Board and select the ESP32 Dev module
- After that, go to Tools > Port and select the COM port the ESP32 is connected to
- Then, press the Upload button
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.
Wrapping Up
With this project you’ve learned how to send SMS with the T-Call ESP32 SIM800L module. Now, you can use this project in a real application and leave it sending SMS notifications when the threshold value is reached or send SMS with sensor readings every hour, for example.
To make this project battery powered, I recommend using deep sleep mode and wake up the ESP32 every hour to check the current temperature, because if you use the code in this project it will drain your battery quickly.
Other articles/projects with the T-Call ESP32 SIM800L board:
- ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)
- TTGO T-Call ESP32 with SIM800L GSM/GPRS (in-depth review)
Learn more about the ESP32 with our resources:
- Learn ESP32 with Arduino IDE (Course)
- MicroPython Programming with ESP32 and ESP8266 (eBook)
- More ESP32 Projects and Tutorials
Thanks for reading.
Hello good afternoon.
First of all, I would like to thank you for the excellent article, very well written and easy to understand. I would just like to make a small caveat, as far as I could tell, there is a logical bug in this code:
else if ((temperature <temperatureThreshold) && smsSent) {
In the line above, if the first temperature reading is less than the limit, the smsSent flag will be set to false and the code will never send the sms, in which case it does not match the tested sentence that expects the true value in this respective variable.
The code is working properly, because the other line will only run if smsSent variable is set to false:
if((temperature > temperatureThreshold) && !smsSent){
As you can see: !smsSent
But the question I raised was exactly whether the first time the code executes and the sensor already returns a value BELOW the limit, in which case the code will never send an SMS because the smsSent flag is set to false and in the statement REQUIRES that it´s true.
As it is written, if the equipment is turned on and soon the first reading is below the limit, it will never send SMS.
Yes.
It doesn’t send an SMS when it initializes below the limit.
It will only send an SMS below the limit, if it has been above the threshold at least once.
I hope this clarifies.
Regards,
Sara
Hi Rui
for sending SMS you do not need a modem, there are a lot email to SMS gateways, so do I for a lot of things..
The object of the library is called modem, you don’t actually need a physical modem.
Just pissed money against the wall buying a unit —- is the rest of rest of the world still using GSM2 ????? Australia is starting 5G with last 2G turned off in 2017 – lots of marketing of the sim800 with no warnings.
is there a reasonably priced 3G4G version available anywhere
Hi John.
I’m sorry about that.
We have a big red note at the beginning of the post warning that this module only works on 2G networks.
2G networks are still supported in many places and it is a very cheap option for this kind of projects.
There are other 3G and 4G modules that should work similarly and the code should be compatible with a few modifications.
We’re still trying to find the best quality/price 3G 4G module. The SIM7600 should work fine: https://www.banggood.com/custlink/D3mmo2TDbj
Regards,
Sara
Los felicito, no solo por este tutorial sino por todos que son verdaderamente excelente.
El uso del SIM800L en Venezuela es ideal, por el retraso de la “actualización” de la telefonía hay buena cobertura 2G y no solo el SIM es barato sino que los planes de consumo son sumamente económicos, lo que hace que esta tecnología sea accesible para nosotros.
Muchas gracias.
Hola Eduardo.
Muchas gracias!
😀
Hello
Using 2G networks is like going back to the past with a 300-baud modem.
I wonder:
Would it have been better to use 3G?
And without offending for this very well crafted work.
Hi John.
This tutorial should be compatible if you’re using other 3G or 4G modules. The tinyGSM library is compatible, you just need to make a few modifications to the pin assignment.
We’ve made this tutorials with this new board because it is extremely cheap compared with 3G and 4G modules (and it is an ESP32 + SIM800 module, not just the single module) and 2G is still supported in many countries. It is a cheap alternative for many people (but I agree with you that 3G and 4G is better)
At the moment, we’re still trying to find the best quality/price 4G module and we’ll write a few tutorials about that.
Thank you for your comment.
Regards,
Sara
How could you read incoming sms in this board ?
Hi.
You can use the same method we use in this tutorial:https://randomnerdtutorials.com/sim900-gsm-gprs-shield-arduino/
Take a look at the code in the “Reading received SMS” section.
Regards,
Sara
Hi, no work.
Hello Sara,
Thanks for the nice tutorial. After reading it I purchased a couple of TTGO T-Call ESP32 SIM800L.
The only problem I have is that the code is not compiling as the SoftwareSerial is missing. As I read on the internet, SoftwareSerial was removed from the Arduino libraries and became “board dependant”. That means that if I compile for “Arduino MEGA” SoftwareSerial is there. If I compile for ESP32 Dev module, SoftwareSerialis missing.
Can you help with that?
Thank you,
Andreas – Greece
Hi Andreas.
I didn’t had that problem.
What version of Arduino IDE are you using?
Can you tell me the exact error you’re getting?
Regards,
Sara
Had the same issue… Wrong board definitions…
Add the board as explained here:
https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/
where in Greece??
Dear,
will you have a section on the ESP32 course explaining how to use this for making phone calls and answering phone calls and connecting it to MIC and Speaker?
Hi.
Those subjects are NOT included in the course.
Regards,
Sara
So no plans to include them in tge near future? cuz they could be hot topic for an open source esp32 phone!!
Hi Salah.
No, at the moment, we don’t intend to include that subject.
Regards,
Sara
I just purchased this board and didn’t work. Here is what I have:
1. My country “Oman” and carrier “Omantel” supports 2G in my place (Muscat)
2. I have a nano 2G sim card
3. I tried powering the board with 5V and 2A current
4. opened the window to get better signal
All of the above didn’t work and the sketch indicates that sim status is 1 and sending the sms failed. The modem is found by the sketch and I was able to display the modem info. Also, I think you got the TX and RX mixed up as in the one I bought from amazon.
has pin 27 as the modem TX and 26 as the modem RX. Still that change didnt help.
Can you please help????
I also tried replacing the antenna with the one that came with this board but not helping either.
By the way, I am able to send sms when placing this sim in my smart phone. Also, while I was trying the code out, the sms was sent from the board twice but never again!!!
Hi,
Thank you for the Interesting Tutorial as always. I have a question to ask about the power consumption of the T-Call. I will be very glad if you can help run some tests on how much current the system draws when the Sim800 is switched on and off. I am just ordering two of the boards and would love to know these figures from people that already have it.
Thanks.
Hi Taiwo.
At the time, we haven’t run any of those tests on the SIM800L board.
Regards,
Sara
Excellent, thanks so much!
Made and worked 1st time.
Can i suggest adding hysteresis of even a few Degs 🙂
Hi,
Do you know what GPIO-pins are RTC-GPIO’pins on the Lilygo ESP32 SIM800L ?
Regards
Diederik
Hi.
The RTC GPIOs are the same as in a normal ESP32. You can check them here: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
Regards,
Sara
Hi,
I must say a big thank you for the excellent tutorial. I wish to ask a question. Can this work alongside ESP-NOW and ESP access point on the same ESP32 SIM800L module?
Hi.
I’ve never tried it, but I would say it is possible.
Regards,
Sara
Sir,thanks for this tutorial.I have a question.I use ESP32 with external SIM800L.I use UART0(TX0 and RX0).What do I have to change in this code?Please help me.I tried so many things.
Hi.
You just need to change the pin definition with your pins on the following lines:
#define MODEM_TX 27
#define MODEM_RX 26
Regards,
Sara
Hello,
first of all i want to give thanks for this wonderful tutorial.
i wanted to create a webpage that shows the temperature (automatic update)
and will send an sms is above or below the threshold however if i combine the code from other tutorial it just wont work and im at my witts end. hope someone can help me.
i have here the pastebin link: https://pastebin.com/0Q6jKqn0
Hi is it possible to request sensor data through sms, using the same board and sensor?
Im struggling to make a code to do this
Hi.
It is possible.
However, we’ve tried reading text messages on the ESP32 and it didn’t work as expected at the time.
Regards,
Sara
where did you purchase the better antenna from please
Hi.
We have a link in the article: https://www.ebay.com/itm/311649924872
Regards,
Sara
Hi, hope you’re doing well.
I’ve used this code, but that sent me an empty SMS instead of String.
so can you help me what is the problem?
Hi.
I don’t know.
Without further information, it is very difficult to find out what might be wrong.
Regards,
Sara
Any chance you have the combined sketch of sensor threshold AND deep sleep ?!
I can get one, or the other to work, but its beyond me;)
I get this error while verifying
In file included from c:\programdata\matlab\supportpackages\r2018b\3p.instrset\arduinoide.instrset\idepkgs\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\algorithm:60:0,
from C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\arduinoide.instrset\idepkgs\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:142,
from C:\Users\4me\AppData\Local\Temp\MW_ArduinoHWSetup\MW_ArduinoBuild\sketch\ESP32_TTGO_Send_text.ino.cpp:1:
c:\programdata\matlab\supportpackages\r2018b\3p.instrset\arduinoide.instrset\idepkgs\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\utility:68:28: fatal error: bits/c++config.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board ESP32 Dev Module.
It’s hard to understand why Matlab is mentioned in your error message.
Can you compile and run other sketches for ESP32?
I used PlatformIO and imported the Arduino project. PlatformIO works well.
Hi. Thank you for this kind of content. I’m very interesting in this kind of things.
Regarding this project, I can’t send the SMS. Always receive some errors, the first of them is: AT+CMGF=1
ERROR
….. and after this, some other errors …
Do you know why it could be?
Thank you very much. An keep with your Great Job.
UP RANDOM NERD TUTORIALS!!!
Hello:
Thank you for this wonderful tutorial. I have issue is that, text is continuously even it is not showing successful text on serial monitor. What should be problem is?
hi
tanx for good tutorial
i want to stablish sim800l and esp32wrover but pinout that you use here are not in esp32wrover
for example uart in esp32wrover is in pin 1,3 or 9,10
and what’s i2c for
sim800 work whit uart or i2c ?
and what’s MODEM_PWKEY?
Hi thank for the tutorial which pin is best to read analog input from a sensor and please do you have an idea on how to change sms sim number to name?
Thank you
Hi.
For analog input, you can use any of the pins marked as ADC with green color in the board pinout: https://makeradvisor.com/wp-content/uploads/2019/08/TTGO-TCall-SIM800-ESP32-Pinout.jpg
Regards,
Sara
Hallo…
I like your project.
Could you verify if Things Mobile (www.thingsmobile.com of course) is compatible with TTGO T-Call ESP32 SIM800L?
I tried but it doesn’t seem compatible.
Do you know something about it?
Thanks
@}-,-‘——-
Gianfranco
Doesn’t compile – looks like the hardware serial library has changed.
You need to specify the serial mode in the begin call:
void begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin, bool invert);
SerialAT.begin(115200, SERIAL_8N1, SERIAL_FULL, MODEM_RX, MODEM_TX);
Good day thank you for you great work.
I need to know,Can you please help met with the correct way to use a AT command to get the signal stregnth aswell as the amount of data that is available on the sim card ?
Much appriciated Thank you
https://www.elecrow.com/wiki/images/2/20/SIM800_Series_AT_Command_Manual_V1.09.pdf
Hi, can this library read sms sent to ESP32?
for example a text message requesting you to check the temperature
Hi.
Yes, that’s possible.
Check the library examples: https://github.com/vshymanskyy/TinyGSM/tree/master/examples
Regards,
SAra
Thank you for this awesome project Rui and Sara. I have a few clarifications regarding multiple SMS recipient on this project. Is it possible to add multiple recipient number? If yes how can I do it?
Thanks and more power!
-Regards
Morning!
Can I connect an external GSM SIM800L to ESP32? (like to Arduino)
If it’s possible, how should I do it?
Hi, I have just copy and pasted the code to my Arduino IDE for sending a simple text message via my ESP32 SIM800L and when I tried to verify the code, it brings up an error for the line
#define SerialAT Serial1
saying that Serial1 was not declared in this scope. Can you please suggest why this might be and what I can do to remedy it?
Thanks
Hi.
Make sure you have an ESP32 board selected in Tools > Board.
Aditionally, make sure you have the libraries updated.
Regards,
Sara
Hello, thanks, yes, just after I posted that comment I noticed that I didn’t have the board set to ESP32. I changed it and it worked fine. Thanks.
Hello, thank you for his training. I get this error and wondered if you could help?
error: redefinition of ‘void setup()’
void setup() {
I am using the latest Adruino IE
I am just trying the test message at the moment
Hi.
You probably have copied the code the wrong way and you have two setup() functions.
Please double-check your code.
Regards,
Sara
you both are perfect and i love your site.
to this project or to this gsm module generally it would be nice to have possibility to set sms reciever number (as you made wifi manager for esp32). is any chance to programe it anyhow?
thanx, denis.
Hello,
I see in top of this that SIM800L works only in 2G and I know 2G is very weak, and probably worse that that by here.
Do you know which component I could use to do quite the same, without working for a really new program ? I need an equivalent component easy to use and able to deal with 3G, or 4G.
Perhaps you give this information in other article, but I havn’t found where.
Regards
Hi.
Take a look at this one: https://randomnerdtutorials.com/lilygo-t-sim7000g-esp32-lte-gprs-gps/
I hope this helps.
Regards,
Sara
Interesting future extension to my home automation system.
But… 3G will be phased out by most major Telecom operators in Belgium (and probably in other EU coutries as well) by the end of 2024. And the plug will be pulled on 2G by 2027. So it’s a safer bet to use a board which uses 4G, like the SIM7000G – unless you want to mess a bit with ESP and SMS before you go for a future-proof project.
Unfortunately boards with a SIM7000G are a lot more expensive (+/- 40€ vs. 11 $ for the SIM800L). Moreover custom charges may apply for goods with a value over 22€ imported from outside the EU.
We have some tutorials with the SIM7000G:
– https://randomnerdtutorials.com/lilygo-t-sim7000g-esp32-lte-gprs-gps/
– https://randomnerdtutorials.com/lilygo-t-sim7000g-esp32-gps-data/
Regards,
Sara
Hello,
maybe as a hint to all who have problems to get the SMS out:
I added a delay of 20sec after PIN initialisiation and the sendSMS comand since it takes a while until the GSM network connection is established and the SMS service is available. At least that helped for me to avoid “SMS failed to send”…
Carsten
Thanks for sharing that tip.
Regards,
Sara
Hello, please can you give me the simplest sketch to control relays with esp32 lyligo Sim800L.
Thank very much.
Hi, realy no need to say this web site is extraordinary one – everyone knows it. But in this project would be nice to be able to input phone number without coding. Somehow after first turn on or etc. Would it be possible? Thanx in advance.
Hi.
Yes. You can create a web server to input the phone number and that number in the code.
You can learn more about input on a web server with this tutorial: https://randomnerdtutorials.com/esp32-esp8266-input-data-html-form/
Then, you need to combine both codes.
Regards,
Sara