Battery Life Algorithm for Low-Power Microcontrollers
Microsoft Excel | August 8, 2011
In general, battery life calculations are done by running an application to draw
a lot of power. However, this is not accurate for low-power microcontrollers, since
they spend most of their time in sleep mode and only occasionally draw a high current.
For example, garage doors spend a long time in standby and only operate twice a day.
As part of an internship, I developed a way to better gauge the battery life of a
microcontroller.
Introduction
Low-power microcontrollers generally have batteries in the mAh range, which last anywhere from 100 to 100,000 hours. The battery life depends on the application being run on the microcontroller and how often it is awake. The amount of current drawn in sleep and awake mode is different, so we need to know how long the application is in either mode. Assume the application runs in alternating modes of standby and full operation, as an approximation of what it does in real life. We also call the awake time an "iteration". The following variables are then defined:- Time per iteration (in seconds), t'
- Current during iteration (in Amps), I'
- Current during sleep (in Amps), I
- Duty cycle (%), D
- Battery capacity during iteration (in Ah), C'
- Battery capacity during sleep (in Ah), C
- Voltage (in Volts), V
Calculations
First, we figure out how long the application is asleep, depending on the duty cycle. Define the amount of sleep time as t, and the total time for one cycle (which is an iteration and a period of sleep) as T.- Time during sleep, t = t' * (100 / D - 1)
- Total time, T = 100 * t' / D
- Total energy, iterating (in Joules), Et' = C' * V * 3600
- Total energy, sleeping (in Joules), Et = C * V * 3600
- Total weighted energy (in Joules), Et = Et' * (t'/T) + Et * (t/T)
- Energy per iteration (in Joules), E' = I' * V * t'
- Energy per sleep period (in Joules), E = I * V * t
- Total energy per cycle (in Joules), E = E' + E
- Total number of possible cycles, n = Et / E
- Battery Life, B = n * T