# Need help in Flyback converter simulation

#### William Johnson

Joined May 25, 2024
26
I want to design a Flyback converter to get output voltages 18V and -5V w.r.t an isolated ground Vcom, from an input Vin=5V w.r.t ground(0). Accordingly, as Vo/Vin=(N2/N1).D/(1-D), I have given the switch a duty ratio of 0.5; so for the top secondary winding I use a transformation ratio of 5:18, and for the second, 5:5. The voltages induced on the primary windings of the transformer is as expected when the switch is on, 5V on primary and 18V and 5V on secondary windings. But when the switch is off and diode is conducting, the voltages are not as expected (-5V on primary; and -18V and -5V on secondary windings), but are rather increasing steadily on the negative side. I figured that is because unlike expected, the output voltages are not constant at 18V (Vdc_18,Vcom) and -5V (Vdc_-5,Vcom) but are rather increasing steadily.

Also, the ripples in the voltages on windings are very large at the time of switching transition. The red is the primary winding voltage, blue the top secondary winding. Note how on the positive side the voltages are 5V and 18V as expected (after settling), but on negative they are quite larger.

If someone could guide me on why am I observing this behavior, it would be really helpful.
Note: I noticed during charging capacitor voltage ripple is quite larger than the ripple during discharging, as a result of which capacitor voltage is increasing. Why is that happening, I'm not sure. The charging and discharging ripple should've been same.
Attaching the .asc file for reference.

#### Attachments

• 2.4 KB Views: 1

#### crutschow

Joined Mar 14, 2008
34,835
Why would you expect a regulated output voltage?
The output voltage of a flyback converter depends upon the switching frequency, switching duty-cycle, and the output load, so it must have feedback to control the voltage.
You need to add a feedback loop for the duty-cycle to control the output voltage.

#### ronsimpson

Joined Oct 7, 2019
3,204
I replaced the switch with a MOSFET and added a resistor to slow it down. The switch was switching infinitely fast and that gave some strange readings.
I changed the -5 to +5 just so I could see the waveforms better. You can change it back.
I connected the secondary ground to the primary ground because SPICE does not like floating components.
I increased the run time by 10x because you were not waiting until the circuit settled down.
There is a large startup current that has confused you. That is why in the real world we have soft start in most PWM. The duty cycle should start out at 0% and work its way up to 50% in 3mS.
By 3 to 4mS the output voltages have found 18V and 5V.

Hope this is help full. RonS.

#### Attachments

• 2.4 KB Views: 1

#### ronsimpson

Joined Oct 7, 2019
3,204
One more thing about startup. If you can't find a better way, just ramp up the supply voltage. Here I go from 0 to 5V in 2mS and the circuit starts up better.

#### Attachments

• 2.5 KB Views: 1

#### William Johnson

Joined May 25, 2024
26
I replaced the switch with a MOSFET and added a resistor to slow it down. The switch was switching infinitely fast and that gave some strange readings.
I changed the -5 to +5 just so I could see the waveforms better. You can change it back.
I connected the secondary ground to the primary ground because SPICE does not like floating components.
I increased the run time by 10x because you were not waiting until the circuit settled down.
There is a large startup current that has confused you. That is why in the real world we have soft start in most PWM. The duty cycle should start out at 0% and work its way up to 50% in 3mS.
By 3 to 4mS the output voltages have found 18V and 5V.
View attachment 323434
Hope this is help full. RonS.
That was actually very helpful! Thank you so much!!

#### William Johnson

Joined May 25, 2024
26
I have designed a Flyback converter in LTspice. I am getting my desired output (18V and -5V dc) when the load resistor is 100 ohms. It takes about 4ms to settle to its final value. However, if I increase the load resistance, it takes longer to settle; like roughly 8ms if I make it 200 ohms. Now, in the actual circuit the load resistance is to be about 1k ohms, and in that case the output isn't settling even till 1s. If anyone could suggest me a way to achieve the desired output voltage (18V and -5V) with a load resistance of 1k faster, it would be great.
NOTE: The output voltages are to be obtained w.r.t an isolated ground, Vcom. That is why I have connected Vcom node through a small capacitor to ground.
The .asc file is attached

#### Attachments

• 2.5 KB Views: 4

#### MrAl

Joined Jun 17, 2014
11,693
I have designed a Flyback converter in LTspice. I am getting my desired output (18V and -5V dc) when the load resistor is 100 ohms. It takes about 4ms to settle to its final value. However, if I increase the load resistance, it takes longer to settle; like roughly 8ms if I make it 200 ohms. Now, in the actual circuit the load resistance is to be about 1k ohms, and in that case the output isn't settling even till 1s. If anyone could suggest me a way to achieve the desired output voltage (18V and -5V) with a load resistance of 1k faster, it would be great.
NOTE: The output voltages are to be obtained w.r.t an isolated ground, Vcom. That is why I have connected Vcom node through a small capacitor to ground.
The .asc file is attached
Hello there,

I did not have the model of your MOSFET installed so I chose another MOSFET, but I could see your problem. It's a very typical situation that is usually caused by the exponential part of the response of an inductor and resistor. The larger the resistor, the longer it takes to settle.

In many types of converters the solution is to use a "slow start" circuit. That is a circuit that does not apply the full pulse width right away, it gradually increases the width starting from a much more narrow pulse. That way you have more control over the start up profile.

You can look up slow start circuits on the web see what you can find. They vary a little bit depending on what controller chip you are using.

Note there is also a chance that it will settle faster once you get an actual control chip in the circuit. The control chip would sense the output is too high and start cutting back the pulse width to a more narrow width and thus help to control the output voltage better.
You do not seem to show the entire circuit, but if this is complete as shown, then you need to add a slow start circuit. This just means finding a way to start the pulse to a more narrow width at startup, then increase the width to the full width gradually. Although this would be a gradual change, it does not have to be super slow. The output would settle much faster than what we are seeing now.

Last edited:

#### William Johnson

Joined May 25, 2024
26
One more thing about startup. If you can't find a better way, just ramp up the supply voltage. Here I go from 0 to 5V in 2mS and the circuit starts up better.
View attachment 323436
Hello
I am wondering how can I have a settled output (perhaps in 10ms) for any value of resistance? I expect my load resistance to be approximately 1k, but for that value the output is not settling even till say 1s.

#### MrAl

Joined Jun 17, 2014
11,693
Hello
I am wondering how can I have a settled output (perhaps in 10ms) for any value of resistance? I expect my load resistance to be approximately 1k, but for that value the output is not settling even till say 1s.
Is this a repeat of another thread?

This is actually very typical in converters. The solution normally is to add a slow start circuit. That provides a more narrow pulse during start up that gradually increases in width until it reaches the final value. It may also help to add an error amplifer and some negative feedback, but even with that you may need the slow start circuit. If you do not want to add feedback, then you should create a slow start circuit.
The exponential part of an inductor and resistor current is the main cause of this problem but with the slow start circuit it reduces the startup overshoot by a lot.

#### ronsimpson

Joined Oct 7, 2019
3,204
I am wondering how can I have a settled output (perhaps in 10ms) for any value of resistance?
Normally there is an error amplifier that looks that the output voltage and adjusts the duty cycle. If the voltage is wrong the duty cycle is adjusted.

#### William Johnson

Joined May 25, 2024
26
Is this a repeat of another thread?

This is actually very typical in converters. The solution normally is to add a slow start circuit. That provides a more narrow pulse during start up that gradually increases in width until it reaches the final value. It may also help to add an error amplifer and some negative feedback, but even with that you may need the slow start circuit. If you do not want to add feedback, then you should create a slow start circuit.
The exponential part of an inductor and resistor current is the main cause of this problem but with the slow start circuit it reduces the startup overshoot by a lot.
Hello, by slowly increasing the pulse width, do you mean that I should increase the input DC supply voltage 5V gradually from 0 to 100% duty cycle? Or the gate pulse to MOSFET from 0 to 50%?
Thanks

Last edited:

#### William Johnson

Joined May 25, 2024
26
I will look into this..

#### MrAl

Joined Jun 17, 2014
11,693
Hello, by slowly increasing the pulse width, do you mean that I should increase the input DC supply voltage 5V gradually from 0 to 100% duty cycle? Or the gate pulse to MOSFET from 0 to 50%?
Thanks
Hello again,

Well let's say that for a given output voltage (2v, 5v, 10v, etc.) the pulse width is supposed to be at a 70 percent duty cycle. If the circuit is turned on and the pulse width jumps right up to 70 percent duty cycle then we see the problem you are seeing with the overshoot. The idea is to start at low duty cycle (maybe even 0 percent) and then gradually increase to 70 percent.
The controller chip has a lot to do with it too though, if you use one. The controller chip may be able to do this already, but if not, then you force it to start with 0 percent and gradually allow it to go up to the full required duty cycle (like 70 percent).
If you choose to use a constant 70 percent (no controller chip) then you can do the same thing. Just start at 0 percent and gradually increase to 70 percent.
It's probably going to be better with a controller chip though because that will keep the output constant even if something changes like the input voltage.
It depends on what you need from the circuit of course.

The 'slow start' circuit is often needed even with a controller chip that does not have that already built in. That's because the characteristics of the internal circuitry are different when the circuit first starts up then after it has been running for some time, even a short time. The amplifiers often take time to ramp up to the normal operating region and during this time there is no feedback. The output is zero so the error amp thinks it has to bang the output with the full possible duty cycle, and then once it does, it takes time to cut it back to the required duty cycle. That causes overshoot also. This is very typical and why slow start circuits came into existence for the most part.

Last edited:

#### ronsimpson

Joined Oct 7, 2019
3,204
Hello, by slowly increasing the pulse width, do you mean that I should increase the input DC supply voltage 5V gradually from 0 to 100% duty cycle? Or the gate pulse to MOSFET from 0 to 50%?
In the real world you cannot make a supply that goes from 0 to 5V in 0nS. In SPICE you can.
Real PWM ICs have a soft start function that helps with the overshoot.
Real PWM ICs have an error amplifier that will keep the overshoot down.
Real PWM ICs have a current limit function that will force the duty cycle to be reduced during startup.
You used V2 to make the duty cycle. It would be hard to make it have a soft stare.
Another way to reduce overshoot is to slowly bring up the power supply.

Either add soft start by starting at 0% and increasing to 50% in 1mS
OR
Add a current limit function to reduce the duty cycle when the input current is too large.
OR
Slowly bring up the supply voltage.

#### William Johnson

Joined May 25, 2024
26
In the real world you cannot make a supply that goes from 0 to 5V in 0nS. In SPICE you can.
Real PWM ICs have a soft start function that helps with the overshoot.
Real PWM ICs have an error amplifier that will keep the overshoot down.
Real PWM ICs have a current limit function that will force the duty cycle to be reduced during startup.
You used V2 to make the duty cycle. It would be hard to make it have a soft stare.
Another way to reduce overshoot is to slowly bring up the power supply.

Either add soft start by starting at 0% and increasing to 50% in 1mS
OR
Add a current limit function to reduce the duty cycle when the input current is too large.
OR
Slowly bring up the supply voltage.
I did implement your first suggestion. But it didn't make a difference. Am I making an error somewhere in understanding or implementing, I'm not sure.

#### Attachments

• 3.5 KB Views: 1

#### ronsimpson

Joined Oct 7, 2019
3,204
I don't see any overshoot.

#### William Johnson

Joined May 25, 2024
26
I don't see any overshoot.
The expected output is 18V (Vdc_18,Vcom) and -5V (Vdc_-5,Vcom). However, for a load resistor of 1k, the obtained output voltages are 49V and -13.59V, for as long as 100ms.

#### William Johnson

Joined May 25, 2024
26
Hello again,

Well let's say that for a given output voltage (2v, 5v, 10v, etc.) the pulse width is supposed to be at a 70 percent duty cycle. If the circuit is turned on and the pulse width jumps right up to 70 percent duty cycle then we see the problem you are seeing with the overshoot. The idea is to start at low duty cycle (maybe even 0 percent) and then gradually increase to 70 percent.
The controller chip has a lot to do with it too though, if you use one. The controller chip may be able to do this already, but if not, then you force it to start with 0 percent and gradually allow it to go up to the full required duty cycle (like 70 percent).
If you choose to use a constant 70 percent (no controller chip) then you can do the same thing. Just start at 0 percent and gradually increase to 70 percent.
It's probably going to be better with a controller chip though because that will keep the output constant even if something changes like the input voltage.
It depends on what you need from the circuit of course.

The 'slow start' circuit is often needed even with a controller chip that does not have that already built in. That's because the characteristics of the internal circuitry are different when the circuit first starts up then after it has been running for some time, even a short time. The amplifiers often take time to ramp up to the normal operating region and during this time there is no feedback. The output is zero so the error amp thinks it has to bang the output with the full possible duty cycle, and then once it does, it takes time to cut it back to the required duty cycle. That causes overshoot also. This is very typical and why slow start circuits came into existence for the most part.
Hello, I did try that out. Does not see to work :/
Increased the duty to the switch gradually from 0 to 50%. I still am getting correct output voltages (18V and -5V) for 100 ohms load, but rather high voltages that do not settle for as long as 100 ms (and definitely for much beyond) for a 1k ohm load.

#### ronsimpson

Joined Oct 7, 2019
3,204
I was working with the LT3473 so I used it. Not the best fit but works.
In the IC there is a MOSFET from SW to GND. C3 is soft start. FB in monitors the output 18V and adjusts the duty cycle.
I tested with 1k and 100 loads.

#### MrAl

Joined Jun 17, 2014
11,693
Hello, I did try that out. Does not see to work :/
Increased the duty to the switch gradually from 0 to 50%. I still am getting correct output voltages (18V and -5V) for 100 ohms load, but rather high voltages that do not settle for as long as 100 ms (and definitely for much beyond) for a 1k ohm load.
Hello again,

Well you do have to realize that most of the time a controller chip of some kind is used. If you can't do that, then you might have to try starting with 100 Ohms and then increasing to 1k once the circuit starts up. That may not work either though because inductors act a little strangely during start up. Once the load is switched to 1k it may jump up anyway.
I'll run the simulation and see what I get.

Ok taking another look at this, I believe you will have to use a controller chip. That's because the circuit needs to decide what duty cycle to set as the output rises. That means it can adjust the duty cycle dynamically rather then in a static way as we did with a manual increase in duty cycle. A controller may bang the output up and be able to catch the overshoot just before it gets too high, and thus cut back and start to regulate right away. This might be the only solution unless you wanted to experiment with setting the duty cycle in well-controlled steps manually. Manually means with a ramp generator or similar, but it could involve a very nonlinear increase which would mean using a set of resistors and switch them in one at a time ... probably not worth the effort. Of course with a DAC you could step the duty cycle up any way you wanted to using a microcontroller, but that seems like too much just for a regulator circuit.

Last edited: