This is supposed to be kind of documentation for a small project I have completed recently. I didn't find on the net a Nickel Cadmium charger that suits my needs. So I developed my own.
Disclaimer: I am an electronics amateur so if you see any major problems or have a better circuit please let me know.
The battery will power Atmega328 with LCD display + some additional circuitry . Overall current consumption in my case does not go above 100mA My battery pack is 4x 1.2 batteries in series. The voltage on the pack starts from 5.4V fully charged. At ~4.3V the display is not readable, so I will take this as the lower bound. In my case the powered circuit needs relatively low constant current it is possible just to connect the battery to Vcc and not to mess with stabilization.
I wanted something simple with the following basic properties:
1. Charged from any USB, provided it can supply enough power.
2. The powered circuit shall work from battery when unplugged
3. When USB charger is connected the circuit is powered from it exclusively, transition shall be seamless.
4. Once USB charger is plugged in, the battery is unplugged from the rest of the circuit and is charged. Nickel Cadmium requires constant current for charging, more about that below.
Here is my final circuit. The rest of this blog is explanation on its inner working. The KiCad project is as usually on github.
MC34063 is a driver with almost standard boost converter setup that is used to charge the battery. The difference between standard setup and this one in pin 5 which is not connected to output, but to the output of unit differential amplifier based on OPA237.
The differential amplifier calculates voltage drop on shunt resistor R8 which shall be 1.25V for 60mA passing over R8. The 60mA is a low speed charging current, specific to my battery pack and specified on the battery by the manufacturer.
To be fully charged my battery must receive 60mA constant current during 16-24 hours. There is fast charge option, when the battery receives higher current for less time, but this requires additional monitoring circuitry since battery may overheat. Thus, I used safer and simpler low speed charging approach.
Pin 5 on MC34063 is connected to internal comparator with voltage reference of 1.25V. When voltage on Pin 5 is higher than 1,25V the boost controller opens its switch allowing the C7 to discharge a little bit. When it is lower than 1..25V the switch is closed and C7 is charged again.
As you can see, boost converter paired with differential amplifier and shunt resistor plays a simple current source used to charge the battery.
Q3 MOSFET pair is set as normally open switch controlled by the VCHARGE signal. It connects the current source to the external charger when it is connected. Q1 is simply P-channel MSOFET acting as a normally closed switch controlled by VCHARGE. It disconnects the battery from the rest of the circuit when the external charger is connected.
The D1 diode has two purposes.
1. It protects the battery from discharging into connected but not active external charger (I am used to transport my devices with USB plugged in, while the charger apparently not in AC)
2. Without it battery voltage would serve as VCHARGE signal for Q1 and Q3 which is undesirable.
The C1 is used as an extra protection from ringings when plugging the USB charger and smooth transition from charger to battery and vise versa.
Power throughput of the circuit is limited by D1 when on external charger and by Q1 when on battery.
There are few drawbacks that I should mention:
1. The voltage drop and current limit of D1. Schottky diode may be used to reduce the voltage drop.
2. In some situations I have used this circuit with battery unplugged. It works, but there is one apparent issue: Q1 will be half open conducting 60mA from the current source. Not very efficient and may damage Q1 if not suitable for the current.