# PWM in a switching power supply

Hi,

First of all, I'm trying to figure out how switching power supplies
work (the ones in PCs). I've found very basic info, but I want more
technical stuff. If anyone has some good links please let me know.
These are questions I have yet to find an answer for.

Anyway, here's my question. One thing I read was that the output
voltage of the supply is fed back to the PWM which changes it's duty
cycle accordingly to keep the output voltage constant. But I thought
that the input-to-output ratio of a transformer is fixed. If the PWM
is outputting 100V at 20KHz to a 10:1 transformer, you get out 10V at
20KHz, right? What does it matter what the duty cycle is? It's still
100V at 20KHz. What am I missing?

Second, why does a switching power supply break without a load?

Third, in all my years in electronics, I have never used a choke, now I
see them all over these power supplies. Can someone clue me in about
what they do, and why they are in these things?

I appreciate any info at all. Thanks a lot.

2. ### w_tomGuest

Duty cycle changes the energy of frequencies (sine waves of
different frequencies) that, together, form a square wave.
Learn about Fourier series (from math books) to better
appreicate the concept. As duty cycles change, then more
energy may appear in a higher frequency sine wave. Those
higher frequencies dissipate more energy in the transformer.
Best to have only a frequency at the ideal transformer
frequency. But then duty cycle would not change to adjust
output voltage. Less efficiency for better voltage
regulation. This and other compromises are why the switching
power supply cannot have 100% efficiency.

Unloaded switching power supplies do not break. Some
switching power supplies do not operate well in a no load
condition; so power supply shuts down without damage.
Characteristics of each design. Important is even how the
transfomer is designed. Numerous design compromises are
involved. Many switching power supplies work just fine under
no load. Which ones? The long list of numeric specs should
be provided for each switching power supply model.

Chokes permit energy at some frequency to be converted to
energy at other frequencies. Chokes permits the design to
intergrate filters with sharper cutoff frequencies. Chokes
are essential to better EMC solutions. Chokes can store
energy at certain key operational points. But chokes cost
money. Some power supplies are designed to cut costs rather
than meet standard criteria. To better appreciate the value
and energy conservation of chokes, learn fundamentals of
filter design. Concepts that also better explain what happens
as duty cycle changes.

3. ### John PopelishGuest

If the transformer is a voltage output (produces some ratio of the
primary voltage when the switches are on) and zero the rest of the
time), then, yes, the peak output voltage is essentially independent
of the duty cycle. but those kind of transformers also require an
additional LC filter that outputs a voltage about equal to the average
input voltage, not the peak. Holding the peak voltage for a smaller
part of the cycle lowers the average voltage.

In supplies, where the transformer acts as an energy storage device
(apply input voltage, till the primary current ramps up to some value,
then cut the primary current, forcing the stored energy to reverse the
winding voltage and go up till an output rectifier connects the
transformer secondary to some storage capacitor). the average energy
throughput depends on how high the energy each charge-discharge cycle,
and how many cycles per second, and if the stored energy is all dumped
each cycle, or only some of it (whether or not the primary switch is
left off till the transformer dumps all its magnetic energy, or is
turned back on while the dump is in progress).
Break? As in Kablooie? I don't know about that, but many
malfunction, because the control loop gain is dependent on the load
current. That is, the gain goes up as the load decreases. Stability
requires that the loop gain fall as frequency rises, so that before
the frequency is reached where the loop phase shift swings by 180
degrees (compared to low frequencies) the gain has fallen below 1, so
that the negative feedback (converted to positive feedback by the
extra phase shift) cannot generate a self sustaining echo.
There are just inductors. They store energy proportional to the
inductance and proportional to the square of the current passing
through them. Once you get up into significant currents, they become
as useful and necessary for energy storage as capacitors. Whereas
capacitors pass current in order to control the rate of change of
their voltage, inductors generate voltage across them to control the
rate of change of the current through them. If you want to absorb
current pulses and stabilize voltage, you use a capacitor. If you
want to absorb voltage pulses and stabilize a current, you use an
inductor. And we are back to that averaging filter that is needed to
smooth out the current from that pulsing voltage, variable duty cycle,
constant peak voltage rectified transformer so that it can be
connected to a storage capacitor where the voltage is to be regulated.

Yes, the _instantaneous_ output voltage of the transformer is still 10V.
The output of the transformer is feed to some form of filtering -- usually a
series inductor and parallel capacitor -- and the output voltage then found
across the capacitor is the _average_ of the input voltage. So... 10V
instantaneous output from the transformer at 100% duty cycle gets you 10V
across the capacitor... 50% duty cycle would get you 10V instantaneous output
from the transformer for half the time and 0V for the other half of the time,
so this averages to 5V across the capacitor... etc...

(This is somewhat simplified; in actuality the voltage change a little due to
diode drops, active device losses, etc. -- the feedback loops jiggles the duty
cycle until the right regulated output voltage appears, though.)
Because the designers are either (1) ignorant or (2) cheap.

OK, actually, not all switchers have no-load problems. What happens -- and
this is for the most basic example you could come up with, something like a
simple buck converter -- is that during the time that the transformer (or
inductor) is being fed current, flux (current) builds up in it. When the
switch controlling this current is turned off, the current (flux) in the core
starts dropping. The rate at which it drops is proportional to the load...
bigger load (lower impedance), faster current drop. With a "big enough" load,
the current goes all the way to zero. On the next switching cycle, the
current ramps up again to some current, then ramps down to zero, etc. -- this
repeats forever.

Now, with a small load, while the current does drop, it doesn't go all the way
to zero before the next switching cycle. Now current ramps up again and -- if
one isn't careful in design -- the current ends up higher than it was at the
turn-off point of the last cycle. It drops a little again (but not to zero),
and now at the next turn on the current is driven even higher. Sooner or
later, the inductor saturates, which tends to look almost (but not quite) like
a short circuit to the driver. That driver starts having massive current run
through it, heats up, and sooner or later dies.

Hence, there's some minimum load that causes the switcher to change from
discontinuous to a continuous mode of operation, and for loads lighter than
this you can get into trouble.

If you think about it for a moment, it's clear you could simply detect the
current in the core and quit driving it when you start to approach
saturation -- this simple solution is what "current mode" switchers do, and
they usually don't have no-load problems. In fact, if you think about it even
more, even in the case with regular "voltage mode" feedback, since the current
in the core is increasing, the output voltage will as well, so the feedback
regulator should keep clamping down on the duty cycle so as to avoid
saturating the core. The problem here is that the 'transfer function' of the
power supply from input to output is different when it's operating in this
'continuous' mode rather than 'discontinuous' mode, and it takes more effort
to build a feedback network that can keep the entire 'loop' stable in both
modes (and without starting to become slightly sophisticated in your feedback
response, which isn't desirable). Hence, for both the sake of cost (the extra
feedback network circuitry) or merely ignorance on the part of the designer,
some power supplies turn over and die when run without a minimum load.
Ummm... you know what capacitors do, right? You 'feed' them a current and
this causes charge to accumulate within them such that a voltage appears
across them? Inductors are their 'dual' -- you 'feed' them a voltage and this
causes flux to accumulate within them such that a current flows throughout
them. Hence, just like a capacitor, inductors can be used to store energy.
With an inductor, by varying the duty cycle of a voltage across it, you can
'charge up' the inductor to some arbitrary average current and then 'dump'
this into a load to get a corresponding voltage. This makes it easy to make
regulated _voltage_ power supplies, whereas a similar approach with capacitors
would get you a regulated _current_ power supply.

I'd suggest checking out Abraham Pressman's switching power supply book. It's
not cheap, but it's written by a guy who seemed far more intent on building
working power supplies than doing more theoretical research. It does of
course have some math in it, but even someone with one semester of caclulus
will probalby be able to follow it.

---Joel

W_Tom,

Uh, no, it doesn't! If I give you a periodic signal of a certain frequency,
it doesn't matter WHAT it 'looks' like, its Fourier spectrum will ONLY contain
the fundamental frequency and harmonics. Changing what it 'looks' like (e.g.,
the duty cycle of a square wave) only changes the magnitudes of the harmonics.
Overall most switchers lose far more efficiency in the switches than they do
in the core.
Some do. Although you could convince me that such switchers are, by
definition, poorly designed.
Where do you get this stuff? Some generic "everything you wanted to know
about electronics" encyclopedia? A lot of what you say is factually correct,
just not at all relevant to the discussion at hand.
Someone who's an expert at filter design could very well not know the first
thing about switcher design. They're pretty disparate areas of design, and
really only start to overlap somewhat when you discuss output filtering,
resonant designs, etc.

OK, I got it, the output is filtered to create a stable voltage that is
the average of the duty cycle. But now I'm wondering, what is the
purpose of the transformer? If you want to convert 100V to 10V, why
not filter the output straight from a PWM with a 10% duty cycle?
What's the difference?

Thanks a lot.

7. ### w_tomGuest

A switching power supply could easily provide those voltages
without the expensive transformer. But a power supply must
also perform many other functions including galvanic
isolation. For computers, this breakdown voltage must exceed
1000 volts. Therefore the transformer (to send power to the
load) and the feedback circuit (to regulate output voltage and
other functions) must both provide that galvanic isolation:
First and foremost for human safety reasons. Second for
transistor safety.

8. ### w_tomGuest

... its Fourier spectrum will ONLY contain the fundamental
That's correct and consistent with what I had posted. Those
harmonics are the different frequencies. As those harmonics
increase magnitude (contain more energy), then the transformer
is confronted by other frequencies with more power. As noted
earlier, this can cause increased energy dissipation in the
transformer and elsewhere.

Meanwhile I did not even try to say where most energy is
lost. Why do criticize me for something that was not even
posted? To argue semantics?

Any power supply that is damaged by a no load condition is
typical of something bought by a bean counter - the enemy of
innovators, responsible manufacturers, and those educated in
computer electronics. No load must not damage a properly
designed switching power supply.
So what? That is not what I said and is completely
irrelevant to what I did say. A filter expert need not know
anything about switching power supplies. But a power supply
designer better damn well understand the principles of filter
design. Why does Joel read reverse logic into a post? Why
post what is both irrelevant and not even stated? Joel is
arguing semantics rather than trying to help or answer the
OP. Don't let him confuse you.

9. ### JamieGuest

if you very the duty cycle alway from 50%, you get an un-even charge and
discharge in the coils of the transformer. this interaction produces is
low output on the secondary.
its gets much deeper than that, but it's just a simple starter for
just think of charging a cap for 10 secs, but only let it discharge
for 1 sec. you will see that the charging current duration is very short
after the first initial charge.

10. ### JamieGuest

high freq is much easier to filter, uses much smaller caps..
also using a switching supply allows you to put the driving
components in saturation or even used things like Power fets to
put the path in near 0 ohm thus generating very little heat and
making the power efficiency much higher and smaller components.

11. ### John PopelishGuest

Energy is passing from transformer to filter only during the "on" part
of the duty cycle, The larger the % on time, the lower peak energy
that must pass during the peak to satisfy the average energy flow.

You could also move an automobile by setting sticks of dynamite off
behind it a small percentage of the time, but the peak forces would
have to be pretty high to make up for the average force needed to keep
the car moving. The windings in the transformer and the switch on the
primary side are also affected by the peak verses average energy
flow. For this reason, one normally wants to have the duty cycle just
hit 100% at full output load and minimum input voltage, to keep the
minimum duty cycle under other conditions as high as possible.

Good question.

12. ### PeteSGuest

There are excellent resources for switching power supplies at all the
major manufacturers (TI, Linear Tech, Maxim and others).

One of my favourite design notes is from Linear Tech:

(AN-73 [pdf] at http://www.linear.com/ should the link not work). This
shows the basic principle of the Switchmode power supply using a
specific device as an example, with the coil used as (as noted) an
energy storage device.

As to why some switching power supplies 'break' with no load, I would
agree it could be poor design, although to be fair to the designers
they may be designed for a specific load. Much depends on the specifics
of the type :
Topologies:
Buck (Step down)
Boost (Step up)
Buck-boost (inverting, usually)
SEPIC (step up and step down - for isntance, generate +5V from a
nominal 6V battery that may have an actual range of 4V to 7V)

Mode:
Current. Inductor (or switch) current is controlled directly
Voltage. Output voltage is controlled directly
Generally, current mode controllers are insensitive to *input voltage*
variations and voltage mode controllers are insensitive to *output
current* variations.

A switching power supply (actually, any regulated power supply) is a
closed loop system that has various (and numerous) filter elements in
the loop. To get regulation employs negative feedback (i.e. an output
variation causes a change at the input such as to [partially] negate
the output variation).

What makes negative feedback negative is the effective phase of the
feedback signal. The filters in the loop add their own phase
characteristics, and if not carefully considered cause sufficient phase
shift in the loop to make the negative feedback positive - giving an
oscillator if it happens at unity gain. This is one of the [many
possible] things that can happen at no load.

Feedback loops of this type have many analogies - the most basic
principles are found in servo theory.
For an excellent app note on loop compensation (the art of keeping
negative feedback negative) for a current mode controller, see
(AN-76, once more from http://www.linear.com/ )
For the filters, the relevant equations

Capacitive filters:
Fx = 1/(2*pi*R*C) where R is the equivalent resistance of the ffilter
and Fx is the Frequency at which the difference between input and
output is 3dB, which is also the point at which the phase difference
between input and output is 45 degrees. The phase and relative
amplitudes may be either leading or lagging depending on the filter
configuration (a leading phase filter is known as a zero, a lagging
phase filter is known as a pole)

Forr voltage mode controllers, there is a 2-pole filter at the output,
given by 1/(2*pi* [sqr(LC)]) where L is the output inductor and C the
effective output capacitance. At this frequency, there is 180 degrees
of phase shift at the output.

Each pole (or zero) has a phase response of 45 degrees per decade, and
an amplitude response of 20dB per decade (alternatively, 6dB per
octave). (Note to others - I realise the filters may be -45 or +45 and
amplitude response could be rising or falling)

So there's a lot of terminolgy and a lot of fundamentals to learn to
understand these things.
I think there's plenty of reading noted here to be getting on with if
you want to understand the subject

Cheers

PeteS

13. ### w_tomGuest

Peter discusses (among many good points) the feedback
circuit in switching power supplies.

A power supply failed repeatedly in the field (I later
learned was also failing in the shop; but the failure was
ignored). The feedback optocoupler required a gain of 150. I
also learned that finding gains of 150 was all but
impossible. So the bean counters installed a lower gain
optocoupler. Therefore the power supply would sometimes -
rarely - but sometimes not power up and sometimes just
shutdown arbitrarily. IOW the power supply was 100% defective
- but was shipped because it usually passed tests. With
insufficient feedback, it was unstable - failed
intermittently. Cost thousands of dollars to replace that
defectively manufactured power supply.

Power supplies break for many reasons. This manufacturer
I'll never forget nor forgive that company. They tried to
claim it was due to insufficient load when even their own spec
sheets said that load was sufficient.

Feedback is a concept taught in control systems. Like
filter design, the power supply designer must also have
fundamental comprehension of feedback control loops.

The user need not understand these technical issues. This
is where manufacturer spec sheets, manufacturer reputation,
and workers with power to flag problems are so much a part of
the system design process. But a power supply design is quite
complex - for something regarded by users as so trivial.

Awesome! That really answered my question. Thanks for all the help

Your "100V input" is typically going to vary between, say, 95-105V.
Similarly, depending on just how heavy the load on the "10V" side is, the
extra current will cause various losses so that your output would tend to vary
between, say, 9.5-10.5V even with a perfect 100V input. (How well a power
supplies copes with the former problem is called "source regulation" and how
well it copes with the laters is "load regulation.")

You do occasionally see some really cheap 12V->24V or 12V->6V DC/DC converters
out there that use a fixed ~50% duty cycle and figure the output will be
"close enough."

Hi W_Tom,

Hmm... if you say so. That's sure not how I read your post.
Yes, certainly true, but not really relevant to what a beginner needs to know.
For a bench supply or even a PC power supply, I'm tempted to agree with you.
For embedded applications in cut-throat markets (TVs are a very good example),
it's hard to ignore the cost savings that can be achieved by not bothering to
make your power supply unconditionally stable when you 'know' there will
always be a minimum load around.
It's the consumer who pushes the bean counters to skimp on parts count and/or
quality. Although the US is a wealthy country that can readily afford to pay
a couple bucks extra for a better computer power supply, this isn't true in
all parts of the world (e.g., China). It's not the kind of engineering work I
want to do, but I can see the justification for designing these really awful
PC power supplies that cost literally no more than \$10 but can readily blow-up
if you look at them crosseyed.
Mnay people get along just fine with being able to analyze single section
filters (both the main L-C 'power' filter and something cheesy like an R-C
feedback loop filter). Now, you may consider than the "principles of filter
design," but personally I would say that someone well versed in such
"principles" is more like to be able to spout off about Chebychev filters,
group delay, Butterworth pole positions -- that sort of thing -- than just
what simple LC and RC filters do. (I realize many power supplies do have
"fancy" filters in the feedback path, I'm just saying plenty of them don't and
I don't think you really need to know that much about filter design to make a
workable switcher.)

---Joel

17. ### w_tomGuest

Somewhere was an 85(?) page introduction (from linear.com)
to switching power supply design. Up front was a flow chart
that asked if one wants to design a supply? The Yes path lead
to a message that asked, "Are you Nuts?" Power supply design
is complex. As demonstrated here, one must have knowledge of
filters, feedback systems, principles of power systems, EMC,
UL approval, FCC regulations, etc. A beginner must first
decide how much will be learn before his eyes disappear into

If consumer pushed bean counters to reduce costs, then Honda
and Toyota would not be dominant and growing car companies.
Bean counters typically increase product costs - at least in
the long term. It explains why GM has so many problems. Cost
controls increase costs. To reduce costs, obtain more
customers, create new markets, increase market share, create
jobs, create wealth, increase product efficiency, etc... all
require the most important thing - innovation. The US is a
miser as are most every other nation. To sell in the US or
anywhere else, the power supply manufacturer must innovate -
not cost control. Meanwhile the US does have standards that
some other nations do not have - for power supply performance,
reliability, safety, emissions, and .... Europe has even
tougher standards.

Most supplies, to be profitable, must be designed to operate
anywhere in the world - either as a universal supply or with
different options for different regions. Just another example
of innovation; the alternative being bankruptcy. Just another
reason why (outside of niche markets), the power supply
designs must meet fairly universal world standards.

Tell us about harmonics? Do we solve this problem with
filters, or what else? Will a power supply create too much
harmonics AND will it operate when line harmonics are high?
I recall the Intel spec that even demands output transient
response - another factor in a feedback control system
innovation - where costs are only one small part of a
profitable design. The only way to cut costs and remain
competitive - innovation.

A large market for inferior supplies exists that create
problems such as computer system damage and intermittent
failures. All power supply outputs must even be shorted and
still not damage the supply. This too has been defacto

We have demonstrated how much is basic information on power
supplies. IOW, "your nuts" in that flow chart should be
appreciated. 85(?) pages in that introduction paper
demonstrates how complex a switching power supply really is
and why a properly constructed supply selling for only \$65
retail is a marvel of free market economics.

critical functions were forgotten to sell that supply only on
price. Yes, some sell power supplies only using cost
controls.

18. ### Terry PinnellGuest

The following thread I started a couple of days ago may also be

From: Terry Pinnell <>
Newsgroups: sci.electronics.design
Subject: Rating of PC power supplies?
Date: Sun, 29 May 2005 07:10:38 +0100
Message-ID: <>

In particular, Franc Zabkar posted this link to a detailed schematic:
http://www.pavouk.comp.cz/hw/en_atxps.html

19. ### PeteSGuest

Regarding Joel's notes on filter sections, it is true that in many
instances a relatively simple filter calculation may be done for a
workable switcher, but that depends on a number of things.

For a voltage mode controller, a widely varying input makes life
difficult and is where a multipole (4 or even 5 filter sections) may be
necessary, with the same provision applicable to large load steps for a
current mode controller.

Where one has both (the usual situation in a lot of embedded systems
nowadays), then a thorough knowledge of filter theory is certainly an
advantage when one must do their own switcher, even though one may use
spice programs; the issue is to use the program effectively, a
knowledge of what one is doing helps

There are a number of reasons for designing one's own, including space,
efficiency, unusual output voltages (althoguh there are 'adjustable'
bricks out there) and Vin / Vout functions that have a particularly
wide range. As an example, I had to do one that had 10-14V in nominal,
1.2V out, at loads from ~0 to 45A, with load steps of <30A in
<2millisec, and efficiency was required to be >90% across the load and
input range. That was quite a challenge. I managed to achieve >94% with
the assistance of the vendors involved.

I deliberately did not even attempt to cover everything (that's a
subject in it's own right that many spend entire careers on, and I
thank them for their assistance , but merely try to point out that
the loop filter is a critical issue in the design of a switcher
(although one may use the 'suggested application' in many cases) that
requires some attention, and is critical to understanding failure
causes.

Cheers

PeteS

20. ### w_tomGuest

To demonstrate the complexity of power supplies - the so
many functions that must be part of a minimally sufficient
supply: Take that example supply from www.pavouk.comp.cz.
Notice the feedback and voltage divider circuit as discussed
by Franc using equations. That supply does not provide
sufficient galvanic isolation. All appliances must have
internal transient protection. Intel specs demand that
computers be even more robust. But that feedback circuit does
not provide thousands of voltages of isolation. That's right -
thousands of volts. An optoisolator for galvanic isolation
should have been located where those feedback resistors are
located.

galvanic isolation? Maybe. Maybe not. But galvanic
isolation is but another function in power supply design.
This noted because so many buy power supplies on price that
are then missing essential internal functions. Does your
clone computer power supply provide galvanic isolation? If
not, then internal transient protection has been compromised.

This posted just to demonstrate but another complication of
power supply design.