Why switch?
A laptop charger takes 230 V or 120 V AC from the wall and delivers, say, 20 V DC over a USB-C cable. Inside the laptop, other converters turn 20 V into the 1 V or so that the processor's cores need, at tens of amperes. An electric car turns 400 V or 800 V DC from its battery into three-phase AC of variable frequency for its motor, and a solar farm turns the DC of its panels into AC synchronised to the grid. Every one of these conversions is done by power electronics, and almost all of them at efficiencies of 90 to 99%.
The obvious way to drop a voltage is a linear regulator: a transistor in series with the load, partly on, acting as a variable resistor. It is simple and quiet, but it burns the difference. Dropping 12 V to 1 V at 50 A this way would deliver 50 W to the processor and waste W in the transistor: an efficiency of 8%.
The trick of power electronics is to use transistors only as switches, fully on or fully off. An ideal switch dissipates nothing in either state: when it is on the voltage across it is zero, and when it is off the current through it is zero, so always. The switches chop the input into pulses, and inductors and capacitors, which store energy without dissipating it, smooth the pulses into the output we want. All the losses come from the ways real switches, inductors and capacitors fall short of ideal, and engineering them down is most of the craft.
Note
Safety. Mains-powered converters, chargers and power supplies contain capacitors charged to around 400 V that can stay charged long after the plug is pulled, and EV and solar converters work at hundreds of volts DC, which is especially dangerous. Never open a charger, a power supply or anything plugged into the mains. To experiment, use simulation, as in this lesson, or a low-voltage converter kit powered from a current-limited bench supply or a small battery pack at a few volts.
The switches
Power converters are built from a handful of semiconductor switches. You met their small-signal cousins in Semiconductors and diodes and Transistors; here what matters is how much voltage they block when off, how much they dissipate when on, and how fast they switch.
Definition— Power semiconductor switches
- A power diode conducts in one direction only, with a forward drop of 0.3 to 1 V or more, and turns on and off by itself as the circuit's voltages change. Schottky diodes have low drops and switch fast.
- A power MOSFET is a voltage-controlled switch that behaves, when on, like a small resistance , from about a milliohm in low-voltage parts upward. It switches in nanoseconds. It also contains an intrinsic body diode from source to drain.
- An IGBT (insulated-gate bipolar transistor) is driven like a MOSFET but conducts like a bipolar transistor, with a roughly constant on-state drop of 1 to 3 V. It suits high voltages (from 600 V to 6.5 kV) and high currents, but switches more slowly and so at lower frequencies, typically a few to tens of kilohertz.
- Wide-bandgap devices are made of semiconductors whose bandgap is about three times silicon's (1.12 eV): silicon carbide (SiC, 3.26 eV for the 4H polytype) and gallium nitride (GaN, 3.4 eV). A wider bandgap supports a critical electric field roughly ten times higher, so a device can block the same voltage with a much thinner, more heavily doped drift layer, with lower resistance and less stored charge. SiC MOSFETs (from 650 V to 3.3 kV) switch faster than silicon IGBTs at similar voltages and tolerate high temperatures; GaN transistors (mostly up to 650 V) switch fastest of all.
The choice follows the voltage and the frequency. A 12 V-to-1 V converter for a processor uses silicon MOSFETs at hundreds of kilohertz to a few megahertz. A compact 65 W USB-C charger increasingly uses GaN, because faster switching allows a smaller transformer. An 800 V electric-car inverter uses SiC MOSFETs, and the main inverters of many cars on 400 V batteries now do too. A wind turbine's converter or a locomotive's drive uses silicon IGBT modules, and the largest HVDC converters use IGBTs or thyristors by the thousand. These devices are made by many companies in Europe, the United States, Japan and China, and wide-bandgap manufacturing has expanded quickly since the late 2010s.
The buck and boost converters
The buck converter (left) switches its input onto a node for a fraction of each switching period , the duty cycle. The switch-node voltage is a train of pulses, for time and about 0 V (through the diode) for . The inductor and capacitor form a low-pass filter that passes the pulses' average, , and blocks most of the switching frequency. The way to make this precise, and to analyse any converter, rests on two facts about periodic steady state.
Theorem— Volt-second and charge balance
In periodic steady state (every waveform repeats each period ), the average voltage across any inductor is zero, and the average current into any capacitor is zero.
Proof
For an inductor, . Integrating over one period, , because the current repeats. Dividing by , the average of is zero. For a capacitor, and the same argument with gives an average of zero.
∎
Buck. With the switch on, the inductor sees for ; with it off, for (taking the output as nearly constant and the diode as ideal). Volt-second balance: Charge balance on the output capacitor says the inductor's average current equals the load current. The inductor current ramps up by while the switch is on and down by the same amount while it is off: This triangular ripple flows into the capacitor; the charge it delivers above the average, a triangle of area , raises the capacitor's voltage by the output ripple of an ideal capacitor. (A real capacitor's equivalent series resistance adds , often the larger term.)
Boost. In the boost converter (right) the inductor sits at the input. With the switch on, the inductor is across the input and charges: for . With it off, its current is forced through the diode into the output: for . Volt-second balance: At the boost doubles its input; the input current is times the output current, so power is conserved. Combine the two ideas and you get the buck-boost (), and put a transformer in place of its inductor and you get the flyback, the isolated converter inside most small chargers.
A buck converter, simulated
Here is a buck converter of the kind on a laptop's motherboard, stepping 12 V down to 5 V at 2 A at a switching frequency of 500 kHz, with H and F. The simulation steps the inductor current and capacitor voltage through time, 480 steps per switching period, with an ideal switch and diode, starting from rest.
import numpy as np
# A buck converter: 12 V in, 5 V out at 2 A, switching at 500 kHz (ideal switch and diode).
V_in, V_target = 12.0, 5.0
f_sw = 500e3
L, C, R_load = 4.7e-6, 22e-6, 2.5
D = V_target / V_in # duty cycle from volt-second balance
T = 1 / f_sw
steps = 480 # time steps per switching period
on_steps = round(D * steps) # 200 of them with the switch on
dt = T / steps
periods = 750 # 1.5 ms: long enough for the LC filter to settle
i_L = v_C = 0.0
v_peak = 0.0
last = [] # (time, i_L, v_C) over the last few periods
for p in range(periods):
for s in range(steps):
on = s < on_steps
v_sw = V_in if on else 0.0 # the switch node: V_in, or 0 V through the conducting diode
i_L += dt * (v_sw - v_C) / L
if i_L < 0: # the diode blocks reverse current (discontinuous mode)
i_L = 0.0
v_C += dt * (i_L - v_C / R_load) / C
v_peak = max(v_peak, v_C)
if p >= periods - 20:
last.append((s * dt + p * T, i_L, v_C))
t, i, v = map(np.array, zip(*last))
dI_formula = (V_in - V_target) * D / (L * f_sw)
dV_formula = dI_formula / (8 * f_sw * C)
print(f"duty cycle D = {D:.4f}")
print(f"output: average {v.mean():.3f} V, ripple {1e3 * (v.max() - v.min()):.1f} mV peak to peak"
f" (formula {1e3 * dV_formula:.1f} mV)")
print(f"inductor current: average {i.mean():.3f} A, ripple {i.max() - i.min():.3f} A peak to peak"
f" (formula {dI_formula:.3f} A)")
print(f"start-up overshoot: output peaked at {v_peak:.2f} V")
print("\ninductor current over one switching period (each # is 0.1 A above 1.2 A):")
for k in range(0, steps, 30):
print(f"{t[k] * 1e6 - t[0] * 1e6:5.2f} us {'ON ' if k < on_steps else 'off'} {i[k]:.3f} A "
+ "#" * int(round((i[k] - 1.2) / 0.1)))The simulation and the formulas agree: 5.000 V out at 2.000 A, with 1.242 A of inductor ripple (formula 1.241 A) and 14.1 mV of output ripple (formula 14.1 mV), about 0.3%. The start-up is another matter: switched on at the full duty cycle, the undamped LC filter rings, and the output overshoots to 8.75 V, enough to damage a 5 V load. Real controllers prevent this with a soft start that ramps the duty cycle up over a few milliseconds, and they regulate the output with a feedback loop (designed with the tools of Feedback control) rather than trusting a fixed .
The same converter in SPICE, with a real switch resistance and a Schottky diode model, shows what ideal models leave out:
* Buck converter: 12 V to 5 V at 2 A, 500 kHz, with a Schottky freewheeling diode
Vin in 0 DC 12
Vgate gate 0 PULSE(0 1 0 1n 1n 0.8323u 2u)
S1 in sw gate 0 SWMOD
D1 0 sw SCHOTTKY
VIL sw lx DC 0
L1 lx out 4.7u
C1 out 0 22u
Rload out 0 2.5
.model SWMOD SW(Vt=0.5 Vh=0.1 Ron=0.02 Roff=1e7)
.model SCHOTTKY D(Is=2e-6 N=1.05 Rs=0.02 Cjo=200p)
.tran 5n 1.5m 0 5n
.control
run
meas tran vout_avg AVG v(out) from=1.4m to=1.5m
meas tran vout_max MAX v(out) from=1.4m to=1.5m
meas tran vout_min MIN v(out) from=1.4m to=1.5m
meas tran il_max MAX i(VIL) from=1.4m to=1.5m
meas tran il_min MIN i(VIL) from=1.4m to=1.5m
let ripple_mv = 1000 * (vout_max - vout_min)
let il_ripple = il_max - il_min
print ripple_mv il_ripple
.endc
.endngspice reports an output of about 4.75 V instead of 5 V, with a ripple of about 14.6 mV and an inductor ripple of about 1.28 A. The diode's forward drop, about 0.4 V for the part of each period, lowers the switch node's average: volt-second balance now gives . In a real product the feedback loop would raise to about 0.44 to restore 5 V, and a low-voltage design would replace the diode with a second MOSFET, switched in antiphase (synchronous rectification), whose few milliohms drop millivolts instead.
Inverters and PWM
An inverter turns DC into AC. Its building block is the half-bridge or leg: two switches in series across the DC supply, with the output taken from their midpoint, which is connected alternately to the positive and the negative rail. The two switches must never be on together, or they short the supply (shoot-through), so the controller leaves a short dead time, tens to hundreds of nanoseconds, between turning one off and the other on. Two legs make a single-phase H-bridge (which also drives a DC motor in both directions); three legs make the three-phase inverter of every variable-speed drive, electric car and solar or battery inverter.
To make a sinusoid with switches that are only on or off, the controller varies each leg's duty cycle smoothly. In sine-triangle PWM, a sinusoidal reference at the desired output frequency is compared with a fast triangular carrier; the upper switch is on whenever the reference is above the carrier. The leg's average voltage over each carrier period follows the reference, so its output contains the wanted sinusoid, of peak for a modulation index , plus harmonics clustered around multiples of the carrier frequency, which the motor's inductance or a filter removes easily.
The program below builds a three-phase inverter's three legs on a 400 V DC link, with , a 50 Hz output and a carrier at 99 times that, 4950 Hz, and takes the spectrum of one leg's voltage and of the line-to-line voltage between two legs.
import numpy as np
# A three-phase, two-level inverter with sine-triangle PWM.
V_dc = 400.0 # DC link voltage, V
f1 = 50.0 # output (fundamental) frequency, Hz
m_f = 99 # carrier frequency / fundamental: a multiple of 3, so f_carrier = 4950 Hz
m_a = 0.8 # modulation index: peak of the reference / peak of the carrier
N = 99 * 400 # samples in one fundamental period
t = np.arange(N) / (N * f1)
carrier = 2 * np.abs(2 * ((m_f * f1 * t) % 1.0) - 1) - 1 # triangle between -1 and +1
legs = []
for k in range(3): # legs a, b, c
reference = m_a * np.cos(2 * np.pi * f1 * t - 2 * np.pi * k / 3)
upper_on = reference > carrier # compare: upper switch on, or lower
legs.append(np.where(upper_on, V_dc / 2, -V_dc / 2)) # leg voltage from the DC midpoint
v_a, v_b = legs[0], legs[1]
v_ab = v_a - v_b # line-to-line output voltage
def amplitudes(x):
"""Peak amplitude of each harmonic (index n = n times 50 Hz) over one fundamental period."""
return 2 * np.abs(np.fft.rfft(x)) / len(x)
A_a, A_ab = amplitudes(v_a), amplitudes(v_ab)
print(f"expected fundamentals: leg {m_a * V_dc / 2:.1f} V peak, line-to-line {np.sqrt(3) * m_a * V_dc / 2:.1f} V peak")
print("harmonic frequency leg a (V) line a-b (V)")
for n in [1, 3, 5, 7, 11, 13, 95, 97, 99, 101, 103, 196, 197, 198, 199, 200]:
print(f"{n:8d} {n * f1:7.0f} Hz {A_a[n]:9.1f} {A_ab[n]:11.1f}")
low = np.sqrt(np.sum(A_ab[2:60] ** 2) / 2)
print(f"RMS of all line-to-line harmonics from 100 Hz to 3 kHz: {low:.2f} V")One leg's fundamental is 159.9 V peak, matching V, and its largest harmonic sits at the carrier frequency, 163.8 V at 4950 Hz, with sidebands at 4850 and 5050 Hz and another cluster near 9900 Hz. The low-order harmonics a motor would feel (the 5th, 7th, 11th, 13th) are a fraction of a volt, at the level of the simulation's time resolution. In the line-to-line voltage, the fundamental is larger, 276.9 V, and the component at exactly the carrier frequency vanishes: each leg has the same carrier, so the carrier harmonic is identical in all three legs and cancels when two legs are subtracted. This is why the carrier ratio is chosen as a multiple of three. Industrial drives go further: adding a third harmonic to the references, or using the equivalent space-vector modulation, raises the usable output voltage by about 15% (a factor ) without distorting the line-to-line voltage.
Rectifiers and power-factor correction
Going the other way, from AC to DC, the simplest circuit is a diode bridge followed by a large smoothing capacitor. It is cheap and robust, and for decades it was the front end of nearly every electronic device. Its flaw is how it draws current. The capacitor holds the DC voltage near the peak of the AC, so the diodes conduct only for a short time near each peak, when the supply voltage rises above the capacitor's. The supply sees narrow, tall pulses of current instead of a sinusoid.
import numpy as np
# A diode-bridge rectifier with a smoothing capacitor: the front end of a simple mains adapter.
V_rms, f = 230.0, 50.0
R_s = 1.0 # resistance of the supply wiring and the bridge, ohm
C = 100e-6 # smoothing capacitor, F
R_load = 1000.0 # the DC load, ohm (about 100 W at 310 V)
dt = 1e-6
n_cycle = int(round(1 / (f * dt)))
v_supply = (np.sqrt(2) * V_rms * np.sin(2 * np.pi * f * dt * np.arange(10 * n_cycle))).tolist()
v_C = 0.0
i_last = []
for n, v_s in enumerate(v_supply): # ten cycles of the supply; keep the last one
i_in = max(abs(v_s) - v_C, 0.0) / R_s # the bridge conducts only while |v_s| exceeds v_C
v_C += dt * (i_in - v_C / R_load) / C
if n >= 9 * n_cycle:
i_last.append(i_in if v_s >= 0 else -i_in) # the supply current changes sign with the supply
i = np.array(i_last)
v = np.array(v_supply[9 * n_cycle:])
P = np.mean(v * i)
I_rms = np.sqrt(np.mean(i**2))
A = 2 * np.abs(np.fft.rfft(i)) / len(i) # A[n] is the harmonic at n x 50 Hz
thd = np.sqrt(np.sum(A[2:41] ** 2)) / A[1]
print(f"real power {P:.1f} W, RMS current {I_rms:.2f} A, peak current {np.abs(i).max():.2f} A, DC {v_C:.0f} V")
print(f"power factor {P / (V_rms * I_rms):.3f}; total harmonic distortion of the current {thd:.0%}")
print("harmonic n (at n x 50 Hz), % of fundamental: " + " ".join(f"n={n}: {100 * A[n] / A[1]:.0f}%" for n in [3, 5, 7, 9, 11, 13]))
print(f"the bridge conducts for {np.mean(np.abs(i) > 0.01):.0%} of each cycle")
print(f"a PFC front end, drawing a sinusoid in phase, needs {P / V_rms:.2f} A RMS for the same power")For about 98 W of output, the bridge draws pulses 3.56 A high, conducting only 15% of the time, with an RMS current of 0.91 A. The power factor is 0.469 even though the current pulses are centred on the voltage peaks, because the current is not sinusoidal: its harmonics carry no real power but add to the RMS current. The third harmonic is 95% of the fundamental. Multiply by every computer, television and LED driver on a street and the distortion becomes a problem for the grid: extra heating in cables and transformers, third harmonics adding in the neutral (as in AC power and three-phase systems), and distorted supply voltages. Standards such as IEC 61000-3-2 therefore limit the harmonic currents that equipment may draw from public low-voltage supplies.
The fix is a power-factor-correction (PFC) front end: a boost converter placed between the bridge and the capacitor, whose controller makes the inductor current follow the shape of the rectified supply voltage, cycle by cycle, at tens or hundreds of kilohertz. The supply then sees a nearly sinusoidal current in phase with the voltage, with power factors above 0.99, and the boost output provides a regulated DC bus of around 400 V for the stage that follows. The program's last line shows the gain: the same power needs only 0.43 A RMS instead of 0.91 A. Large three-phase equipment such as EV fast chargers and data-centre rectifiers uses three-phase active front ends that do the same job, and the newest designs drop the diode bridge altogether (bridgeless or totem-pole PFC, often with GaN or SiC switches) to save its losses.
Losses, heat and efficiency
Every converter's efficiency is a ledger of small losses. For a MOSFET carrying current with duty cycle :
- Conduction loss: (for an IGBT or a diode, roughly average current).
- Switching loss: during each transition the device briefly carries current and blocks voltage at once. For transition times and , a rough estimate is .
- Gate-drive loss: charging the gate each cycle, .
- And outside the switches: the diode's or synchronous rectifier's conduction loss, the inductor's winding and core loss, and the capacitors' ESR loss.
Example— Where the buck converter's losses go
Take the 12 V to 5 V, 2 A buck converter above (10 W output) with a MOSFET of 10 mΩ, transitions of 10 ns each, 10 nC of gate charge driven at 5 V, a Schottky diode dropping 0.4 V, and an inductor of 15 mΩ winding resistance:
| Loss | Calculation | Watts |
|---|---|---|
| MOSFET conduction | 0.017 | |
| MOSFET switching | 0.120 | |
| Gate drive | 0.025 | |
| Diode | 0.467 | |
| Inductor winding | 0.060 | |
| Total | 0.688 |
The efficiency is , and two-thirds of the loss is the diode. Replace it with a second 10 mΩ MOSFET and its loss falls to W, the total to 0.245 W, and the efficiency rises to 97.6%. That single change is why nearly every low-voltage converter today is synchronous.
Heat is the other half of the story. The power a device dissipates must flow from its junction to the surrounding air through a chain of thermal resistances, in kelvin per watt: junction to case , case to heatsink (the thermal pad or grease), and heatsink to air . Like resistors in series: A transistor in a TO-220 package dissipating 6 W, with K/W, a 0.5 K/W pad and a 5 K/W heatsink, in 45 °C air, runs at °C, comfortably below a typical 150 or 175 °C limit. Without the heatsink, the package alone has around 62 K/W to air, and the junction would head for °C: the device would fail long before. Thermal design (heatsinks, fans, liquid cooling in cars and data centres, and the circuit board's copper as a heat spreader) often sets a converter's size more than its electronics do.
Where power electronics works
USB-C chargers. A modern charger is a PFC stage (above about 75 W of input) followed by an isolated flyback or resonant converter that steps the rectified mains down to the voltage the device negotiates over the cable: 5 to 20 V in USB Power Delivery's standard range, and up to 48 V and 240 W with the USB PD 3.1 extended range. GaN switches let these converters run at hundreds of kilohertz, shrinking the transformer, which is why chargers of the same power have become much smaller since about 2018.
EV chargers and drivetrains. An electric car's on-board charger is an AC-to-DC converter of a few kilowatts (commonly 7 to 22 kW), with PFC, used at home and at public AC points. DC fast chargers put the converter in the roadside cabinet instead, delivering from tens to hundreds of kilowatts directly to the battery, from a three-phase grid connection through an active front end and isolated DC-DC stages. Inside the car, the traction inverter drives the motor of Transformers and electric machines by PWM and runs in reverse to recover energy when braking, and a DC-DC converter supplies the 12 V or 48 V systems. Cars with 800 V batteries, whose higher voltage halves the current for a given charging power, rely on SiC devices.
Solar and battery inverters. A solar inverter has a DC-DC stage that operates the panels at their maximum power point (the subject of Renewables, storage and electric vehicles) and an inverter that injects current synchronised to the grid. They range from microinverters behind a single panel, through string inverters of a few to a hundred kilowatts, to central inverters of several megawatts. Battery storage uses the same hardware in both directions, and how these inverters behave during grid disturbances is now one of the central questions of grid engineering, taken up in The power grid.
And everywhere else: variable-speed drives in industry, LED drivers, induction hobs, railway traction, HVDC converter stations, and the power delivery of AI data centres, which is the subject of Powering data centres. MIT's open course Power Electronics and the IEEE Power Electronics Society are good places to go deeper.
Common misconceptions
Misconception
"A boost converter creates energy: 5 V in, 12 V out." Power is conserved, less losses. A boost converter delivering 12 V at 1 A from 5 V draws at least 2.4 A from its input. The same is true of every converter and every transformer.
Misconception
"The duty cycle alone sets the output voltage." Only for ideal components in continuous conduction. Diode and switch drops, winding resistance, light loads (discontinuous conduction) and input-voltage changes all shift the output, which is why every practical converter regulates with feedback.
Misconception
"Higher switching frequency is always better." It shrinks the inductors, capacitors and transformers, but switching and gate losses grow in proportion to frequency, and faster edges radiate more electromagnetic interference. Every design picks a frequency that balances size, efficiency and EMI.
Misconception
"Wide-bandgap devices make silicon obsolete." SiC and GaN win where their speed or voltage rating pays for their cost, but silicon MOSFETs still dominate low-voltage conversion, and silicon IGBTs remain the workhorses of high-power industrial and traction converters.
Exercises
1. Power electronics
Warm-upHumanA power bank boosts the 3.7 V of its lithium-ion cell to 5 V for a USB port. Treating the boost converter as ideal and in continuous conduction, what duty cycle does it need, in per cent (nearest whole number)?
2. Power electronics
CoreHumanA buck converter steps 24 V down to 5 V. Its switch is ideal, but its freewheeling diode drops 0.5 V while it conducts. What duty cycle, in per cent (nearest whole number), gives exactly 5 V out in continuous conduction?
3. Power electronics
CoreHumanWhich switch is the usual choice in 2026 for the traction inverter of an electric car with an 800 V battery?
4. Power electronics
CoreHumanA MOSFET dissipates 4 W. Its junction-to-case thermal resistance is 1.2 K/W, the thermal pad adds 0.3 K/W, and the heatsink's resistance to air is 8 K/W. The air is at 40 °C. What is the junction temperature, in °C, to the nearest degree?
5. Power electronics
CoreHumanIn the lesson's simulation, a diode bridge with a smoothing capacitor had a power factor of 0.47, although its current pulses were centred on the voltage peaks. What is the main reason the power factor is so low?
6. Power electronics
CoreComputationalWrite buck_design(V_in, V_out, I_out, f_sw, ripple_ratio, dv_max) for an ideal buck converter in continuous conduction. Return (D, L, C): the duty cycle, the smallest inductance that keeps the peak-to-peak inductor ripple at or below ripple_ratio * I_out, and the smallest capacitance that keeps the peak-to-peak output ripple at or below dv_max volts (ignoring the capacitor's ESR).
7. Power electronics
StretchComputationalWrite simulate_boost(V_in, D, L, C, R, f_sw, periods=1500, steps=200), a time-stepping simulation of an ideal boost converter starting from rest, like the lesson's buck simulation. With the switch on, the inductor is across the input and the load is fed only by the capacitor; with it off, the inductor's current flows through the diode into the capacitor and load (and cannot reverse). Return the average output voltage and its peak-to-peak ripple over the last 20 periods. The tests check that the average matches and the ripple matches .
Further reading and resources
- IEEE Power Electronics SocietyThe professional society of the field, with its journals, conferences and educational material.
- USB Charger (USB Power Delivery) · USB Implementers ForumThe USB Power Delivery specifications, up to 240 W over a USB Type-C cable.
- ngspiceThe open-source circuit simulator used for the SPICE netlist in this lesson.
- Power Electronics (6.334) · David J. Perreault, MIT OpenCourseWareFree lecture notes covering converters, magnetics, rectifiers and inverters in depth.