Reading out the battery life

Hello,

I want to run my arduino nano with an 9V battery, which I connect to VIN and GND.
Is it possible to check the battery life state on an analogous input?
And if the battery life under 50%, that I can turn on a digital output for warning?

Best regards

You can read the voltage with a voltage divider (two resistors).

Start with two resistors of 10k. One resistor to the 9V, one resistors to GND. The middle point to A0. Every measured voltage will be divided by 2.
However, the 5V is used as reference, so if the 5V is getting lower, so does the reference and the measured voltage is no longer accurate.

Better is to use the internal voltage reference of 1.1V.

The voltage divider should be changed. Perhaps 10k to GND, and 100k to 9V.
Then every voltage would be divided by 11, and 9V becomes 0.82V, that is nicely in the range of 0...1.1V.

The voltage is not the same as the remaining charge in the battery, but it is a good indication.
What else is powered by the battery ? A servo motor ? leds ? Don't be disappointed if a 9V battery lasts only a few hours.

The internal reference needs calibrating as it varies between devices.
The 5V regulator providing Vcc is probably a good enough reference for
this purpose.

Thanks for your replies.

Can I also use a 12V battery for running arduino nano with my peripherals (LED and a sirene, which runs if a analoge value is not in range)?

So which is the best way for indicating the actual battery state?

You can not tell the battery life unless there is a constant current discharge and even then only with a very rough degree of accuracy after calabration.
You can use a trick to measure the external referance voltage by measuring the internal referance voltage. You know what it should be when the external voltage is 5V and the internal referance voltage will appear to increase when the external one decreases.

julianpe:
So which is the best way for indicating the actual battery state?

To know the State of charge of the 9V battery you need to know the capacity of the 9V battery and do a Coulomb-counting of the charge that been discharged by reading of the battery voltage and measuring the battery current and integrating it in time.

But as show in the attach picture, the 9V battery capacity will change with the current draw, the more current your circuit draw and the lower the capacity.

If your circuit draw about 25mA, the capacity is about 600mAh, you will have about 24 hours usage.

julianpe:
I want to run my arduino nano with an 9V battery

9V battery?
That's possibly the most expensive and worst idea for operating an Arduino on battery.

Most 9V batteries have a capacity of only about 500 mAh, and if you draw just 50mA from them, the capacity can become even less. If you draw more than 100mA from a 9V battery it becomes empty quicker than you can look.

How much current does your battery project draw from the battery?

If it is more than 50mA, I'd suggest using a battery with less than 5V.
Such like series of 3xAA battery = 31.5V (Alkaline) or 31.2V (NiMH rechargable).
Then use a small step-up converter that creates stable 5V output for the Arduino 5V connector.
Step-up converters like eBay 331289615598 from China can provide up to 500mA @5V.

Thanks for your replies.

I'm still uncertain about the voltage for my circuit.
I want to connect this sirene to my circuit:
http://www.ebay.de/itm/311338681120?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

So when a condition in my source code becoming TRUE, a digital output will be set.
The article discription says that the maximum current will be 10mA and has a voltage range from 3-24V.
This sirene must be loud. So I prefer a higher voltage for the whole circuit, or what do you mean?

I am grateful for any suggestions and comments.

julianpe:
I want to connect this sirene to my circuit:
http://www.ebay.de/itm/311338681120?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

That's certainly more a "buzzer" than a "siren".

This is a siren:

If you really need it loud, you could possibly use two batteries in your application: One battery for operating the Arduino, and another battery operating the siren. Then you'd need a transistor to let your Arduino switch on the power for the siren.

But of course there should also be circuits to create higher voltages if you need them. When searching eBay I just found item 271839841140 which can be adjusted to deliver step-up voltages up to 28V. So possibly you could use two step-up converters: One is stepping up to 5V to operate the Arduino. The other is stepping up to 12-15V (possibly switched on by the Arduino with a transistor circut) to operate a loud siren.

BillHo:
If your circuit draw about 25mA, the capacity is about 600mAh, you will have about 24 hours usage.

Highly doubtful. The datasheet you attached is clearly energizer's sales pitch. Look at the end-of-discharge voltage they list. I'm not really sure who could be interested in when their primary battery reaches something close to half the rated voltage.

In any case - for the usual project we see on the forum, your basic 9V PP3 cell is pretty much always unsuitable.

So I could use 4x1,2V accu AA batteries for my circuit.
I already have a step up converter which inreases my 5V up to 35 V.
Can anyone tell about the battery lifetime?

If you run your Arduino on 4x 1.2Volt batteries your internal Arduino voltage reference will change when the batteries get weak. So you cannot trust your Analog Input values anymore.

So you will not have a reliable voltage reference.

Batteries will NEVER tell you how much energy is left.

It is best to watch the voltage drop over time and find the right point when you want to set up an alarm.

Datasheets wont help a lot. You have to try and watch it.

And I think that not even experts can help you, as long as noboby knows how much current your cuircuit is drawing.

And YES, it is the current draw that is depleting batteries.

Higher capacity batteries are only available at 6V or 12 V.

However, when using 1.2 cells you can build your own voltage level.

6 Volts is not enough for powering an Arduino, 12 Volts means a 7 Volts drop at the voltage regulator (wasting some 60% of your energy).


So please give us an idea how long you expect your system to run and how much energy your circuit is drawing from the batteries.

Your question is like somebody asking:

How far can I go with this car?

The driver does not know how many miles the car can make per gallon and has no idea how much fuel is left.

Please do not be annoyed. I just wanted to make clear how hopeless your case is without further information.

arduinoaleman

Use the internal bandgap reference (1.1V), will still be 1.1V as Vcc drops down.

arduinoaleman:
If you run your Arduino on 4x 1.2Volt batteries your internal Arduino voltage reference will change when the batteries get weak. So you cannot trust your Analog Input values anymore.

Would you like to wager on that?

My circuit needs ca. 35mA average.
I bought a battery clip for storing 6x AA Batterys.
So my maximum voltage is round about 7,2V using 1,2V batteries.
I found rechargable batteries with 2700mAh:
http://www.heise.de/preisvergleich/sanyo-mignon-aa-nimh-akku-1-2v-2700mah-a419653.html
So the maximum would be 7,2V and 1080mAh and could live with this charging round about 308 hours (10800mAh/35mA=~308h)
Is that serious?

2700 mAh/35 mA is about 60 hours at best. Plan on less.

how did you get the number of 10800 mAh?

if you use 6 batteries in parallel you might get 6x 2700 mAH. that is not 10800.

however, when running batteries in series the mAHs will NOT add up. it is just the voltage that will go higher.

if you have no space restrictions you should get a 12V battery with 10AH in the 20-30 dollar range.

in that case i woukd use a 7808 voltage regulator so that your Arduino onboard voltage regulator has extra protection. a fully loaded 12V battery can give you voltages up to 13.5 volts. too much for an arduino.

Thanks for your posts.
Yes you were right. The batteries in series will have 2700 mAh.

I have enough space, but it must not be heavy.

@arduinoaleman:
Do you have a link for the 12V battery?

if you speak german i can give you several links from german suppliers.

however, keep in mind:

these smaller rechargeable batteries have an average weight of 300 - 400 gramms per Ah.

the 2,2 AH battery i am using as a portable power supply weighs 800 grams (panasonic lcr 12 - 2,2).

i think this is not really good news for you.

however, 35mA will deplete 1Ah of battery energy within 30 hours.

Select from among these https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=12V+battery+10AH&tbm=shop