Introduction: Arduino Project #1
This is a guide on how to make a D-battery charge tester using arduino.
Step 1: Step 1: MATERIALS
Here is a list of what you need for the D-battery charge tester.
- 1 Arduino Uno R3 and breadboard
- 3 LED lights
- 10 wires
- 1 1.5V (D) battery
Step 2: Step 2: Putting It Together
Use the attached image for assembly.
Step 3: Step 3: Code Time
If not already downloaded-
- download the arduino software from the arduino website
- Imput the code below and run
float a = 0;
float x; float y;
void setup() {
x=conversion(1.4);
y=conversion(0.4);
pinMode(13, OUTPUT); }
void loop() {
a = analogRead(0);
if (a > x) {
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
} else if (a > y && a < x) {
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
} else if (a < y) {
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
}
}
float conversion(float a){
float b=((a/5)*1024);
return b;
}
Step 4: Step 4: You're Done!
The arduino should work perfectly now.
Comments
6 years ago
Nice little project! I would recommend changing your title though, to tell people what this is. Maybe "Arduino Battery Tester" or something like that.
Thanks for sharing your first instructable! Hope to see more projects soon :)