If you use a li-ion battery, you'll need a proper charger. My battery was from a smartwatch that was broken. I didn't have the charger, so i had to make one. Battery datasheet: http://pdf.datasheetcatalog.com/datasheets2/45/45633_1.pdf

There are plenty of ICs designed for this application, and they make the circuit design easier, but they're rather expensive, and i had all the components i used avalible.



The charger consists in a current and voltage limitter, that is what a li-ion battery needs. I used a MCP602SN dual op-amp (rail to rail) to controll the charging cycle in the circuit, R4 and R5 set a voltage reference equal to the max current in amps, in this case, 100mV for a 100mA max charging current.

The current is controlled in that way: The first op-amp outputs enough voltage so the transistor starts conducting, and continues until de current gets up to 100mA, at that point, if the circuit outputs a little more current, the voltage accross the 1ohm sensing resistor would be greater that the one set in the first reference, so the op-amp would ouput a lower voltage than before, maintaining a constant current. When the battery is in the constant current AKA CC stage, the op-amp keeps the refernece voltage equal to the one in the sensing resistor.



Meanwhile, the voltage in the battery is slowly increasing (see the chart in the datasheet), and we all know that li-ion batteries shouldn't be charged above 4.2v. The second op-amp is there to save the day:

When the battery voltage is under 4.2v, the voltage at IN- is higher than the 0.8v refernece in IN+ ( which is always VCC-4.2v). But when the battery voltage reaches 4.2v, the voltage at IN- is slightly lower than the reference at IN+, and the op-amp otput voltage increases, the diode starts conducting and the voltage in the first op-amp at IN- goes higher, the op-amp beging to output lower voltages, and the current starts to drop. The constar voltage or CV stage has begun.



Along this stage, the voltage at the battery remains constant, at an ideal value of 4.2v. Meanwhile, the current slowly drops, until it goes under the ideal value of 3% of the max charging current. At this point the battery is fully charged.

You can see, that in the circuit i haven't installed any charge indicator. I just leave it charging 3 hours, because i know that it will be fully charged. If a battery is already charged, with this circuit, is okay to leave it plugged a bit more, because the current is still going down and it won't harm the battery.



If you use this charger design with a 200mAh battery, you can leave the design untouched. If you use lower capacity batteries, lower the first voltage reference (R4 & R5) at the value where the voltage in milivolts is 0.5 times the capacity of the battery in mAh.



If you use this charger design with bigger batteries, you'll have to do a little modifications in the circuit:

First of all, use a transistor capable of delivering more current, this will force you to use another package, like TO-122 (not sot23).

Then, if you still use the 5v as VCC, don't use a computer USB if you draw more than 300mA, and then, use a lower value sensing resistor, in the way That 4.2v plus Collector-Emitter Saturation Voltage AKA VCE(sat) plus the voltage accross the sensing resistor at peak current still under VCC 5v.

If you use a higher voltage power supply, for example 12v, you'll have to calculate the voltage dividers again, the second one, must output VCC-4.2v or more, not less. The first one should output the same voltage as the spected accross the sensing resistor at maximun charging current.

As you can see, this circuit can be used in more battery-powered projects by adjusting some component values. It can charge both li-ion and li-poly batteries.