Nov 7, 2016

Battery Level Indicator Circuit using Arduino

 In this post, we are going to construct a battery level indicator using Arduino, where a series of 6 LEDs show the level of the battery. If you are interested in monitoring and maintenance of your 12V battery, this circuit might become handy.


By: Girish Radhakrishnan

All batteries have certain voltage limit to discharge, if it goes beyond the prescribed limit, the life span of the battery will reduce drastically.

Being electronics enthusiasts, we all might have a battery for testing our prototype circuits. Since we concentrate on the prototype during experiment, we care less on the battery. 

The proposed circuit will show you how much energy left in the battery, this circuit may be connected to battery, while you prototyping your circuits. When this circuit indicates low battery, you may put the battery to charge. The circuit has 6 LEDs, one LED glow at a time to indicate the voltage level of the battery.

If your battery is full, the left most LED glows and you battery is dead or about to die, the right most LED glows.

The circuit:



Battery Level Indicator Circuit using Arduino


The circuit consists of Arduino which is the brain of the system, a potential divider which helps the Arduino to sample the input voltage. A pre-set resistor is used to calibrate the above setup. The series of 6 LEDs will indicate the battery level.

The relation between LED and battery level is given below:

LED1 – 100% to 80%

LED2 – 80% to 60%

LED3 – 60% to 40%

LED4 – 40% to 20%

LED5 – 20% to 5%

LED6 - <5% (charge your battery)

The Arduino measures a narrow range of voltage from 12.70V to 11.90V. A fully charged battery should have voltage above 12.70V after disconnecting from charger. A low battery voltage must not go below 11.90V for a 12V sealed lead-acid battery.

Author’s prototype:





Program:

//--------Program developed by R.Girish---------//

int analogInput = 0;
int f=2;
int e=3;
int d=4;
int c=5;
int b=6;
int a=7;
int s=13;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000;
float R2 = 10000; 
int value = 0;
void setup()
{
Serial.begin(9600);
pinMode(analogInput,INPUT);
pinMode(s,OUTPUT);
pinMode(a,OUTPUT);
pinMode(b,OUTPUT);
pinMode(c,OUTPUT);
pinMode(d,OUTPUT);
pinMode(e,OUTPUT);
pinMode(f,OUTPUT);
digitalWrite(s,LOW);
digitalWrite(a,HIGH);
delay(500);
digitalWrite(b,HIGH);
delay(500);
digitalWrite(c,HIGH);
delay(500);
digitalWrite(d,HIGH);
delay(500);
digitalWrite(e,HIGH);
delay(500);
digitalWrite(f,HIGH);
delay(500);
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
}
void loop()
{
value = analogRead(analogInput);
vout = (value * 5.0) / 1024;
vin = vout / (R2/(R1+R2));
Serial.println("Input Voltage = ");
Serial.println(vin);
if(vin>12.46) {digitalWrite(a,HIGH);}
else { digitalWrite(a,LOW);}
if(vin<=12.46 && vin>12.28) {digitalWrite(b,HIGH);}
else { digitalWrite(b,LOW);}
if(vin<=12.28 && vin>12.12) {digitalWrite(c,HIGH);}
else { digitalWrite(c,LOW);}
if(vin<=12.12 && vin>11.98) {digitalWrite(d,HIGH);}
else { digitalWrite(d,LOW);}
if(vin<=11.98 && vin>11.90){digitalWrite(e,HIGH);}
else {digitalWrite(e,LOW);}
if(vin<=11.90) {digitalWrite(f,HIGH);}
else {digitalWrite(f,LOW);}
delay(2000);
}
//--------Program developed by R.Girish---------//

How to calibrate the circuit:

The calibration for this Arduino 6 LED battery level indicator circuit must be done carefully, if you did not calibrate correctly, the circuit will show incorrect voltage level of the battery.

When you turn on the circuit, it starts with LED test, where the LEDs glow up sequentially with some delay. This might help you to debug errors while arranging the LEDs.

1)    Set the voltage of your variable power supply to precisely to 12.50V.

2)    Open the serial monitor.

3)    Rotate the preset resistor clock wise or counter clock wise and bring the readings to 12.50V.

4)    Now, reduce the variable power supply to 12.00V, the readings on the serial monitor should show the same or very close to 12.00V

5)    Now, increase the voltage to 13.00V, the readings on serial monitor should also show the same or very close.

6)    At the same time when you increase or decrease the voltage, the each LED should turn on/off with different voltage levels.

Once the above steps are done successfully, your battery level indicator circuit will be ready to serve the intended purpose.

Hi Friends, Welcome to my site, a place where you will discover a massive collection of electronic circuit ideas, mostly requested by the dedicated readers and exclusively designed by me for their customized application needs. I have posted more than 1100 circuit designs in this site, if you have a personalized circuit requirement you may feel free to request it through the comment box, if it seems feasible to me then surely you may find it published here with your credentials attached in the post, thanks and please keep reading