After being inspired by a simple ATMEGA 168 based darkness alarm that has a theoretical life span of 3 years on batteries utilising sleep mode, I had decided to make something similar of my own (a wakeup alarm, using the oscillator for roughly okay precision rather than light)

My confusion is in the way the battery life is calculated (see the "Battery live time calculation" section) so I had decided to do my own calculating.

The AVR apparently at 1.8V in power down mode consumes 0.1µA. In active mode, 250µA assuming a 1MHz external oscillator (datasheet here).

Now a few (ideal maybe) AA batteries would have 1200 mAh, so

1200 / 0.001 / 24 / 365 = ~137 years standby life time
1200 / 0.250 / 24 / 365 = ~0.5 years active life time

Assuming my piezo buzzer + 10k series resistor for it takes 5 mA total, I could maybe average the current usage by hour

5mA * 10 (second alarm)? / 6 (intervals of 10) / 60 (in to hours) = ~0.138mAh
0.250mA (active current) * 10 / 6 / 60 = ~0.00694 mAh

End result being (ignoring that active power draw overlaps powered down status)..

1200 / (0.001 + 0.138 + 0.00694) / 24 / 365 = 0.9 years 

Can you suggest major flaws in this? What would be a method to calculate all this current draw over time especially when batteries use mAh rather than Wh, and the data sheet only specifies "xx uA @ 1.8v" (and not ~4.5V I am using). Is there a simpler way to calculate power consumption when things only draw energy at certain periods (rather than my "average per hour" calculation) I've done?

I seem to have hit a wall at the theory side of the personal project. It just interests me how long it can run if I design it as simple as possible.

  • 1
    \$\begingroup\$ 1.8V specd becuase lower current and power than at higher V. uP is specd to run at 1.89V. Be sure to be awre of battery self discharge. Std Nimh long dead by then. LSD nimH and modern Alkaline OK but down at that age. AA should be >> 1200 mAh in any usual technology. \$\endgroup\$
    – Russell McMahon
    Commented Jan 20, 2012 at 7:39
  • 1
    \$\begingroup\$ @RussellMcMahon, we switched rolls, you gave a quick comment giving the basic answer and I wrote a long winded answer :) \$\endgroup\$
    – Kortuk
    Commented Jan 20, 2012 at 7:52
  • \$\begingroup\$ @Kortuk - -1 each :-) \$\endgroup\$
    – Russell McMahon
    Commented Jan 20, 2012 at 10:22
  • \$\begingroup\$ "Now a few (ideal maybe) AA batteries would have 1200 mAh" - Alkaline AAs are in the 2000-2500mAh range, as far as I know. \$\endgroup\$
    – marcelm
    Commented Nov 15, 2016 at 16:27

2 Answers 2


You are very close. The average power is a very accurate way to do this given that you are not pulling such a high current that the effective capacity of the battery fluctuates.

Batteries, Batteries, and More Batteries

There is one very important term, and that is the self discharge rate of the battery. This is dependent on chemistry, but lets say you get a nickel-metal hydride. The self discharge rate is "20% or more in first 24 hours, plus 4% per day thereafter" if it is not a low self discharge rate NiMH, which still discharges around 25 or so % a year.

Lithium batteries have some of the best characteristics for self discharge rate and my experience supports this fact. I think battery university has a great site to discuss many different battery characteristics and I often point people there to learn about batteries when they are starting to work with them. If you want to compare battery discharge rates they have an entire article discussing the phenomena.

This is a bit around the point, but I always try to make this point, when you measure battery voltage you need to have it under load. This varies with chemistry, but it is paramount in lithiums. I had a coworker placing bad coin cells in our devices and using them because the coin cells showed almost full voltage with no load. Under a load of any amount(10kohm aprox .2mA) they were flat dead.

Your Microcontroller and You

As you are dealing with using the manufacturer sheet on leakage current there are also many different issues you will have to deal with to keep to those specs that are probably also work thinking about. The biggest I have seen is a floating input. Many engineers will leave unused pins as inputs thinking, "Hey, what harm can this do?" Quite a bit if you are talking microamps. A floating input will have its transistors changing state constantly and the fluctuations cause a power draw difference. We once had a reduced lifetime in a product because we had an error that left 2 pins floating causing our standby current to more then double on our MSP430. You need to drive all of your pins to output and let them hold a state.

It is easy to miss when doing these calculations things like wakeup time. I seem to remember our MSP430 had a non-negligible wakeup time if you were doing it very often. It also had a larger power pulse for just a moment as it came online. Our little homespun RTOS had to try to take this into account and if the shutdown was less then X milliseconds we skipped it with NOPs and saved some power.

If you are looking at a very long life product, you are going to need conformal coating. The oils in your skin are not an issue immediately, but with time they form a lightly conductive material on your board. Conformal coating protects your board from this little current sucking side affect.

Read any app notes they have about low power operation, it probably covers issues like the pins need to be held as output and many other important and useful facts.

Last but not least, Dont let yourself get relaxed just because you have read the app notes and everything seems okay after a week of running your product, you have to do as clabacchio says, you must measure and make sure. You debug your code normally, this is part of it, you need to find out if you made a mistake that is causing your idle current to be mAs instead of uA or even just if you did what we did and a pin is floating on accident. Make sure you use buffered measurements when you do this, if you have a large leakage on your device taking the data you can make a mountain out of a molehill when testing. Also, never forget about pullups, they are little power hogs if you are not careful.

  • \$\begingroup\$ 20% + 4%/day, that are very interesting and sad numbers. (That's why I never buy digital cameras which need AA batteries.) \$\endgroup\$
    – Al Kepp
    Commented Jan 20, 2012 at 10:34
  • \$\begingroup\$ @AlKepp, you can purchase lithium based AAs I believe, they just cost a bit more. \$\endgroup\$
    – Kortuk
    Commented Jan 21, 2012 at 17:22

The theory seems correct, I would just give you a hint: designing circuits with very low duty cycle (the time the device is working) it's usual to know the sleeping power consumption (and that's what you've done, but i would suggest to measure it once built, as I've just discovered how much the design is influent on the power leakage.

Then, but this doesn't require the same precision as involves bigger currents, you should try to measure the energy consumed by the device during it's active state. You can do this also with the breadboard, as what you need is a measure of the average current absorbed and the time the device is on (~10s).

Then you can sum your energies (or Ah, as you wish), without care about the overlapping time.

But, coming just now from a measurement of this kind, don't rely too much in the values given by the data sheet and try if your design is capable to guarantee that value; for instance, you would check accurately all the output pins of your microcontroller to avoid unwanted leakage due to DIO interfaces, and maybe you have to work also with the power domains of the microcontroller itself. Good luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.