Battery Tester Fam

This project was simple in essence. Use the Arduino development platform to test the capacity of a 1.5 V battery. Use the analog input to gauge the voltage by converting it to information the digital output of the arduino can use.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Code

int ledpin12 = 12;

int ledpin11 = 11; int ledpin10 = 10; void setup() { Serial.begin(9600); analogRead(A0); pinMode (ledpin12, OUTPUT); pinMode (ledpin11, OUTPUT); pinMode (ledpin10, OUTPUT);


void loop() { float sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: Serial.println(voltage); if(voltage==0){ digitalWrite (ledpin12, LOW); digitalWrite (ledpin11, LOW); digitalWrite (ledpin10, LOW); } if (voltage>0){ digitalWrite (ledpin12, HIGH); } if (voltage>=.5){ digitalWrite (ledpin11, HIGH); } if ((voltage>=1)){ digitalWrite (ledpin10, HIGH); } }

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest