# Need explanation on battery monitoring (STC3100)

Hi there,

I currently work on a project which works with a battery. I decided to use a monitoring IC to have a precise State of Charge to display.
There is many things that I don’t understand well about the battery subject. I’m very interested to know more.
I have the “Charger 2 clic” module of MikroE with the STC3100 which is my monitoring component.
I did my code to write/read in registers by I²C. This part works.
I’m now on the main part which is to get the current State of Charge. I followed the Application Note of the STC3100 (AN3064) : They say we can make a periodic function which read all registers every 5 seconds (IT). They also say we need to use the battery voltage to estimate the State of Charge at start.
My problem is I want to have a precise value. I did a code with just an AnalogRead on Arduino but that’s not what I want. So how can I have a good battery monitoring if my first measurement is not precise (The voltage is precise but not the State of Charge that I need to calculate).
(I know there are many things I ignore)
Is it the same method in our cellphones?

The application note :

``````Periodic GasGauge task
A simple periodic GasGauge task will do the following.
● Read the battery voltage, temperature, current and charge accumulator.
● At first call, use the battery voltage to estimate the battery’s state-of-charge and save it
in a RAM location of the STC3100 as a reference value.
● During subsequent calls, use the saved reference value and the present charge
register content to calculate the present battery capacity:
battery capacity = reference value + charge register content.
● Trigger a "low battery" alarm if the battery’s voltage is low (typically less than 3.1 V).
● Calculate the remaining operating time from the remaining battery capacity and current
consumption when the battery is not charging (negative current).
``````

My battery’s datasheet, 18650CA-2P-3J (Li-Ion), doesn’t give a discharge curve which could be very usefull. I guess every battery have a different curve?
I really appreciate any kind of response to grow my knowledge on this subject ;)[/right]

State of charge estimates are fairly rough and ready, you need to consider lots of factors for best accuracy,
temperature, charge rate, discharge rate, aging/wear of cells. With coulomb counting you can do a lot
better than just using voltage, but you need to track the aging of the battery and the self-discharge ideally.

However to coulomb-count requires a shunt resistor which loses you some voltage, and its not very accurate
when the dynamic range is high (for instance 1mA most of the time with brief 1A spikes - the shunt resistor
can’t be sized for both extremes…)

``````At first call, use the battery voltage to estimate the battery’s state-of-charge and save it in a RAM location of the STC3100 as a reference value.