A flyback converter is a transformer that is also its own inductor: it stores energy in the magnetic field while the switch is on, then delivers it to the output while the switch is off. That makes the transformer the whole design — the turns set the voltages, the air gap sets the inductance and the flux, and the winding layout sets the leakage that the snubber must eat. The earlier guides used flyback transformers (the core-selection guide picked the core, the RCD snubber guide tamed its spike); this guide designs one from scratch: a 36 W universal-input flyback transformer, turn by turn, with every number checked.
Figure 1: A flyback transformer on an ETD29 N87 core (a) — the primary is split into two halves around the secondary, which keeps the leakage to 2%, and the 0.87 mm air gap in the centre leg stores the energy. The waveforms (b) show one cycle at 65 kHz and low line: the primary current ramps 0 → 1.71 A while the switch is on, then the secondary current falls 13.7 → 0 A while the switch is off, and the drain voltage spikes to the 525 V RCD clamp at turn-off. (Schematic, not to scale.)
Why a flyback transformer needs an air gap — and a normal transformer does not
A normal mains transformer transfers energy straight through: flux in, flux out, and the core only has to avoid saturating. A flyback stores energy: while the switch is on, the primary current ramps up and the core holds ½ × Lp × Ipk² of energy, and while the switch is off that energy leaves through the secondary. The core cannot hold that energy — ferrite saturates at about 0.39 T at 100 °C, and its energy density is tiny. The air gap holds it. The energy density in a gap is B² / (2µ0), and a millimetre of gap holds far more energy than the whole ferrite core. So the design runs backwards from an ordinary transformer: pick the gap and the turns together so the inductance lands where the power needs it, and check that the flux stays under about 0.2 T.
The dot convention matters here too. The dots on the primary and secondary mark the ends whose voltages rise together. While the switch is on, the secondary voltage is negative at the diode, so the diode is off and no secondary current flows — all the input energy goes into the field. When the switch turns off, the voltages reverse, the diode conducts, and the stored energy flows out. If you wind the secondary backwards, the diode conducts during the on-time and the converter never works at all — the first thing to check on a dead flyback board is the dot.
Worked example — a 36 W universal-input flyback transformer
Design the transformer for 85–265 V AC in, 12 V out at 3 A — 36 W — at 65 kHz, on the boundary between continuous and discontinuous conduction. After the bridge and bulk capacitor, the DC bus is about 100 V at low line (85 × √2 minus ripple) and 375 V at high line. Choose the reflected voltage VOR = 100 V: that is the voltage the secondary reflects back to the primary during the off-time, and it sets the maximum duty cycle: Dmax = VOR / (Vdc_min + VOR) = 100 / 200 = 0.50. At 85% efficiency the input power is 36 / 0.85 = 42.4 W. For boundary conduction the primary inductance is Lp = (Vdc_min × Dmax)² / (2 × Pin × fsw) = (50)² / (2 × 42.4 × 65 kHz) = 454 µH — use 450 µH. The peak primary current is then Ipk = 50 / (450 µH × 65 kHz) = 1.71 A, and the energy check closes the loop: ½ × 450 µH × (1.71 A)² × 65 kHz = 42.7 W, the input power, as it must be.
The turns ratio follows from the reflected voltage: n = Np/Ns = VOR / (Vout + Vf) = 100 / 12.7 = 7.87, so use 8:1. Pick the core first — an ETD29 in N87 ferrite (Ae = 76 mm², Ve = 5.35 cm³, ungapped AL = 2200 nH per turn² — TDK datasheet). With 64 primary turns the peak flux is Bpk = Lp × Ipk / (Np × Ae) = 450 µH × 1.71 A / (64 × 76 mm²) = 0.158 T — comfortably under the 0.2 T design limit, and far from the 0.39 T saturation of N87 at 100 °C. That fixes the secondary at 64/8 = 8 turns and the auxiliary winding (15 V for the controller supply) at 64 × 15.7/100 = 10 turns.
The gap is what makes the inductance: Lg = µ0 × Np² × Ae / Lp = 4Ï€ × 10⁻⁷ × 4096 × 76 mm² / 450 µH = 0.87 mm total, ground into the centre leg. The gapped AL is then 450 µH / 64² = 110 nH per turn², down from 2200 ungapped — the gap dominates, which is exactly what you want, because it makes the inductance stable against core tolerance and temperature. And the energy check proves the gap does the work: B²/(2µ0) × Ae × Lg = 0.158² / (2 × 4Ï€ × 10⁻⁷) × 76 mm² × 0.87 mm = 657 µJ — the same 657 µJ that ½ × Lp × Ipk² gives. The gap stores essentially all the energy; the ferrite just guides the flux.
The proof the gap is needed — try it without one
Without a gap, the same 450 µH needs Np = √(450 µH / 2200 nH) = 14.3 turns. The flux would then be Bpk = 450 µH × 1.71 A / (14.3 × 76 mm²) = 0.71 T — nearly double the 0.39 T saturation of N87 at 100 °C. The core would saturate part-way through every on-time, the inductance would collapse, and the switch current would run away until something failed. The gap trades turns for flux headroom: 64 turns instead of 14, and the flux falls from 0.71 T to 0.158 T. That is the whole point of gapping a flyback core, and the reason a flyback transformer always has a visible gap while a forward transformer's core is usually ungapped — the forward core only has to avoid saturating, so it needs far fewer volt-seconds per turn.
Leakage, the snubber, and the switch voltage
Not all the primary flux links the secondary. With the primary split into two 32-turn halves sandwiching the secondary, the leakage is about 2% of Lp — 9 µH. That leakage stores ½ × 9 µH × (1.71 A)² = 13.2 µJ per cycle, or 0.86 W at 65 kHz, and it has nowhere to go when the switch turns off except into the drain node. With roughly 200 pF of node capacitance (MOSFET Coss plus transformer and layout capacitance), the unclamped spike is Ipk × √(Llk/Coss) = 1.71 × √(9 µH / 200 pF) = 363 V on top of the 375 V bus plus the 100 V reflected voltage — 838 V at the drain, which kills a 600 V MOSFET outright. The RCD snubber from the earlier guide clamps it: set the clamp at Vsn = 150 V (1.5 × VOR), so the worst-case drain voltage is 375 + 150 = 525 V, and the switch is a 650 V part, the IPA65R380E6 (650 V, 0.38 Ω — Infineon datasheet), with 125 V of margin. The snubber resistor is Vsn² / P = 150² / 0.86 = 27 kΩ, fitted as a 2 W part for the 0.86 W it burns, and the capacitor is 10 nF of film, which holds the clamp ripple to 8.8 V. The snubber is a 0.86 W tax on the design — the price of the 2% that does not couple.
Copper, core loss and the output ripple
The RMS currents are what size the wire. The secondary conducts for half the cycle as a triangle falling from 13.7 A (Ipk × 8), so Is_rms = 13.7 × √(0.5/3) = 5.58 A; the primary is the same shape at 1.71 A, so Ip_rms = 0.70 A. The primary is 64 turns of AWG26 (0.134 Ω/m, mean turn length 52 mm on ETD29): 3.33 m, 0.446 Ω, so 0.70² × 0.446 = 0.22 W. The secondary is 8 turns of two AWG22 wires in parallel (0.011 Ω together): 5.58² × 0.011 = 0.35 W DC, about 0.52 W once the skin effect at 65 kHz (skin depth 0.26 mm, against a 0.64 mm wire) is counted. Core loss is small here because the AC flux is only half the peak — 79 mT at 65 kHz costs about 40 mW/cm³ in N87, so 5.35 cm³ burns 0.21 W. Total magnetics loss is about 1 W on a 36 W output.
The output ripple is a capacitor-ESR story, as the earlier ESR guide showed. The capacitor supplies the 3 A load during the 7.7 µs on-time, so the capacitive droop is only 3 × 7.7 µs / 2000 µF = 12 mV with two 1000 µF capacitors. But the 13.7 A secondary peak flows through their combined 10 mΩ ESR, so the step is 13.7 × 0.01 = 137 mV — eleven times the capacitive part. Total ripple is about 150 mV peak-to-peak, and it is set by the ESR, not the capacitance: doubling the capacitance would barely help, while a lower-ESR capacitor would.
Design it for something else — a 24 V, 2 A version on the same core
The same ETD29 core covers a 24 V / 2 A (48 W) output with different turns. Input power is 56.5 W at 85% efficiency, so Lp = (50)² / (2 × 56.5 × 65 kHz) = 340 µH and Ipk = 50 / (340 µH × 65 kHz) = 2.26 A. The ratio is 100 / 24.7 = 4.05, so use 4:1 — 64 primary turns and 16 secondary. The flux is the same 0.158 T (Lp × Ipk is unchanged at 50/fsw), the gap grows to 1.15 mm, and the secondary peak is 2.26 × 4 = 9.05 A (3.69 A RMS). Leakage is still 2%, so the snubber takes 1.13 W, and the drain still clamps at 525 V — the same 650 V MOSFET works. One core, one switch, two outputs: that is why the flyback dominates low-power mains supplies.
Key points to remember
- Worked example: a 36 W universal-input flyback at 65 kHz needs Lp = 450 µH at Ipk = 1.71 A, with VOR = 100 V and Dmax = 0.50; the energy check (657 µJ × 65 kHz = 42.7 W) closes against the 42.4 W input power.
- On an ETD29 N87 core, 64 primary turns and 8 secondary turns give Bpk = 0.158 T with a 0.87 mm gap (AL = 110 nH per turn²); the auxiliary winding is 10 turns for a 15 V controller supply.
- The gap stores the energy: B²/(2µ0) × Ae × Lg = 657 µJ, the same as ½ × Lp × Ipk². Without the gap, 14 turns would push the flux to 0.71 T and saturate the core.
- Leakage is 2% (9 µH) with an interleaved winding: it stores 13.2 µJ per cycle (0.86 W), drives the drain to 838 V unclamped, and is held to 525 V by a 27 kΩ / 10 nF RCD snubber — so the switch must be a 650 V part.
- Copper and core loss total about 1 W; the output ripple is ~150 mV peak-to-peak, and 137 mV of it is the ESR step — the capacitor's ESR, not its capacitance, sets the ripple.
- A 24 V / 2 A version on the same core needs Lp = 340 µH, a 4:1 ratio (64:16 turns) and a 1.15 mm gap, with the same 0.158 T flux and the same 650 V switch.
