I built a basic LED blinker to serve as a car theft deterrent. Originally I was using a 9V battery and delay() but I've refined my approach to consume less power. Here's my code, utilizing the JeeLib library:

#include <JeeLib.h>

int led = 13;
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     

void loop() {
void blink_quick() {
  digitalWrite(led, HIGH); 
  digitalWrite(led, LOW);    

It just blinks twice every 8 seconds. I also used 4 AA batteries as they have a higher amperage rating. How long should this system work before I need to replace the batteries?

My thinking is that AA batteries offer 2000mAh and an Arduino typically consumes about 45mA on average. If I were running the above code with delay() instead of the JeeLib functions, it would last for 44 hours. Let's call one cycle the two blinks and the following 8 seconds of rest. I am confused about how long I should factor in for the digitalWrite(led, HIGH) and the corresponding 'low' call, because the rest of the time, the circuit is using JeeLib. I am just interested in figuring out how long I can let this run without changing the batteries, and admittedly I am not experienced enough to tell definitively.


  • Did you already go through the countless "how long does X run on Y batteries" questions here? [moderator note: at the moment of writing "here" was EE.SE]
    – PlasmaHH
    Commented Mar 21, 2015 at 21:37
  • @PlasmaHH I went through a few, but I figured JeeLib changes a few things and I couldn't find much on that specifically even though it seems to be very popular for this kind of Arduino setup elsewhere.
    – Mark Lyons
    Commented Mar 21, 2015 at 21:41
  • I also understand that it is difficult to give an exact rating, but could it run for a week, a month? I'm really confused as to how to estimate.
    – Mark Lyons
    Commented Mar 21, 2015 at 21:42

3 Answers 3


What board are you using? For example, the Uno has a lot of other components that will consume power, even if you sleep the main processor. Instead use something like a Pro Mini.

You can bypass the voltage regulator, and just supply 4.5v by using 3 AA batteries. You can even use just 2 AAs if you have the 3.3v version. The lower the voltage the less current the ATMega uses.

Most importantly, measuring the power consumption using a multimeter. Measure the current the led uses. Disconnect the led, and measure how much the arduino uses. Use this handy Battery Life Calculator, and just fill in those numbers.

Run the led with the lowest current, where the led is still visible enough. Running a power-led at just 1mA will still give a decent amount of light.

In your situation, if coded correctly, power usage of the ATMega is negligible. The only real power user is the led. If you run the led at 1mA, and use a set of AA batteries, you get around 3.5 years of running time, no problem.


As mentioned in another answer use a multimeter to measure. However I would recommend using the cars battery to power the system. A parasitic draw on a cars battery of under 1 amp is considered acceptable (per what I learned in school). A parasitic draw is current used while the car is off. Get a clamp ammeter and check your parasitic draw and if you have the available amperage to spare run it from your battery. To check your parasitic draw place the clamp around the ground wire (or multiple ground wires) at the battery terminal.

If you run it from your car battery you will never have to worry about changing the battery and it becomes a set and forget system.


I have a lot of detail about here: Power saving techniques for microprocessors

Let's call one cycle the two blinks and the following 8 seconds of rest. I am confused about how long I should factor in for the digitalWrite(led, HIGH) and the corresponding 'low' call, because the rest of the time, the circuit is using JeeLib.

To answer this specific question, we can work out a "power budget" by taking the large consumption time (eg. the LED being on) and working out how much that is, as a fraction.

So in your case you have the LED on for 500 ms every 8 seconds. That is:

8 / 0.5 = 16

That is, 1/16th of the time. Or, putting it another way:

0.5 / 8 = 0.0625

So, let's say the LEDs use 20 mA. The average consumption then is:

0.020 * 0.0625 = 0.00125 A (1.25 mA)

And let's assume that while asleep it uses 1 mA. So the total consumption on average is:

1 + 1.25 = 2.25 mA

So if you have a 2000 mAh battery, you would get:

 2000 / 2.25 = 888.88  hours

However as others have pointed out, this is pretty meaningless if you use a development board. The on-board LED, the voltage regulator, the USB chip etc. will use much more power than you save by going to sleep. You have to move to a low-power or custom design, which minimizes these extra effects.

With careful design you should be able to get the sleep usage down to around 6 µA with the watchdog timer to wake you up.

Your Answer

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