Multiphase Buck Converter controlled by uC with CV and CC - Page 1
Forum section: electronics / projects

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 10:20:17 am
content: I've been experimenting with such a device, using the uC to generate output PWM for the buck converter instead of using one of the approximately 1 billion purpose made chip controllers availableSomething like this: (Note: Not a complete schematic)I use a small 16 bit PIC running at 80MHz/40MIPS, that gives a PWM resolution of 25nS or about 8.65bits/400 levels at 100kHz.The PIC also got 12 bit ADCs capable of up to 500 kSPS for feedback. Not sure how accurate/linear it is at that speed, but it can probably be compensated.The plan is 2 PWMs 180 degree out of phase, lowering the output ripple and sharing the load. (the PIC got 3 timers, 2 for PWM and 1 for the feedback loop)The feedback/correction loop runs at 50kHz, sampling and correcting the PWMs.Testing with quick prototype looks promising, but it is tricky to get the sample and correct loop fast enough. Floating point calculations are out of the question, so a lot of shifting left and right for precision.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 10:28:41 am
content: Made a small PCB for better testing:And assembled:This should be capable of delivering 0-18V probably up to around 5A.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 12:09:42 pm
content: Output ripple at various loads:@500mA Load:@ 1A Load:@ 2.5A Load:Reasonably small ripple, mostly high frequency switching noise. Could get rid of the ripple with an inductor and capacitor on the output, but that would probably result in wild overshoots during recovery.

author: BravoV
author_rank: Super Contributor
timestamp: December 05, 2013, 12:20:58 pm
content: Interesting project, thanks for sharing !Is there any plan to try it at dynamic load ? Really curious to see the transient response performance.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 12:50:19 pm
content: Quote from: BravoV on December 05, 2013, 12:20:58 pmThanks, I have just done a few experiments with shorting the output into CC mode then capture the overshoot on recovery back into CV. I'll post a few captures.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 01:08:19 pm
content: Here a capture (zoomed) of going from shorted output CC limited to 1A and then recovering into no load CV (5V)Overshoot is about 160mV, not too bad all things considered. This might or might not improve as I fine tune the feedback algorithm.I do use a couple of resistors as a load, before the current shunt, to improve the regulation. Plan is to replace these resistors with a small constant current load, maybe 100mA.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 05, 2013, 03:03:16 pm
content: Made a few minor code changes, here is the current performance when switching a 1A load (resistive) on and off while remaining in CV mode:1A Load On:1A Load Off:Not too bad, good enough that it can be used as a lab supply or a high end battery charger or something.One interesting observation is that even with just ~8.65bits PWM resolution, it's possible to set the output voltage with a resolution better than 1mV (average). That is better than what I had hoped for, even with the reasonably fast feedback adjustments.

author: owiecc
author_rank: Frequent Contributor
timestamp: December 05, 2013, 05:42:34 pm
content: How do you measure current and which current(s) do you measure? How about current sharing between phases?

author: strobot
author_rank: Contributor
timestamp: December 05, 2013, 08:53:34 pm
content: Cool project! You definitely learn a lot doing these.

author: P_Doped
author_rank: Contributor
timestamp: December 06, 2013, 05:16:29 am
content: The DC accuracy of the output is not controlled by the PWM resolution.It is based on the LSB size of the ADC gained up by any feedback divider between the output and the ADC.The limited PWM resolution just means you will have some sub-harmonic envelope on your duty cycle as the system dithers the duty cycle to achieve a higher resolution average duty cycle.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 06, 2013, 11:24:02 am
content: Quote from: owiecc on December 05, 2013, 05:42:34 pmJust the usual shunt resistor on the output and a differential amplifier, but I didn't show it in any of the pictures, it's on a breadboardThe load will by default be equally shared between the phases by connecting them together at the output.Quote from: strobot on December 05, 2013, 08:53:34 pmThanksyeah it is a fun little project and hopefully it will end up with something useful. It's interesting to change code instead of resistors to adjust feedback gain etc.Quote from: P_Doped on December 06, 2013, 05:16:29 amAgree, I guess I just expected it to be lower resolution with only 400 PWM levels/100kHz and 50kHz updates.I've found the simplest/best way to adjust the PWM is to write the code something like this:pwmDuration += (targetVoltage - actualVoltage) * gainFactorBut, of course, in reality it gets more complex than that with both CC and CV modes.Cheers

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 06, 2013, 03:20:43 pm
content: Quote from: AcHmed99 on December 06, 2013, 12:48:54 pmGood pointI guess 100% equally balanced with my current setup would require impossible luck in matching of MOSFETs, inductors and diodesOther than looking at the thermals and ripple, I cannot think of a good way to meassure the balance without disturbing it.Temperatures of MOSFETs and inductors do seem balanced under load, but I cannot measure them very accurately.Here a couple of captures of the ripple with single PWM and 2 phases:Single phase PWM 2A load, 12V in 5V out:2 phases 2A load, 12V in 5V out:It appears to be fairly well balanced, but I do need to perform more tests at different loads and output voltages. As you said, it's most important at high loads.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 06, 2013, 07:29:08 pm
content: Here close to max designed output, 18V in, 15V out 4A (60W) load:Wideband switching noise does increase, but actual ripple is looking reasonably balanced.MOSFETs, inductors and diodes do start to heat up at this load, probably around 20-25C above ambient.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 06, 2013, 10:34:46 pm
content: Quote from: AcHmed99 on December 06, 2013, 09:19:21 pmI don't think there is much info to get from the gate of the two MOSFETs, I use a fairly potent driver (TC4427) for fast switching and minimal loss in the driving PMOSs.Anyway, here is a capture of the gates with 15V in, 5V out and 1A load:I'll have a good look at the TI app note, thanks

author: C
author_rank: Super Contributor
timestamp: December 06, 2013, 11:52:36 pm
content: Quote from: jaxbird on December 05, 2013, 10:20:17 amQuote from: jaxbird on December 06, 2013, 11:24:02 amAre you computing everything as Volts? Said a different way, is the software converting the ADC_Value to a Volts_value?These conversions take cpu time and are not needed in the control loop.You may be be doing a lot of needless computing. The pic only needs to know volts to interface with humans.Above could bePWM_Duration = (target_ADC_value - actual_ADC_value) * gainFactorBoth the ADC & PWM are binary percentages.C

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 07, 2013, 12:06:43 am
content: Quote from: AcHmed99 on December 06, 2013, 10:56:57 pmThanks, yeah I guess it does't look too awfulI don't expect the efficiency to be that great though with just the most basic configuration.Still just experimental, mostly to satisfy my curiosity on how possible it is do do the PWM and regulation feedback loop using a low cost uC.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 07, 2013, 12:21:51 am
content: Quote from: C on December 06, 2013, 11:52:36 pmYeah, I do the calculations in "kind of" volts, sure you can exclude a multiplication by doing it in the actual ADC value. But since I do want it to average and report the actual voltage I do need a voltage value.At the few cycles available in the feedback loop it is not possible to use floating point for precision, so instead I use a multiplication factor, giving me a result equal to the voltage * 1000 and shifted left by 10 bits for precision to do the PWM adjustments.Cheers

author: megajocke
author_rank: Regular Contributor
timestamp: December 07, 2013, 04:01:52 pm
content: Quote from: AcHmed99 on December 06, 2013, 10:56:57 pmOnly in discontinuous current mode. In continuous current mode you don't know the inductor current at the start of the on-time so you can only calculate the current change during the on time but not the average current.What you can do however is to use the resistance of the inductors to measure the currents through them by looking at the DC component of the inductor voltage. An RC low-pass filter and multimeter set to DC millivolts could work.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 08, 2013, 03:31:26 pm
content: Quote from: megajocke on December 07, 2013, 04:01:52 pmGood suggestionthanksI'll try do some measurements like this on both phases at various loads and see what numbers I get.I have measured the resistance of a few (5) of the inductors using a pair of kelvin clamps, results ranges from 171.28 to 178.75 mOhm.If I measure them with 1A, they do increase significantly in resistance while heating up, haven't gone as far as charting it, but I guess that will actually help equal the load between the two phases as the current and temperatures rises.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 08, 2013, 06:00:30 pm
content: Using the method suggested by megajocke, I have soldered in a few resistors and capacitors (using 100k and 100nF) to measure the drop in each of the inductors under load:Here are the results:12V in 5V out:LoadPhase IPhase II500 mA43.02 mV44.27 mV1 A86.97 mV88.82 mV2 A176.13 mV180.57 mV3 A272.7 mV272.4 mV4 A378.2 mV381.5 mVNote: At 3-4 A load the resistance does rise fairly rapidly, I'll try leave it for 10 minutes to stabilize then do another measurement.It appears the minor variations are mainly due to differences in the inductors.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 08, 2013, 08:03:24 pm
content: Just a quick update on phase balance once the thermals are stable.I have left it running with3A load for about 30-45 minutes, then measured the average voltage drop over the 2 inductors.Phase I: 292.1 mVPhase II: 289.3 mVAt this 3A load the inductors stabilize around ambient + 17C. MOSFETs a bit cooler and diodes slightly warmer.

author: temmi_hoo
author_rank: Contributor
timestamp: December 14, 2013, 06:07:10 pm
content: I have to say: what an interesting thread! Interesting topic, good links, good discussion. Thank you allI'm involved in designing software controlled smpsu modules in an open source project and I'll have to link this to our guys.My project ishttp://www.ell-i.org/andhttp://github.com/Ell-i/- our aim is to provide development system for (S/P)ELV small voltage DC powered devices in the less than 100W region using PoE as electricity transport.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 15, 2013, 09:16:43 am
content: Quote from: temmi_hoo on December 14, 2013, 06:07:10 pmThanks, yeah, maybe not the most generally interesting subject, but I do find it an interesting experiment. Mostly to see how possible it is to do the full control loop including dual phase PWM, CV and CC in a low cost uC, but also experimenting with lower ripple multiphase design. Still needs a bit of work to filter out most of the high frequency switching noise and some minor fine tuning.I hope to make something useful out of it once done with the experiments.feel welcome to join the discussion.Cheers

author: temmi_hoo
author_rank: Contributor
timestamp: December 15, 2013, 11:39:11 am
content: Quote from: jaxbird on December 15, 2013, 09:16:43 amI've just barely grasped how a buck or boost works in single phase discontinous mode. I hope you publish your findings in some way.We're teaching software engineering students and hackers on how to power things from a PoE supply. A shiny wiki leak as an example of our material:https://github.com/Ell-i/Hackathon/wiki/LED-driver-forward-control-testingOur learning material is hugely disorganised so you might get lost in there without finding anything good.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 23, 2013, 11:57:36 am
content: I've been experimenting a bit more with this converter over the weekend, mostly adding an output filter and more fine tuning of the feedback algorithm.I've found the most effective output filter to be another LC filter after the primary LC filter. I'm not sure if this is the most efficient way to do it, very open to suggestions. I'm using smallish values, 10uH and 100uF (+ a few 100nF), for a reasonable balance between hurting the already not so great dynamic performance and getting rid of as much ripple and switching noise as possible.Some new measurements with the filter bodged in, using flying components, not ideal, but still a nice improvement on the output ripple and switching noise. With proper assembly and a bit of shielding I think it will be close to perfect.Ripple at 1A load:No load to 1A load:1A load to no loadDynamic performance is kind of a worst case here, with e.g. 500mA constant load and 1A switching it does look better. I am considering adding a dynamic load I can monitor and control from the uC to improve any overshoot, just an opamp, MOSFET and a shunt kind of thing.I think with a 400 MIPS uC the performance could be close to perfect, but that would be a bit overkill to dedicate such a uC to purely regulating of a buck converterAt the current 40 MIPS I find the performance quite usable, not awful.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 23, 2013, 12:12:39 pm
content: Quote from: temmi_hoo on December 15, 2013, 11:39:11 amThe one I'm experimenting on here is not particularly complex (well, it's all very complex when you get down in the details) Most of the commercial ones does actual sensing on the individual phases, but I kind of liked the idea of using a regular uC's features to turn it into converter that can easily be controlled and voltage and current read in serial data.Looks like you are into some cool projects, you should start a few threads here on eevblog, I've found there are many very experienced contributors always ready with constructive feedback and help.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 23, 2013, 12:26:18 pm
content: Also done some work on the switch on / large change performance. I have slowed down/limiting the maximum gain, the control is much improved and overshoot is pretty much non existent without disturbing the "as fast as possible" dynamic performance.Switch on 5V into no load, CV:Switch on 5V into 1A load, CV:Switch on into 1A load CC limited:

author: temmi_hoo
author_rank: Contributor
timestamp: December 23, 2013, 07:52:31 pm
content: Quote from: jaxbird on December 23, 2013, 12:12:39 pmThanksOur switchers are as of yet singlephase, but the controller does have plenty ADC channels for feedback, so who knows what our users will whip up eventually.The whole idea is to build a platform enabling the design of smartly powered things that just happen to be IP connected and IP controlled. We're slowly starting an ecosystem of small power internet of things devices that are specifically designed to handle some amount of energy instead of just being smartypants. We will do a C library for controlling these things too, so that solution developers need not think too much about ittybitty details.Anyhow, the devil is in the details, so your things are simple yet complex.

author: megajocke
author_rank: Regular Contributor
timestamp: December 23, 2013, 10:27:13 pm
content: Great to see that you didn't have trouble with load sharing, but considering that you will have good matching between pulse widths and that the inductors have significant resistance (which also has a positive temperature coefficient) it isn't too unexpected.I think it might be possible to improve the load/line response speed though if you want to do it. In your previous post I saw this:Quote from: jaxbird on December 06, 2013, 11:24:02 amand I wonder if this the control strategy you still use?Even though this essentially integrating controller will work great as long as the loop crossover frequency is below the LC filter resonance, it should be possible to get significantly faster response to load/line changes if you use a more sophisticated controller. A proportional-integrating controller can give good performance with a crossover frequency above the output capacitor ESR zero, but this might be difficult considering your sampling frequency. A PID-type controller however should be able to give quite fast settling. On the order of 100 µs should not be too hard.What are your component values? I saw earlier that the inductors are 100 µH with 180 milliohms of resistance, but what about the capacitor capacitance and ESR?

author: temmi_hoo
author_rank: Contributor
timestamp: December 24, 2013, 07:21:37 am
content: Quote from: megajocke on December 23, 2013, 10:27:13 pmWhat makes the situation even better is that the same MCU driving that power supply can be the one that is controlling what the load does and when, so the power supply can be preloaded since the control algorithm knows near future events.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 24, 2013, 09:32:14 am
content: Quote from: megajocke on December 23, 2013, 10:27:13 pmIt was nice to get a confirmation and a reliable way to measure it.Quote from: megajocke on December 23, 2013, 10:27:13 pmI did like the simplicity of that method and that it always arrives at the target with nice dithering patterns and high accuracy, but, as you point out, it's not fast. And now, with a lot of conditional butchering for improved control, the elegant simplicity is gone as wellHaving a go at using a PID control algorithm instead is an excellent suggestionIf it can predict the needed PWM change with reasonable accuracy it should correct much faster. I will certainly have a go at implementing that.Probably best approach will be to write a small emulator/test harness first. I think it will be tricky to implement, optimize and fine tune the algorithm at the same time.Quote from: megajocke on December 23, 2013, 10:27:13 pmYou are right on the inductors being 100uH and ~175mOhm (+15-20% at full load stable temperature)The capacitors I use are 220uF general purpose, not ideal. I don't know the ESR, but I use 50V rated ones hoping the ESR will be reasonably low.I don't have an ESR meter, but I can probably put something together to get an approximate reading.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 24, 2013, 01:00:42 pm
content: Quote from: temmi_hoo on December 24, 2013, 07:21:37 amIn such a use case it should be fairly simple to insure good performance. Could just be a simple formula or a look up table to compensate. But I have to say that in my setup I don't have many cycles left with the 100kHz PWM and 50kHz control loop, plus calculating and reporting average, min, max current and voltage every 100mS on UART.Even easier if CC mode is not required, could just beef up the output capacitors.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 25, 2013, 02:23:26 pm
content: Found a bit of quiet time between all the Christmas eating and drinkingto write a basic test harness to evaluate feedback control algorithms. It's not a simulator, just an emulator of the approximate behavior.this is what it looks like: (here with too much gain, just for illustration)Performance of current algorithm with optimal gain:And performance with a reasonably tuned PID algorithm:The PID is much faster, so next step will be to re-write it so that it does not use any floating point, purely integers for speed. And no divisions either.I find it often saves time to write a test harness to do things like this, much easier to optimize and debug an algorithm on a PC instead of doing it directly in a uC.

author: temmi_hoo
author_rank: Contributor
timestamp: December 25, 2013, 08:33:25 pm
content: Are you releasing the software in some open source licence? If yes, we at ELL-i would like to take a look and port it to our system, keeping your copyrights naturally.If you're interested, you're naturally welcome to join us in our effort to revolutionise power delivery by making smarter than usual point of load power converters as close to the actual load as possible. Our current delivery network is PoE, but that's just the beginning.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 26, 2013, 12:39:01 pm
content: After a bit of fun optimizing and tuning the PID algorithm (nice suggestion by megajocke) I have got it running at 50kHz in the uC. The test harness was well worth the couple of hours it took to construct it.Only implemented CV with PID so far, but CC should be easy to add. Either using a different set of tuning values or just scale the current sense and target values to match the voltage.Anyway, a new set of measurements:No load to 1A load:1A load to no load:Switch on into CV no load:Switch on into CV, 1A load:It's a nice improvement on the response/recovery times. I believe the time and volt scales are the same as the previous set of measurements for easy comparison.It might be possible to squeeze a bit more out of it with more tuning.

author: C
author_rank: Super Contributor
timestamp: December 26, 2013, 03:55:13 pm
content: HiHave you thought of using a common mode choke or transformer for your output filter?C

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 27, 2013, 06:33:04 am
content: Quote from: temmi_hoo on December 25, 2013, 08:33:25 pmSure, I'll try to sum up my findings when I'm reasonably happy with it. (or in case I get bored of it)

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 27, 2013, 06:41:58 am
content: Quote from: C on December 26, 2013, 03:55:13 pmGood suggestionI don't have any common mode chokes to try out, but I do have some smallish toroidal core inductors that I can probably butcher into common mode chokes.I should probably also try out a few different sizes of output capacitors.My goals are primarily low ripple/noise, good response and precision. High efficiency is not so important.

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 27, 2013, 02:35:42 pm
content: Made the larger of the two inductors into a common mode choke, it's <= 5 uH, don't have any instruments to measure reliably in that range.And bodged in with a couple of capacitors:It very effectively kills the remaining ripple and noise, here with 1A load:I did have it in the wrong way firstwell it was a 50/50So I expect it being in common mode and not differential mode for the best results.Unfortunately it's not pure joy, I got stability issues now, I did make some quick attempt at re-tuning the PID, but not getting as good a dynamic/recovery performance as before. I might need to rethink the layout a bit.

author: C
author_rank: Super Contributor
timestamp: December 27, 2013, 08:14:31 pm
content: The common mode choke will try to remove all AC difference between the two phases.You need an AC difference between the two caps to charge the cap for each phase due to the time difference.So a direct connection could work against the caps charging.You might try inserting two air core inductors before the common mode choke input.An air core would be easy to play with to see the results. Just bend and move.C

author: jaxbird
author_rank: Frequent Contributor
timestamp: December 29, 2013, 11:04:21 am
content: I have tried 3 different output filter configurations:1. Additional LC filter:It's low noise and good control.2. Common mode choke between phases:It's medium noise and good control3. Common mode choke on the combined output of the phases:It's very low noise, but much ringing, over/under shoot.I'm afraid I cannot wield the powers of the common mode chokeAlso having some trouble getting good behavior from the PID control over the full range. If I tune it aggressively for fast response, it works great with medium and high loads, but easily oscillates with low loads. If I am less aggressive, I do not get much benefit compared to the basic control algorithm I used previously.I'm thinking, since I know targets, plus changes in voltage and current at any time, it should be possible to work out a better and more adaptive control algorithm.

author: C
author_rank: Super Contributor
timestamp: December 31, 2013, 06:10:38 pm
content: You may not be think of this.simple wire & also filters have time delays.A link I foundhttp://www.st-andrews.ac.uk/~www_pa/Scots_Guide/audio/part3/page1.htmlLooking at fig #2. If the right cap is load, it = load + 2x time delayed & 2x filter reduced from load side & 1x time delayed & filter reduced switcher + 3x time delayed & 3x filter reduced switcher. The reverse is true for the left caps.So where you sample could make a big difference.Looking at fig #1.If the left most inductors are the switcher inductors, the left most caps need to bounce. If the left most inductors are the filter inductors, then you probably want the two filters not to have the same freq. Same freq could = more ringing and osc while different should be less. Remember a harmonic can create a osc.You also need to remember that power Up is not the same as power Down. One is switcher and the other is load.So where you are sampling could make a big difference.Using your computer monitor as a reference.Y = voltsX = ampsZ = TimeI would guess that any change change in X & Y, be it the start point or the end point gives you a different curve. Your low power curve is different from a high power curve. Trying to put that in one PID probably will not work well. You may want a Amp PID & a Volt PID with the output of these two feeding a third PID.You may want an Up set of PID's and a Down set.And then Time pops in an adds a Z factor to the curves, but the mpu may help here also.Looking on the web.Some are using transformers in place of switcher inductors so the the switcher kick hits both power rails. Looking at fig 1, the 4 caps would become 2 stacked caps, the output would not be shorted but kept separate for the two outputs power & ground. So if this is a two wire filter then during the two phases process you would have a three wire filter.Looking at fig 2, most PHD designs on the web have a small inductor between the left caps and the common mode choke.Also at small % PWM times you are probably doing more heating the fet then good. So you might want to skip cycles/phases at low power.Just some ideas, good or bad.C

author: jaxbird
author_rank: Frequent Contributor
timestamp: January 06, 2014, 05:59:14 pm
content: Hello C, thanks for all the insights, thought, ideas and inputsMy currently best performing setup is with the switching inductor and capacitor being 100uH and 100-220uF/50V and then using the #1 output filter (LC) with 10uH and 100uF/50V plus a few 100nF ceramic. It give a good balance between minimal ripple/switching noise and good dynamic response. I do need to make a new PCB though, to more accurately measure the actual performance, so far tests have been with bodged in flying components.For the PID, yeah it is tricky, as you said, up and down are not equal neither are different loads and modes CV and CC. I do use a minimum constant load of around 250mA to improve the performance. Without a minimum load the performance is pretty awful. I am considering adding a crude control of the constant load in the main control algorithm.Like you suggest probably a nice improvement could be achieved by a simple current multiplication factor on the PID parameters to compensate for the changes in behavior at different currents. Some experiments required.It's all fun and experiments, I'm mostly interested in how far it is possible to take this fairly basic design.I've been building an ESR meter over the weekend to get a better reading on the influence of the choice of capacitors. It's based on one of the nice designs posted by Jay_Diddy_B, but I probably better put that in a separate thread