Battery

How to Calculate ESP32 Battery Life

2026-07-05 · IoTTools

Learn how to estimate battery runtime using average current consumption.

Open calculator →

How to Calculate ESP32 Battery Life

Estimating battery runtime for an ESP32 is essential for remote IoT deployments. The key is to calculate average current over a full operating cycle, not just look at peak transmit current.

Formula

For an ESP32 that alternates between active time and deep sleep, the most useful formula is:

Iavg = (Iactive x tactive + Isleep x tsleep) / (tactive + tsleep)
Battery life (hours) = Battery capacity (mAh) / Average current (mA)

This time-weighted approach is more accurate than estimating with rough percentages, and it matches the logic used by the ESP32 battery life calculator.

Example

Assume a realistic low-power cycle like this:

  • 120 mA while active
  • 5 seconds active time
  • 15 uA in deep sleep
  • 595 seconds sleep time

First convert sleep current from microamps to milliamps:

15 uA = 0.015 mA

Then compute the average current over the full 600-second cycle:

Iavg = (120 x 5 + 0.015 x 595) / 600 = 1.015 mA
Battery life = 3000 mAh / 1.015 mA = 2955 hours ~= 123 days

That result is much closer to what you should expect from a duty-cycled ESP32 sensor node. If you want to test your own numbers, use the battery life calculator with measured active current, sleep current, and cycle times.

Common Mistakes

  • Using transmit or CPU peak current as if it were the average current
  • Treating deep sleep as milliamps when ESP32 deep sleep is usually in the microamp range
  • Ignoring the time spent in each state
  • Using datasheet maximum current instead of measured values from the real board

Conclusion

Use average current across the full active and sleep cycle, and keep a margin for regulator losses, battery aging, temperature, and self-discharge. When possible, measure current on the real hardware instead of relying only on datasheet values.