Measuring Battery Life

Hello dear arduino-forum : )

I'm looking for a chargeable battery, but I need to find out how much power is left and send this information to a server. It does not need to be 99% precise. However, it should be exact enough, to react when the battery reaches a critical area.

Could you recommend me a way to measure this and a compatible battery? Sadly, my knowledge about battery energy consumption is really limited. All it does is measuring a short distance (1 metre) and checking whether something is there or not. Following with contacting the already mentioned server with WiFi. Therefore, the capacity shall be sufficient for one day at least.

Thanks for taking your time to read my topic : )

You have left out extremely important information. Please read and follow the instructions in "How to use this forum".

You cannot measure battery capacity directly since the voltage discharge curve depends on too many variables. Some battery chemistry, such as lithium types have extremely flat discharge curves and then drop off very rapidly.

However what you can do is measure the AH you extract from a battery by measuring the current drawn over time and subtract that value from the known AH of the battery. This will give you a semblence of remaining capacity.

Manufacturer's stated capacity should be taken with a pinch of salt. You first need to fully charge the battery, then discharge it whilst monitoring AH extracted. This will give you its nominal capacity for use in the "capacity left" calculations.

Sparkfun carries some battery discharge (fuel guage) monitoring chips for those purposes.

A voltage readout will only be meaningful for that particular battery after you run a few measured cycles with it to have a runtime curve that will only be relevant to that particular battery, assuming a constant load and temperature.

You need to tell us what kind of battery, what your project is, just a whole lot more information. We have no idea if you're powering a wifi camera or a bicycle.

You can measure the voltage. If you're running the Arduino from a regulated voltage (ie, multiple cell lithium through a linear regulator, or something with a switching regulator in it) that's stable as the battery voltage changes, just put the battery voltage to an analog pin (through a voltage divider if appropriate).

Otherwise, use the bandgap reference and use an appropriate voltage divider to get the voltage below the internal reference voltage

However - the problem with measuring battery capacity based on voltage is the shape of the discharge curve, as others have mentioned. With some battery chemistries (like alkaline batteries), you can get a reasonable estimate of the battery state by measuring the voltage under a light load. With others (like lithium rechargables), the curve is very flat - you get virtually the same voltage until it gets very near to being discharged - and then the voltage falls off very quickly. Depending on your requirements, monitoring voltage may be fine, or it may be totally useless.

Others have pretty much covered this, in short you really need to count the amps in and amps out and claculate what's left.

Look up "coulomb counting".

Hi there,

Battery capacity is probably one of the hardest static quantities to measure in electronics. You can try one of those "coulomb counters" or make something yourself after some testing based on the voltage measurement and temperature measurement.

For an Li-ion battery, the open circuit voltage is a somewhat good indicator of the state of charge (SOC) which tells us how much charge is left in the battery. You application though may require a constant run time so you cant stop to disconnect the battery and measure the voltage. What else we know for sure though is that when the battery runs down under load, the voltage drops little by little, until it reaches the breaking point and then drops quickly. This means that ideally you could measure the voltage over one run and then store the voltage readings, then determine what voltage you want to cut out at or start charging again.

The algorithm however has to be adaptive because as the battery ages the voltage will come down faster after a full charge. So you'd have to store some values and determine what voltage you need to start charging at again, or just when you need to replace the battery.

Temperature could affect the battery voltage also if it changes enough, so you may have to account for that also.

What we end up with though is something that might work, if we have a well behaved battery cell. But what if the cell starts to die prematurely? We need a better way.

A more reliable method would be to do something like the above, perhaps simplified, and provide a second battery to act as the 'backup' battery, that is kept fully charged and used only once the first battery runs down to a certain voltage level. The second battery kicks in and takes over, then the first battery is charged. Once the first battery is charged then it can be switched back over to using that one, then the second battery is charged back up again. Of course the batteries need to be sized accordingly.

Good luck with whatever you end up doing :-)