DEV Community

GeunWooJeon
GeunWooJeon

Posted on

From Ideal to Reality: Taming Resonance in a Flyback Converter

From Ideal to Reality: Troubleshooting Parasitics in a Flyback Converter
In my university classes, PSIM simulations have always shown perfect, ideal results. But I started wondering: What happens when we introduce real-world non-idealities like Equivalent Series Resistance (ESR)? Can I successfully design a control loop to handle these errors?

To find out, I intentionally injected parasitic elements into my circuit. Because I am using the PSIM demo version, I couldn't rely on the C-block for digital programming. Instead, I took on the challenge of designing an analog PI control circuit from scratch. It was a tough process, but the sense of accomplishment made it incredibly fun!

The Problem: Resonance & Voltage Overshoot

I designed a 220V to 5V Flyback converter. To mimic the real world, I added a parasitic inductor (representing transformer leakage) and a parasitic capacitor next to the switch.

These opposing properties created a resonance phenomenon—a state where they violently exchange energy, causing severe oscillations. Theoretically, my output should have been 5V with a switch voltage stress of 320V. However, this resonance caused a massive voltage overshoot that would have easily fried a real-world component.

First Attempt: The Snubber Circuit & Its Limitations
To protect the switch, my first step was adding a snubber circuit to act as an energy valve and dissipate the dangerous ripple as heat.

When the switch turns off, the diode acts as a valve to let energy in. The capacitor absorbs the dangerous ripple energy, which is then safely dissipated as heat through the resistor.

While this successfully brought the voltage stress down to a safer level, the result was slightly disappointing. The circuit still felt somewhat unstable, and most importantly, the output voltage completely failed to reach my intended target of 5V. It became clear that simply absorbing the parasitic energy wasn't enough; I needed an active feedback loop.

Since I hadn't formally learned snubbers yet, I initially placed the diode backward and spent a lot of time debugging! Once I realized the error and flipped it, the voltage stress dropped significantly.

Second Attempt: Closing the Loop with Analog PI Control
While the stress decreased, the output voltage still wasn't hitting my target of 5V. To fix this, I implemented a feedback control logic:

  • Sensing & Filtering: A sensor reads the output voltage (Vo). A Low-Pass Filter removes high-frequency noise, allowing only the DC component through.
  • Error Calculation: A summing block calculates the error margin: Verror = 5V - Vo
  • PI Control & Limiter: The error signal is fed into a PI controller, followed by a limiter to prevent windup. Tuning the gain and time constant was tricky, but after many trials, I found the optimal sweet spot at 0.01 and 0.05.
  • PWM Generation: A comparator compares this control signal with a triangular wave (0V to 1V). If the voltage is too low, the Duty Cycle (D) increases; if it's too high, D decreases.

The result? The control logic successfully stabilized the output at an average of 5V while keeping voltage stress in check!

The Struggles & Troubleshooting
Going beyond simple ideal circuits meant I faced a lot of unexpected challenges:

  • The Snubber Diode Mistake: Since I hadn't formally learned about snubber circuits yet, I initially placed the diode in the reverse direction. I wasted a significant amount of time trying to figure out why the circuit was failing before finally noticing the reversed orientation!
  • Tuning the PI Controller: Adjusting the proportional gain and time constant was quite difficult. I went through countless trial-and-error attempts to see what combination produced the cleanest output wave. After many tests, I finally found the optimal sweet spot at a gain of 0.01 and a time constant of 0.05.

The "ESR Dilemma" & Industry Insights

One of the most fascinating things I learned is that the parasitic resistance (ESR) in a capacitor isn't always a bad thing. It actually adds a "zero" to the system, compensating for the pole and preventing phase reversal. If we use modern, near-zero ESR capacitors (which are highly ideal), the controller might actually become unstable! To fix this, engineers sometimes intentionally draw trace resistance on the PCB or use a Type-3 compensator.

This raised a question for me: When is this analog control approach actually efficient?

  • Lightweight devices: Small, cheap analog ICs are widely used to handle feedback control efficiently.

  • Heavy-duty/Precision devices: Digital control via MCUs (using code) is preferred for its convenience and flexibility.

With some help from AI to grasp the initial concepts, this project became a fantastic foundational experience. Moving beyond simple, ideal circuits to intentionally injecting errors and troubleshooting them has given me a solid framework for how to design control logic in the future.

Top comments (0)