How can I correctly measure battery voltage using the A0 pin on Arduino?
I want to know when the batteries of a model are getting low.
The 5 AA batteries are over 5 volts so I cannot check the end voltage.
I make a tap after the second AA battery and take it to pin A0.
Unfortunately a meter shows a voltage of 2.39 but A0 shows 1.18!!
What is the correct way to get a real reading?
The 5 AA batteries are over 5 volts so I cannot check the end voltage.
I make a tap after the second AA battery and take it to pin A0.
Unfortunately a meter shows a voltage of 2.39 but A0 shows 1.18!!
What is the correct way to get a real reading?
void doshowvoltage()
{
adcValue = analogRead(A0); // Convert analog of pin A0 to digital
voltage = adcValue * (5.0 / 1023.0); // Calculate voltage according to digital
Serial.println(adcValue);
Serial.println(voltage);
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF);
matrix.textFont(Font_4x6);
matrix.beginText(0, 1, 0xFFFFFF);
matrix.println(voltage);
matrix.endText(0);
matrix.endDraw();
}
