Controlling DC Converter Modules

35K3072

Intro: Controlling DC Converter Modules

There are many types of DC-DC converter modules for sale at very reasonable prices. Many of them, like the ones pictured, include two potentiometers for adjusting the output voltage and a current limit.

This Instructable is about how to control the output voltage from an external device, which can be either a potentiometer or a PWM signal from a microcontroller such as Arduino.

There are some general principles which I will explain. Then, for each module, there are some specific requirements which I will cover for the two modules I have used, which are
a) a module based on the XL4016 IC with a current capacity of 8 Amps; and
b) a module coded SZBK07 with a current capacity of 20 Amps.

Acknowledgment

Thank you to zopinter who originally showed how to control an XL4016 module with PWM.

UPDATE:

These modules, and ones like them, can be found on EBay and Aliexpress by searching for "DC converter 300W". I also found modules coded YD4020J which appear to be identical to the SZBK07 module.

STEP 1: How the Output Voltage Is Controlled by a Pot

The way it works is this:

The pot is a variable resistance and is connected between OUT+ and Feedback. There is another (fixed) resistor between Feedback and Ground.

"Feedback" is the negative input of an operational amplifier. The positive input of that operational amplifier is connected to a reference voltage, which varies from one design to another but is usually between 0.8 Volts and 1.25 Volts. The XL4016 and SZBK07 are both about 1.2 volts.

These components form a negative feedback control loop that maintains the Feedback pin at the reference voltage. If the voltage at OUT+ is too high, the output of the operational amplifer goes down and decreases the PWM duty cycle of the converter, which decreases the output voltage. The converse happens if the OUT+ voltage is too low. Winding the voltage control pot one way to reduce its resistance reduces the output voltage; winding it the other way to increase its resistance increases the output voltage.

It is essential to have this feedback control loop formed by the pot, a resistor to ground, and the operational amplifier.

However if the pot is wound up to a high value, additional current from another source can be fed into the Feedback pin, which has the effect of reducing the output voltage.

One way of providing that additional current is by putting an external pot between OUT+ and the Feedback pin. Using a suitable value pot will give a new (lower) maximum setting for the OUT+.

Another way of providing additional current is to connect a resistor and diode coming from a PWM pin of a microcontroller. The resistor is needed to avoid drawing excessive current from the PWM pin. The diode is needed to ensure that the current is always additional.


deletesave

STEP 2: Controlling the Voltage of the XL4016 Module

The Feedback pin of the XL4016 module can be identified in the photo above. It is actually 2 pins of the pot (they are already joined together by the makers). I soldered an orange wire across both pins, which makes a solid connection.

The on-board pot on this module is 10K, and the resistance from Feedback to Ground is about 360 Ohms. When the pot is set to its maximum value, the OUT+ voltage should be 1.25*(10000+360)/360=36 volts, which lines up with the specification.

If you want to use an external pot between Feedback and OUT+, a value of 22K Ohms will give a maximum output voltage of about 24 Volts.

If you want to use 5 Volt PWM via resistor and diode, and if you set OUT+ to 15 Volts with no signal (ie 0 PWM duty cycle), the chart shows what minimum voltage you can achieve as a function of the connecting resistance. So for example if you use a 2200 Ohm resistor, you can control the output voltage of the XL4016 module between 8 Volts (with 100% duty cycle) and 15 Volts (with 0% duty cycle).

STEP 3: Controlling the Voltage of SZBK07 Module

The Feedback pin of the SZBK07 module can be identified in the photo above (the red wire). It is actually 2 pins of the pot, but the middle pin has a surface mount component (I think it is a capacitor) soldered to it, so I just used the top pin.

The on-board pot on this module is 100K, and I expect the resistance from Feedback to Ground is about 4,000 Ohms.

If you want to use an external pot between Feedback and OUT+, a value of 220K Ohms will give a maximum output voltage of about 21 Volts.

If you want to use 5 Volt PWM via resistor and diode, and if you set OUT+ to 15 Volts with no signal (ie 0 PWM duty cycle), the chart shows what minimum voltage you can achieve as a function of the connecting resistance. So for example if you use a 22,000 Ohm resistor, you can control the output voltage of the SZBK07 module between 7 Volts (with 100% duty cycle) and 15 Volts (with 0% duty cycle).

STEP 4: Technical Details of the XL4016 Module

The XL4016 module is based on the XL4016 integrated circuit. Here is the first general description paragraph from the data sheet.

"the XL4016 is a 180 kHz fixed frequency PWM buck (step-down) DC/DC converter, capable of driving a 8A load with high efficienc, low ripple and excellent line and load regulation. Requiring a minimum number of external components, the regulator is simple to use and include internal frequency compensation and a fixed-frequency oscillator."

The XL4016 comes in a 5-pin TO220 package. The block diagram for its functional blocks from the data sheet is reproduced above (right side picture).

The XL4016 is designed to be used as an asynchronous DC-DC converter with the addition of an external inductor and external power diode, both atttached to the SW pin. The XL4016 provides the high-side switch in the form of a P-channel MOSFET internal to the device. That MOSFET is made with a partition to sense the current through the device and provide over-current protection.

The XL4016 module uses the XL4016 IC as its main switching control element, and adds an inductor (22 turns of 2 strands of 0.7 mm magnet wire on a T94 toriod core), a power diode (VD3, a STPS2045CT Schottky).

The module incorporates a low-side current sense resistor of 10 milli ohms, and a dual op-amp (LM358) that senses the current. If the current reaches the limit set by the current control pot, the op-amp feeds current into the feedback pin of the XL4016 IC which has the effect of limiting the current to the set value.

STEP 5: Technical Details of the SZBK07 Module

Technical details of this module have been more difficult to obtain and the following information may not be reliable. However it is the best I can find. This information came from a YouTube video at

The module uses a 20-pin surface mount control IC which is probably LM25116. Originally I thought it could be type LTC1625 which has a similar function, but comes in a 16-pin package. The Description part of the LM25116 data sheet starts with the following: "The LM25116 is a synchronous buck controller intended for step-down regulator applications from a high voltage or widely varying input supply. ... The LM25116 drives external high-side and low-side NMOS power switches with adaptive dead-time control. ..."

The inductor is about 12 turns of 3 strands of 0.7 mm magnet wire on a T94 toriod core.

The power MOSFETs are type TK80E08K3, which are rated for 75 Volts and have Rds-on of 7.5 milli-ohms at 25C.

54 Comments

Thanks farmerkeith, this helped me a lot with my project (a smart battery charger) where I want the Arduino to monitor and alter the output voltage from a SZBK07, for example from a constant current charge upto 14.4V, and then a constant voltage charge by reducing the current. To achieve this I obviously need the Arduino to monitor the output voltage and current separately.

So given this external monitoring, can I still not remove the voltage pot and just provide a 0-1.2V PWM signal as feedback?

Also, it seems to me (possibly incorrectly?) that if the voltage pot is wound down to it's minimum, an output voltage way higher that 1.2V (the SZBK07 is supposed to be able to output 36V) would be injected straight into feedback. Have I missed something, or do SZBK07 users need to be carefull with the voltage pot setting to avoid damage?

Finally, I found a SZBK07 schematic that is probably a useful addition to your instructable?

Thanks again.

Hello,
I wish to know your thoughts on using a DAC, rather than PWM to control the output voltage? It seems as though it should be a better solution for a solar MPPT?
Hi DannyZeee, I think using a DAC does make sense. Maybe as simple as putting a low pass RC filter in the control line. Several people have commented to this effect, but I have not done it myself and they did not report the results so I am not sure how well that works.
Keith
I used a PWM running at 100kHz on a nano, which gives 160 steps. I filtered it with a 3k9 and 22pF which is 100uS or 10 cycles. This is quick enough when you consider panels have ~1ms response times, and is so easy and low cost. Interestingly the PWM output point rarely moves more than 10 steps and gives an MPPT control point within 1% of optimal from 1 to 10A output at 14.0V
Sorry, other info I should have mentioned, I am using 11 bit resolution, at 39kHz for my PWM output. With the 100nF cap and 2K2 resistor, @39kHz the bias voltage to the buck is extremely smooth, no discernable ripple.
I am pretty busy with other projects right now, but I do plan on building another mppt controller prototype. I will be using a DAC solution, will let you know how it works out.
Hi Danny, any news about DAC solution? Thanks.
No, I looked into the DAC idea, the processors I have do not have enough resolution, and, I came up with a better idea. Use the output of the MC to drive an N channel FET(connected to an RC) to pull down the feedback output, rather than driving it up. (honestly, not sure if I came up with that, or, maybe farmerkieth mentioned in once in a discussion, but, whatever, it is the current idea.) Using this approach, you can dial the output of the buck to the lowest charge voltage you would want to use, and use the MC output to pulldown the feedback. (To drive the output of the buck up) This way, you have a failsafe charger that will not overcharge your batteries if the MC fails.
Thanks Danny, could you share an schema (even painted in a paper, please) and the part ids? or at leats the part ids? You are talking about N channel mosfet and a RC. Is RC connected to MC output or to feedback pin of SZKB07 ? Thanks
Sorry it took so long to reply, this is the basic idea.
I have not tried this yet. (Too many demands on my time) Anyone see why it will or will not work?
I have finally gotten around to trying this, it does indeed work like a charm! I tested with a 100R resistor on the output of an ESP32 (to limit current flow from the MC pin) With this 100R resistor, the gate voltage rises to 3V3 in about 200nS. I used a 100nF cap, and a 2K2 resistor, with a TN0702 MOSFET connected to the feedback pin of the buck to pulldown the feedback voltage rather that to boost it. These were just random values for stuff I had easy to hand that seemed like they should work, a little experimentation will likely yeild better values.
That being said, using these values allows me to set the pot of my buck to output 12.8V with no external inputs, and ramp the output up to nearly 15V, by Increasing the PWM duty cycle.
I am using an ESP32 running @ 240MHz, driving the bias voltage to the buck @39kHz with 11 bits of resolution. Ripple of the bias voltage to the buck is not discernable on my scope.

Hi Farmerkeith, I have tried your DIY project.
I have implemented a MPPT with a SZKB07 in tasmota firmware.
I have worked with an ESP8266. I have coded my own module to include in tasmota firmware. If I get managed to work with it I will publish my code to github for every body, of course.

I am measuring every 50ms the IN3221 data and adjust PWM output. (I think is good enought as "sun" doesnt change so fast.
I think I have a hardware problem, not software.
The problem is that with a 100w solar panel i can't get the MPP.
I see the voltage in the panel varies from 14.5v (for example) to 19 or 20v in the next "PWM" duty.
And the other way round.
I hardly can't see voltages around 16 or 17v. (almost NEVER)
In tasmota firmware, PWM is 4Khz, and 1024 values in PWM. (10 bits)
I have this hardware in pwm output pin: 6.8k with a 1uF capactitor (low filter) and then a 20k resistor to FB pin of the LM25116, to get from 12v to 16v

May be I have a problem with resistors? capacitor? frecuency of PWM?

Hi guys, any help for me? Thanks
The SZBK07 module is still widely available, and good value at AUD7, but seems to have its capacity largely overstated. At 10A output the hi side FET has a 45C lift. Up to this point the efficiency is good at 96%, keeping temperatures relatively low, but if you were to follow the guidance given in the devices spec sheet and took it to 15A (without a fan) you would have 0.9W in the current sense, and probably 7W in the FETs with perhaps a 65C lift. The electrolytics, although rated at 105C, would have a considerably shortened life, so I would recommend adding a 40mm fan blowing down onto the electros and FETs, which keeps the temperature lift below 40C.
farmerkeith's solution is still great for old 200-250W 30V panels.
Funny, I didn't see this post, until just now, but, a few months ago, I burned up one of my MPPT Chargers. Not having a spare, I thought I would just put a SZBK07 dialed to the correct charging voltage as a temporary solution, while I built a replacement for the failed charger. Some time during the day, the batteries reached full charge, load decreased to near zero, and Panel voltage rose to a value high enough to short the two caps on the input. (The current output of the buck when I initally connected it was around 13A, as I hadn't immediately noticed the failed charger, and battery voltage(4 75Ah SLA's) was down to high 11's.) So, consequenly, battery voltage again was down, due to the loss of nealy 1/3 of the charging capability. Until reading this post, I just assumed I had installed a faulty Buck. Appears as though it was overrated, and just not up to the job I handed it.
Hi Danny, I have burnt so many of the bucks... usually though, the JCCON caps (green and gold) on the input are really good, handling up to 42V and big ripple current no problem. If you are using "24V" panels they shouldn't go over 42Voc. There are a lot of different manufacturers for the SZBK07s though, and some may use cheaper parts, as the input caps are a big part of the cost. I think the only problem with the buck is overheating, so I use a 40mm fan to cool both the MOSFETs when the temperature goes over 50C.
Hi, What PWM frequency do you recomend to control SZBK07 LM25116 module using one ESP32 or arduino, for example? I tried 5Khz and 50Khz... Works fine... Lower frequencies like 500Hz,1KHz, causes some output voltage unstable.
There is no reason to go under 50kHz, and you get minimum ripple in a 500us filter (say 4k7 into 100nF). I use a nano, sampling output every 500us, and adjusting PWM to control current. Remember to keep the maximum delay between sampling the output and modifying the voltage at the FB pin below say 2ms or the set point will continue to hunt above and below the maximum power point, even though this doesn't necessarily have a big impact on the power produced.
More Comments