Battery level indicator?

Lliam20789

New Member
Hi everyone,
just a quick question, does anyone know if it is possible, say for an 08-M to monitor the battery level of it's own batteries?
anyone done this?

 
 

Rickharris

Senior Member
Oooo big question a while ago - a search should turn up a lot of info. Yes it can be done - how accurate is another matter.
 

BeanieBots

Moderator
Quite easy to do.
As you've probably realised, the ADC is referenced to the supply rail, so it's not possible to simply connect an input to the rail or use a simple divider.
ANY component who's current is not linearly proportional to voltage is all you need.
The ideal device would be a low voltage reference voltage. This can be easily realised with something as simple as a diode or even an LED. The only thing to watch is if your reference changes much with other variables such as temperature.
Try it with an LED.
Just put an LED with series resistor across the power supply and connect the LED/resistor junction to an analog input and then see how the ADC value changes as you change the supply voltage. Then try a regular diode with a resistor.
If you are using a nominal 5v supply, the best results will be obtained if you can get hold of a low dropout 3.3v regulator.

If you really want to know if the battery is getting flat, then measure the current drawn and sum over time. Voltage is not a very good indicator if you want early warning of a failing battery. There are also numerous custom chips specifically designed for just that job.

Edited by - beaniebots on 27/03/2007 22:40:47
 

BeanieBots

Moderator
Don't use them myself because I prefer to use a few op-amps and a sense resistor but do a (close your eyes Dippy) Google on "battery monitor" and you'll get quite a few hits. Alternatively, have a look at Maxim, National and/or a few of the other 'big boys' and use their product search function. You could probably even get a few free samples if you ask nicely.
 

moxhamj

New Member
I measure voltages for all my battery powered picaxe projects using BeanieBots' idea. Use a 1k resistor and a LED across the power supply. The LED generates a reference voltage (and acts as an On indicator as well). Measure the voltage on the LED using ADC and debug.

Now decrease the supply voltage to about 4V using a variable power supply and measure the debug value again, which will have gone up. You don't need to do any calculations on this number - just test whether the value read by the ADC is above this value (note that this number rises as the battery goes down). If you don't have a variable power supply, take three 1.5V batteries and add two 4001 diodes in series - each will drop 0.6V so you will get 3.7V.

A simple circuit using just two components.

Edited by - Dr_Acula on 28/03/2007 00:17:58
 

nbw

Senior Member
this is a good thread. I would like to run a picaxe circuit off 4 x 1.5V rechargeable AA batteries, using the LED-series resistor trick as a good enough guide when the batteries were getting tired. The whole circuit would have a USB socket allowing it to draw 500mA from a laptop's USB scoket.

What I wanted to do was, when the batteries get to say 2.5V, to allow 5V from the laptop to charge the AA batteries. From what I've heard tho, you want slowish charging - maybe only 100mA per hour. Not sure how I would limit this without getting fancy, extra ICs. I can measure the battery voltage rising OK, as the LED-series resistor value feeding into the ADC pin on the picaxe will of course rise. When the batt supply voltage hits around the 5V mark, turn off the charging bit.

(I thought a picaxe OUT pin could switch on a small transistor connected to the USB 5V, as the piacxe pins can only handle 20mA from memory)

I'm a bit loathe to just throw 5V @ 500mA at the 4 AA batteries, in case they fry...

All comments gratefully received!
 

premelec

Senior Member
assuming you are charging nickel cad or hydride batteries - 5v/4batt = 1.25 volts per battery - so they won't charge fully - however prudence [she's still watching] dictates a series current limiting resistor perhaps 10 to 100 ohms... any series voltage drop like a diode or LED would just take you further into not enough voltage per cell....
 

BeanieBots

Moderator
I'm afraid you are way off mark with how you want the charge/discharge of your batteries to work.
First off, if you allow a pack of 4 NiCd or NiMh batteries to drop to around 2.5v, don't bother trying to re-charge them. Just put them straight in the bin and buy some new ones. Seriously, they will be beyond help.
If you apply a voltage direct to the discharged pack, one of two things will happen. Either the supply will overcurrent and possibly get damaged, or worst, the supply will take the pack instantly to 5v shortly followed by an explosion. DON'T DO IT.

Both NiCd and NiMh should be charged at a constant current or at least a current limited to one tenth of the capacity of the battery.
You can charge at quicker rates but you will then need a method of detecting when they are full. Charging a full battery at more than one tenth capacity will generate gas which has to escape. At best, you will simply lose the contents and hence capacity, at worst, again you could end up with an explosion.
I'll not go into more detail because it has been covered many times here and there are many differing opinions. For more details use google or similar. "Delta-peak" is the most popular method used often backed up with timers and temperature sensing.
This is a good starting place for all things battery:-
<A href='http://www.batteryuniversity.com/partone.htm' Target=_Blank>External Web Link</a>
 

nbw

Senior Member
OK, thinking about it, the picaxe will probably 'die' at about maybe 3.3V so the batteries might drop to maybe 0.8+V each. Not too bad. Yes, using NiMH, 2500mAH. I'm perfectly happy to charge the little buggers slow - 1/10th the charge of the batteries would be ok - 250mA per hour is fine. I'd much rather do something slow, safe, and simple (resistors, and check battery voltage with the ADC pin) than learn more about the dreaded delta peak and more complex ICs at this point in time! It's pretty hard to learn anything with a 3 month baby girl screaming while you're trying to read. :)
 

BeanieBots

Moderator
Simple resistive current limit is OK for about 10 charge/discharge/top-up cycles but then you should do a full controlled charge/discharge cycle to prevent capacity loss (NOT memory effect) and reduce dendrite (causes internal shorts) formation.
Unlike lead acid batteries, it is not possible to tell the state of charge by measuring the voltage but for short term and inefficient applications it can be used as a vague guide.
An 08M makes a nice delta-peak controller!
 

nbw

Senior Member
Ok, a simple resistor set-up to quietly (=slowly) charge the batteries will do for now. If an 08M could be easily set-up to delta-peak test batteries, that's something I'd be interested in. The initial thought of temp sensors, expensive add-on ICs (more $$$) + complex theory put me off somewhat, but there might be a happy medium.

Thanks for your thoughts above BBots and others, much appreciated.
 
Top