Adding CC to a CV buck to make it CC/CV - Page 1
Forum section: electronics / beginners

author: Rick Law
author_rank: Super Contributor
timestamp: February 27, 2015, 02:47:45 am
content: I. Adding Current Limit to existing Boost/Buck module - preface[EDIT: hunting for the picture for another post, and I realized I had the XL4015E1 as XL4051E1. Trouble with once the heat sink was on, I can't see the darn number, I didn't realize my notes was wrong and it stayed wrong... wow 2 years later...]I am a hobbyist with limited experience. I am sharing this experience with detail explanation as many others have been generous in sharing their experience with me. I hope those less experience than me can benefit. Further, I hope to learn from comments some of you more experienced folks will post.So, I got one of these boards to float charge my SLA – an XL4015E1 buck module. The XL4015 is a 5A version LM2596 like buck regulator. After a while, I wanted to use it for something else but hampered by its lack of current limit.[Picture 1][Picture 2]Looking at examples of how some CC/CV board does it, and with a little more experience under my belt, I created my own current limit to a CV board.This circuit has been tested with LM2596 buck converter, LM2577 boost converter, and the XL4015. Some components may benefit from some adjustment, but even as is the circuit works for all three. Given my limited experience, I am sure this could be done better. This for me is a starting point.II. Figuring out the controlFrom the TI’s LM2596 datasheet, you see this application example below. Typically, the module implementation is R2 being a VR to adjust the output, and R1 is a fix resistor:[Picture 3]R1 and R2 forms a divider to send a feed back voltage to the LM2596's feedback pin. If the feedback voltage is >1.23V, the output is too high and the LM2596 lower the output until the feedback reference voltage is 1.23V. The LM2577 boost and the XL4015 work the same way but with a slightly different feedback reference voltage (1.25V for XL4015).Note that I am using Adj Pin and feedback pin interchangeablysince in my earlier drawings, I used to call it Adj.Now think about this modified the module:So, if one can inject current (at the red arrow), the current flows to ground via R1 increasing voltage across R1 (or increase voltage causing the current flow at R1, doesn't matter). Thus to lower the output at current over limit, I merely held Adj to a higher voltage than the reference 1.23V, the LM2596 will think the output is too high and lower the voltage. As typically R2 is a VR, so to find the connection point, it is a simple tasks of identifying which of the 3 VR contacts connects to Pin 4 of the LM2596.By inserting a 0.1ohm current sensing resistor between the load and the module's Vout-, we have a way to measure the current to the load. The grey arrow is the "output" of current sensed as voltage above the module's ground.For example if I wish the current limit to be 1.5A, the 0.1ohm would be 150mV at the grey arrow: It is a simple matter of comparing the current sense voltage (grey arrow) to a pre-selected limit-voltage of 150mV. Upon compare, if the current sense voltage is > 150mV, that trigger the enhancement circuit to "send" a control voltage (along the red line) to drive the feedback pin above reference voltage. This is exactly the kind of job op-amps are good at.With my boost module, I found R2 being a 3296 styled 50K VR with Pin 1 connecting to feedback and Pin2 shorted to Pin3 and connected to module's Vout+ to LOAD.From this point forward in this writing, I will switch to using XL4015 as that is the one I ended up implementing. This circuit has been tested to work with LM2596 and LM2577.III. Simple VersionSo, this is a simple circuit to compare the current sense voltage verses a preset voltage for an LM358 op-amp.[Picture 4]While the buck module can accept 4V to 38V, the current-sense voltage needs to be compared against a predictable voltage. The LM358 will also benefit from the stability of a predictable voltage. So, a 78L05 is added to give the circuit a fixed 5V. Adding the 78L05 however limits the module's Vin+ to what a 78L05 can take – around 7V to 35V.The 5V is divided down by 120K(fixed)+10K(VR1). This ratio allows VR1 to range from 0V to 0.385V. VR1's output is the selected current limit voltage. The max 0.385V equals 3.85A for selected current limit.The selected current limit volt (abbr as limitVolt) is compared against the current sense volt (abbr as senseVolt) by the op-amp. The op-amp's output is connected via the RED LED to the feedback pin of the regulator. The 1ohm connected to RED LED is optional. Its sole purpose is a mean to determine LED current if desired.When the senseVolt is below the limitVolt, the op-amp can't output negative. It outputs the minimum which is 0V. The RED LED is thus off. The LED is a diode thus blocks any current from the regulator-ADJ pin (1.25V) to the op-amp's 0V output. In this mode, the regulator is functioning normally as if the add-on stuff does not exist.When the senseVolt is above the limitVolt, the op-amp outputs the max voltage it can. At 5V Vin+, the LM358, output max is around 3.7V. With +3.7V, the RED LED is turned on. The RED LED Vf is about 1.8V. Current now flows through the LED continues to the feedback pin bringing that up to approx 2V. 2V is above the reference voltage of 1.25V (or 1.23 for the LM2596) thus the regulator brings the output voltage down which also lowers the current. The op-amp output will stay on as long as senseVolt>limitVolt. It stops when senseVolt<limitVolt thus limiting the current to the preset limitVolt.Capacitor C3 stops oscillation when senseVolt and limitVolt are almost equal. Without C3, when current is just above the limit:- The LED is turned on thus lowering the output voltage,- Lowered output voltage reduces the current thus turn LED back to off- With the LED off, the regulator turns voltage back up and go above the current limit- Now LED is back on and the whole cycle starts again.Without C3, this oscillation will begin form about 15% below limit to about 15% above limit. C3 stops the oscillation.This simple single op-amp circuit will adequately control the max current. One can make the LOAD a "dead short", and then set VR1 to lower/increase the current until the desired limit. Next time when senseVolt reaches this preset limitVolt, the LED will turn on again and lower the output voltage thus limiting it to senseVolt <=limitVolt (approx +- 2%).IV. Full VersionThe simple version uses only one of the two op-amps in the dual op-amp LM358. With the other op-amp, one can use that for indicator. Since I often use this for charging, I added two LED's driven by the same principal.VR2 selects a pre-selected indicator voltage (current). VR2 is not connected to +5V but instead to the VR1 output, thus, it is set as a percentage of VR1.[Picture 5]The method is the same as the current limit comparing senseVolt to inidcatorVolt. The green LED is in reverse to the yellow LED thus only either green or yellow is on. The green goes from +5V to op-amp out, the yellow goes from op-amp out to ground.Thus:- Indicator op-amp / yellow on (green off) indicating current > set%.- Indicator op-amp / green on (yellow off) indicating current < set%.So, when >x% current, yellow is on for still charging. When <x%, green is on for done.V. Wrap upThe rest is just laying it out on the proto-board. I choose to place the buck-module's VR on the proto-board (row17) rather than keeping it on the buck module. The trimpot life-cycle is only about 100 full turns. So I expect to be replacing them in the future and it being on the proto-board makes that easier.[Picture 6]Note this layout only applies to my version of the XL4015E1 buck board. A different version of the board will not have the VR and feedback pin at the same position (I-12) and the feedback pin may be on different pin of the VR. You will need to make appropriate adjustments.H-14:G-14:F-15 jump-block is for experimentation. The yellow line at H-14 can join directly to G-14 and go directly from the original module's VR on row12 to the new VR position on row17.One mistake I made with this layout is my three indicator LEDs being behind the VR, so they are blocked from some viewing angles. If I am to do it again, I may place it higher or closer to the edge of the board.Here is how mine look:[Picture 7]I hope this experience-share will be beneficial to you. I also hope to learn from comments.Rick

author: sleemanj
author_rank: Super Contributor
timestamp: February 27, 2015, 03:08:25 am
content: China did it...http://item.taobao.com/item.htm?spm=a1z10.3.w4002-721870275.54.Wq9tTm&id=19009783985

author: Rick Law
author_rank: Super Contributor
timestamp: February 27, 2015, 03:28:32 am
content: Quote from: sleemanj on February 27, 2015, 03:08:25 amOh boy, they took all the fun out of it... And completed one is cheaper than I can get parts.Mine isn't to save money, it was to fix the mistake of getting one without CC to begin with. The with CC one was only about $2 more.I should get one to see how they did it and see what I can learn from it.

author: mswhin63
author_rank: Frequent Contributor
timestamp: February 27, 2015, 04:24:47 am
content: Actually I prefer your design layout more as you have create a top loading module keeping the power tightly confined in a small central layout instead of a tacked on board to the side. If you can get it small enough then you could place it directly under the PCB with the same physical dimension with only a little extra height.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 27, 2015, 12:58:16 pm
content: Note that it's essentially impossible to have a compensated feedback loop here, as you are driving a high gain node with a high gain amplifier. So it will basically always oscillate.The controller is already CC after a fashion, but it isn't adjustable. I'd recommend starting over with one that is, to make a proper unit. (Obviously, that doesn't help much if the goal is, "hey, I already have these crappy things,what can I do?"...)Tim

author: Rick Law
author_rank: Super Contributor
timestamp: February 27, 2015, 06:21:03 pm
content: Quote from: T3sl4co1l on February 27, 2015, 12:58:16 pmYeah, that is the goal. It would be cheaper to get it with CC+CV to begin with. But with CV only, this is a way to add CC.

author: Dinesh6252
author_rank: Contributor
timestamp: August 09, 2022, 03:56:40 pm
content: Can't understand the schematic, can you share the schematic again or any links?

author: Rick Law
author_rank: Super Contributor
timestamp: August 09, 2022, 04:45:23 pm
content: Since this is my own home-made design, I know for sure this is the only explanation I wrote and has all the schematic/drawings I did for this circuit. If there is other link(s) or explanation out there, it would surprise me.What don't you understand? If you are specific, may be I can explain what I was doing (or trying to do) there.

author: Dinesh6252
author_rank: Contributor
timestamp: August 14, 2022, 04:00:22 pm
content: Can the simple Lm358 circuit be implemented in a 24v power supply. The power supply is using pc817 optocoupler and tl431 shunt for voltage regulation.

author: Rick Law
author_rank: Super Contributor
timestamp: August 14, 2022, 06:18:40 pm
content: Quote from: Dinesh6252 on August 14, 2022, 04:00:22 pmThe circuit I described above was my simple designed to add cc to a buck convertor. It limits current by messing with the buck convertor's feedback voltage fooling it into stepping down the voltage when current is too high.Your power supply uses a totally different strategy. Since your power supply is 24v, it probably is using the TL431 as a reference to drive another power-carrying circuit. My method of fooling a buck convertor is not going to work with a zener based regulation or voltage reference.

author: MrAl
author_rank: Super Contributor
timestamp: August 16, 2022, 05:43:15 pm
content: Quote from: Rick Law on February 27, 2015, 02:47:45 amHello,There is a simple way to do this but you are right you basically detect some level of current and when it gets too high the current feedback takes over completely. Injecting the current into the feedback pin node is right.If you dont need super accurate current feedback you can use a small transistor, power resistor, and diode. The base emitter senses the current, the collector taps into that feedback pin node. If the logic works with an NPN you can use that, but if not it may take another transistor or possibly a PNP instead.