Battery life indicator for battery powered arduino and external battery source

Hi guys,

My arduino is run by a 9V battery and and I need to make a battery life indicator for this 9V battery. I just need a red LED to light up when the battery voltage reaches below a certain limit.

Also, I need another similar battery life indicator for the same arduino. This is for a 6V battery source which is used to power a servo motor.

Any ideas on how to implement this idea?

You could use a voltage divider to bring the nominal 9V down to the 0 - 5V range and connect that to an analog input, and have your sketch read that and turn the LED on when required.

If your 9V battery is one of those little PP3 things, they're a relatively expensive and inefficient way to power an Arduino since they have a tiny charge capacity and very low current capability, and the voltage is too high which means the voltage regulator throws a lot of the energy away as heat. Search for Arduino battery power to see some better alternatives.

Will using 6V battery pack be better than 9V?

Is there a way to come up with a 6V battery life indicator and another for 3V battery life indicator?

kurtselva:
Will using 6V battery pack be better than 9V?

Is there a way to come up with a 6V battery life indicator and another for 3V battery life indicator?

For an Uno, it is recommended that you use 7-12 volts, since the voltage regulator needs some amount of current to do its job. You can use 6 volts, but it isn't recommended, and I imagine things will be problematical if the battery drops to under 6 volts. I personally like to use cell phone chargers to power the battery through the USB port. Here is the one I currently use (it powered an Uno doing blink continuously for 3-4 days): http://www.amazon.com/EZOPower-Universal-External-Rechargeable-Smartphone/dp/B004I0J4E6/ref=sr_1_10?ie=UTF8&qid=1360766731&sr=8-10&keywords=ezopower+5000.

In terms of battery charge indicators, it depends on whether the battery provides such an interface. Many do not, some do. I would suggest whatever battery support you use, you get rechargeable batteries, so you don't have to keep replacing them.

Sparkfun sells a LiPo fuel gauge monitor: SparkFun LiPo Fuel Gauge - TOL-20680 - SparkFun Electronics. They also sell a battery voltage monitor: https://www.sparkfun.com/products/11087.

Since Battery discharge is not proportional, you don't need the whole spectrum of the 9V mapped into the 5V of the analog input.
You can use zener diodes (one or more) to lower the voltage like shown in this circuit:

In the example, the two 5V zeners in series lower the input in 10V, so you have a better resolution of the remaining voltage, that is significative for measuring the charge. I did use this circuit, because a 12V battery is dead when it reaches 10V, no need to measure under this voltage.

So lets say you'll consider a 9V battery dead when it reaches 7.5V, you just need to measure with big precision this 1.5v. So If you use a zener of 4.3V, you have
an arduino ready signal and wont be misusing so many steps of the ADC.
This way you'll get more precision when reading the battery charge.
Hope this helps.