Inductors, Transformers and Relays

Inductance and flyback, chokes, transformers, and relays versus solid-state relays, with the protection each needs.

Inductors

An inductor is a coil of wire, often around a magnetic core. It stores energy in a magnetic field, and it opposes changes in current, the way a heavy flywheel opposes changes in speed. It is the partner of the capacitor, which opposes changes in voltage.

V = L × dI/dt    E = ½ × L × I²    time constant τ = L ÷ R

  • Inductance L is in henries (H); typical parts are nH to mH. A larger value means a stronger opposition to a change.
  • Steady DC passes almost freely (only the winding resistance, called DCR, remains). Fast changes are resisted, which is why inductors smooth currents in switching regulators and block high-frequency noise.
  • Current rating and saturation. Past the saturation current, the core can hold no more magnetic flux and the inductance collapses, so the current rises sharply. Choose an inductor whose saturation current is above the peak current in the circuit, with a margin.
  • Cores. Air-core (RF, no saturation), ferrite (switching supplies and RF chokes), powdered iron (power inductors; soft saturation) and laminated iron (mains and audio frequencies).
  • Self-resonance. Every inductor has stray capacitance and above its self-resonant frequency behaves like a capacitor. Check it against the frequency you use.

Flyback: the spike when a coil switches off

Current in an inductor cannot stop instantly. When a switch interrupts the current in a coil (a relay coil, a solenoid, a motor, a fan), the collapsing field drives the voltage up as far as needed to keep the current going, often through the switch itself. That voltage spike is the main way relays and motors destroy transistors and microcontroller pins.

Worked example: a 5 V relay coil

  • The coil draws 70 mA at 5 V, so its resistance is 5 ÷ 0.070 = 71.4 Ω. If its inductance is 100 mH, the time constant is L ÷ R = 0.1 ÷ 71.4 = 1.4 ms: the current builds up in a few milliseconds.
  • The energy stored is ½ × 0.1 × 0.07² = 0.2 mJ. When the transistor switches off in 1 µs, V = L × ΔI ÷ Δt = 0.1 × 0.07 ÷ 0.000001 = 7 000 V in theory. In reality the transistor or its wiring breaks down at a few hundred volts, which damages it.
  • A flyback diode across the coil (cathode to the supply side) gives the current a path, so the spike is limited to about 0.7 V above the supply. The coil current then decays through the diode and the coil resistance.
  • The diode always goes across the coil, reverse-biased in normal operation. Choose a diode rated for the coil current: a 1N4007 or 1N4148 for small relays, a Schottky or fast diode for motors.
  • The diode slows the release of a relay slightly. If a fast release matters, add a Zener in series with the diode or use a TVS.
  • AC coils and motors need an RC snubber or a TVS instead, because a plain diode conducts on one half of the cycle.
  • Brushed motors also make electrical noise in use: add a 100 nF ceramic capacitor across the motor terminals.

Chokes, ferrite beads and filters

  • Ferrite bead. A small ferrite part that looks like a resistor at high frequency, turning RF noise into heat. Put one in series with a supply to filter noise onto a sensitive analog or radio circuit.
  • Common-mode choke. Two windings on one core; it blocks noise that appears equally on both wires (USB and mains filters) and passes the signal.
  • LC filter. An inductor and capacitor together make a steeper low-pass filter than an RC filter, with little loss at DC. The cut-off is f = 1 ÷ (2π × √(L × C)).

Transformers

A transformer is two coils on one core. An alternating current in the primary creates a changing magnetic field that induces a voltage in the secondary. The voltage ratio is the turns ratio, and the current changes in the opposite direction, so power (ideally) stays the same.

120 VAC6 Ω loadPrimaryN1 = 1000 turnsSecondaryN2 = 100 turnsiron coreTurns ratio sets the voltageV2 ÷ V1 = N2 ÷ N1 = 0.1V2 = 120 V × 0.1 = 12 Vand inversely the currentI2 = 12 V ÷ 6 Ω = 2 AI1 = 2 A × 0.1 = 0.2 APower in = power out120 V × 0.2 A = 12 V × 2 A = 24 W(ideal; real ones lose a few percent)
An ideal transformer: ten times fewer secondary turns give one tenth of the voltage and ten times the current.

V2 ÷ V1 = N2 ÷ N1    I2 ÷ I1 = N1 ÷ N2    Pin ≈ Pout

  • AC only. A transformer does nothing with steady DC, and a DC component can saturate the core.
  • Rating in VA. The secondary’s volt-amp rating is the voltage times the maximum current. A 12 V, 1 A transformer is 12 VA. When it feeds a rectifier and filter capacitor, the rectified DC voltage is about 1.4 times the AC RMS value (minus diode drops), and the current rating is effectively lower.
  • Regulation. The secondary voltage is higher with no load (up to 10–20 % for small ones) and drops as the load rises.
  • Isolation. The primary and secondary are not electrically connected, which is a safety feature: an isolation transformer allows work on mains-referenced equipment without a ground connection. Wall adapters and power supplies rely on this isolation, so do not bypass it.
  • Types. Laminated (EI) and toroidal for mains frequency; ferrite-core transformers inside switch-mode supplies (much smaller, working at tens to hundreds of kHz); audio and pulse transformers; current transformers for measuring AC current.

Relays

A relay is an electrically operated switch. A small current through a coil moves an armature that closes or opens contacts. The contacts are electrically separate from the coil, so a 5 V signal can switch mains, and the relay isolates the control side from the load.

TypeHow it switchesStrengthsLimits
Electromechanical relayCoil moves metal contactsLow contact resistance, handles AC or DC, isolates fully, tolerates surgesSlow (5–15 ms), contacts wear (105 to 107 operations), clicks, bounces, coil draws 30–100 mA
Reed relayContacts in a glass tubeFast, small, long-lived for low currentsLow current and voltage
Solid-state relay (SSR)Optocoupler drives a triac (AC) or MOSFETs (DC)Silent, no wear, fast, tiny control currentVoltage drop and heat (needs a heat sink), leakage when off; AC and DC types are not interchangeable
ContactorLarge relay for motors and heatersHundreds of ampsLarge coil, usually 24 V or mains

Reading a relay rating

  • Contact forms: SPST-NO (one normally-open contact), SPDT (changeover: common, normally-open, normally-closed), DPDT (two changeover contacts at once).
  • AC and DC ratings differ. A relay marked 10 A 250 V AC may be only 10 A at 28 V DC, because a DC arc does not extinguish at the zero crossing the way an AC arc does. Always use the rating for your supply.
  • Inductive and lamp loads (motors, solenoids, incandescent bulbs, capacitor-input supplies) draw a surge several times the running current. Derate the contacts or choose a rating for that load type.
  • Coil voltage (5, 12, 24 V DC) and current: the coil, not the contacts, is what your control circuit must drive. Check the pull-in voltage and the minimum voltage to hold.
  • Relay modules with an optocoupler and a transistor on a small board are convenient for microcontrollers. Some are active-low (the relay closes when the input goes LOW).

Driving a relay

A microcontroller pin supplies perhaps 20 mA, but a relay coil needs 30–100 mA, so the pin drives a transistor and the transistor drives the coil.

Control side: 5 V coilLoad side: separate 12 V circuit+5 VRelay coilFlyback diode(cathode to +5 V)5 V pin470 ΩIB ≈ 9 mA+12 VRelay contact (normally open)Lamp, 12 V 0.5 Athe coil’s magnetic fieldcloses the contactWithout the diode, switching the coil off creates a spike of tens to hundreds of volts that can destroy the transistor.
A transistor driving a relay coil, with a flyback diode across the coil and the contacts switching a separate 12 V lamp circuit.

Worked example: 70 mA relay from a 5 V pin

  • The coil current is 70 mA, so allow a base current of one tenth: IB = 70 ÷ 10 = 7 mA.
  • RB = (5 − 0.7) ÷ 0.007 = 614 Ω; use 470 Ω, which gives (5 − 0.7) ÷ 470 = 9.1 mA, comfortably above the 7 mA needed.
  • A 2N2222, BC337 or similar NPN handles this easily. Add the flyback diode across the coil.
  • For a relay needing more than about 150 mA, use a logic-level MOSFET instead (see Transistors).

Related

FAQ

Why is a relay’s DC rating lower than its AC rating?

An AC current passes through zero a hundred or more times a second, which helps an arc between opening contacts die out. A DC arc has no such help and can persist and weld or erode the contacts. Use the DC rating from the datasheet, and derate for inductive loads.

Can a microcontroller drive a relay directly?

Not usually. A relay coil takes 30–100 mA, more than most pins can supply, and the switching spike can damage the pin. Use a transistor or MOSFET and a flyback diode, or a ready-made relay module.

Why does my relay chatter or click erratically?

The coil supply is probably sagging (so the relay drops out as it pulls in), the drive signal is noisy, or the voltage is marginal. Measure the coil voltage while the relay is on. Chatter also happens when a load switched through the relay disturbs the control signal.

Should I use a relay or a MOSFET?

For DC loads up to a few amps, a MOSFET is smaller, silent and fast. A relay is better for mains, for AC loads, when you need full isolation, or when the load voltage is high.

Can I use a transformer to change DC voltage?

No. A transformer works only with changing current. To change a DC voltage, use a switching converter, which chops the DC into AC internally.

References

  • Horowitz, P. and Hill, W., The Art of Electronics, 3rd ed., Cambridge University Press.
  • Relay manufacturers’ application notes and datasheets (for example Omron, TE Connectivity, Panasonic): contact ratings, coil data and derating for inductive loads.
  • Solid-state relay datasheets (for example Crydom, Omron): load ratings, off-state leakage and heat-sink requirements.
  • Platt, C., Make: Electronics, 3rd ed., Make Community.

Last reviewed: October 2026. Values are typical: check the datasheets of the parts you use. Do not work on live mains equipment unless you are qualified.