Easiest Way To Check External Battery Status?

Thanks for looking at the post.

I'm looking for the easiest way to check the battery status.

I have an External 6V Battery Pack which is powering the Arduino Uno. I also have a small LED Strip being powered off of it through a transistor. The LED strip only turns on for 10 seconds when a contact is open.

All of that programming I have done so far.... So next I'm looking to add two small LEDs to the project (one red, one green). After the contact opens and the LED strip turns on, flash the green LED twice if the battery is ok, or flash the red LED 4 times if the battery is gong bad.

There are so many posts related to batteries that I don't know where to begin. Some posts say that the Ardunio board can do it on it's own, or some say that I will need an external piece of hardwire wired in as well.

Any help is greatly appreciated.

PS... Love these forums... Everyone has been such a great help so far.

You'll, I guess, be assessing the condition of the battery by measuring its voltage. A low voltage indicates a low/dead battery. You should consider what kind of battery your supply is. 6V could be 4 x 1.5V alkalines, 3 x 2V lead-acid, 4 x 1.25V NiCd or NiMh. What constitutes "low" will depend on the exact type.

6V is generally above the operating voltage of the Arduino, which would be 3.3V or 5V usually. To enable the Arduino ADC to read the battery voltage would require a voltage divider. This is a couple of resistors. You should google "voltage divider" and read.

Operationally, you would want to sample the battery voltage when it is under load -- ie: when the main LEDs are on. This will give you the best idea of the battery condition. So you'll have logic to turn on the main LED strip, then just before switching it back off, sample the battery voltage and determine the battery state-of-charge. Cut the main LED strip and then flash the other leds as appropriate.

You will need a voltage divider to keep the battery voltage below the absolute limit for the analog input pins (Vcc+0.5V). Since the battery and Arduino share a Ground then the measurement of the voltage is easy.

When you are using your 6V battery are you connecting it to the +5V pin which has an absolute maximum of 6.0V or to the VIN pin which requires a minimum of 6V or power jack which requires a minimum of 7V?

Another option, that perhaps doesn't qualify as "simple" would be to use a zener reference to subtract part of the battery voltage to place it in range of the ADC. A 3V zener would chop ~3V off the battery voltage so a battery voltage of 4V ... 7V would put 1V ... 4V into the ADC. This puts the interesting part of the battery discharge curve into the full ADC range.

Generally the zener current needed is under 2mA and if you're worried about the load, you can sink it through an I/O pin and shut the whole reference off when you're not using it.

I use this method with 12V lead-acid batteries to map the interesting part of their discharge curve into the 5V ADC range. If it has to be REALLY accurate, it helps to know the tempco of your zener.

Great replies.

So now before moving forward with any of the options I need to determine the exact type of batteries that I'll be using. I originally wanted to have this Ardunio be powered off of either 4 or 6 AA batteries. However after looking into if further and doing a little math, it doesn't look like it would stay alive too long.

Even if I used some sweet rechargeable batteries, the Ardunio alone without constant power would draw dead within 4 months. Then once I actually use it for it's purpose, it would be dead too quickly.
I was looking at something like this that I could recharge.

Would be great if I only had to recharge it once every 6Months +, but with a 5V LED strip, and 6V Solenoid, I'm realizing that it would just die too quickly.

So likely what I'll wind up doing is wiring it up to a 12V wall wart, and have 4AA's or 4C's (6V) Alkalines as the UPS battery backup. Then test that voltage after use and report. So these batteries without really being used should stay alive for the backup for quite a while.

Thanks for the replys.
I'll add more once I finalize my thoughts, then i'll be able to dive into the right course to take.