This CircuitPython Battery Tester Works From Big Car Batteries Down to Teeny-Tiny Coin Cells
Powered by a Raspberry Pi Pico, this battery tester uses a solid-state relay to shunt current through the user's choice of resistors.
Semi-pseudonymous maker "carsonauto," hereafter simply "Carson," has put together a universal battery tester which uses a constant current discharge system to measure the capacity of anything from car and boat batteries down to hearing aid cells β driven by a Raspberry Pi Pico.
"This was my first Raspberry Pi/microcontroller project, and I wanted to make a tool for myself that I couldn't find commercially available," Carson explains. "I wanted to use a solid-state relay [SSR] to control the drain of a battery through a fixed resistance. The reason for a using an SSR instead of just draining through the resistor is to vary the current to match 1:1 a manufacturer datasheet, but also to ensure the current is constant irrespective of battery voltage."
Saying that nothing was commercially available isn't quite accurate: Carson did come across a device from a Chinese manufacturer which seemed to be suitable, but decided against using it. "The documentation and everything about it seems sketchy," the maker explains. "So, I wanted to make my own sketchy version."
The resulting "sketchy" device is powered by a Raspberry Pi Pico development board running CircuitPython on its RP2040 microcontroller, connected to an Adafruit 16Γ2 character-based LCD with buttons for user input and status reporting. There's a Texas Instruments INA260 battery monitor, connected via I2C, and a "no-name solid-state relay" plus three different resistors to provide an adjustable current sink.
"The battery is connected directly to the resistor via a DC switching solid state relay," Carson explains. "The duty cycle of the SSR firing will be modified to control the average current draw by the battery to the resistor. A PID [Proportional-Integral-Derivative] control loop (in PI mode only) is used to achieve the set-point and compensate for battery voltage drop over time, etc."
The usage is simple: pick the average current draw required alongside the minimum permissible battery voltage and maximum test duration, then set it going. The test will finish when the battery reaches its minimum voltage, the maximum run time elapses, or in the event of being unable to reach at least 90 per cent of the chosen test current over several minutes.
"This was really just a tool for me, so I've forgone a lot of safeties and niceties," Carson admits. "[There's] no e-stop or master off relay, no warning or safety for a runaway SSR or short circuit. Gotta yank a battery lead if you don't like something. The SSR has no heatsink, which is no issue at all below ~5 amps of load, but above that it seems to get very hot, so, either lower the test current or put the box in something flameproof-ish. Might add a heatsink if I need to test above that current lots."
More information is available in Carson's Reddit thread, with a wiring schematic posted to Imgur. The source code β "probably ugly and inefficient," Carson admits, "since it was just for me" β has not been publicly released, but is available from the author on request.