The Circuit
The heart of this charger is Z1a, one half of an LM393 dual voltage comparator. The output (pin 1) can be in one of two states, floating or low. While charging, the output is pulled low by an internal transistor, drawing about 5.2mA of current through Q1 and R5. Q1 has a beta of about 90, so about 470mA will flow through into the two AA cells being charged. This will fully charge a pair of 2500mAh cells in just over 5 hours.
During charging, R1, R2, and R4 form a three-way voltage divider which yields about 1.26V at the non-inverting input of Z1a (pin 3, Vref).
TR1 is a thermistor that is in direct contact with the cells being charged. It has a resistance of 10kΩ at 25°C (77°F), which varies inversely with temperature by about 3.7% for every 1C° (1.8F°). R3 and TR1 form a voltage divider whose value is applied to the inverting input (pin 2, Vtmp). At a temperature of 20°C (68°F), TR1 is about 12kΩ, which makes Vtmp about 1.76V.
Once the cells are fully charged, the charge current will literally go to waste, in the form of heat. As the cell temperature rises, TR1's resistance drops. At 33°C (91°F), the resistance will be about 7.4kΩ, which makes Vtmp about 1.26V, which equals the Vref voltage.
As the temperature rises above 33°C, Vtmp will become less than Vref, and the open-collector output of Z1a will float high. Therefore, the current flowing through R5 is greatly reduced, as it is now limited by R1, R2, and R4. As a result, the current flowing through Q1 and the cells is reduced to a 10mA trickle charge rate.
Also, because R4 is now connected to +5V through R5 and Q1 instead of being held at 0.26V by Z1a, the Vref voltage changes to about 2.37V. This guarantees that as the cell temperature drops, the charger won't turn back on. In order for Vtmp to reach 2.37V, TR1 would have to reach about 20kΩ, corresponding to a temperature of about 6°C (43°F), which should never happen in a room temperature environment.
Z1b is the other comparator on the LM393 chip, and a close look at the schematic reveals that it's performing the same comparison as Z1a. Instead of driving the charging transistor however, it drives an LED that indicates that charging is in progress. R6 limits current to the LED to about 10mA. By running the LED from its own comparator (which is on the chip whether we use it or not), the LED current has no effect on Vref.
Finally, C1 is there to ensure that charging starts when a pair of cells is inserted. With no cells in place and the charger off, C1 has about 1.9V across it (5V - 0.7V - Vref). As soon as the second of two cells is inserted, the positive side of C1 is suddenly forced down to the battery voltage (about 2.4V). This immediately forces the negative side 1.9V lower than this, to about 0.5V. Since this is connected to Vref, Z1a's output goes low, causing charging to start. After a few milliseconds, C1 adjusts to the new voltage difference imposed by R1, R2, and R4 on one side and the cells on the other, and no longer affects the circuit.
Part Description
R1 56kΩ ¼W, 5% resistor
R2 27kΩ ¼W, 5% resistor
R3 22kΩ ¼W, 5% resistor
R4 47kΩ ¼W, 5% resistor
R5 750Ω ¼W, 5% resistor
R6 220Ω ¼W, resistor
TR1 10kΩ @ 25°C thermistor, approx. 3.7%/C° NTC
Radio Shack #271-110 (discontinued†)
C1 0.1µF 10V capacitor
Q1 TIP32C PNP transistor, TO-220 case
Z1 LM393 dual voltage comparator IC, DIP
LED1 Red, green, or yellow LED, 10mA
Other 2-cell AA battery holder
USB cable
Small heatsink