View Full Version : Battery Status?

computer guy
05-22-2010, 05:28 PM
Is there a cheap and easy way to get the propeller to determine the status of a 9V battery? i.e 0-100%, how much charge is remaining.

edit: Li-Ion 9V battery.

Thank you http://forums.parallax.com/images/smilies/smile.gif

"powered by Propeller" domed stickers $1.50 - Find them here (http://forums.parallax.com/showthread.php?p=847513)
Check out my Design and Technology project for my Higher School Certificate www.ecosureblog.net (http://www.ecosureblog.net)

The Sarah Myatt Fund - Help Sarah and Her Family Fight Quadriplegia HERE (http://www.thesarahmyattfund.com)

Post Edited (computer guy) : 5/23/2010 1:34:31 AM GMT

05-22-2010, 05:54 PM
to analyse how much(electrical) charge is remaining you have to measure the current all the time and accumulate the current-measurings over time.

So this requires a shunt-resistor which should have a low value dependning on the current 1 ohm down to 0,01 ohm.

The value should be low like this to keep the wasted energy low that is dissipated in the resistor.
You would measure the voltagedrop across the shunt-resistor. Which could be done by the ADC-circuit using a propeller-counter
or with any kind of adc-chip.

Another idea is: to watch the voltage-level of the accumulator accurately over time. I have no practical experience with that.
It MIGHT be possible to conclude surely from the voltage-level to the remaining charge.

If the current is always on the SAME level you could simply add a constant (representing the current) over time.
If you have different states that are absolutely deterministic you could include this information to add several constant values depenending on the state of your program

Before using this technique in situations where you have to rely on a proper function I would test it dozens of times with different accumulators etc.

another idea:
counting pulses from a voltage controlled oscillator (VCO)
The voltagedrop across a shunt-resistor determines the frequency of a VCO and a propeller-counter counts and summarises the pulses.

best regards


If you regard all these things it might be the better solution to buy a ready to use mAh-meter (milliampere-HOUR-meter) from the shelf and add it to your application

05-22-2010, 05:56 PM
What is "cheap and easy" for you? For me it's having some pins that can do AD. This topic has been discussed before, do a search, I know it was discussed within the past couple of weeks. Basically, you will have to do the circuit yourself, maybe easy for you, but not for me.


05-22-2010, 06:16 PM
you can do sigma-delta ADC with 2 resistors and 2 capacitors and get the voltage.· Hard to do on a breadboard, but you can do it on a protoboard.

My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

05-22-2010, 08:02 PM
What about using diodes? They are switches that are turned on by a voltage. Depending on your precision needed between 0 - 100% you could use 0 to 10 diodes etc... Diodes are cheap.

05-22-2010, 10:44 PM
or leds...

My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

05-22-2010, 10:48 PM
with diodes you can only measure voltage but if I understand it right computerguy want's to measure milliampere hours.
The resistor for measuring the current has to be a small value. The voltagedrop across this resistor could be amplified with a
OP-Amp. Then the outputvoltage of the OpAmp could "drive" the diodes. To keep the current low you would have to use so many didodes that
NEVER all diodes would switch through. This would mean a high current emptying the acumulator quickly

best regards


Post Edited (StefanL38) : 5/22/2010 4:39:50 PM GMT

Clock Loop
05-23-2010, 03:12 AM
Use voltage drop resistor + RCTIME. Use 2 pins to run two RCTIME's on both sides of the resistor, (with proper caps and resistors for rctime)

05-23-2010, 06:42 AM
OK, this probably does not fit into the category of "simple and easy" but...
You can use a "gas gauge" chip. Grab a free sample here http://focus.ti.com/docs/prod/folders/print/bq27210.html#samples