The formula
avg_current = (Iactive × duty) + (Isleep × (1 − duty))
runtime_hours = (capacity_mAh × efficiency) / avg_current_mA
Duty cycle — the big lever
An ESP32 pulls ~80 mA awake but <10 µA in deep sleep. A 2,400 mAh 18650 lasts 30 hours always-on, but 8+ months at 0.1% duty cycle (wake 3.6 sec every hour to send a sensor reading). Battery life is mostly a sleep-strategy problem.
Common gotchas
- Voltage drop — devices cut out before battery fully empty (LiPo at 3.0V, alkaline at 0.9V). Real usable capacity is less than rated.
- Boost converter overhead — boosting 3.7V → 5V costs ~15% efficiency.
- Cold temperature — capacity drops 20–40% in cold. Heated PCB or insulation for outdoor projects.
- Self-discharge — most LiPos lose 2–5% per month idle. Long-term sensors need lithium primary cells, not rechargeables.