NIMH battery tester – firmware version 2. Now with improved voltage reading accuracy.

In my last post I built a multiple AA battery tester but it used the 5V as a voltage reference which wasn’t ideal and was giving readings that were good but could be better. I modified the code to use the 1.1V internal reference of the Mega328 MCU to calculate the actual 5V supply voltage and this has proved to be much better. Voltages measured by the Arduino are now within 10mV when compared with a calibrated DVM.

As far as the battery tester goes this will produce a more accurate mAh rating and a couple of tests show that battery capacity is now within 100mAh instead of the 250mAh as it was before. These measurements were taken at the load resistors as the battery holders and wiring produced a voltage drop between 30 and 110mV which at 550mA load current is fairly acceptable. If you wish to build this project please refer to my previous post as all the build details are in there. I will also put the latest firmware download on the project post as well.

Issues to resolve – spurious voltages displayed when no battery present. Does not affect operation but will look into resolving this.

3 thoughts on “NIMH battery tester – firmware version 2. Now with improved voltage reading accuracy.

  1. A quick update on this; using the method of using VCC as the voltage reference this causes inaccurate readings if the actual supply voltage is above 5V. It’s also a good idea to use a good quality regulator such as a 7805 or switching regulator instead of using the cheap regulator built into the Arduino board as these never output nowhere near the 5V they are supposed to output. Every 7805 regulator I’ve tested has 5V +/- 10mv output opposed to the 5V +/- 300mv of the cheap Arduino clone regulators.

    In this project the supply is provided by a 7805 regulator. I may also try a LT1029CZ which is a 5V precision voltage reference IC which I suggest you use if you intend this to be as accurate as possible. Having said that using the default reference voltage with a good quality regulator should suffice. I think using a precision reference chip would produce negligible difference as the real problem with accuracy lies with the voltage drops caused by poor battery contacts. But I may try it sometime and see.

  2. That (external) schematic you referred to has 2 very serious flaws, due to poor design:

    1. Accidentally inserting the battery with the polarity inverted *will* blow up the AVR’s ADC input pin, due to the internal ESD protection diode being driven into heavy conduction.
    Also, it’s generally very poor form to directly connect an AVR I/O pin to *any* voltage, without sufficient series resistance (>100…220ohms) to prevent damage – because in such a case, accidentally declaring that pin as an output WILL fry it instantly!

    2. As you’ve already noticed, when the battery isn’t inserted, the unconnected analog input registers total garbage.
    This is because the analog input has a very high impedance (many megaohms), and the length of wire acts as an antenna, picking up random interference, which gets rectified (“detected”/demodulated, like in a crystal radio) by the input ESD protection diodes.

    The fix to both issues requires adding 3 parts per analog input:
    – a bypass capacitor (10…100n) between ADC input pin and ground (partially fixes #2),
    – a series resistor of some 10…47k between the ADC input pin and battery terminal (completely fixes #1, and further improves #2),
    – a shunt resistor of some 100k-1M, between the battery terminal and ground (fixes the root cause of #2).

    • Yeah, good ideas especially the reverse polarity protection. I added a 1 meg ohm resistor already from the battery positive to ground. I’ll try adding the capacitors to see if that improves things but at the moment I’m not too fussed as it works reasonably OK.

Comments are closed.