Introduction: Arduino Battery Tester With Led Light

Picture of Arduino Battery Tester With Led Light

What I'm making is a battery tester with Led lights that also runs on an Arduino.What it does is shows how much battery is left in it by the LED lighting up.For the Wiring I used a breadboard which helped me a lot.Please comment on my project and tell me how you made yours and how I could've improved mine.

Step 1: Get the Materials

Picture of Get the Materials

3 560 Ohm Resistors(Green,Blue,Brown)

1 2.2k Ohm Resistor(Red,Red,Red)

1 Green Led Light

1 light blue or Yellow Led Light

1 Red Led Light

1 Zener Diode

1 Breadboard and Various Jumpers(connecting wires)

1 Arduino Uno R3 Microcontroller with USB cable

Step 2: Wiring

Picture of Wiring

I have 4 pictures of how I did the Wiring

Step 3: Code

Picture of Code

Here's the code to run the Arduino

#define newLED 2 // green LED 'new'
#define okLED 4 // yellow LED 'ok'

#define oldLED 6 // red LED 'old'

int analogValue = 0;

float voltage = 0;

int ledDelay = 2000;

void setup(){

pinMode(newLED, OUTPUT);

pinMode(okLED, OUTPUT);

pinMode(oldLED, OUTPUT);

}

void loop(){

analogValue = analogRead(0);

voltage = 0.0048*analogValue;

if(voltage >= 1.6){

digitalWrite(newLED, HIGH);

delay(ledDelay)digitalWrite(newLED, LOW);

}

else if(voltage <1.6 && voltage > 1.4){

digitalWrite(okLED, HIGH);

delay(ledDelay);

digitalWrite(okLED, LOW);

}

else if(voltage <= 1.4){

digitalWrite(oldLED, HIGH);

delay(ledDelay);

digitalWrite(oldLED, LOW);

}

}

I want to give credit to wcyoder for the code

Comments

seamster (author)2016-05-20

Nice and simple! Thanks for sharing how you made this :)

About This Instructable

113views

3favorites

License:

More by wann669:Arduino Battery Tester With Led Light
Add instructable to: