How long can arduino run off a 9v battery?

I was wondering if anyone has used an arduino off a 9v (using instructions off of the playground for soldering the correct power plug) and has any observations about about how long it lasts.

Currently I have the original USB model Arduino and I'm using it in a halloween costume. Basically it's being incorporated to a helmet with a piezo disk that will cause LEDs to flash whenever I speak. The LEDs will normally be off and only turn on when I talk, so they will not be a constant drain on the battery. Although depending on responses here, I have LED's I was going to wire to a seperate battery for the eyes but may attach to the Arduino and make flash also if the results here are encouraging enough.

There are about 12 red LEDs of a normal size (not counting the 2 for the eyes that I'm not sure I'm adding yet) and I'm trying to find out if anyone had any idea how often I'd be changing the battery.

This is very difficult to say anything about.

Different LED's draw different amounts of current, and the processor on the Arduino board will probably use more or less current depending on how your program is written.

You can try to meassure the current it draws when "idling" and when the LED's are on by inserting a mA meter i seriers with the battery. If you know the capacity of the battery in mAh you can do a qualified guess.

You could also wire 2 or 3 batteries up to get a much longer battery life time.

Or you could use 6 AA batteries in a suitable holder, they will give you 9V, but last much longer than a single 9V block cell.

it also depends how much you talk!

only sure way is to test it. If its a one off have a couple of spare batteries with you.

it is going to be a one off kind of deal (or 2 off, Saturday and Halloween proper) but wiring up six AAs might actually be a good idea.

the code, in case you're curious, is basically the knock tutorial with the serial code removed and an IF statement for the lights. Maybe I should put in a delay to slow it down a little.

Thanks for the tips!!

My own project gets somewhere over ten hours -- but it's only burning one LED (plus writing to a MIDI port).

But, I added a cute little routine for my peace of mind;

Positive lead of the 9v battery connected through two 1 meg resistors in series to ground. Lead from where the resistors met to one of the analog inputs on the Arduino (aka a simple voltage divider).

Then the routine;

batLevel = analogRead(batteryIn);
if (batLevel < 720){
lowPower++;
}
if (lowPower > 10000){
lowerPower = 0;
}

And in the middle of the code that set the color for the multi-purpose indicator LED (red is power on, green is transmitting);

if (lowPower < 1000){
digitalWrite(LEDgreen, LOW);
}
else{
digitalWrite(LEDgreen, HIGH);
}

In essence, once the battery voltage fell below a preset point, the variable "lowPower" would begin counting up. When enough cycles had passed to be certain the battery is below threshold, the power LED turns off. The counter continues to increment until it rolls over, thus the power light will in fact blink -- until power falls so low the entire circuit fails.

(As explanation, a bicolor LED is tied across two digital outputs. Thus writing "HIGH" to the green side will permit the green "transmitting" state to work but turns off the red "power" state.)

Wow. That's freaking awesome. I kind of think that worthy of a playground entry.

I agree. Letting the Arduino monitor it's own power is smart.
Do a little write up and put it in the playground. Many people could benefit from a design like that.

Drool

Now to figure out something I can run off a battery to try it with. :wink: