Controlling DC Converter Modules

4,106

14

20

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. 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.

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    20 Discussions

    0
    None
    DannyZeee

    Question 8 weeks ago on Step 2

    Hey, I thank you for the info you have provided regarding the PWM means of control. I built a couple of MPPT Solar powered battery charging boards using this info. The problem with this method is that I need to dial the pots on the buck converter to provide the max voltage I might possible need to charge with, and use PWM to decrease that voltage to the value I wish to operate at.
    The problem is, if the micro faults, output goes to max voltage.
    What I am proposing is to turn your diode around between the micro and the buck, add a resistor in series between the micro and the diode(which obviously is already there), and a capacitor to ground between the diode and the series resistor (to smooth the voltage output of the micro)
    Near as my logic tells me, this should allow me to set the pot on the buck to a lower voltage, and use PWM output to increase that voltage, so that if I have a micro failure, I will not overcharge my batteries. Do you see any reasons this should not work?

    10 answers
    0
    None
    farmerkeithDannyZeee

    Answer 8 weeks ago

    Hi DannyZeee, I am glad to hear you have used the information successfully.
    The main issue with your proposal is that there is not much margin between the set point voltage of the feed back loop on the DC converter module, and the forward voltage drop of the diode. That limited margin, combined with any output voltage of your microcontroller when it is at the "0" state, does not give you much room for error.
    For example, in the case of the ATmega328P, the output low voltage (Vol) is not guaranteed to be under 0.6V at 85C, although it is typically lower than that. If you add 0.7V for the diode voltage drop, you have 1.3V which is higher than the control point voltage of the DC converter, being 1.25 V. So the control will not work in this case.

    It may not be a problem in practice, since the output stage of the microcontroller will probably not have such a high value. If necessary, this problem can easily be solved by using a MOSFET (eg 2N7000) to control the impedance you are adding between the control point and ground. If you use a MOSFET in this position, you do not need a diode and so there is no diode drop to deal with.

    You will appreciate that I have not tried this and there may be other issues as well. I will be interested to know how you go. If you have trouble understanding the above, feel free to ask again. If you send me a sketch of your intended circuit I will let you know what I think of it.
    Keith

    0
    None
    DannyZeeefarmerkeith

    Reply 8 weeks ago

    I did consider the voltage drop of the diode, but, I do not believe it will cause a problem. The previous battery chargers (4 of them) were built around a PIC16F18855 controlling 2 XL4016 buck converters (the 18855's zero output does go to almost exactly zero volts), all 4 MPPT chargers charging the same battery bank. While all worked well in Bulk and absorbing modes, once I got to float mode, the chargers would fight with each other over which charger was going to provide the float voltage. So, I am planning a larger MPPT charging system, where one micro (perhaps PIC24FV16KM204, because it is one I use and am familiar with) controls a host of buck converters, (or perhaps a host of microcontrollers, havn't thought too hard about it yet).
    Not really sure if I would gain much, other than a central data point to collect information, as I have seen some pretty high end commercial chargers connected to a single battery bank, and 1 or 2 of the chargers would be in bulk charge, while another would be in float, and the last had turned itself Off. (So if the high end commercial guys can't control their chargers, what makes me think I can?)
    At any rate, I plan on going to a 24F series PIC, if for no other reason than the 12 bit ADC, and more adaptable PWM peripheral.
    Thanks for the suggestion on the FET, and the quick response. I also have a suggestion regarding the connection point for externally controlling the feedback on the buck converter. Look at the XL4016 chip on the buck converter, and nearly directly in front of the "feedback" pin, you will see a through hole with a trace connected to the feedback pin. Solder your control circuit wire here. (I built my charge controllers with 2 buck converters mounted directly onto my control board, with the feedback pin lined up with a through hole on the main board. If you are interested, I could upload a picture, if my description doesn't make sense.

    0
    None
    farmerkeithDannyZeee

    Reply 8 weeks ago

    Hi DannyZeee,
    I think it would be useful for you to post pictures of your connections. I will check my hardware when I have access to it later, in the next day or two.
    If you are using multiple XL4016 converters, would you be better off using a smaller number of SZBK07 or equivalent modules? The XL4016 is an async converter, so it has the inherent loss of the series diode built in, where is the SZBK07 is synchronous and all the current passes through "ON" MOSFETs.
    Keith

    0
    None
    DannyZeeefarmerkeith

    Reply 8 weeks ago

    Yes, you make a good point with the diode losses, I probably will not use the XL4016 buck in a future charger design. (Even tho the diode used is a shhottky diode, any losses are undesirable) This project was originally intended to provide power to my daughter's RV batteries, from a couple of 12V 100W solar panels I had lying around, I had a few XL4016's as well, so I designed an MPPT charge controller based off of your idea's on this instructable. The charger has 2 input, 2 bucks, and 2 output terminals, with a common negative connection on the main board. The positive connections do not suffer from being connected together, so, when she ended up wanting more power, I added a 280W, 24V panel. Some minor code changes, and a few voltage divider resistor swaps, and the 12V charger became a 24V input / 12V output MPPT charger.
    Now I plan on doing a much larger system for my own RV, using around 10 280W panels, so a major re-design is in order.
    We are currently vacationing out of country, won't be back for another 2 weeks, will upload some pictures then. (The vacation is part of the reason I am asking questions, instead of just experimenting, but, also, because you might see something I do not. (Which you already have, thank you.)

    0
    None
    farmerkeithDannyZeee

    Reply 7 weeks ago

    Hi DannyZeee, The losses in the diode used with the XL4016 are not so serious when the panel is "12 volts" (36 cells, MPP voltage around 18V) since the current multiplication is reasonably small . The diode losses become more significant, and the benefit of a synchronous converter correspondingly greater, when using a 60-cell panel (MPP voltage around 30V) which is what I think you are planning to use in your larger system with 280W panels. In this case the current multiplication is around 2.5, with the Earth phase current being about 1.5 times the panel current (instead of more like 0.5 times in the case of a 36-cell panel).
    With 10 panels, you may need to cater for different shading conditions for each panel, or for groups of panels, with separate control for each. This is being used in current grid-connect systems, and may be even more needed in an RV environment where the shading conditions may be unpredictable.

    0
    None
    DannyZeeefarmerkeith

    Reply 7 weeks ago

    Wow, I am suddenly feeling the weakness of my mostly self education in electronics. Could you explain the "In this case the current multiplication is around 2.5, with the Earth phase current being about 1.5 times the panel current (instead of more like 0.5 times in the case of a 36-cell panel)." (Or a reference to an explanation? I googled "earth phase current" and can't seem to find anything relevant to this discussion.)

    0
    None
    farmerkeithDannyZeee

    Reply 7 weeks ago

    Hi DannyZeee, Sorry if my language was not clear. I was using terminology that I used in work I did a couple of years ago but never published. You can find that work, which explains these terms, here:
    https://www.instructables.com/id/Designing-MPPT-So...
    The bit you will need for these terms (like "earth phase current") are in Step 2: How a DC-DC Converter Works.
    I started writing that Instructable in the early stages of my journey with solar chargers, and have learned quite a lot more since then. I think there is still a role for that type of tutorial but it needs a lot of improvement - for example, diagrams showing the panel phase, earth phase and null phase; and more on the design considerations.
    Despite its deficiencies, I hope you find it helpful.
    Keith

    0
    None
    DannyZeeefarmerkeith

    Reply 7 weeks ago

    Hello again farmerkeith,
    Yes, i went and read your instructable, What you were refering to in your previous explanation makes a lot more sense now, thanks.
    I was planning on using a syncronous converter in my next design of charger anyway, but, to clear things up a bit, if I did go for the 60 cell panels (which I likely will) I was planning on running a 24V system, exactly for the reasons you brought forth, to decrease the greater switching losses in a 12V system.

    On another note, wondering if you are still actively developing your own buck converters? Or have you gone to using commercially made bucks? Just curious if you might be interested in a different syncronous buck design. I can't make any prommises, not sure if I can still find the information, it is a design proposed by someone else, that I stumbled upon while searching for something else. I remember thinking that the design looked ingenious (to my level of thinking anyway) and pretty sure I printed the circuit, and filed it in my "Interested, look at when you get more time" pile. When I get home, I will see if I can find the info, & forward to you, see if it makes sense to you?

    0
    None
    farmerkeithDannyZeee

    Reply 7 weeks ago

    Hi DannyZeee, I would certainly be interested to see any design concept that may be better than the ones I know. So please send it to me if or when you find it.
    Keith

    0
    None
    farmerkeithDannyZeee

    Reply 7 weeks ago

    Hi DannyZeee, I agree that the through hole near pin 2 of the XL4016 IC is an equally valid connection point for the feedback pin. However I feel that it is probably a little easier to use the pins of the pot, as I did. But they are both valid and equal.
    Keith

    0
    None
    SophanaK

    11 months 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.

    3 replies
    0
    None
    farmerkeithSophanaK

    Reply 11 months 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
    None
    jobarjofarmerkeith

    Reply 11 months 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
    None
    DannyZeeejobarjo

    Reply 8 weeks 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
    None
    mr-apoptosis

    5 months 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?

    1 reply
    0
    None
    farmerkeithmr-apoptosis

    Reply 5 months 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
    None
    keyur.rakholiya

    11 months ago

    Thank you for making this instructable it is very helpful.