Measuring the power or charge available in the battery

Hi,

I am operating the Arduino with a solar powered battery. Rite now I am just operating it with a simple Alkaline battery. I want to measure the charge or power remaining in the battery via Arduino so that I can switch down connected units in case of low power. Is there any mechanism already implemented which can be used to measure power, current or charge remaining in the battery ?

BR,
Vik

I haven't gotten to try this out yet, but you can try Google Code Archive - Long-term storage for Google Code Project Hosting..

With the internal volt meter you just measure how stable the voltage regulator works. To get info about the charge state you have to measure the voltage of the battery, probably connected to Vin or to some external voltage regulator. Depending on the battery voltage you may have to install a voltage divider to measure the state (attention: a simple circuit with two resistors will always have some current, emptying your battery a bit faster).

What kind of battery?

Lead Acid and alkaline batteries have a reasonable voltage vs. state of charge curve, but you should measure at a relatively constant current or correct for the current.

NiCD and NiMH voltage is pretty flat from 80% to 10% state of charge. You get a warning just before the battery dies, but not a lot.

You can track the current in and out of the battery and infer the state of charge by integrating over time; that works ok when the battery returns to fully charged state regularly, but not so well if it is charging discharging in the middle of the range.

You can calculate the battery's internal resistance but you need a large load current to be accurate, which wastes charge.

Well I am a newbie to this whole setup and therefore cant understand some of the comments and logic.

the code works and gives out the voltages.

My questions is, if in any case, the voltage and the current drop due to discharge of the battery, the volt measured by this code would also drop ?

and can u please explain a machanism..like what I need to plug in and what to read from where to check for the current and charge ?

BR,
Vik

Any Help guys ?

Vik009:
My questions is, if in any case, the voltage and the current drop due to discharge of the battery, the volt measured by this code would also drop ?

If you are talking about the SecretVoltmeter, it should be a good way to check how discharged the battery is if you input 5V directly into the 5V and GND pins, becuase the voltage will drop as the battery is drained. However, it cannot measure current capability.

What kind of battery are you using? Tell us about your system and we can give better advice.

When you say your code gives out voltage, does that mean you are measuring the battery voltage? or something else?

To further explain my earlier post, some batteries see the voltage drop as they discharge. It is not a straight line, but it is a repeatable voltage drop curve so you can estimate the battery 'state of charge' based on the voltage. Lead-Acid (car batteries, deep-cycle marine batteries) and alkaline batteries (AA, AAA, 9V etc.) are like that. NiCD or NiMH rechargeable batteries do not see the voltage drop until they are almost totally discharged, so the voltage measurement is not enough to estimate the battery state.

If you draw a high current from a battery, the voltage will drop. If there is very little current draw, then the voltage will "recover" higher, so it is best to measure the voltage under moderate current and always under similar conditions. Temperature can also affect the voltage.