Saturday, February 25, 2012

Improving Battery Tester Accuracy

In earlier experiments I found that when powering the Arduino from USB, the battery voltage measurements were all over the place. This is because when the Arduino uses its power supply as the reference voltage for analog conversion, and the power supply isn't precise, neither is the analog measurement precise. It turns out USB power can vary +/-10% and still be in spec.

Accuracy can be improved by adding a reference voltage. I used an LM431Adjustable Precision Zener Shunt Regulator. By the way, when looking for spec sheets it's best to go to the manufacturer's site or to a vendor site, otherwise you may end up in the land of pop-up hell or you may run the risk opening malevolent PDFs.

Normally one would connect the reference output to Vref, but since my battery voltages are over over 2.5 volts, I connected it to one of the analog inputs such as A0.

I then applied the measured reference voltage as a correction factor to each measurement.

batt01 = (float)a1 * 2.5 / (float)a0;

This resulted in much more stable measurements, but unfortunately it didn't improve the repeatably. I repeated charged and discharged the batteries and although some generalizations about each battery can be made, I doesn't seem like it will be possible to compare a battery from one set to a battery in another set. I want to be able to do this so I can regroup the batteries into better performing sets.

Better, but still not good enough. To be able to compare batteries from different sets I would need to see the discharge curve for each battery overlay itself in these test runs. Perhaps the problem is related to the charger. I'll try a different charger and repeat the experiment.

One final improvement I want to make is to the resolution of the graphed data. I'm rounding off the results to to two decimal places. The A-D converter has twice that resolution, so in the future I'll increase the output to three decimal places.

The source code for this project can be found on GitHub as usual.