How to measure State of Charge(SOC) through algorithm? I found some details about SOC. in that they mentioned it can measure through voltage method, Hydro meter and columb counting etc.. But Through Software algorithm how to measure? I mean what are the hardware inputs we have to give for Software module? If so, How to give that signals to SOftware module.
3 Answers
Algorithms cannot measure anything; they can only compute. So the measurements are the same as for the other methods you mentioned : voltage for the voltage method; and in practical terms, current and time for the coulomb counting method.
How to get the signals to a software module?
Voltage would be measured in an ADC (Analog to Digital Converter) which usually has a register your software can read, containing a number that (multiplied by a scale factor) gives you the voltage. Many embedded CPUs include an ADC which can read several voltages as part of the chip, making the hardware design easier.
Current would be measured in a small value sense resistor, making a small voltage which is amplified and measured in the ADC. Note that current changes sign (reverses) when the battery switches between charging and discharging.
Time ... a timer or RTC (real time clock).
Software then uses these inputs; possibly your algorithm can use both voltage and coulomb-counting methods and fuse the results for better accuracy or to look for signs of battery failure.
Battery state of charge (SOC) determination is a black art.
Essentially you are modelling an electrochemical reaction under a varied and vaying set of conditions.
Analog inputs to a digital microcontroller are achieved by use of what is generically known as an analog to digital converter ADC. That obviously makes sense and also tells you little. ADC types vary and processor data sheets will provide information on specific types used, resolution, sampling time and more. ADC's may have as little as 8 bit resolution but this is usually not enough for good results. While 8 bits nominally allows about +/- 1% resolution, in practice variables may alter across a restricted range of values and far more than eg 8 bits may be required to get 8 bits of resolution across the range of interest. eg a LiIon battery may be operated from 3V to 4.2V in normal use, or a range of 1.2V. 8 bits of resolution across this range gives a resolution of 1.2V/256 = 4.7 mV/bit. However, if the AD has a full scale range of 0-5V then 4.7 mV resolution = 5V/4.7 mV = 1062 steps so at least 10 bits (1024 steps) and preferably at least 12 bits of resolution is desirable.*
The minimum parameters measured are usually battery voltage, current and temperature, all over time. Measuring of battery electrolyte specific gravity ("hydrometer reading" is possible but not usual except in very large battery systems.)
More completely, as well as battery voltage, charge or discharge current, and battery temperature, parameters such as : battery cycle history, typical initial and current charge/discharge curves, initial and current capacity under relevant condition, certainly battery chemistry, phase of moon and now many bank holidays are left in the year may be measured. Magic and secret and/or arcane knowledge is usually required to do a good job. Failing that, much experience, a good understanding of the chemistries involved and lots of testing and measuring.
Some battery chemistries lend themselves to relatively accurate SOC estimation based on current state. eg LiIon is reasonably good - but even so it is poor enough that people go to great lengths to make "coulomb counting" systems that measure charge in and out and combine this with a selection of the above parameters to provide a SOC estimate.
SO - you need to provide more detail about what you want to achieve and why to zero in on which aspects are liable to be worth talking about in more detail.
* [[Some will mutter about +/- 1% versus 256 steps etc but it matters little here]]

- 147,325
- 18
- 210
- 386
Ideally, your charge level would completely depend on its voltage, and to get the charge level you would simply need to measure the voltage and use the manufacturer-defined voltage-to-charge curve to translate voltage into the SOC. However, the curve itself depends on the battery temperature, which means you need to measure the temperature first before knowing which curve to use.
You should start by having battery voltage and temperature measurements (presuming you are going for the voltage method), which can be connected to analog inputs of your device (a PLC, a microcontroller, an acquisition card). The temperature measurement needs to go through a temperature transmitter to get an electric signal (usually linearly dependent on the temperature). Analog inputs then perform ADC conversion (analog to digital) and store the measurement and specific memory locations, or registers.
Once you've got this, you need to translate the voltage measurement into capacity by choosing the right curve, depending on the battery temperature. Your battery manufacturer should have a datasheet with these curves. For example, this is how battery discharge curves might look like depending on the temperature:
You can see that a battery at a lower temperature has a lower voltage at the same capacity, and that these curves are not linear. They can be probably be approximated as linear in a certain range, but the simplest thing to do is to store them as lookup tables to account for the non-linearity.
So, as for the algorithm, it would simply be:
- read the temperature measurement \$ T \$ from your analog input port
- read the voltage measurement \$ V \$ from your analog input port
- choose the appropriate lookup table using temperature as the argument: \$ LT = f(T) \$. If the temperature is somewhere in between, you can either round it, or select two lookup tables and then interpolate afterwards.
- read the SOC from the lookup table, using voltage as the argument: \$ SOC = LT(V) \$, interpolate if needed.

- 232
- 1
- 9
-
@Red: thanks, that's correct, I initially used [this low-res image](http://www.mpoweruk.com/images/soc_lithium.jpg) from [mpoweruk.com](http://www.mpoweruk.com/soc.htm), but then performed an image search to find one with a better resolution, and in the process didn't realize that curves are current-related. But I presume what OP asked for is the principle of measurement/calculation, not exact data. – vgru Jan 23 '14 at 11:40