Introduction

This project uses one of the analog to digital converter (ADC) channels on the TINKERplate to measure and evaluate the capacity of a standard 1.5V alkaline battery.

Required Parts

This project only requires a TINKERplate connected to a programmed Raspberry Pi and two wires

Steps

Assembly

The assembly consists of simply attaching a pair of wires to the Analog Input block as shown here:

When testing, place the red wire pn the positive terminal and the black wire on the negative terminal.

Code

We used the code shown below for our tester. In our program we sit in a loop that samples the voltage on analog channel 1 twice every second and display the data to a panel meter. To make it a little interesting, we base the color of the meter and the wording in the label on the battery voltage.

The output from a GOOD battery:

The output from an OK battery:

And the output from a BAD battery:

Note that you could modify the threshold voltages in the above code to test 9V alkaline batteries, lithium batteries, and 6V lead acid batteries.

Here is the code ready for copy and paste:

The above code can be downloaded from github by typing the following instructions on the command line:

  1. git clone https://github.com/pi-plates/TINKERplate-Projects.git
  2. cd TINKERplate-Projects
  3. python3 BatteryTester I.py

Theory

We based our threshold voltages on the blue line in the chart below.

Series Navigation<< Measuring Temperature Using a DS18B20Battery Tester II >>