Controlling DC Converter Modules

Introduction: Controlling DC Converter Modules

About: I am a retired professional engineer, now farmer. Taking an interest in all things technological and in building devices useful on the farm.

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.

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.

2 People Made This Project!

Recommendations

  • Organization Contest

    Organization Contest
  • Robots Contest

    Robots Contest
  • Plastic Challenge

    Plastic Challenge

35 Comments

0
DannyZeee
DannyZeee

2 months ago on Step 5

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?

0
farmerkeith
farmerkeith

Reply 2 months ago

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

0
DannyZeee
DannyZeee

Reply 2 months ago

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.

0
Banala_PWM
Banala_PWM

Question 9 months ago

Hello,
I want to connect four modules in parallel with batteries at the output of converters. Can I control the converters using current control.
I see the modules are equipped with poti to control the output voltage. I dnt see any pin to connect it with the STM32 to control.

0
mr-apoptosis
mr-apoptosis

2 years ago

Is it also possible to control the current output/ current limit with the use of a pwm in the same way as you do for the voltage? And if not, how would you do it?

0
LaszloL3
LaszloL3

Reply 10 months ago

I would not feed raw PWM into the CC pot, but first apply a low pass filter and, from that one, feed a bias current into the slider of the CC pot over a 47K resistor (value to be determined empirically.

0
farmerkeith
farmerkeith

Reply 2 years ago

Hi mr-apoptosis, Interesting question.
When you control the output of the converter with PWM generated by a microcontroller, you can use any arbitrary algorithm to determine the PWM duty cycle.

So, for example, if the microcontroller has measurements of both output voltage and current, the algorithm can simultaneously put a limit on both voltage and current. This would achieve the equivalent of the built-in voltage and current pot settings.

Since these converters have a built-in current sense resistor between the IN- and OUT- terminals, and the output current and only the output current flows through that resistor, the simplest implementation of current measurement is to put an op-amp such as AD822 or LM358 with suitable gain setting across those terminals and connect its output to an ADC input of the microcontroller. The op-amp needs to be capable of outputs down to ground, and inputs a little bit below ground.


For an example of this current sense op-amp circuit, have a look at https://github.com/farmerkeith/SolarChargerSZBK07M...
Please note that this circuit is not exactly what I describe above, since the current sense is set up to measure INPUT current rather than output current. However the op-amp configuration is the sort of thing you would need.
Keith

0
LaszloL3
LaszloL3

Reply 10 months ago

I did it in software with INA226 high side current sensing boards, they are cheap, calibrated oob provide voltege measuring as well and an I2C interface.

0
LaszloL3
LaszloL3

10 months ago

The SZBK07 module definitely uses the LM25116 I have a module here with labelled chip that i partly reverse engineered.
The CC circuit appears to be very similar to this of the XL4016 module, using a LM321 as comparator that modifies the FB pin.
The CC potentiometer applies an adjustable threshold voltage (0.01 to 0.4 V) to the LM321 input, so it could be easy to feed a bias current into the CC potentiometer to control the current.

0
keyur.rakholiya
keyur.rakholiya

3 years ago

Thank you for making this instructable it is very helpful.

0
LaszloL3
LaszloL3

Reply 10 months ago

Hi brother Farmerkeith,
we have the same aims and should share our knowledge!
I had also the idea of tweaking DC/DC controllers to provide a real MPPT.
Currently I have built the hardware and am scrutinizing several buck converters for suitability: I need two versions: a low power one (10W panel) that must draw as low quiescent current as possible and a mid-power one 150W panel 10A, that must b as efficient as possible.
My project on Github is here: https://github.com/rin67630/Solar-Booster
It runs on an ESP8266, uses one or two INA226 high side power monitors to measure the current/voltage and provides a deep battery monitoring over the cloud.
Here a view over the dashboard:

SKA Dashborad.jpg
0
SophanaK
SophanaK

3 years ago on Step 2

Hi

I am not very sure about what you say about how the pwm works.

The feedback pin drives 2 op amps in serial (in the provided schematic).

The first one has fixed reference voltage (1.2v), the second has a saw tooth.

If you saturate the first op amp, it is probable that the output amplitude value will be larger than the saw tooth amplitude, meaning that the pwm signal you provide to the FB pin will be the same pwm signal that will drive the power stage.

For this to work you must turn the pot to achieve maximal output, or even disconnect the pot from the feedback pin, because you need to saturate the op amp in both high and low states.

0
LaszloL3
LaszloL3

Reply 10 months ago

I did it too, but I did put a 1K / 100nF low pass filter from my 3,3v PWM output and inject/withdraw current over a limiting resistor (150K) into the potentiometer.
The comparison voltage of the module is always 0,8V.
That way, I can increase the voltage with PWM between 0 - 25% and decrease the output voltage with PWM >25%.
The potentiometer is set to a safe 13,8V, over software I can modify the set point between 11.6 and 14.4 V.

DCDC module injection.jpg
0
farmerkeith
farmerkeith

Reply 3 years ago

I know the control works with PWM applied to the feedback pin. The exact mechanism is a bit unclear to me. I think the sawtooth from the oscillator must have a larger aplitude than the swing of the first op amp. Maybe the response time of the first op amp is rather long, so that it effectively averages out the input PWM signal.

Because these op amps are internal to the XL4016 device, it is not possible to do any observations on these signals.

The pot must not be disconnected from the feedback pin, otherwise there is no control over the output voltage.

If you are able to do some testing that throws light on how this works in detail, I will be happy to include the information in an update of this instructable.

0
jobarjo
jobarjo

Reply 3 years ago

When driving the FB pin with a pwm, there is no more feedback. In the solar application, you don't want any feedback because feedback is done by software.
Removing the resistors and driving logic to the FB pin will saturate the op amp and will probably go through the second one. This is easy to validate with an oscilloscope

0
DannyZeee
DannyZeee

Reply 2 years ago

There is still feedback, and for the people who say to disconnect the feedback, or that there is no feedback, that is wrong! Leave the feedback connected, and use the pwm output to bias (pull up or pull down) the feedback pin. The PWM output from your micro is applied ideally through a series resistor, with a cap to either ground or Vdd

0
akramamriversailles
akramamriversailles

Question 11 months ago on Step 2

Hello,
I am doing a job on the MPPT control of a solar panel. Under ISIS I did the design and it works.
Now i want to order XL4016 with arduino .i want to know how i do.

0
ooobe
ooobe

Question 1 year ago

Can i ask a question i am making a psu with XL4016 and 24 volt 6.5A SMPS. I measure value of constant volt: for 12 volt i should set pot 3,12 Kohm for 24 volt --> 6,65 Kohm. I shared my schematich. I want to use a two 270 degree normal pot(because they are inexpensive and they can set quickly) one of the pot is approximately 3,25 ohm(I combined 5k pot with 10k resistor.) and other pot for fine tuning. In schematich in switch rigth position i can adjust 1.2 volt to 12,5 volt. Left position of switch i adjust 12 volt to 24 volt. My question is when i change position of switch on middle position pot circuit will be open. It will be a problem? (Can i use pull up-pull down resistors, if it yes, where i should use it?) I didn't try cut switch wire of number 2. I am afraid of broke my module. Could you help me. I hope i can explain myself. Thank in advance

XL4016 Şema.png
0
farmerkeith
farmerkeith

Answer 1 year ago

Hello ooobe, I think your simplest solution is to connect terminals 1 and 2 of your switch together, so that the 3 positions of your switch become 24V, 24V, 12V (instead of 24V, Open, 12V).
If you keep the existing wiring, with the switch in the "Open" position the voltage of the XL4016 will be at a maximum (or whatever you have set it to with its built-in pot) which will not be a problem for the XL4016 but may not be OK for the circuit where you are delivering the output.
Hence I think it is better to have just 2 settings as I suggest in the first paragraph above.
Keith

0
ooobe
ooobe

Reply 1 year ago

I understood it. I almost got a PSU with your experiences and your help.
Thank you for your time. Have a nice day.