The picture is attached. Sorry if the picture is blurry, the small part(if someone can't see it properly) is a 10k-10k voltage divider. And the middle pin on the Arduino, says analog.
I just need to make sure that everything is connected properly before I wire it. I don't want to break anything and waste time.
Hi,
I used 2 x 3.7v Lith-ion 14500/AA batteries on my robot/buggy. I too used 2 x 10K resistors across the supply with the centre to an Analogue pin, and then used used this code:
{
unit=0.00488; //4.88mV per analoge step
val=analogRead(A2); //Analogue value
bv=(unit*val)*2; // As we are only reading half the voltage x2!
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Battery Status");
val=bv;
if(val>4.80)
{
lcd.setCursor(1,1);
lcd.print(val);
lcd.print(" V+ -Full");
delay(2000);
factor=1;
}
if(val<=4.80)
{
lcd.setCursor(1,1);
lcd.print(val);
lcd.print(" V -Good");
delay(1000);
factor=1.2;
}
if (val <4.50 and val>4.0)
{
lcd.setCursor(1,1);
lcd.print(val);
lcd.print(" V -OK ?");
delay(1000);
factor=1.4;
}
if (val <4.0 and val>3.70)
{
lcd.setCursor(1,1);
lcd.print(val);
lcd.print(" V -Low");
delay(1000);
factor=1.6;
}
if (val <3.70)
{
lcd.setCursor(0,1);
lcd.print(val);
lcd.print(" V -Recharge!");
delay(3000);
}
Great thanks!
Im going to use a 10LED bar graph.
EDIT: I am not the greatest coder. I am guessing the map function could have also been used. The values I used were derived mathematically on paper
So if anyone wants, here is my code for it: