TTGO T-Call ESP32 SIM800L: Pinout, SMS and GPRS Guide
The TTGO T-Call (ESP32 + SIM800L) board: IP5306 power management, pinout, SMS and HTTP over GPRS with TinyGSM, SIM and antenna, 2G check, SMS relay code.
The TTGO T-Call ESP32 SIM800L is a development board from LilyGO that puts an ESP32 microcontroller and a SIM800L GSM/GPRS modem on the same board. If you want to send SMS, receive commands by SMS and push data to the internet over 2G GPRS from a cabin, shed, storeroom or vehicle with no Wi-Fi, this is the board you're looking for. It also carries an IP5306 power management chip that both charges a 3.7 V Li-ion or LiPo battery and runs the board from it.
Its biggest advantage over wiring a separate ESP32 to a separate SIM800L module is that the power supply, the SIM800L's most troublesome part, is solved on the board: no voltage divider, thick supply wires or big capacitor to hunt for. In this guide you'll go step by step through the hardware, the pinout, the power and battery setup, SIM and antenna choice, SMS and GPRS code with the TinyGSM library, and relay control by SMS. One important warning before we start: the SIM800L only works on 2G networks.

What is the TTGO T-Call and what's on the board?
The board's brain is the familiar ESP32: a dual-core chip running at up to 240 MHz with Wi-Fi and Bluetooth. In the Arduino IDE it is programmed like any ESP32, and code is uploaded over USB. On the modem side sits SIMCom's SIM800L, which talks to the ESP32 with AT commands over an on-board serial line (UART). In between there's the IP5306 power chip: it charges the battery from the 5 V USB input and boosts the battery voltage to power the board. The chip sits on the I2C bus and can be configured from code.
| Section | Feature | Note |
|---|---|---|
| Microcontroller | ESP32, dual core, up to 240 MHz | Wi-Fi and Bluetooth are also available |
| Modem | SIMCom SIM800L, quad-band 2G GSM/GPRS | GSM 850, EGSM 900, DCS 1800, PCS 1900 MHz |
| Data rate | GPRS, up to 85.6 kbps | Enough for sensor data and small JSON |
| Power management | IP5306 (charger + boost converter) | I2C address 0x75 |
| Battery input | 3.7 V single-cell Li-ion / LiPo | Through the on-board JST connector |
| SIM and antenna | SIM slot and u.FL (IPEX) GSM antenna socket | Never run the modem without an antenna |
| User LED | GPIO 13 | Can be switched from code |
Power: the IP5306 and 2 A current peaks
At idle the SIM800L draws a few tens of milliamps, but while transmitting the current jumps to up to 2 A in very short pulses. In GSM the modem transmits in half-millisecond slots repeated about 217 times per second; if the voltage collapses during these pulses, the modem shuts itself down and the ESP32 may restart too. The T-Call has the IP5306 and on-board capacitors for this, but the source still has to deliver that current. A computer's USB port is often not enough; the most stable setup is to plug in a battery and keep USB connected as well. To roughly estimate how long the battery will last, you can use the battery life calculator.
| Power source | What happens | Recommendation |
|---|---|---|
| Computer USB only | The board may restart during network registration and SMS | Use it only for uploading code |
| USB + 3.7 V LiPo / Li-ion battery | The battery covers the peaks, USB charges the battery | Best for development and permanent installs |
| Battery only | The board runs portable | Choose at least 1000 mAh that can deliver 2 A |
| 2 A 5 V USB adapter | Stable in most cases | Use a short, good-quality cable |
The IP5306 has one quirk: if the current drawn is very low, it switches its output off after a while because it reads this as "no device connected". When running on battery, the board can shut down by itself at moments when the ESP32 draws little current. The fix is to write the "keep output on" bit to the chip's register with the setPowerBoostKeepOn() function in the code. For battery choice and safe charging, also have a look at the 18650 Li-ion battery article.
TTGO T-Call pinout
| Function | GPIO | Description |
|---|---|---|
| MODEM_PWRKEY | 4 | Turns the modem on with a 1-second LOW pulse |
| MODEM_RST | 5 | Modem reset; kept HIGH during operation |
| MODEM_POWER_ON | 23 | Switches on the modem supply when HIGH |
| MODEM_TX | 27 | From the ESP32 to the modem's RXD input |
| MODEM_RX | 26 | From the modem's TXD output to the ESP32 |
| I2C SDA / SCL | 21 / 22 | IP5306 power chip (0x75) |
| User LED | 13 | On-board LED |
| Relay in the example | 32 | A free GPIO on the pin header; if your board lacks it, pick another free pin |
Preparing the SIM card and antenna
- Use a SIM that supports 2G; some newer SIMs and IoT plans may have 2G disabled.
- Disable the SIM's PIN code in a phone first; if it stays enabled, enter it in the SIM_PIN line of the code.
- Insert the SIM into the slot in the direction printed on the board; check which SIM size your board version takes.
- If you'll use GPRS, make sure the plan includes mobile data and find out your operator's APN; for most operators the username and password are empty.
- Connect the GSM antenna to the u.FL socket before powering the modem; transmitting without an antenna lowers the signal and stresses the modem.
- Don't put the antenna inside a metal box or stick it on top of the ESP32's Wi-Fi antenna; route it outside the enclosure if you can.
- Make sure the SIM has credit or a bundle for sending SMS; every message costs money.
Arduino IDE setup and TinyGSM
- Install the ESP32 board package in the Arduino IDE and select ESP32 Dev Module as the board; install the USB driver first if needed.
- Install the TinyGSM library (Volodymyr Shymanskyy) from the Library Manager.
- For HTTP requests over GPRS, also install the ArduinoHttpClient library.
- Set the Serial Monitor to 115200 baud; when typing AT commands by hand, choose Both NL & CR as the line ending.
- Plug in the battery, fit the antenna and the SIM, then connect the USB cable.
First test: turning on the modem and sending an SMS
The first sketch does three things in order: it puts the IP5306 in "stay on" mode, turns on the SIM800L by switching on its supply and giving the PWRKEY pulse, then registers on the network with TinyGSM, prints the signal strength and sends an SMS to the number you set. After that, loop() bridges the Serial Monitor and the modem, so you can try commands like AT+CSQ or AT+COPS? by hand. Write the number with the country code, for example starting with +44.
1// TTGO T-Call (ESP32 + SIM800L, IP5306) - modem testi ve SMS / modem test and SMS
2#define TINY_GSM_MODEM_SIM800 // include'dan önce modem tipi / modem type, before the include
3#define TINY_GSM_RX_BUFFER 1024
4#include <Wire.h>
5#include <TinyGsmClient.h> // "TinyGSM" (Volodymyr Shymanskyy)
6
7#define MODEM_PWRKEY 4
8#define MODEM_RST 5
9#define MODEM_POWER_ON 23
10#define MODEM_TX 27 // ESP32 TX -> modem RX
11#define MODEM_RX 26 // ESP32 RX <- modem TX
12#define I2C_SDA 21
13#define I2C_SCL 22
14#define IP5306_ADDR 0x75 // güç yönetim yongası / power management chip
15
16#define SerialAT Serial1
17TinyGsm modem(SerialAT);
18
19const char SIM_PIN[] = ""; // SIM PIN'in varsa yaz / your SIM PIN, if any
20const char PHONE[] = "+905551112233"; // ülke koduyla numaran / your number with country code
21
22// Pille çalışırken IP5306 çıkışı kapatmasın / keep the IP5306 boost on when on battery
23bool setPowerBoostKeepOn() {
24 Wire.beginTransmission(IP5306_ADDR);
25 Wire.write(0x00); // SYS_CTL0 yazmacı / SYS_CTL0 register
26 Wire.write(0x37); // boost keep-on açık / boost keep-on set
27 return Wire.endTransmission() == 0;
28}
29
30void modemPowerOn() {
31 pinMode(MODEM_PWRKEY, OUTPUT);
32 pinMode(MODEM_RST, OUTPUT);
33 pinMode(MODEM_POWER_ON, OUTPUT);
34 digitalWrite(MODEM_RST, HIGH); // reset pasif / reset released
35 digitalWrite(MODEM_POWER_ON, HIGH); // modem beslemesi açık / modem supply on
36 digitalWrite(MODEM_PWRKEY, HIGH);
37 delay(100);
38 digitalWrite(MODEM_PWRKEY, LOW); // 1 sn LOW darbe = aç / 1 s LOW pulse = power on
39 delay(1000);
40 digitalWrite(MODEM_PWRKEY, HIGH);
41}
42
43void setup() {
44 Serial.begin(115200);
45 Wire.begin(I2C_SDA, I2C_SCL);
46 Serial.println(setPowerBoostKeepOn() ? "IP5306 tamam / OK" : "IP5306 yanit yok / no reply");
47
48 modemPowerOn();
49 SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
50 delay(3000); // modem açılsın / let the modem boot
51
52 Serial.println("Modem baslatiliyor / starting...");
53 modem.restart();
54 Serial.println("Modem: " + modem.getModemInfo());
55 if (strlen(SIM_PIN) && modem.getSimStatus() != 3) modem.simUnlock(SIM_PIN);
56
57 Serial.print("Sebeke bekleniyor / waiting for network");
58 if (!modem.waitForNetwork(60000L)) { // 60 sn / 60 s
59 Serial.println(" YOK: anten, SIM ya da 2G kapsama / FAIL: antenna, SIM or 2G coverage");
60 return;
61 }
62 Serial.println(" tamam / OK");
63 Serial.println("Operator: " + modem.getOperator());
64 Serial.printf("Sinyal / signal (0-31): %d\n", modem.getSignalQuality());
65
66 bool ok = modem.sendSMS(PHONE, "TTGO T-Call calisiyor / is working");
67 Serial.println(ok ? "SMS gonderildi / sent" : "SMS gonderilemedi / failed");
68}
69
70void loop() {
71 // Seri Monitör'den AT komutu gönder / send AT commands from the Serial Monitor
72 if (Serial.available()) SerialAT.write(Serial.read());
73 if (SerialAT.available()) Serial.write(SerialAT.read());
74}| Code part | What it does |
|---|---|
| #define TINY_GSM_MODEM_SIM800 | Tells TinyGSM the modem type; must come before the include line |
| setPowerBoostKeepOn() | Writes 0x37 to register 0x00 of the IP5306 so the output stays on at low current |
| modemPowerOn() | Turns on the supply, releases RST and gives PWRKEY a 1-second LOW pulse |
| SerialAT.begin(115200, ..., 26, 27) | Connects the ESP32's second serial port to the modem pins |
| modem.waitForNetwork(60000L) | Waits up to 60 seconds for network registration |
| modem.getSignalQuality() | Signal strength from 0 to 31; 10 and above works comfortably, 99 means unknown |
| modem.sendSMS(number, text) | Sends an SMS; returns true on success |
Going online with GPRS: sending data to ThingSpeak
The SIM800L's GPRS connection is slow, but more than enough for sensor data. TinyGSM presents the TCP connection opened through the modem like Arduino's familiar Client class, and ArduinoHttpClient builds HTTP requests on top of it. The sketch below writes the signal strength and uptime to a ThingSpeak channel once a minute. Because the SIM800L's own encryption support is limited to old TLS versions, many current HTTPS servers may reject the connection; that's why starting with services that accept plain HTTP is easiest.
1// TTGO T-Call: GPRS üzerinden ThingSpeak'e HTTP / HTTP to ThingSpeak over GPRS
2#define TINY_GSM_MODEM_SIM800
3#define TINY_GSM_RX_BUFFER 1024
4#include <Wire.h>
5#include <TinyGsmClient.h>
6#include <ArduinoHttpClient.h> // "ArduinoHttpClient" (Arduino)
7
8#define MODEM_PWRKEY 4
9#define MODEM_RST 5
10#define MODEM_POWER_ON 23
11#define MODEM_TX 27
12#define MODEM_RX 26
13#define SerialAT Serial1
14
15const char APN[] = "OPERATOR_APN"; // operatörünün APN'i / your operator's APN
16const char GPRS_USER[] = ""; // çoğu operatörde boş / empty for most operators
17const char GPRS_PASS[] = "";
18const char SERVER[] = "api.thingspeak.com";
19const char WRITE_KEY[] = "YAZMA_API_ANAHTARI"; // ThingSpeak Write API Key
20const unsigned long INTERVAL_MS = 60000; // dakikada bir / once a minute
21
22TinyGsm modem(SerialAT);
23TinyGsmClient client(modem);
24HttpClient http(client, SERVER, 80);
25unsigned long lastSend = 0;
26
27bool setPowerBoostKeepOn() {
28 Wire.beginTransmission(0x75);
29 Wire.write(0x00);
30 Wire.write(0x37);
31 return Wire.endTransmission() == 0;
32}
33
34void modemPowerOn() {
35 pinMode(MODEM_PWRKEY, OUTPUT);
36 pinMode(MODEM_RST, OUTPUT);
37 pinMode(MODEM_POWER_ON, OUTPUT);
38 digitalWrite(MODEM_RST, HIGH);
39 digitalWrite(MODEM_POWER_ON, HIGH);
40 digitalWrite(MODEM_PWRKEY, HIGH);
41 delay(100);
42 digitalWrite(MODEM_PWRKEY, LOW);
43 delay(1000);
44 digitalWrite(MODEM_PWRKEY, HIGH);
45}
46
47// Şebeke ve GPRS bağlantısını hazır tut / keep network and GPRS up
48bool ensureGprs() {
49 if (!modem.isNetworkConnected() && !modem.waitForNetwork(60000L)) return false;
50 if (modem.isGprsConnected()) return true;
51 Serial.println("GPRS baglaniyor / connecting...");
52 return modem.gprsConnect(APN, GPRS_USER, GPRS_PASS);
53}
54
55void setup() {
56 Serial.begin(115200);
57 Wire.begin(21, 22);
58 setPowerBoostKeepOn();
59 modemPowerOn();
60 SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
61 delay(3000);
62 modem.restart();
63 http.setTimeout(15000); // GPRS yavaştır / GPRS is slow
64}
65
66void loop() {
67 if (lastSend != 0 && millis() - lastSend < INTERVAL_MS) return;
68 lastSend = millis();
69 if (!ensureGprs()) {
70 Serial.println("GPRS yok / no GPRS");
71 return;
72 }
73 int csq = modem.getSignalQuality();
74 // field1 = sinyal gücü, field2 = çalışma süresi (dk) / signal quality, uptime (min)
75 String path = String("/update?api_key=") + WRITE_KEY +
76 "&field1=" + csq + "&field2=" + (millis() / 60000);
77 int err = http.get(path);
78 if (err != 0) {
79 Serial.printf("Baglanti hatasi / connection error %d\n", err);
80 http.stop();
81 return;
82 }
83 int status = http.responseStatusCode();
84 String body = http.responseBody(); // kayıt no / entry id
85 http.stop();
86 Serial.printf("CSQ %d HTTP %d kayit/entry %s\n", csq, status, body.c_str());
87}Relay control by SMS
Now let's turn the board into a switch controlled by SMS. The sketch uses AT+CNMI=1,2,0,0,0 so that incoming messages are passed straight to the serial line without being stored. Each SMS arrives as two lines: first a +CMT line with the sender's number, immediately followed by the message text. The code only looks at messages that come from your number and contain the password; it recognises "ROLE AC 4827", "ROLE KAPAT 4827" and "DURUM 4827" (relay on, relay off, status) and sends you a confirmation SMS after each action. You can rename the commands in handleCommand(). For how relays work, see the relay module article.
1// TTGO T-Call: SMS ile röle kontrolü / relay control by SMS
2#define TINY_GSM_MODEM_SIM800
3#define TINY_GSM_RX_BUFFER 1024
4#include <Wire.h>
5#include <TinyGsmClient.h>
6
7#define MODEM_PWRKEY 4
8#define MODEM_RST 5
9#define MODEM_POWER_ON 23
10#define MODEM_TX 27
11#define MODEM_RX 26
12#define SerialAT Serial1
13
14const int RELAY_PIN = 32; // röle IN (boş bir GPIO) / relay IN (a free GPIO)
15const bool RELAY_ON = HIGH; // düşük seviyeli modülde LOW / LOW for active-low modules
16const char OWNER[] = "+905551112233"; // komut kabul edilen numara / the only accepted number
17const char SECRET[] = "4827"; // komuttaki şifre / password inside the command
18
19TinyGsm modem(SerialAT);
20String line = "";
21bool bodyNext = false; // sonraki satır SMS metni mi? / is the next line the SMS text?
22bool fromOwner = false;
23bool relayState = false;
24
25void modemPowerOn() {
26 pinMode(MODEM_PWRKEY, OUTPUT);
27 pinMode(MODEM_RST, OUTPUT);
28 pinMode(MODEM_POWER_ON, OUTPUT);
29 digitalWrite(MODEM_RST, HIGH);
30 digitalWrite(MODEM_POWER_ON, HIGH);
31 digitalWrite(MODEM_PWRKEY, HIGH);
32 delay(100);
33 digitalWrite(MODEM_PWRKEY, LOW);
34 delay(1000);
35 digitalWrite(MODEM_PWRKEY, HIGH);
36}
37
38void setRelay(bool on) {
39 relayState = on;
40 digitalWrite(RELAY_PIN, on ? RELAY_ON : !RELAY_ON);
41}
42
43void handleCommand(String text) {
44 text.toUpperCase(); // "role ac" = "ROLE AC"
45 if (text.indexOf(SECRET) < 0) return; // şifre yoksa yok say / ignore without password
46 if (text.indexOf("ROLE AC") >= 0) {
47 setRelay(true);
48 modem.sendSMS(OWNER, "Role ACIK / Relay ON");
49 } else if (text.indexOf("ROLE KAPAT") >= 0) {
50 setRelay(false);
51 modem.sendSMS(OWNER, "Role KAPALI / Relay OFF");
52 } else if (text.indexOf("DURUM") >= 0) {
53 modem.sendSMS(OWNER, relayState ? "Role ACIK / ON" : "Role KAPALI / OFF");
54 }
55}
56
57void setup() {
58 Serial.begin(115200);
59 pinMode(RELAY_PIN, OUTPUT);
60 setRelay(false);
61 Wire.begin(21, 22);
62 Wire.beginTransmission(0x75); // IP5306 keep-on
63 Wire.write(0x00);
64 Wire.write(0x37);
65 Wire.endTransmission();
66
67 modemPowerOn();
68 SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
69 delay(3000);
70 modem.restart();
71 modem.waitForNetwork(60000L);
72 modem.sendAT("E0"); modem.waitResponse(); // yankı kapalı / echo off
73 modem.sendAT("+CMGF=1"); modem.waitResponse(); // SMS metin modu / SMS text mode
74 modem.sendAT("+CNMI=1,2,0,0,0"); modem.waitResponse(); // yeni SMS'i doğrudan ver / push new SMS to UART
75 modem.sendAT("+CMGDA=\"DEL ALL\""); modem.waitResponse(); // eski SMS'leri sil / delete stored SMS
76 Serial.println("SMS bekleniyor / waiting for SMS");
77}
78
79void loop() {
80 while (SerialAT.available()) {
81 char c = SerialAT.read();
82 if (c == '\r') continue;
83 if (c != '\n') { if (line.length() < 200) line += c; continue; }
84 if (line.length()) {
85 Serial.println(line);
86 if (line.startsWith("+CMT:")) { // +CMT: "+90555...","","26/12/11,10:00:00+12"
87 fromOwner = line.indexOf(OWNER) >= 0;
88 bodyNext = true;
89 } else if (bodyNext) {
90 bodyNext = false;
91 if (fromOwner) handleCommand(line);
92 }
93 }
94 line = "";
95 }
96}TTGO T-Call project ideas
- Greenhouse or chicken coop alarm: send an SMS when the temperature limit is exceeded (smart greenhouse project).
- Vehicle or boat tracker: request the GPS position by SMS or write it to a server over GPRS (ESP32 GPS tracker).
- Remote water tank: get an SMS when the level drops and start the pump by SMS (water tank level meter).
- Cabin security: have it call you and send an SMS when motion is detected (PIR motion sensor).
- Power cut alert: when the mains goes off, the battery-powered board sends you an SMS.
- For areas without 2G, build the same projects with a 4G modem (4G LTE module with ESP32).
Common mistakes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The modem doesn't respond at all | PWRKEY or POWER_ON step missing, wrong pins | Use modemPowerOn() and check the pins for your board version |
| The board restarts during network registration | The supply can't handle the current peaks | Plug in a battery, use a 2 A adapter and a short cable |
| On battery the board turns off after a few seconds | The IP5306 switches its output off at low current | Call setPowerBoostKeepOn() |
| waitForNetwork always fails | No 2G coverage, antenna not fitted or SIM PIN enabled | Test 2G with a phone, fit the antenna, disable the PIN |
| Signal strength 99 or below 10 | Antenna inside the box or weak signal in the area | Move the antenna outside and the board towards a window |
| SMS works but GPRS won't connect | Wrong APN or no data on the plan | Enter your operator's APN and check the data bundle |
| Can't connect to HTTPS addresses | The SIM800L's TLS support is outdated | Use HTTP or switch to a 4G modem |
| Incoming SMS never reaches the code | CNMI not set or SIM memory full | Send AT+CNMI=1,2,0,0,0 and delete old messages |
If you want to try the parts of the alarm and remote control projects you'll build with the TTGO T-Call one by one first, the BlueGrays app has ESP32 projects such as a PIR motion alarm, relay-based smart lighting and an alarm with Telegram notifications, each with a step-by-step circuit diagram and ready-made code; to turn the Wi-Fi notification into an SMS, just add the functions from this article.
Frequently asked questions
Which SIM card does the TTGO T-Call work with?
It works with any operator SIM that runs on a 2G (GSM) network. The SIM's PIN must be disabled, and if you use GPRS the plan needs mobile data. Since the slot can differ between board versions, check the SIM size on your board.
Will the TTGO T-Call work if 2G has been shut down in my country?
No. The SIM800L only uses 2G; if 2G is gone, neither SMS nor GPRS will work. In that case you need to move to an ESP32 board with an LTE modem such as the SIM7000, SIM7600 or A7670.
Can the TTGO T-Call run on a battery?
Yes, the on-board IP5306 chip both charges a 3.7 V single-cell Li-ion or LiPo battery and powers the board from it. Because the modem draws up to 2 A while transmitting, choose a battery of at least 1000 mAh that can supply high current, and use the keep-on setting in the code.
Which board should I select in the Arduino IDE for the TTGO T-Call?
After installing the ESP32 board package, selecting ESP32 Dev Module is enough. To talk to the modem you need to install the TinyGSM library and add the TINY_GSM_MODEM_SIM800 definition at the top of your code.
Why does the SIM800L send SMS but not connect to GPRS?
The most common cause is a wrong APN or no mobile data on the plan. Enter your operator's APN in the APN line of the code and leave username and password empty for most operators. If it connects but can't reach HTTPS sites, that's due to the SIM800L's outdated TLS support.
Can the TTGO T-Call make phone calls?
Yes, the SIM800L supports voice calls; calling a number with the ATD command, letting it ring for a few seconds and hanging up is a simple, free alarm method. Since the microphone and speaker connections needed for talking vary between board versions, ring-and-hang-up is the most practical use.
Projects to build after reading this
See all projects
LED Blink with ESP32
Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

ESP32 Built-in LED Blink
Blinking the built-in blue LED on the ESP32 DevKit V1. No external components required! The first project you should try when you buy an ESP32. GPIO 2 is connected to the built-in LED.

ESP32 Wi-Fi STA Connection (with LCD Screen)
In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

ESP32 Motion Alarm System (PIR + Buzzer + LED + Telegram)
A smart security alarm: when the PIR sensor detects motion, it sounds the buzzer, lights the LED and sends the owner an instant Telegram notification. A 30-second cooldown limits how often the alarm repeats; it does not filter out the PIR sensor's false detections. Use it at home, in a garage, a storeroom or a study.

Automatic Lighting with the ESP32 PIR Motion Sensor
In this project an HC-SR501 PIR motion sensor detects someone entering the room and turns on an LED automatically. millis() tracks how long the LED stays on: each HIGH reading refreshes the last-motion time, and the LED turns off at least 10 seconds after the last HIGH. The code also waits 50 ms with delay(50) in every loop, so the loop is not fully non-blocking. Great for stairs, hallways, bathrooms or closet lighting.

ESP32 Smart Lighting (PIR + LDR + Relay + OLED)
With an ESP32, a PIR motion sensor, an LDR light sensor and a relay module, we turn your hallway, bathroom or pantry into smart lighting. If the room is already bright, the light stays off even when there is motion, so it never wastes energy during the day. The light stays on for 30 seconds, and the time extends automatically while motion continues.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

