Battery Life Calculator: Runtime from mAh, Average Current, or an Active/Sleep Duty Cycle

Estimate how long a battery will last from its capacity and average current draw. If your circuit wakes briefly and then sleeps, enter the active and sleep currents and times instead. The usable-capacity percentage leaves room for capacity lost to temperature, battery age, and the circuit cutoff voltage.

Enter values and press Calculate.

The formula

Runtime (hours) = capacity (mAh) × usable capacity (%) ÷ 100 ÷ average current (mA)

For an active/sleep cycle, first convert sleep current from µA to mA by dividing by 1000, then calculate the time-weighted average:

Iavg = (Iactive × tactive + Isleep × tsleep) ÷ (tactive + tsleep)

Example: a 2000 mAh battery at 80% usable capacity provides 1600 mAh. A circuit drawing 100 mA for 2 seconds and 100 µA for 58 seconds per cycle averages (100 × 2 + 0.1 × 58) ÷ 60 = 3.43 mA. Estimated runtime is 1600 ÷ 3.43 ≈ 466.5 hours, or 19.44 days. In average-current mode, the same battery at a steady 20 mA gives 80 hours, or about 3.333 days.

Practical notes

  • Use current at the battery. A regulator changes the relationship between load current and battery current. Include conversion losses and regulator idle current in the estimate.
  • Include every load. Indicator LEDs, sensors, pull-up resistors, and development-board circuitry can dominate sleep current. Include wake-up and radio bursts in the active profile.
  • 80% is a starting assumption. Usable capacity depends on battery chemistry, temperature, age, discharge rate, and cutoff voltage. Check the battery discharge curves for your load.
  • This is an estimate. The model assumes a repeating cycle and constant usable capacity. It does not model self-discharge or voltage changes, which can matter for long runtimes.

More calculators: Tools page.

Worked examples

An ESP32 sensor with a long sleep interval

Consider an ESP32 sensor powered by a 2000 mAh cell, with 80% usable capacity. Assume measured battery current is 80 mA during a 1-second active interval and 20 µA during the following 299-second sleep interval. The complete cycle lasts 300 seconds.

First convert sleep current: 20 / 1000 = 0.020 mA. Then calculate Iavg = 80 × (1 / 300) + 0.020 × (299 / 300) = 0.2866 mA.

Usable charge is 2000 × (80 / 100) = 1600 mAh. Runtime is 1600 / 0.2866 ≈ 5582.694 hours, and 5582.694 / 24 ≈ 232.6122 days. Following the widget's four-significant-digit display rule, the results are 5583 hours and 232.6 days.

Against a 180-day design target, the nominal difference is (232.6122 / 180 − 1) × 100 ≈ +29.23%. This compares the estimate with a requirement; it is not a measured prediction error.

Practical caveat: measure the real active and sleep currents at the battery with a meter that can resolve microamps. Regulators, LEDs and sensors left powered often draw more in sleep than the ESP32 itself.

A logger that samples every minute

A second device uses a 1200 mAh battery at 80% usable capacity. It draws 30 mA for 5 seconds, then 50 µA for 55 seconds.

Convert 50 µA / 1000 = 0.050 mA. The average is Iavg = 30 × (5 / 60) + 0.050 × (55 / 60) ≈ 2.545833 mA. The widget displays 2.546 mA but retains the unrounded average for runtime.

Available charge is 1200 × 0.80 = 960 mAh. Thus runtime = 960 / 2.545833… ≈ 377.0867 hours, or approximately 15.71 days. Displayed results are 377.1 hours and 15.71 days.

Relative to a 14-day target, the nominal difference is (15.71195 / 14 − 1) × 100 ≈ +12.23%.

Practical caveat: battery capacity drops in the cold and as cells age, so keep more margin than 12% if the logger lives outdoors.

Common mistakes

  • Entering the complete cycle duration as sleep time instead of subtracting the active interval.
  • Taking the simple mean of active and sleep currents despite unequal durations.
  • Adding cell capacities in mAh when connecting identical cells in series.
  • Entering 0.80 in the percentage field when the intended usable capacity is 80%.

Comments

Popular posts from this blog

Gear Ratio Calculator: Multi-Stage Ratio, Output Speed, Torque and Direction

Mecanum-Wheel Pick-and-Place Robot: From Arduino UNO to Mega2560 + ESP32-CAM

Voltage Divider Calculator: Output Voltage, or the Best E24 Resistor Pair for a Target Voltage