GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsWi-Fi is the most power-hungry thing an ESP32 does, so a battery sensor wakes briefly, connects, sends one reading and returns to deep sleep. This sketch reads a BME280, sends the values to a ThingSpeak channel by HTTP and sleeps for 15 minutes. A bare ESP32 development board has regulator and USB chip losses that waste much of the sleep savings, so real battery life is far shorter than the chip's own numbers suggest. Treat battery life as something to measure, not a promise.
Lithium cells can catch fire if shorted or overcharged. Use a protected cell and a proper charger.
Tick anything you already have and the total updates.
Temperature, humidity and pressure sensor
Follow the colours: red is power, dark grey is ground, blue is a signal.
A 18650 lithium cell in a holder with protection. Handle lithium cells with care and never short them.
deep_sleep_node.inoVerify & upload in Electrolark#include <WiFi.h>
#include <HTTPClient.h>
#include <Adafruit_BME280.h>
const char* SSID = "YOUR_WIFI";
const char* PASS = "YOUR_PASSWORD";
const char* API_KEY = "YOUR_WRITE_KEY";
const uint64_t SLEEP_US = 15ULL * 60ULL * 1000000ULL;
Adafruit_BME280 bme;
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
if (bme.begin(0x76)) {
float t = bme.readTemperature(), h = bme.readHumidity(), p = bme.readPressure() / 100.0;
WiFi.begin(SSID, PASS);
unsigned long start = millis();
while (WiFi.status() != WL_CONNECTED && millis() - start < 10000) delay(100);
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin("http://api.thingspeak.com/update?api_key=" + String(API_KEY) + "&field1=" + String(t, 1) + "&field2=" + String(h, 0) + "&field3=" + String(p, 1));
Serial.println(http.GET());
http.end();
}
}
esp_sleep_enable_timer_wakeup(SLEEP_US);
esp_deep_sleep_start();
}
void loop() {}
Check that esp_deep_sleep_start() is reached; a failing sensor should not block it.
Dev boards waste current in the regulator and USB chip. Measure the sleep current.
Check Wi-Fi range and that updates are at least 15 seconds apart.
It depends on the board. Measure your sleep current and divide the cell capacity by the average current.
Yes, with a proper charge controller for lithium cells.
Deep sleep resets the Wi-Fi connection, so it reconnects on each wake.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic ZY-BME280 Pressure Temperature Humidity Sensor Module – I2C Interface, 18650 Li-ion Rechargeable Cell, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
No. This page has the complete, tested code (deep_sleep_node.ino).
About ₹994 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Timer wake-up from deep sleep; Keeping the wake time short; Why the board's regulator limits battery life.
Lithium cells can catch fire if shorted or overcharged. Use a protected cell and a proper charger.
Ideas that reuse this build: ESP32 deep sleep battery temperature node. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.