The only electronic website that replies to every comment, and addresses all circuit related issues.

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 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()
void loop()
value = analogRead(analogInput);
vout = (value * 5.0) / 1024;
vin = vout / (R2/(R1+R2));
Serial.println("Input Voltage = ");
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);}
//--------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.

Please Share this Post:
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble


    1. Hi Mr swagatam well I need to do my final year project. I need to do battery indicator using Bluetooth and wifi. My question is do I need to do a vdr to avoid a more volt supply to my arduino+LCD+bluetooth module. I hope you can help me

      1. Hi Fatin, you can use a 7805 IC voltage regulator for ensuring a safe 5V for the Arduino.

    2. Hello;
      I have been searching for a circuit that can detect if lithium ion 4.2v rechargeable battery is at fault i mean consuming very less current like 10-100mA but not getting the proper charging current.With LED indication.

      1. Hello, the only way to detect this could be through a current sensing resistor and a voltage amplifier circuit which will indicate whether the cell is consuming around 1C current or not......LM3915 IC looks a candidate for making this system.

    3. Can this be done using arduino with less parts i want to achieve the result.

    4. I only need one LED to indicate so small opamp like lm393 can be use?.Please suggest a circuit.

      1. you can try the following concept, keep only one opamp instead of the shown 4

      2. ....connect the LED cathode to the input supply ground line.

        LED will ON for good battery and OFF for bad battery...for an opposite response connect the LED across opamp output and positive line.

    5. can you provide a circuit for solar panel powered battery charging circuit that charges 12V 7Ah battery

      1. you can make the following circuit:

        adjust the 10K to get exactly 14V for the battery, and use an input of 15V at 1 amp

    6. Good evening....please sir how can i make the led to be constantly ON but Turn OFF when the battery is LOW

    7. If a dead battery attached to this circuit but the battery is also attached to the charging circuit how can we get low battery indication?.As charger output is above 13v so the green LED ON instead of red LED.What to do?

      1. when a good battery is connected the supply voltage will instantly go down and settle down to the battery discharge level...but for a dead battery this might not happen and will indicate something's wrong with the battery.

      2. Hi, Faizan

        Do not charge your battery along with this circuit, it won't indicate the correct battery level.


    8. hello i have calibrated the circuit FOR LITHIUM ION battery charger i have connected the charger it shows 4.2v when no battery and when a 3.7v battery attached to it the serial monitor shows voltage more then 4.7v what to do?.Why it is not showing correct charging voltage or do i need to change the formula?

      1. Hello, Mr. Girish will hopefully see your question here and respond appropriately....please be patient.

      2. Hi, Faizan,

        The circuit is NOT designed for Li-ion batteries, it is proposed for 12V SLA batteries.

        The code is written for 12V batteries and will not monitor 3.7V Li-ion batteries.

        Do not charge your batteries along with this circuit. It is designed to monitor the battery only on discharge.

        Please read the article properly, this will keep most of the misunderstanding about the project at bay .


    9. Its adding battery voltage as well

    10. hy sir i make circuit same as above but the serial monitor shows 20+ reading without battery.
      and only secondary battery are use.

      1. Hi Unknown....LOL :)

        Please elaborate your issues and please comment you problem in a way that others can understand.


    11. Waiting for the reply anxiously.

      1. Please refer to your previous comment above, for the reply....

    12. OK if i calibrate for Li battery but once charging circuit connects what will be the changes to be done to detect original voltage of battery under charge? instead it add up the battery voltage with the charging circuit voltage.

    13. Hi faizan,

      You cannot calibrate the circuit for li-ion battery as the program is written for 12V battries only.

      That's why you are getting unusual voltage readings on serial monitor when you connect the charger.

      If you are looking for li-ion based projects this is not the right one.


    14. Hi,
      I need to do battery level circuit for my intern project. The will be 5v at the input and there will be five leds. For example if there is 1v just one of the leds will light then for 2v first two of themcan you help me about this?

      1. Hi, Mr, Girish will be able to advise you better, I'll forward the question him soon....

      2. Hi, Gizem

        Are you sure about your design, because a 5V (4.5v etc) battery should not be allowed to fall to 1 Volt and most of the circuit will only work above 3V in general.

        I will design a circuit for you, if you want me to proceed with your requirements.


    15. Dear sir,
      Is it only use the battery terminal voltage as input? can i used this for stand alone PV system (12V battery monitoring)?.Because I want to disconnect the battery from the load or pv array at the required charging levels.

      1. Dear Dinusha,

        Yes you can use it separately for monitoring battery only, the Arduino can be powered from the battery under monitor.

    16. Thank you sir.
      Actually I want to design a controller circuit for stand alone pv system to energize the 12V DC bus. This controller must have the MPPT (with P & O algorithm). normally systems disconnected at the overcharging and over discharging the 12V battery.
      I want to design a controller to disconnect MPPT at the battery charging is greater than the 95% ,then it track the voltage without MPPT until 100% charging. if the charging level less than the 95% then it connect to the MPPT again. can it do this by using arduino. ?
      {i want to prevent the problem of cut off the MPPT at the No-load and fix this disconnection & re-connection in smoothly}

      1. Dinuasha, if your requirement is to keep the charging thresholds within the margin of 100% and 95%, then I think it could be done with a simple opamp circuit, using Arduino will be an overkill for such a a simple operation.


    Please Note: If you find any DEAD link starting with http//, please replace it with for making it visible and alive again.