Electronic – Switching regulator using MCUs

microcontrollerswitching-regulator

One of the most useful ability of MCUs is generating PWM signal. For example ESP32 duty resolution can be lowered down to 1 bit in which case the maximum frequency is 40 MHz.

With such fast clock speed a 200-500KHz and 10-12 bit resolution is more than enough to build a switching buck or boost converter:

schematic

simulate this circuit – Schematic created using CircuitLab

  • Is there a down-side in using of MCUs PWM to build a switching regulator? (am I going to face any problem?)

  • What advantages switching regulator ICs (like LM2596 or XL6009 etc) have over this method other than simplicity and ease of use?

Best Answer

10 bits at 200kHz requires a 200MHz peripheral clock, and 12 bits at 0.5MHz requires a 2GHz peripheral clock unless you have a fancy enhanced resolution PWM peripheral.

So lower PWM frequency means more expensive, heavier larger inductor. It’s difficult to get the MCU to regulate its own power. “Soft” firmware disruptions or bugs can cause physical damage.

Some processor bandwidth and resources are consumed by the (interrupt driven) control loop unless your chip has a dedicated processor for the purpose. That may increase latency for servicing lower priority interrupts or compromise the regulator performance.

Microchip has marketed versions of their PICs with peripherals optimized for SMPS control.. if Olin was still here he could tell you a lot more about actually using them, personally I tend to err on the conservative side.

There are also some small very low power MCUs that actually contain an entire switching regulator (except the inductor) to allow 1.5V operation.

There are a lot of similarities between a motor controller implemented by a DSP or microcontroller and a switching power supply so the existing peripherals often aimed at motor control could be used for a SMPS (although the frequency would typically be very low compared to a modern SMPS chip). Might be useful for special applications such as a polyphase low EMI power supply.

Related Topic