NIMH battery maintenance trickle charger


Exhausted Battery

With this article I intend to go through the whole process of designing a PIC based project, including designing the electronics and software and so on. It's a deliberately simple project which is just a slightly more polished version of something I breadboarded to solve a problem I had.

The problem.

I use NIMH batteries only occasionally, but I need them to be charged and ready for action when needed. I have grown tired of spending substantial amounts of money on expensive high capacity NIMH batteries to find that by the time I get around to using them they have irretrievably self-discharged below that magic 0.8v/cell and forever lost all but the vestigial remains of their capacity.

The Brief.

Generally speaking, for a given form factor (AA, AAA, C, D etc) the higher capacity a battery has compared to another then the shorter its usable life will be, and the more sensitive to mistreatment they are. Therefore I needed a way to keep my expensive, highly strung NIMH batteries in top condition without letting them discharge, and also without overcharging them.

There is a lot of information on the internet, and much of it is contradictory, incomplete and just plain wrong [1]. While I don't claim to be a battery expert, my research at the Battery University and Wikipedia leads me to believe that it will be safe to charge batteries:

  • At < 1/10C for 10 hours or so, and
  • At < 1/40C pretty much indefinitely.

Since my batteries are NIMH packs in the region 2000mAH - 2800mAH I am taking C to be 2000, and therefore the charge currents to be 200mA and 50mA respectively.

So what I want, in short, is a constant current source of 50mA that can optionally be turned up to 200mA on a 10 hour timer. The timer should be able to be switched off at any time to revert to 'trickle' mode.

I had considered adding features like delta-v cutoff in "high" mode and thermal monitoring, but these are only features that make much sense in a real fast charger (~ 1C). They would also constitute feature creep, a trap worth avoiding in what is, after all, supposed to be a simple hack. Besides, I have a "proper" charger for fast charging with all those features already, and I was mainly inrerested in the "trickle" mode, something my charger doesn't do.

The electronics

The design comprises 2 sections:

  • A (switchable) constant current generator
  • A 10 hour timer
7805 as constant current generator

The first section, the constant current generator, needs to be able to generate up to 200mA for long periods of time. I decided to use the classic voltage regulator and resistor method using a standard voltage regulator, because (I had some and) it can double up as power regulator for the timer.

The diagram to the left illustrates the basic principle. The voltage regulator is a device with 3 terminals - Input, Output and Common. In ordinary use the input voltage from a transformer/rectifier or higher voltage source is connected between the input and common terminals, and the regulated voltage between the output and common terminals used to power the circuit.

In constant current configuration, a fixed resistor is connected between the output and common pins. Since the voltage between the output and common pins is fixed by the regulator, then a fixed current of V / R amps must flow through the resistor. The current flowing through the regulator from the input to common is so small it can be ignored, which means that the only current flowing is the previously calculated one. By arranging for this current to flow through the load, then the current in the load will be fixed, regardless of the resistance of the load. Of course, there is a limit to this, and that happens when the voltage across the load becomes so large that the sum of that and the voltage across the regulator exceeds the voltage being supplied to the circuit.

The voltage across the regulator is about 7v for one with a 5v output, less if it is one of the "low dropout" type. My battery packs are 4.8v - 7.2v, which means I need an input of at least 14.2 volts. Fortunately I have a number of nominally 12v "wall wart" power supplies that are poorly regulated and kick out well over this at the sort of currents I am considering. If this was an issue, I could use a 3.3v regulator since the microcontroller works down to 2v. However, I don't have any and as we will see the timer microcontroller is more accurate at 5v than 3.3v.

The second element is a timer, and this will be a PIC microcontroller. I chose a PIC because I have some small ones in my parts collection. You could as easily use a Atmel ATtiny chip if you have one, although many of the specifics of the design will be different on the Atmel, the general principles are the same, and if you are more familiar with them and have the necessary development tools then that would be a good reason to use them. [2] Then of course there are all the others by TI, Renesas, etc...

Specifically, I will be using a PIC 16F508 (or 509, its just the same but has more memory). These are lovely little 8 pin chips with (up to) 6 i/o pins! They have an internal 4Mhz clock oscillator, so no messing with crystals or resonators, and the clock is accurate to 1% which is accurate enough for me.

If I was building this as a commercial design, I would probably opt for the newer 10F200 series that come in a truly microscopic 6 pin package and are cheaper and likely to be around longer than the '508, but apart from 2 less I/O pins are very similar architecturally.

So this is my "first cut" schematic of what it will look like:

Schematic of trickle charger

Note I am using only 3 I/O pins, one to switch the transistor(s), one as the pushbutton input, and one to drive the LED that indicates status.

The circuit will be further described in the next part.


[1]This may be a future article.
[2]Despite the many thousands of words written / ranted about on the internet regarding the PIC v Atmel debate, I feel that in reality each have their merits and the best choice is based on oppertunity and familiarity rather than any intrinsic merits.

Version 4 updated Sept. 15, 2012, 11 p.m.