← Back to the chapter · Previous detail
Technical detail · Reference: IoT Code Pattern Library
Estimate battery life from the duty cycle
33.9 Putting Numbers to It
Average current depends on how long the device spends active and asleep, as well as the current in each state. Weight each current by its share of the cycle to estimate battery life. Context: ESP32 deep sleep with 5-minute timer wakeup for battery-powered sensor. Comparing active vs sleep power.
Formula: Battery life =
Worked example: 2,000 mAh battery. Without sleep: Active 100 mA continuously = hours. With deep sleep: Active 100 mA for 10 s every 5 min (96.7% sleep at 10 µA). Average: mA. Battery life: hours = 25 days (30× improvement).