A CPU based NiMH charger

17 June 2008 Version 20080617a releaced.
This version of NiMH charger has been used successfully for over 2 years. A flashing indication of an open circuit condition is added to ensure your battery charger functions normally.

This firmware version will function on all previous versions of hardware.

11 December 2006 Drawing error fixed.
The drawing of the charger showed the switch connected to PC2 while the firmware looked at PC3. It was decided to change the circuit rather than the firmware as this seems to be what most people did.

Change : 13 November 2006 recompiled using WinAVR 20060412.


NiMH cells are gaining wide popularity in, amongst other places, digital cameras.
The energy density in NiMH cells may be lower than that of lithium ion cells, but the fact that they are, in most equipment, interchangeable with disposable dry cells makes them very attractive power sources.
The similar electrical and mechanical considerations of NiMH and to dry cells, translates into a wide supply of relatively low cost cells. Also, in case of an emergency, you can always revert back to dry cells if all your NiMH cells are discharged.

NiMH should under ideal charging conditions charge for 14 hours at 10% of their rated hourly capacity.

The charger.

This project provides a good NiMH charger that charge for the full 14 hours and then switches itself off.

A potentiometer is used to set the charging current, and a bicolour LED indicates the charger's state.

Unlike conventional analogue chargers, the POT simply controls a voltage on the micro controller's ADC. This is used to set the charging current and is sampled ONLY in the initial stage of operation.
Once the button is pressed, the micro controller implements a software switch mode power supply controller for a period of 14 hours. The ATMEGA 8 uses its internal PWM and ADC to control the charging current.

After 14 hours the charging current switches off and the LED flashes green.

A 3 pin header (top right of PCB) is added to provide serial port i/o used in the once off calibration of the system.
Calibration only takes place after the final construction so as to prevent mechanical inaccuracies.
POT knob slippage can be prevented by flattening the round POT shaft on the side of the grub screw.

Flashing LED state indication

o o o Programmer awaiting power setting.
o o o o o o o o o o o o o o o o o o Normal charging, no errors.
o o o o o o o o o o o o o o o o o o Error cells not making contact.
o o o o o o Finished charging.


The circuit is calibrated with the aid of a serial terminal.
The micro controller will prompt the user, however calibration can only be entered in the first 1,5 seconds of 'power up', and is entered by typing 'set'. You will have to cycle the power if you missed the window.

During calibration, the 1000mAH and 3000mAH points of the POT are provided to the micro controller. The micro then stores the calibration points in it's internal eeprom and compensates for any variances. (offset and gain)
The charging current is calibrated next. The user is expected to insert a set of cells and an ammeter in series as a load. Calibration occurs at 100 and 300mA, so be sure not to destroy the fuse in your meter.

Calibration is a MUST and is not just to fine tune the system.
Once calibrated there is no need for serial communications.

Serial setup.

9600 baud.
1 stop bit.
0 parity bits.
Full duplex

For a terminal application, use Hyper Terminal or the terminal application included with WinAVR or alternately use the demo terminal application found here.

The circuit.

A high quality image of the circuit can be found here ( 18KB ).

RS232 converter.

The RS232 level converter is a stand alone unit that can be used in numerous projects, here it is only used to calibrate the charger.
The circuit requires a 8..15 V supply (the red wire). You can simply connect it to the 12V supply feeding NiMH charger and use the communication ground as the negative power rail.


The label was printed on a 4 x 6 inch glossy photo paper, which was than glued on using super glue. A high quality BMP version of the label can be down loaded here ( 9KB ).

The latest version, 20080617a (WinAVR 20060421) can be down loaded here ( 19KB ).
Older version (WinAVR 20060421) of the firmware can be down loaded here ( 14KB ).
Even older version (WinAVR 20040404) of the firmware can be down loaded here ( 14KB ).
A single Zip containing all the files can be down loaded here ( 182KB ).

As a result of numerous requests, I am planning a future version with a fast charge option.

Information about the programming of the AVR device can be found here.
Home mail add