Introduction: Arduino AA Battery Tester

About: I love all things programming from making a Led blink on a arduino, to controlling a whole Christmas light show from my phone with raspberry pi and other hardware. If you'd like to see the light show, check ou…

If you live in a family like mine, there is always a problem finding fresh batteries. Sure, you may have a battery bin, but how do you know which ones are charged and which are not. Well this project will help you find your good batteries! The project is super simple, even a beginner could build this. It will take you about 5-10 minutes to build this project.


Only test batteries with a voltage of 5 volts or lower. Any batteries higher will damage your Arduino. It's best to stick with AA batteries or AAA batteries. Other batteries under 5 volts will still work, but will provide inaccurate results.


any Arduino

AA/AAA battery holder with wires or 2 jumper wires.

Step 1: The Circuit

Take your battery holder and plug the ground or black wire to any ground on the Arduino. Take the positive or red wire of the battery holder and plug it into analog pin 5. If you do not have a battery holder, take 2 jumper wires, plug one into analog pin 5, and the other wire to ground. leave the other ends of the wire unplugged. And that is the simple circuit!

Step 2: The Code

The code is very simple. Just copy it from below and paste it into the Arduino IDE. Then, upload it and open the serial monitor. In the pricture of the code, i added some code to use with a screen. When there is no battery connected, you will get a bunch of random numbers like 0.45 or something. When you do have a battery connected, you will get other numbers. The serial monitor outputs the batteries voltage. 1.49 volts or more = Great battery. 1.42 - 1.48 volts = okay battery. 1.41 volts or less = dead battery.

int batteryPin = A0;

void setup(){



void loop(){

float value = analogRead(batteryPin*0.0048);




Step 3: Taking It Further

Maybe if the the battery is rechargeable, you can make the arduino charge the battery. Maybe you can find a way to test batteries with voltages higher then 5 volts. Maybe you could even add a coin slot and sell batteries. You can do or add anything to this project. I hope you enjoyed this instructable. If you liked it, i entered this in the arduino contest. If you wouldn't mind, i would love if you voted for my project. Thank you so much!!!! btw the contest ends june 22 2020.

Arduino Contest 2020

Participated in the
Arduino Contest 2020