Introduction: Project Exploration: How to See Battery‘s Voltage

In this project we will use an Arduino Uno and code to see the voltage of a battery. This can show how much more you can use your AA batteries. I did this project to originally see the voltage of a smartphone battery. I realized that I didn’t have the resources to do it and that it could be very difficult, I decided to test AA batteries. I never knew if batteries were in good condition. You would have to switch out batteries because you did not know which battery is full or which battery is not full. I used this project to see the voltage of batteries. I can now see which battery is in good condition with a red, yellow, or green light. It takes some knowledge with engineering with arduino’s and some knowledge of voltage.

YouTube Video Demonstration: https://www.youtube.com/watch?v=82TkaeOLp1M&list=PLqm5gWXqdD3B7NhGDu8uIvkDZ72s0PhIN&index=2

Step 1: Ground Wire

The supplies necessary for this project are an Arduino Uno, a 2.2k ohm resistor, 3 100 ohm resistors, a green LED, a yellow LED, and a red LED, bread board wire, a bread board, 2 AA batteries, a battery holder with jumper wires at the end, and a computer that can run Arduino. First you need to connect a black ground wire to the ground pin (gnd) to the negative rail of the bread board.

Step 2: LEDs

Next you should position the LEDs. The LEDs should be facing the right way meaning that the positive (longer) leg should facing up or should be at a higher number pin.

Step 3: Jumper Wires for the LEDs

When placing the bread board jumper wires, the wire should be next to the negative (shorter) leg of the LED. The other end of the jumper wire should then go to the negative rail of the bread board.

Step 4: More Jumper Wires

Some more jumper wires must be added. One should be placed in the analog 0 pin (A0) on the Arduino Uno. The three other wires should be placed at pins 2, 3, and 4 on the Arduino Uno.

Step 5: Code

Copy this code word for word.

*/int greenLed = 2;int yellowLed = 3;int redLed = 4;int analogValue = 0;float voltage = 0;int ledDelay = 1000;void setup(){ Serial.begin(9600); pinMode(greenLed, OUTPUT); pinMode(yellowLed,OUTPUT); pinMode(redLed,OUTPUT);}void loop(){ analogValue = analogRead(A0); voltage = 0.0048*analogValue; Serial.print(voltage); delay(1000); if( voltage >= 2.5 ) digitalWrite(greenLed, HIGH); else if (voltage > 2.1 && voltage < 2.5) digitalWrite(yellowLed, HIGH); else if( voltage <= 2.1) digitalWrite(redLed, HIGH); delay(ledDelay); digitalWrite(redLed, LOW); digitalWrite(yellowLed, LOW); digitalWrite(greenLed, LOW);}

Step 6: Add Resistors

Add the 100 ohm resistors to the positive legs of the LEDs. They should cross over to the over section of the board. The other leg of the resistor should be in the d or e column.

Step 7: Connect Jumper Wires to Resistors

Take the jumper wires that are connected to pins 2, 3, and 4. Connect them to the resistors that are with the LEDs. 2 should go to green. 3 should go to yellow. 4 should go to red.

Step 8: Add a Ground Wire

Place a ground wire from the left negative rail to the right negative rail.

Step 9: Connect A0 to the Bread Board

Take the other end of the jumper wire that is connected to A0 and put in the open or empty end of the bread board.

Step 10: Add One 2.2k Ohm Resistor

Place one 2.2k Ohm Resistor to the bread board. Make sure one of the legs of the resistor lines up with the end of the jumper wire that goes to A0 (the one we just added).

Step 11: Add Another Jumper Wire

Place a jumper wire that is in the same row as the other leg of the 2.2k Ohm resistor that we just added. Place the other end of the wire to another row and column of the bread board (preferably somewhere open and empty on the bread board).

Step 12: Add a Ground Wire

Place a ground wire that goes from the negative rail of the left side of the bread board. Place the other end directly below the end of the jumper wire (the end that is in the open and empty part of the bread board) that we just added.

Step 13: Connect Battery Holder

Place two AA batteries in the holder. Connect the jumper wires from the holder to the bread board. The black wire from holder should be in the same row as the ground wire. The red wire should be in the same row as the other jumper wire.

Step 14: Plug in USB Cable Into Arduino and Computer

Plug in the smaller end of the USB cable in the Arduino’s USB Port. Place the larger USB into the computer’s USB port.