loading

This is a program designed for use with an arduino and a battery that does not exceed 5 volts.
You will need:
- an arduino
- a breadboard
- 10 wires
- 3 LEDs
- a battery of less than 5 volts


Step 1: Assembly

Follow the attached image for instruction on assembly.

Step 2: Program

float highT = 1;

float lowT = 0.5;

void setup() {

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

}

void loop() {

float a = convertVolts(analogRead(0))

if(a>highT){

digitalWrite(13, HIGH);

} else if(a>lowT){

digitalWrite(12,HIGH);

digitalWrite(13,LOW);

} else{

digitalWrite(11,HIGH);

digitalWrite(12,LOW);

digitalWrite(13,LOW);

}

}

float convertVolts(int b){

return((b/1024)*5);

}

Step 3: Different Batteries

If you wish to use a different battery, slight adjustments to the code can be made. To change the voltages considered high, medium, and low, simply change the variable highT, to whatever you wish the threshold for the battery to be considered high voltage, and lowT to whatever you wish to be the most charged the battery can be to be considered low.

NEVER use a battery that emits more than 5 Volts.

<p>Great idea, but I didn't liked the led feedback, so I used my LCD screen. Unfortunately all of my battery cases are in use, so I had to improvise.</p>
<p>In order to make a good guess you need to add a (controlled) load to the batteries. I'm currently working on a(nother ultimate) battery tester ;-)</p>
<p>My son is going to love making this! Thanks for sharing your ideas and knowledge!</p>

About This Instructable

458views

6favorites

License:

More by malsomjoseph:Arduino Vertical Pong Thermostat Battery Tester 
Add instructable to: