Electronic – Calculating run time for a device with variable current draw

math

I recently built a small microcontroller-based project for a friend that consumed different amounts of current at different times. I wanted to calculate the run time for a given battery type (but discovered the area of my brain that used to know algebra seems to have gone missing).

The device draws 2mA of current for 2s, then draws 20mA as it sequentially lights LEDs for 500ms.

I originally tried to calculate the average draw: In 3 seconds it consumes (2 + 2 + (20 * 0.5)) 14mA or an average of 4.67mA per second. Therefore, a battery with 2400mAh should be able to power the device for (2400/4.67) ~514 hours or 21.4 days.

This math seems incorrect to me, though I am not sure why. I didn't expect the run time to be over a few days.

Whether my calculations are correct or not, can you explain a simpler or better method to calculate run time for circuits with variable current draw?

Best Answer

Your calculations are slightly off, as the duration you averaged over was 3 seconds, not (2 + 0.5):
(2 * 2 + 20 * 0.5) / (2 + 0.5)
= 5.6 mA
average current draw

2400 / 5.6 = ~ 428.6 hours
= 17.86 days
running time

This is a good enough method of estimating run time.

Actual results will vary due to battery condition, charge status, temperature changes, and of course whether your current measurements are reliable and repeatable.