I want to check battery level using Arduino. Arduino is powered by 3.7v Li-Ion Battery. using the same Arduino, I want to check check level of battery. Is it possible with Arduino's ADC?
I am using following code :-
void setup()
{
Serial.begin(9600);
pinMode(12, OUTPUT);
digitalWrite(12, LOW);
}
void loop()
{
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
float voltage = sensorValue * (3.7 / 1023.0);
Serial.println(voltage);
Serial.println("V");
delay(500);
if (voltage < 3.0)
{
digitalWrite(12, HIGH);
}
}
Circuit Diagram :- enter image description here
Serial Monitor of Arduino IDE :-
2.98
824
2.98
824
2.98
824
2.98
824
2.98
824
2.98
Can anyone suggest me to how to read exact live voltage of 3.7V 600mah battery using Arduino?
I have tried one more thing you can see the picture below :-
By using above circuit output is :-
1023
3.70
1023
3.70
1023
3.70
1023
3.70
1023
3.70
1023
3.70
1023
If I connected a 470ohm resistance between analog(A0) and Vcc(+) of battery, there is no output.