Author Topic: Building a PSU - Stuck with Compensator Values  (Read 4547 times)

0 Members and 1 Guest are viewing this topic.

Offline Someone

  • Super Contributor
  • ***
  • Posts: 6068
  • Country: au
    • send complaints here
Re: Building a PSU - Stuck with Compensator Values
« Reply #25 on: August 24, 2026, 10:57:07 pm »
Why should I use a simulator if I can test it physically?
Ignoring all the advice of people who have been there and done that before (already explained in above posts and other threads you started) such as learning away from significant power, be that simulation or small "toy" examples, is entirely your choice. There is no magic shortcut or easy path that we are hiding from you, starting with an unproven and complex design expecting to just adjust some specific component values is wildly optimistic.

The design you presented has numerous problems that need to be sorted out before you could consider tuning the compensator. Start from small provable subsystems/modules but to do those divisions (and simplifications) you need to learn how these things work and are analysed. No shortcuts unless you want to hire some contractor to do those boring/hard bits for you.
 
The following users thanked this post: psydaddy

Offline psydaddyTopic starter

  • Regular Contributor
  • *
  • Posts: 76
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #26 on: August 25, 2026, 01:29:41 am »
Why should I use a simulator if I can test it physically?
Ignoring all the advice of people who have been there and done that before (already explained in above posts and other threads you started) such as learning away from significant power, be that simulation or small "toy" examples, is entirely your choice. There is no magic shortcut or easy path that we are hiding from you, starting with an unproven and complex design expecting to just adjust some specific component values is wildly optimistic.

The design you presented has numerous problems that need to be sorted out before you could consider tuning the compensator. Start from small provable subsystems/modules but to do those divisions (and simplifications) you need to learn how these things work and are analysed. No shortcuts unless you want to hire some contractor to do those boring/hard bits for you.

Yes, the design had several problems, but they were related to the feedback loop. Initially, I didn't know how to implement it around the SG3525. Then I found a solution (although not a very good one) where I was feeding an analog signal that was proportionally inverted relative to the power supply output. I have since fixed that, and now I'm comparing the output voltage against a reference voltage.

The buzzing is no longer present. I only get a sawtooth waveform when I draw more than 48 W (with a small amount of buzzing), but below that everything is fine the voltage is stable and there is no buzzing.

That said, I'm not an expert, and I understand that you know how this should be done. But could you let me know what is wrong with my circuit and what I need to go back and fix? What should I test or review?

More than just these issues. This is not really about making it work, it's about what I can learn from the process. I'd like to get a Bode plot and work on adjusting the compensator. I'm not worried if it doesn't work perfectly that was never the goal. The goal was simply to build a power supply. Even a crappy one would be perfectly fine for that purpose.
« Last Edit: August 25, 2026, 01:34:28 am by psydaddy »
 

Offline temperance

  • Super Contributor
  • ***
  • Posts: 1609
  • Country: 00
Re: Building a PSU - Stuck with Compensator Values
« Reply #27 on: August 25, 2026, 02:32:40 am »
Quote
I'd like to get a Bode plot and work on adjusting the compensator.

Start with a low power 24 V to 5...12 V 1A buck regulator employing current mode control running at 50 kHz. Current mode contrlol= easy to compensate because current mode control takes the output inductor out of the equation (until the error amp runs out of gain.). Voltage mode control like in your half bridge= difficult to compensate.

Why side stepping to a low power buck:
an SMPS with a proper compensation circuit can be unstable if you made a small mistake. With a low power buck regulator you can experiment with a bad and a good PCB layout. (this can be done on a perf board with just minimal tools and expenses).

Things to try:
1. Connect the output voltage sensing divider wrong in terms of board layout (shared current path) and you will never get the compensation circuit to work properly.
2. Change the board layout such that you couple switching noise into the feedback circuit.
3. Use a regular wire wound resistor for the current sensing in the current loop. Change the RC filter time constant for the current sense circuit.
4. Add some small inductance in series with the output capacitor. 1µH or something.
5. Add some small inductance in series with the input capacitor. Again 1 µH or something.
6. Change the switching frequency to 200 kHz or higher.
7. Construct a bode plot. If you are lucky, the noise is manageable.
8. After all the above, try to build a buck capable of 10 A running at 200 kHz with a control IC driving an external MOSFET. You should see some, hopefully, interesting artifacts while increasing the output current.
9. Try again to construct a bode plot from a signal buried in noise.
10. Fiddle with the slope compensation.

This is not meant to discourage you. When I was teenager I build audio amplifiers and just like any teenager: it must be at least 200 W in 8 Ohm. You quickly learn a few things: even the smallest mistake is expensive and there is nothing to learn from components ready to go to the grave yard. Return on investment= 0,0. A 20 watt amp powered by current limited power supplies is much more forgiving and easier to experiment with.

Some books you might find interesting:
https://powersimtof.com/book7.html
https://powersimtof.com/book5.html
 
The following users thanked this post: psydaddy

Offline xavier60

  • Super Contributor
  • ***
  • Posts: 3272
  • Country: au
Re: Building a PSU - Stuck with Compensator Values
« Reply #28 on: August 25, 2026, 02:36:58 am »
I'm not able to give detailed advice except for suggesting it's ok to use over-compensation initially to check that the design is capable of being stable but with slow response, say 100nF and 1K for C_COMP and R_COMP with C_FF omitted. C_HF should be just low high enough to adequately filter ripple which should only be present at double operating frequency.
« Last Edit: August 30, 2026, 08:06:13 am by xavier60 »
HP 54645A dso, Fluke 87V dmm,  Agilent U8002A psu,  FY6600 function gen,  Brymen BM857S, HAKKO FM-204, New! HAKKO FX-971.
 
The following users thanked this post: psydaddy

Offline mtwieg

  • Super Contributor
  • ***
  • Posts: 1790
  • Country: us
Re: Building a PSU - Stuck with Compensator Values
« Reply #29 on: August 25, 2026, 09:17:53 pm »
By creating a step-down converter I still need to get create a good compensator. So I would be stuck in the same subject again.
Yes, the point is to learn that subject in a way where it's safe to make mistakes. That means no high voltage or high power. Feedback control theory is exactly as valid at milliwatts and millivolts as it is at kilowatts and kilovolts.

Quote
Yes, SG3525 is powered from the sec side. Firstly powered by an auxiliary flyback module and then it gets power from the secondary side to keep working.
Okay, your schematics don't show that. We can only imagine what else might be hiding.
 
The following users thanked this post: psydaddy

Offline D2236

  • Regular Contributor
  • *
  • Posts: 158
  • Country: us
Re: Building a PSU - Stuck with Compensator Values
« Reply #30 on: August 26, 2026, 01:45:18 am »
Typical Loop Design Process suggested by Dr. Ridley in his lectures:

1/ Build Power Stage
2/ Close Loop Slowly (BW < 10 Hz)
3/ Measure Power Stage
4/ Compare with Theory
5/ Design Compensator
6/ Measure Loop
7/ Compare Loop with Theory

Unfortunately to do this easily you will need some form of FRA.
 
The following users thanked this post: psydaddy

Offline temperance

  • Super Contributor
  • ***
  • Posts: 1609
  • Country: 00
Re: Building a PSU - Stuck with Compensator Values
« Reply #31 on: August 26, 2026, 11:36:19 am »
Quote
That means no high voltage or high power. Feedback control theory is exactly as valid at milliwatts and millivolts as it is at kilowatts and kilovolts.

Consider developing a simple 1 A linear regulator with discrete components in order to gain some insight. No switching noise and unpredictable parasitics to battle with. A kW switcher will push you past the limit of your knowledge pretty fast.

Trying to learn about loop compensation from a 1 kW SMPS will be very exhausting.

Capacitors don't look like those capacitors found in linear circuit analysis text books. The same applies for inductors, transformers, capacitors,... You will find very small inductors everywhere but they are large enough to create a mess. Or to put in an other way: any component in the power path is going to create something you didn't expect because of the parasitic components. By going after a 1 kW SMPS you will have to deal with many problems.

An example:
PCB trace are inductors. If you want to tame the problems you see in the power path caused by pcb trace inductances (preferably before you order the PCB), you must try to found out what the problem looks like.

https://learnemc.com/ext/calculators/resistance/trace.html

Or maybe I'm the only one who doesn't know how to develop an SMPS and wasting my life. The latest one I developed is a 700 W LLC converter. I spend over two months to get the board layout right in order to pass EMC regulations from the first time.
« Last Edit: August 26, 2026, 11:53:34 am by temperance »
 
The following users thanked this post: psydaddy

Offline psydaddyTopic starter

  • Regular Contributor
  • *
  • Posts: 76
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #32 on: August 26, 2026, 01:02:24 pm »
Thank you guys. I'm going to test your advices and let you know how it went.
@temperance we are not saying you don't know how to do it. I trust your advices and i understand your worries because you have been there before, and you would have done it differently. I appreciate your help and everyone's help too.
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5359
  • Country: nl
Re: Building a PSU - Stuck with Compensator Values
« Reply #33 on: August 27, 2026, 08:58:12 am »
As for the linear power supply: using transistors to dissipate power as heat in order to regulate the output is a fundamentally different approach. How would building a linear power supply benefit me before moving on to an SMPS?

For the control circuitry it matters surprisingly little whether you build an SMPS or a linear power supply. With an SMPS the regulation speed is fixed by the PWM frequency, with a linear supply it's determined by the speed that the power amplification circuitry (capacitances, miller effect and such) reacts. The power stage has some amplitude and phase shift, and you have to compensate for that.

But if you increase the overall power, influence of parasitics becomes (much) bigger, especially with an SMPS, and designing a 1kW power supply (whether linear or switching) is a quite big project. PCB layout is also very often more critical with an SMPS then with a linear supply, but a linear supply can also become completely unstable just by a faulty PCB layout. (Probably) The biggest common error is voltage drops over the high current GND return path that somehow generate a feedback voltage into the regulator circuit.

For measuring response and drawing the bode plot, an "Injection transformer" is the best option. You basically add a (10 Ohm or so) resistor somewhere in the control circuitry, and then you use the injection transformer to induce a small AC voltage over that resistor.

Injection transformers are very simple devices (toroidal ferrite core with a bunch of wire) but they are surprisingly expensive (around EUR 500) I guess most of this is due to their use in a small niche market, and that for the target audience price does not matter much. They all use pretty big toroids to get into low frequency. It's also common to stack two big toroidal cores on top of each other (each with different magnetic properties). There are a lot of DIY projects for injection transformers. If you search for them, you will also find plenty of details of how to use them.

https://html.duckduckgo.com/html?q=diy+injection+transformer


« Last Edit: August 27, 2026, 09:04:43 am by Doctorandus_P »
 
The following users thanked this post: psydaddy

Offline psydaddyTopic starter

  • Regular Contributor
  • *
  • Posts: 76
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #34 on: August 30, 2026, 01:19:14 am »
Injection transformers are very simple devices (toroidal ferrite core with a bunch of wire) but they are surprisingly expensive (around EUR 500) I guess most of this is due to their use in a small niche market, and that for the target audience price does not matter much. They all use pretty big toroids to get into low frequency. It's also common to stack two big toroidal cores on top of each other (each with different magnetic properties). There are a lot of DIY projects for injection transformers. If you search for them, you will also find plenty of details of how to use them.

https://html.duckduckgo.com/html?q=diy+injection+transformer

Thank you,
I was already planning to build an injection transformer. So I finished it today. I had a Nanocrystalline Core from a faulty solar inverter. So I decided to copy the B-WIT 100 that Dave reviewed on his youtube channel and to add a 3D printed case (here: https://www.thingiverse.com/thing:7402314).
I still have to figure out how many turns I need. I copied the 40 turns from the B-WIT 100, and after testing it doesn't disturb the input sine wave (no load) within 200hz and 15Mhz (kinda high).
My transformer has:
Inductance: 202Mh
Pri-Sec capacitance: 130pF @1kHz

Now I'll have to buy a scope that is able to automaticity plot bode plots. I could do it manually but it takes forever and my scope is not that great.

For measuring response and drawing the bode plot, an "Injection transformer" is the best option. You basically add a (10 Ohm or so) resistor somewhere in the control circuitry, and then you use the injection transformer to induce a small AC voltage over that resistor.

The 10r resistor is put in series with the feedback resistor divider?
The SMPS is on or off while testing it?
« Last Edit: August 30, 2026, 01:23:09 am by psydaddy »
 

Offline psydaddyTopic starter

  • Regular Contributor
  • *
  • Posts: 76
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #35 on: August 30, 2026, 01:28:53 am »
I'm not able to give detailed advice except for suggesting it's ok to use over-compensation initially to check that the design is capable of being stable but with slow response, say 100nF and 1K for C_COMP and R_COMP with C_FF omitted. C_HF should be just low enough to adequately filter ripple which should only be present at double operating frequency.

That's was an awesome suggestion! I did that and now it behaves way better: No audible buzzing, voltage is stable and a flat line with a few noise (< 300mV). I was able to test it up to 200W (maximum of my electronic load) and it's fine (i don't remember this ripple value). Too slow in response ofc, but that's expected considering the values.
« Last Edit: August 30, 2026, 01:30:45 am by psydaddy »
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 688
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #36 on: September 01, 2026, 07:42:39 am »
Can you provide the parameters of the output filter, the inductance of the inductor, the capacitance of the capacitors, and their ESR?

In the simulation, you can view the Bode plot, and later check how much the actual system differs at a few points. It doesn't have to be very precise.

I once linked an article that describes the impact of different compensator designs on the impulse response of a buck converter. I added it in the attachment.
Your circuit is a buck with a transformer. Small signal model is the same.

Placing the crossover frequency below the resonant frequency will result in an oscillatory impulse response. Something like this:
2887956-0
These are oscillations in the output LC circuit in CCM mode. A slow feedback loop will not eliminate them, a fast one will.
The rate of oscillation decay will depend on the damping of the LC circuit through the load resistance and the ESR of the capacitors.

You can check this yourself by applying a step change in current and observing the voltage waveform.The waveforms for CCM and DCM will be different.

Quote
But after i have the Bode Plot built, how do I convert it into the resistors and capacitors of my Type 2 and 3 compensator?
When you know the Bode plot and choose the crossover frequency, you will read what the phase shift. From the assumed phase margin, it will follow what phase shift the compensator should have.

The lower the ESR of the capacitors, the better the filtering, but the zero ESR will be at a higher frequency, which may necessitate the use of a type III compensator.


« Last Edit: September 01, 2026, 09:40:51 am by MariuszD »
 
The following users thanked this post: psydaddy

Offline psydaddyTopic starter

  • Regular Contributor
  • *
  • Posts: 76
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #37 on: September 19, 2026, 10:49:18 pm »
Can you provide the parameters of the output filter, the inductance of the inductor, the capacitance of the capacitors, and their ESR?

In the simulation, you can view the Bode plot, and later check how much the actual system differs at a few points. It doesn't have to be very precise.

I once linked an article that describes the impact of different compensator designs on the impulse response of a buck converter. I added it in the attachment.
Your circuit is a buck with a transformer. Small signal model is the same.

Placing the crossover frequency below the resonant frequency will result in an oscillatory impulse response. Something like this:
(Attachment Link)
These are oscillations in the output LC circuit in CCM mode. A slow feedback loop will not eliminate them, a fast one will.
The rate of oscillation decay will depend on the damping of the LC circuit through the load resistance and the ESR of the capacitors.

You can check this yourself by applying a step change in current and observing the voltage waveform.The waveforms for CCM and DCM will be different.

Quote
But after i have the Bode Plot built, how do I convert it into the resistors and capacitors of my Type 2 and 3 compensator?
When you know the Bode plot and choose the crossover frequency, you will read what the phase shift. From the assumed phase margin, it will follow what phase shift the compensator should have.

The lower the ESR of the capacitors, the better the filtering, but the zero ESR will be at a higher frequency, which may necessitate the use of a type III compensator.



Thank you. I bought an oscilloscope with a built-in function generator that can also generate Bode plots. I also built an injection transformer. However, when I try to plot the Bode response, I get a noisy sine wave (image attached).
I could simulate it like you suggest, but I would like to get it working with the oscilloscope first. It was also a good excuse for myself to get a better oscilloscope.

I’m doing the measurement with the power supply turned on, but with no load connected. I’m not connecting any capacitors or resistors either to the compensation circuit.

I’m following the schematic provided by the oscilloscope, but the PSU GND is not connected to the oscilloscope GND. If I connect the secondary-side GND of the power supply to the oscilloscope GND, I get no signal at all.

If i give very high resistor and capacitor values to my compensator it doesn't make any output noise, so I would say it is possible to make it work?
« Last Edit: September 19, 2026, 10:51:41 pm by psydaddy »
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 688
  • Country: pl
Re: Building a PSU - Stuck with Compensator Values
« Reply #38 on: September 24, 2026, 08:08:05 pm »
The disturbances on the oscilloscope need to be reduced first.

How did you connect the ground of the probes? Did you use springs?
 
The following users thanked this post: psydaddy

Online dietert1

  • Super Contributor
  • ***
  • Posts: 3008
  • Country: br
    • CADT Homepage
Re: Building a PSU - Stuck with Compensator Values
« Reply #39 on: September 24, 2026, 11:04:20 pm »
The injection method is in between a simulation and a true test, which involves significant load changes - like between 200 W and 800 W. The injection method is a first step to test loop stability, before starting the real tests. Real tests will also require higher loads that invoke the overcurrent limiting circuitry - in order to verify its stability as well.
You will certainly produce a lot of hot water before arriving at a good solution. I mean at these power levels many people use water cooling.

Regards, Dieter
 
The following users thanked this post: psydaddy

Offline mtwieg

  • Super Contributor
  • ***
  • Posts: 1790
  • Country: us
Re: Building a PSU - Stuck with Compensator Values
« Reply #40 on: September 25, 2026, 05:26:11 pm »
Typically for these types of measurements you want the scope to be using an averaging acquisition mode (all digital scopes should have this option). That will reduce ripple and noise in the measurement much more effectively than lowpass filtering.

You don't want to trigger the scope from any signals near the SMPS itself. Ideally the signal generator for the injection also provides a sync/trigger output which will be very clean.
 
The following users thanked this post: psydaddy

Offline D2236

  • Regular Contributor
  • *
  • Posts: 158
  • Country: us
Re: Building a PSU - Stuck with Compensator Values
« Reply #41 on: September 27, 2026, 07:32:21 pm »
For someone who sweeps a loop for a switcher for the first time can be tricky, especially regarding injection levels. Rinj values, conduction mode etc.
Below is my general procedure I have used to sweep many control loops successfully: 

1/ Before you can sweep the loop, you must get the system stable, otherwise you will get garbage results.
Looking at your scope plots, it appears that there are signs of instability from the burst oscillations on a 100 Hz ripple. Since the 3525 doesn't have a burst mode, it is most probably instability. Slow the loop down as previously suggested and make sure you get it into a constant conduction mode.
2/ Since the loop gain will be at the highest near the low-frequency start of your sweep, you will need to inject at a higher amplitude. I normally use Rinj value between 33 and 50 ohm. The 5 ohm in the setup diagram seems too low in my experience and will make it difficult to drive at low frequency, where you need the extra amplitude.
3/ One of the pre checks I do (with the loop stable) is to just manually sweep the freq injection from my function gen, while looking at the PSU output (AC coupled, lowest BW, Avg) on one channel and the triggered input on another channel. What I am looking for is to see that I get a good response on the output (the same un-distorted sine shape) as the one I am injecting. Some switching noise on the sine is normal, as long as the sine shape looks good. This noise will be suppressed by your instrument measurement software using a narrow RBW during the actual bode sweep. I will up the injection signal to get higher SNR level if needed, as long as I don't see any distortion on the sine riding on the output voltage. You don't want to see the sine wave with clipped tops or start looking like a triangular wave. I will note the level that gives a good shape up until about 1 kHz.
4/ After 1 kHz, you can normally drop down to around 10- 20 mVrms, since the loop gain also drops off with frequency. So, you need to taper your level from high to low as the frequency increase in most cases.
5/ With these levels in mind, I set up my synchronized bode sweep with an RBW low enough (1 Hz to 10 Hz) to reject the switching noise. You can also use averaging sampling if you need more noise rejection, but it will increase sweeping times.
6/ Run the sweep and see how clean the phase plot comes out, as phase is the most sensitive of the measurements. The region you will be most interested in, will be around the point where the gain plot crosses the 0 dB line. Sometimes you may tweak the levels a bit to get the best response.
7/ You want your phase margin to be more than 45 deg, more like 55 to 60 to be safe. Higher margins will give a more damped but slower response with less overshoot. I am happy when my gain margin sits at about 10-12 dB.
8/ Once you get acceptable results you can start messing around with the compensation values (small tweaks at a time, re sweep) to increase the loop BW and speed up the transient response. Take your time, don't rush.

Here is a helpful vid by OMICRON lab that explain some techniques and results.

I also include an old document by CleverScope on FRA sweeps where they use a Jensen VB-1BB video isolation transformer for injection. These are often available used for below $50.
« Last Edit: September 30, 2026, 12:15:59 am by D2236 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->