Sunday, December 2, 2012

Battery monitor & discharge tester

I like to use little AGM lead-acid batteries on the workbench and in the field with my QRP stuff.  The KX3 transceiver likes to have voltage up over 13V if you want full power (10W), so I bought one of those amazing little DC-DC boosters from eBay.  Using it though, I could be unaware of how low my battery's terminal voltage has gotten.  Taking it lower than about 1.8VPC (volts per cell) could be harmful to the battery, so that led to this project - a battery monitor.

The heart of the thing is an ATmel ATtiny85 8-pin MCU.  I've been moving from PICs to AVRs lately, and from assembler to C.  I originally used the ATtiny13 and did get a functioning version in its 1024 byte program memory space, but I wanted more features so I went to the '85 and the luxury of a full 8K of memory.

To keep things simple, the user interface consists of just a speaker, and LED, and a push button.  the MCU monitors battery voltage via ADC and issues a warning beep at 11.0 volts and a "tripped" beep at 10.8 volts.  A logic line output changes states when tripped and can be used to stop the battery discharge via a relay, MOSFET or transistor.  If you just want an alarm, the output line is not used.

A brief press of the switch in normal operation will cause the speaker to beep out the current voltage.  This can be in Morse, or for those who aren't Morse literate, it will give one beep for "1", two for "2" and so on, with a long beep indicating "0".  The readout is to the hundredth digit.

If you initiate a voltage report and then re-close the switch and hold until it's finished, the MCU will swap between Morse and "count beeps" reporting methods.

Holding the switch closed for > 2s while in normal operation will toggle the sense of the output line between HIGH and LOW for the non-tripped condition.  All configuration changes are saved in EEPROM and  therefore survive a shutdown and re-start.

The MCU is programmed for a trip setpoint of 10.8V and an alarm setpoint 0.2V higher.  This is also programmable:  Connect it to a variable voltage source and hold the switch while powering on the board. The voltage at the time the switch is released becomes the new trip setpoint.

The LED flashes briefly about once per second in the untripped state and changes to two brief flashes every 2.5 seconds after it trips.  I wanted to avoid the dreaded "car alarm syndrome" of continuous audible alarms driving me crazy.  The board gives two 0.5 second raspy sounds at the warning setpoint and one two second raspy sound when it trips.  Then it goes quiet.  Check the LED to see if it's tripped.

Another function is use of the board to supervise a discharge test.  After it reaches the trip setpoint and stops the discharge, it reports the discharge time in minutes. Knowing the discharge current, you can calculate the amp-hour capacity.  Additional presses of the switch while in the tripped state cause it to repeat the discharge time and the battery voltage.

So, a fair amount of function in a tiny chip & board.  One drawback is that after it trips, it's still pulling current from the battery.  But that's only about 2mA.

I tested my trusty 4 A-hr AGM and found that it had less than 1 A-hr capacity, so it went into the recycle bin.

No comments: