Now if you browse about in this document, you will detect that we are taking advantage here of the current sense resistor 0.2* (Ohms) which drops more voltage as the load current increases. When it approaches 0.6V drop (typical) the 2N2222 conducts, pulling the ADJust pin down, which effectively turns this into a constant current charger with a max voltage limit set by the voltage divider. Under a heavy output load, the 2N2222 forces the output to drop to at most 1.2volts (the regulator's reference voltage). Note that a short circuit is inadvisable as it drops the full supply voltage (and power) across the regulator, and will thus rely only on the thermal protection.
The voltage divider circuit of 240Ohm/1.1KOhm effectively ignores the current sense resistor value, which only drops between 0.0v unloaded and 0.6v under full charge. I used a value of around 2 ohm to get a 300mA cut-out. Note that the current limiting is constant, and not designed to protect against a dead short. You will need a 5 Watt sense resistor, and a heatsink for the regulator, a pretty substantial one.
So here goes with a basic parts list:
1. LM338 TO220 package (5A max)
2. Heat sink, around 6cw, it's not small.
3. R1 240 Ohm
4. R2 1.1K Ohm (normally a 2% tolerance component)
5. R3 100 Ohm, this is here to prevent T1 saturating
6. R4 0.2 Ohm (current sense)
7. T1 2N2222
8. C1 1000uF
Next I replaced R1 with 330Ohm, and R2 with a 2KOhm trimmer, since I wanted around 9.6volts to charge some NiMh cells, I am using 300mA, which is below the 1/4 charge current calculation for my pack making this a normal/slow charge current. I already mentioned changing R4 to 2 0hms, this will charge my battery, normally flat at about 7volts all the way up untill 9.6volts with no more than 300mA then quickly drop off once we get to the charge voltage. At this point of the design, mentioning a temperature sensor is required if you are going to sell or give this completed circuit to anyone. To work well the temperature sensor needs to be integrated into the battery pack, and in direct contact with the cells, as many as possible. It's law as far as I know, but we do not have to add one yet, so let's carry on without it.
If your supply already has filtering, reduce C1 to 100uF, however not fitting enough filtering can also mean C1 will heat internally, and 1000uF will not be enough if delivering in excess of 3amps for instance. I am using an existing smoothed supply, which wins me some space that C1 takes up. I tend to use 2200uF in my power supply filter circuits anyway. You can add a filter cap to the output, if you do, you will also have to add 2 discharge diodes to protect the regulator if the voltage anywhere in your circuit is greater than 15v.
OK, but I still want some protection diodes, to prevent the charger from draining the battery when the mains goes off (I used to live in a country this happened in a lot and have gotten burned by it.) I found a diagram of this in action while hunting for suggestions on how to do it. My first guess was to just increase the output by 0.6volts to cater for a reverse flow from the battery into the charger, and hook a diode in series with the battery pack... I did eventually find a prettier solution. To see this in action, wait for part 2. Part 2 of this prototype will add protection diodes, and turn off the charging action a bit more intelligently with only a few more small parts. I will be burning in the design as it stands for a few weeks first though.