I want to make an 18650 charger without a microcontroller for fun, I was designing a very simple circuit but I had a problem with adjusting the voltage if current/voltage excceds max current/voltage.

The circuit consists of a high value resistor R1 in parallel with the battery and a shunt resistor R2 in series with battery, then I will use opamps as comparators and tl431 as voltage references to compare to and a transistor as a switch to turn on/off the charging and I will use 5/9/12 volt supply depending if I used a linear regulator.

The logic of the circuit is if voltage across R1 is higher than 4.2v or voltage across R2 exceeds a certain level IE current is higher than the max current, the voltage should decrease, here is where I stalled I don't know how to change voltage based on another voltage from the op-amp, I might be able to use a transistor amplifier but I don't know if it is linear or not (also transistor's gain change with temperature) and I have a lot of circuits that needs a voltage controlled by another voltage where a transistor wouldn't be applicable.

Edit1 : I just noticed that if I used this circuit the voltage will decrease to match the max current for an empty battery for example it will be 3.5v, but it will not increase as the battery gets charged, I will deal with it later, but I still have the same question.

Edit2 : I think it can be done by 555 timer varying the width of pwm as voltage changes, but I believe their is a better way.


1 Answer 1


Here is a simple circuit that might give you some ideas. It's very inefficient (4W dissipation during charging, as you can see in the top trace). U1 controls the charging current at 500mA based on the 0.5V reference generated by the bottom TL431. Bottom trace shows the charging current before and after the voltage limit is reached.

U5 controls the voltage shut-off based on the voltage generated by the other TL431 (4.1V with the values shown). The bias current for that TL431 passes through R1 but it is negligible in comparison with the charging current.

Diodes D1, D2 allow the two constraints to be combined. You could easily add a third diode and op-amp, say to limit the temperature.

Caution: There is no redundancy in this circuit and it's possible for failures in various parts or bad connections to lead to a potential fire.

enter image description here

  • \$\begingroup\$ Thanks this is a very helpful circuit. \$\endgroup\$
    – AhmedH2O
    Aug 13, 2022 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.