Hi
I would like to measure the voltage of an 1 cell Lipo. Why doesn’t this work with this sketch?
int val = analogRead(1); voltage = (5.0 * val3)/1.024;
it always shows me 4995 what means 4.9V but the lipo has a voltage of 3.94V
Bat+ | | R1=1K ohm | Analog Pin 1
Bat- | | GND
Thx Geko
val != val3 ?
Shouldn't it be:
int val = analogRead(1); voltage = (5.0 * val)/1024;
You're dividing by 1.024 (that is one and 24 thousandths).
Andrew
yeah ok I forgot to change val to val3 in this code but not in the real sketch! I got the mistake. It is my Battery configuration: It should look like this: Bat+ | R1 | Arduino 1 | R1 | Bat-