In this post i am going to explain how to find state of charge of the battery using current sensor ACS712 30 A sensor.connect the load in series to the current sensor.
float rawvalue;
float current;
float soct=100;
void setup()
{
Serial.begin(9600);
}
void loop()
{
float averagecurrent=0;
for (int i=0;i<5;i++)
{
rawvalue=analogRead(A0);
current=((0.0049*rawvalue)-2.5)/0.066;
averagecurrent=averagecurrent+current;
delay(1000);
}
soct=soct-((averagecurrent)/18000)*100;
Serial.print( averagecurrent );
Serial.print(" ") ;
Serial.println( soct );
}
The above program shows how to find the soc using ACS712
float rawvalue;
float current;
float soct=100;
void setup()
{
Serial.begin(9600);
}
void loop()
{
float averagecurrent=0;
for (int i=0;i<5;i++)
{
rawvalue=analogRead(A0);
current=((0.0049*rawvalue)-2.5)/0.066;
averagecurrent=averagecurrent+current;
delay(1000);
}
soct=soct-((averagecurrent)/18000)*100;
Serial.print( averagecurrent );
Serial.print(" ") ;
Serial.println( soct );
}
The above program shows how to find the soc using ACS712
No comments:
Post a Comment