Project Exploration: How to See Battery‘s Voltage

by Aran Pathmarajah in Circuits > Arduino

296 Views, 0 Favorites, 0 Comments

Project Exploration: How to See Battery‘s Voltage

IMG_0608.jpeg
IMG_0607.jpeg
IMG_0606.jpeg
IMG_1432.jpeg
IMG_1469.jpeg
Project Exploration

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

Ground Wire

IMG_1422.jpeg

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.

LEDs

IMG_0608.jpeg
IMG_0607.jpeg

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.

Jumper Wires for the LEDs

IMG_0609.jpeg
IMG_0608.jpeg
IMG_0607.jpeg

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.

More Jumper Wires

IMG_0611.jpeg
IMG_0610.jpeg

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.

Code

IMG_1469.jpeg

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

Add Resistors

IMG_1469.jpeg
IMG_0616.jpeg
IMG_0617.jpeg

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.

Connect Jumper Wires to Resistors

IMG_0618.jpeg
IMG_0619.jpeg

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.

Add a Ground Wire

IMG_1423.jpeg

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

Connect A0 to the Bread Board

IMG_1424.jpeg

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.

Add One 2.2k Ohm Resistor

IMG_1427.jpeg
IMG_1425.jpeg

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

Add Another Jumper Wire

IMG_1428.jpeg

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

Add a Ground Wire

IMG_1429.jpeg

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.

Connect Battery Holder

IMG_1431.jpeg
IMG_1432.jpeg
IMG_1433.jpeg
IMG_1434.jpeg

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.

Plug in USB Cable Into Arduino and Computer

IMG_1435.jpeg
IMG_1436.jpeg
IMG_1437.jpeg
IMG_1438.jpeg

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.