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 interchangeably since 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