Running on batteries
How long can an ESP32 sleep between jobs?
The question
How long can an ESP32 sleep between jobs?
What I built
A sensor node that wakes, reads a temperature, sends it over Wi-Fi, and goes back to sleep. Two AA batteries. Changed one thing at a time:
- Always on: about 2 days.
- Deep sleep, wake every minute: about 9 days.
- Wake every 15 minutes: about 7 weeks.
- Wake every 15 minutes, send in batches every hour: about 4 months (estimated from measured current).
The design process
Problem. Battery devices kept dying in a few days. The real question: how often does each device actually need to be awake?
Iterations.
- v1: always on.
- v2: deep sleep every minute.
- v3: deep sleep every 15 minutes, batched sending and a fixed IP address.
Testing. Measured current with a meter during sleep, wake and send, then calculated battery life for each version.
Design decision. Every sensor project now starts with one question written at the top: how fresh does this data really need to be?
What broke
Wi-Fi connecting took 3 seconds and used most of the energy. Using a fixed IP address cut it to under one second.
The power LED on the board was quietly using more than the chip while asleep. Desoldered it.
What I learned
Battery life is a design decision. How often does the person actually need the data? The answer is almost always “less often than I thought”.