uC based buck converter - Page 1
Forum section: electronics / general

author: ElectroWarrior
author_rank: Contributor
timestamp: October 23, 2013, 07:47:04 am
content: Hi guys, im working on a project where I need to have a buck convterter, and some uC based stuff. I was thinking if it is possible to make a buck converter usingthe uC as the controller. The plan is to use the integrated PWM module of the uC to control the buck converter transistor, and the uC ADC to probe the output and thereby making a control loop.However the problem is that most low cost microcontrollers only produce PWM frequency of 16-20kHz if i need a minimum duty cycle resolution of 10bits. At a PWM frequency of 16-20kHz the inductor and filter cap has to be quite large.The question is:Is it possible to multiply the PWM frequency while keeping the dutycycle information in some way? - maybe some PLL or other stuff?I know if it is done this way, the duty cyle will only update at 16-20kHz rate, however that should be fast enough for a fair regulation.

author: Harvs
author_rank: Super Contributor
timestamp: October 23, 2013, 09:16:45 am
content: Pretty much every manufacturer has app notes on digital control of power converters.As for low cost uC, well it depends on how low cost you mean. Once you get to 16bit and beyond pretty much every manufacturer has models that have high speed PWM units (>100MHz), usually multi-phase for this exact purpose. I haven't seen a 32bit controller that doesn't have them. Usually you also need the higher power of the these controllers with fast ADC and 16 or 32 bit MAC instructions, depending on how fast you want you control loop. If you're trying to do it on a $1 8bit uC, then you're probably going to be better off using an analog solution.If you go to any of the major's website and have a look at uCs for power conversion applications you'll find lots of documentation.

author: tszaboo
author_rank: Super Contributor
timestamp: October 23, 2013, 12:06:34 pm
content: Have you looked at the dsPIC33 series? It is supposed to be a fast PWM power supply chip from microchip, they are basically PIC24 with more stuff. I find digital control slow for practical applications, but I've seen implementations.

author: Paul Price
author_rank: Super Contributor
timestamp: October 23, 2013, 01:31:24 pm
content: Inductor and Output filter cap...what do you consider quite large? Depends on the input/output current and voltage your trying to work with, and the ripple, PCB size requirements you have to meet.I've successfully designed and built several 20KHz PWM 16Fxxx 8bit low cost PIC MCU (20MHz) as the complete SMPS controller, circuits using external dual comparator and an a dual op-amp and so can use150 to 330uH inductors to make very efficient >5-amp Li-Ion chargers with simple cirucitry, and with a low-RDSon MOSFET, got a very high efficiency, losses mostly due to Schottky diodes, inductor resistance heating, but overall, very quite good results in regulation and ripple and high output current and yet capable of operating over a wide range of DC input voltages just a few volts over >Vbattery to >36V Vin.The catch Sw. inductor size is, always the biggest hog of PCB real estate, followed by in/ouput filter caps, but total area needed is always in proportion to output current requirements..yet I have gotten very low cost, good size/efficiency/performance with output currents <3 Amp.If have used a PIC MCU and a cheap IC comparator to PWM control a TI/Natsemi ~500KHz switcher IC output voltage with very good efficiency, 5-amp output, small inductor size and good regulation with acceptable load change transient response but the cost of the fast LM switcher is not so attractive considering the large quan. of free larger toroidial inductors I have on hand from defective PC power supplies and discarded PC printers, so I opt often to work with 20KHz PWM if PCB size is not an issue.If you bother to build a freq. multiplier, your best bet would be dicard this idea in favor of using a MCU to control something like a LM2678 fast SMPS IC, due to the large circuit complexity.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 23, 2013, 05:06:07 pm
content: Although it's doable, it's often not worth the hassle unless you're very cost-constrained.Software regulators can take up significant resources, and risk smoke (of both the reg and in the case of bucks, what it's powering) if the firmware has problems.There can also be smoke issues when debugging if you happen to halt when the PWM is on, and you need to be sure you know what will happen under all reset and brownout conditions.A seperate buck will "just work", have overcurrent protection etc. There are plenty of cheap (<<$1) buck convs, especially as you move away from mainstream ICs from TI - look at Richtek, Diodes and Alpha Omega.Microchip's MCP16301 is also good.the higher PWM freqs you'll be able to use on seperate regs will allow small inductors and often ceramic-only decoupling, and this alone may outweight any cost savings of doing it in software

author: TMM
author_rank: Frequent Contributor
timestamp: October 24, 2013, 10:04:10 am
content: I agree with Mike. The uC will be running flat out for the best transient performance - making it pretty useless for anything else. It may work ok in an application where you don't expect sudden changes in load (e.g. a battery charger).

author: nctnico
author_rank: Super Contributor
timestamp: October 24, 2013, 12:06:05 pm
content: Its not a useless technique but you shouldn't expect to built the best converter ever. In one of my products I was lucky to use the uC as the PWM controller. Half way the project it turned out the load needed current control instead of voltage control. In that design the current limiting is done in hardware though.

author: ovnr
author_rank: Frequent Contributor
timestamp: October 24, 2013, 12:34:46 pm
content: Having recently built one myself: They do work, and you're not restricted to low frequencies either. I'm running a PIC12F1501, and doing 500 kHz PWM on it. You only get 6 bits of resolution, but if you do some magic with the CLC and NCO modules, that gets expanded to 15 bits - seeAN1476. This is essentially just dithering, but it shouldn't present any real problems.Yes, transient response is rather bad (ADC is limited to ~80 KSPS), but for my application, it's fine. Also no problems re: overvoltage on the output, as the downstream device is fine with pretty much whatever I feed in. I'd obviously not go power a laser diode with it.The main reason I picked a µC-based solution was that I needed it to be programmable over a serial bus, and I didn't feel like dicking around with PWMing the feedback pin on a dedicated regulator, or using digipots.

author: tszaboo
author_rank: Super Contributor
timestamp: October 24, 2013, 04:46:42 pm
content: Quote from: ovnr on October 24, 2013, 12:34:46 pmIf you make dithering on a power converter, that doesnt help that much. The reason is that the dithered frequency will be the same frequency as if you used lower frequency PWM. And you dont want a "wobble" on the output, so you need to design your output filter below the dither filter. So we are at square 1. Sometimes it is useful though.

author: ovnr
author_rank: Frequent Contributor
timestamp: October 24, 2013, 05:22:11 pm
content: Quote from: NANDBlog on October 24, 2013, 04:46:42 pmWell, the magnitude of the dither "frequency" as it were is going to be significantly less than if you just tried to push 20kHz through a filter designed for 500kHz. I don't need a super stable output voltage, so I'm happy to deal with a bit more low-frequency ripple compared to having an enormous inductor.

author: ElectroWarrior
author_rank: Contributor
timestamp: October 25, 2013, 09:59:39 am
content: I want to thank everybody for all your great inputs!The point behind the project is to make a 5V 500mA USB charger, being as low cost as possible, while having some ability to do some minor processing. The USB specification does not explain much about ripple voltage, however it specifies that the voltage has to be between 4.75V to 5.25V. And since a USB charger does not experience major transient loading conditions - I hope it will be possible to regulate the converter by using a uC, and thereby having some headroom for a bit of proccessing. I have read the AN1476 application note, and the information is amazing, just what i needed. I will try and see if I can make it work - Thank you very much ovnr.