 # Battery Sate of charge

How to measure the state of charge of lithium battery ?? i tried voltage method but it has big variation

Post a schematic of how you tested it showing all the connections. Post the code you used .

tefa: How to measure the state of charge of lithium battery ?? i tried voltage method but it has big variation

Yes look and see how successful commercial methods are, that is not very. It is an almost impossible thing to do accurately mainly because the battery characteristics change over time so it is a moving target.

I used 12 volt 4AH battery , so i used voltage divider to reduce the voltage that go to the arduino so i used 2 resistor ,

code : voltage part
delay (5000) ;
Serial.println(V);
float voltage = V5.000/1023.000 ; // hena ba7wal el voltage le digtal
Serial.println(voltage);
Serial.print(voltage);
3.000) ;

Soc part

float Percentage (float volt){
float SOC ;
if (volt <= 11.96 ){
SOC = ((volt-11.36)/0.15 ) 10 ;
}
if (volt <= 12.24 && volt > 11.96 ){
SOC= ((volt-11.96)/0.14)
10 +40 ;

}
if (volt <= 12.5 && volt > 12.24 ){
SOC = ((volt-12.24)/0.13)* 10 +60 ;

}
if (volt <= 12.62 && volt > 12.5 ){
SOC = ((volt-12.5)/0.12)* 10 +80 ;

}
if (volt > 12.62){
SOC = ((volt-12.62)/0.11)* 10 +90 ;

}
return SOC ;

i used this numbers
****Battery SOC
100% = 12.73
90% = 12.62
80% = 12.50
70% = 12.37
60% = 12.24
50% = 12.10
40% = 11.96
30% = 11.81
20% = 11.66
10% = 11.51

If you are referring to the charging curve , yes of course it is going to vary. What did you expect ? what should i do ?

i tried voltage method but it has big variation

You said you took some measurements. Where is your data ?

what should i do ?

What does this mean ? Do about what ? (the voltage variation ?) Was the arduino powered by the battery you were measuring ?

i didn't have the data now but this is quietly the same as data voltage 12.45 12.46 12.50 12.51 12.47 12.60 the ardunio not powered from the battery

Next time you run the test use a terminal capture program like easy term or realterm to capture the serial monitor output and put it in a loop. Did you calibrate your code using a multimeter with a reference voltage ?