ArduinoBatteryTester

This is a simple arduino project, that will allow you to test the voltage remaining in a battery. It is a simple project to complete, even for someone relativley new to Arduino.

Supplies:

Arduino UNO
Green LED
Yellow LED
Red LED
5.1k Zener Diode
100 ohm resistors
2.2k ohm resistor
Breadboard
Breadboard Wire
Computer

Step 1: Assembling Arduinoo

You can either follow the directions, or follow the diagram.

1. Wire the ground pin on the Arduino to the ground rail on the breadboard.
2. On the breadboard place the green, red and yellow LEDs. Connect the ground pins to the ground rail.
3. Place a 100-ohm resistor onto positive end of the LEDS then hook a wire from a resistor to the relevant pins on the Arduino.
The following LEDs should connect to the relevant pin numbers.
Red LED = 4
Yellow LED = 3
Green LED = 2
4. Now connect from analogue pin 0 (A0) to the breadboard. After this add a 2.2k resistor and the Zener diode (with the line on Zener diode facing towards the Arduino). Finally have a loose wire coming from the other end of the diode.
5. Finally, have a loose wire connected to the ground rail.

Step 2: Download Code

The code is below at Github.com. Simply copy and paste it into the arduino on the computer and it should work.

https://github.com/pimylifeup/arduino-battery-tester/blob/master/arduino_battery_tester.ino

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);

For this part of the code, adjustments may be needed to the voltage amounts depending on the battery size being used. This can be done by simply changing the numbers to the desired voltages.

Step 3: Using the Battery Tester


When you first turn on and deploy the new code to the Arduino, you will notice that it keeps jumping between the LEDs. This is because the analog input wire is floating and picking up noise causing our program to detect false positives.
To stop the jumping, you can simply ground the analog wire to the ground rail when not in use. You can also try grounding the other analog pins to help reduce the amount of noise it’s picking up.
To test it, all you need to do is hook up a battery to the two wires. Place the ground wire to the negative end of the battery and the positive wire to the positive end of the battery.

Share

    Recommendations

    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Sensors Contest

      Sensors Contest
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    Discussions