# DIY Battery Level Checker

3,426

47

1

Batteries are harmful to the environment, which is why there are special battery recycling facilities. However, we must not forget, reducing and reusing comes before recycling. Many batteries get thrown into the bad batteries pile even though thy still have a lot of juice left in them. For those without a multimeter and have no other way of checking a battery, if a battery-powered device is not being powered or turned on , the batteries are usually the first to blame and the first to be thrown out.

This is a simple battery checker that will have an LED light up indicator to tell the user how much juice a battery still has to minimize our waste and pollutants. This allows us to reuse our batteries and consequently reducing our waste, every little help counts in helping save this planet.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: BoM

• Arduino Uno or 101
• Zener Diode
• 5mm Red LED
• 5mm Green LED
• 5mm Yellow LED
• 3 pieces of 100Ω Resistor
• 2.2kΩ Resistor (or make one using 1kΩ and 100Ω resistor)
• Used Battery for testing

## Step 2: How It Works?

The Arduino's pins, by definition, reads the voltage levels of the signal. However, feeding raw input from the battery can damage the Arduino. This is where the 2.2k Ω resistor comes in. It reduces the current from the battery to a readable value for the Arduino without damaging it, since the pins have a current input limit.

The Zener diode allows us to test batteries that have a voltage greater than 8 volts. A Zener diode, like all other diode ensures that current will flow in only one direction until it hits a voltage threshold, which is dependent on the diode type. For a Zener diode, the limit is around 5.1V. When this limit is reached, current can go in the reverse direction. This is important since it is used to protect the Arduino from over-voltage.

## Step 3: Making the 2.2kΩ Resistor

If you don't have a 2.2kΩ Resistor like me, don't worry, you can make your own quite easily.

By equivalent resistance laws, any resistors in series will have an equivalent resistance of those resistances summed up. While any resistors in parallel will have an equivalent resistance of the sum of the inverses of their resistances.

Most people already have 1kΩ resistors and 100Ω resistors, so by putting 2 1kΩ resistor and 2 100Ω resistors all in series, we will get a total of 2.2kΩ resistor.

## Step 4: Hardware Hookup

LED Battery Indicator: The LED battery indicator will be in order of red, yellow, then green, where red means low, yellow is medium, and green is high or full.

• Connect the cathodes of each of the LEDs to the ground rail on the breadboard.
• Connect the anodes of each of the LEDs to it's own 100Ω resistor. Then connect the other end of each of the resistors to a jumper wire to pins 2,3 and 4, respectively.
• Green LED: pin 2
• Yellow LED: pin 3
• Red LED: pin 4
• Connect the ground rail on the breadboard to the GND pin on the Arduino

Battery Checker

• Connect the 2.2kΩ resistor to A0.
• Connect the other end of this 2.2kΩ resistor to the negative end of the zener diode, indicated by the black bar.
• Connect the end of the free end of the diode to an orange jumper wire. This will connect to the positive terminal of any battery you want to test
• Connect a white jumper wire on the ground rail on the breadboard. This will connect to the negative terminal of any battery you want to test.

The zener diode is veryimportant as it is used to protect the Arduino if the battery has a lot of charge left. Note the polarity of the zener diode, since it will be used to only allow current to flow in one direction!

## Step 5: Coding

`int greenLed = 2;`
```int yellowLed = 3;
int redLed = 4;```
```int analogValue = 0;
float voltage = 0;
int ledDelay = 1000;```
```void setup()
{
pinMode(greenLed, OUTPUT);
pinMode(yellowLed,OUTPUT);
pinMode(redLed,OUTPUT);
}```
```void loop()
{
voltage = 0.0048*analogValue;

if( voltage >= 1.6 )
digitalWrite(greenLed, HIGH);
else if (voltage > 1.2 && voltage < 1.6)
digitalWrite(yellowLed, HIGH);
else if( voltage <= 1.2)
digitalWrite(redLed, HIGH);

delay(ledDelay);
digitalWrite(redLed, LOW);
digitalWrite(yellowLed, LOW);
digitalWrite(greenLed, LOW);
}```

## Step 6: Done

Test you batteries by touching the white jumper wire to the negative terminal of the battery while touching the orange jumper wire to the positive terminal of the battery.

The LED indicator will light up red, yellow, or green depending on the voltage left on the battery.

Participated in the
Makerspace Contest 2017

## Recommendations

• ### Internet of Things Class

22,865 Enrolled

## Discussions

Hey, Im planning using it with 3.7 lithiun battery (18650) can it work with this configurations? (I know i have to modify the code, i want to know if i wont fry the arduino. And maybe the batterys will be in parallel, will it be different or the same?

Sorry for bad english not native.