← 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 = Battery capacity (mAh)Average current draw (mA)\frac{\text{Battery capacity (mAh)}}{\text{Average current draw (mA)}}

Worked example: 2,000 mAh battery. Without sleep: Active 100 mA continuously = 2000100=20\frac{2000}{100} = 20 hours. With deep sleep: Active 100 mA for 10 s every 5 min (96.7% sleep at 10 µA). Average: (100 mA×10300)+(0.01 mA×290300)=3.33+0.0097≈3.34(100 \text{ mA} \times \frac{10}{300}) + (0.01 \text{ mA} \times \frac{290}{300}) = 3.33 + 0.0097 \approx 3.34 mA. Battery life: 20003.34≈600\frac{2000}{3.34} \approx 600 hours = 25 days (30× improvement).

← Back to the chapter · Previous detail