Battery discharge curve mapping

Hi,
I currently have a device that is reading the battery voltage over a voltage divider to drop it down to a usable value for the arduino. However I would like to convert this into an accurate percentage value using the battery discharge curve such as one of these,

How would I go about mapping it to an equation to use for the arduino?
Thanks in advance.

"battery discharge curve such as one of these"

Something supposed to be attached?

Hi,
Yes

i don t understad that graph Voltage of the batery vs capacity in mA? xD i think u whant voltage vs time or mA usague or something like that xD

i do a batery monitor, u have to make a sketch measure you batery max charge voltage and the min safe voltage, the use analog read to measure it and use the map function to display it ass % or if u can take alot of reads of your analog read and paste it in exel they make for you a nice graph showing the discharge rate over time

That graph is meant to show the useable capacity of a given battery at different discharge rates. The basic gist being, the faster you discharge the battery, the less actual capacity you have. It's not really useful for determining a percentage capacity left over (though there is a correlation).

An 'accurate' percentage is going to be difficult to computer and maintain, and likely not really worth the effort. The simplest method is an approximate percentage based on battery voltage. If you know the average current draw that the battery will be providing, then you can tailor your percentage to that current draw from the above discharge rate chart. If it's a steady state current draw, just use the charts above as is. If it's more of an intermittent current draw, then the capacity will be a bit better than the 'average' current would indicate (as the battery has time to rest in between demands for current, which gives the internal chemistry time to normalize and improves overall capacity)

Here's one thread on voltage to capacity conversions: Can someone tell me LiPo Voltage vs Percent Charge? - HeliFreak
There are others. Again, a simple voltage measurement is only going to give you an approximation of capacity.

So I guess I have to stick with my oversimplified calculation range then of
battPercent = (((battVoltage - 1.69) / 0.39) * 100);

The battery graph is not opening for me, times out.
Another option might be to pick off 10 points from an average curve, and put that data into an array for a lookup table also.
If your lookup point is in between points, then do a simple linear interpolation, not likey to be too far off.
Otherwise, you need to monitor current flow (measure voltage across a shunt resistor typically) and pick a curve to use based on the recent current history you would have collected.

The type of battery chemistry is not mentioned. I once did a state-of-charge model for flooded lead-acid chemistry and you can look at the details here:
http://1474orchard.ca/projects/?x=entry:entry120622-013912

The curve mrjonny2 posted does not look like lead-acid to me, but you could use the same method to bodge up a calculation.

I did mine more for interest than anything. I don't think state-of-charge modelling is particularly accurate.

gardner:
The type of battery chemistry is not mentioned. I once did a state-of-charge model for flooded lead-acid chemistry and you can look at the details here:
Estimating state of charge for lead acid batteries « Projects

The curve mrjonny2 posted does not look like lead-acid to me, but you could use the same method to bodge up a calculation.

From the voltage range on the chart it appears to be a Li-po cell, to me anyway.

I did mine more for interest than anything. I don't think state-of-charge modelling is particularly accurate.

They'res a a whole bunch of Gas Gauge chips for Li-Po batteries... about 136000 results in .35 seconds (I have a slow internet connection) Here is one.
TEXAS INSTRUMENTS - BQ27210DRKRG4 - IC, BATTERY GAS GAUGE, LI-ION, VSON-10 From Newark and I am wondering why re-invent a wheel that is already invented.
Take the results from any of these IC's and set a lower limit for warning.

Doc

The part number on the graph is a LiPoly battery if you google it

There are problems trying to use voltage to measure state of charge (quite obvious from those curves in fact), that the voltage depends on more than just the state of charge - it depends on batt temperature, the current flowing (due to internal resistance), whether the battery is charging or discharging. It will also change as the battery ages (and internal resistance itself changes with age).

Some chemistries have very flat curves (lead acid is fairly flat, NiCd is very flat), and this makes it very inaccurate to try and judge S.o.C. except at extremes. NiMH and lithium chemistries do have reasonable slopes IIRC (and probably for the same reason, come to think of it).

If you can record actual charge flow history as well as voltage this ought to be much more robust at keeping track of S.o.C. and current capacity.

Looking at the datasheets it is very difficult to accurately work out how much power you have left in a LiPo.

But this may do you:

...and if not, read the datasheet for the chip used. Its interesting reading. Makes it sound quite complex (but then again, thats what they want you to think).

Hi,
Unfortunately I cannot add any extra items for my PCBs as this is a custom design that I was hoping to add as an extra feature in software.
And it is a LiPo battery