Application circuits: motor, LED, heater, position, pulse

Real products drive the switch for a purpose: dim an LED, turn a motor, hold a heater, pull a valve. Each tab has the real driver circuit, a live time simulation and the losses of the part you pick.

Simulator

  • Every tab is a live time simulation: ▶ Play, ❚❚ Pause, ↺ Reset.
  • Speed 1× = real time. Slow down for electrical events, speed up for thermal ones.
  • Dots follow the simulated current. Losses come from the datasheet values of the part you pick.

PWM keeps the LED’s peak current fixed and changes only its duration. The colour does not shift. The eye sees the average, but only if the frequency is high enough.

Simulation

LED dimming: PWM with a low-side N-MOSFET

Model: per LED VF = 2.8 V + 0.8 Ω·I; 1 LED in series at 5 V, 3 at 12 V, 6 at 24 V. Light ∝ current. The lamp shows light averaged over one screen frame; the eye and a camera integrate the same way. Psw = ⅙·V·I·(ton+toff)·f (resistive). Tj steady state, 25 °C ambient.

Why low-side?

The source is at ground, so VGS = the GPIO voltage. No level shifter needed. LED strips are common-anode anyway (+12 V common).

Gamma correction

The eye perceives brightness roughly as D1/2.2. 10 % duty looks 35 % bright. So use D = setting2.2 and at least 10-bit PWM.

Frequency

Below ~200 Hz the flicker is visible. IEEE 1789: at 100 % modulation ≥ 1.25 kHz is low-risk, ≥ 3 kHz no effect. Switching loss and EMI set the upper limit.

Worked: 3 LEDs at 12 V, 350 mA, series resistor
Rail12 VLED3 × (2.8 V + 0.8 Ω·I)Target350 mARDS(on)25 mΩ (IRLB8721, 3.3 V)
  1. String voltage3 · (2.8 + 0.8 · 0.35)9.24 V
  2. Series resistor(12 − 9.24) / 0.357.9 Ω → 8.2 Ω
  3. Actual current(12 − 8.4) / (8.2 + 2.4)340 mA
  4. Resistor loss0.34² · 8.20.95 Wuse a 2 W resistor
  5. MOSFET loss (D = 1)0.34² · 0.0252.9 mW
  6. 14.4 V with the engine running(14.4 − 8.4) / 10.6565 mA+66 % current
The MOSFET stays cool; the real problem is the rail swing. In a car, use a constant-current driver instead of a resistor.

A one-direction motor needs one low-side N-MOSFET and one flyback diode. The average voltage D·V sets the speed. A PI loop holds the speed regardless of load.

Simulation

DC motor speed control: PWM, flyback diode, PI

Model: L·di/dt = V − R·i − k·ω; J·dω/dt = k·i − b·ω − Tload (ke = kt). Each PWM interval is advanced with the exact exponential solution; mechanical step ≤ 0.2 ms. Schottky VF = 0.5 V. PI at 1 kHz, clamped integrator. Psw = ½·(V+VF)·I·tedge (inductive). Rotor animation slowed down.

No braking

A single switch can only accelerate the motor. Friction and load do the slowing. That is why a downward step overshoots and recovers slowly.

PWM frequency

If the period is longer than τ = L/R, the current drops to zero each period. Torque ripples and the motor whines. 16–25 kHz avoids that and the audible tone.

Inrush at start

A stopped motor has zero back-EMF, so I = V/R. On a step the PI saturates at 100 % and draws that current. Size the switch and supply for this peak.

Worked: 12 V motor, inrush and PWM frequency
V12 VR2 ΩL1 mHk0.02 V·s/radJ2·10⁻⁵ kg·m²
  1. Stall currentI = 12 / 26 Aseen at every start
  2. No-load speedω = 12 / 0.02600 rad/s ≈ 5700 rpm
  3. Electrical ττ = 1 mH / 2 Ω0.5 ms
  4. 20 kHz periodT = 1 / 20 kHz50 µsT ≪ τ → continuous current
  5. 200 Hz periodT = 1 / 200 Hz5 msT ≫ τ → discontinuous, pulsed torque
  6. Mechanical τJ·R / k² = 2·10⁻⁵ · 2 / 0.02²0.1 s
Switch and diode must take 6 A peak; PWM ≥ 16 kHz. The 0.1 s mechanical τ sets how fast the PI can be.

A heater is slow: even 1 Hz PWM is averaged perfectly. On/off is simple but oscillates because of the sensor lag. PI sets the power on average and shrinks the ripple.

Simulation

Heater: on/off (hysteresis) vs PI (slow PWM)

Model: Cth·dT/dt = P − (T − Tamb)/Rth; Cth = 25 J/K, Rth = 3 K/W (τ = 75 s), Tamb = 25 °C. Sensor lags 6 s (sheathed NTC). P = I²·RH, RH constant. 1 kHz PWM is computed as averaged by the thermal mass. Ripple: peak-to-peak over the last 60 s.

Why slow PWM?

The thermal τ is seconds to minutes. Slow switching makes no EMI and almost no switching loss. AC heaters use an SSR that switches at zero crossing.

Relay or MOSFET?

A relay lasts ~100 000 cycles. At a 2 s period that is 2–3 days. For frequent switching use a MOSFET or an SSR.

Low-side or high-side?

Two-wire isolated heater: low-side N-MOSFET, the cheapest. One end on the chassis (seat heater, 24 V sourcing output): high-side P-MOSFET or a smart switch.

Worked: 12 V, 40 W heater, IRLZ44N
V12 VP40 WRDS(on)≈ 27 mΩ (5 V, hot)RθJA62 °C/W
  1. Heater resistanceR = 12² / 403.6 Ω
  2. CurrentI = 12 / 3.63.33 A
  3. Conduction loss (100 %)3.33² · 0.0270.30 W
  4. Junction25 + 0.30 · 6244 °Cno heatsink needed
  5. Highest reachable T25 + 40 · 3145 °C
  6. Thermal time constantτ = 25 · 375 s1 Hz PWM is fully averaged
The IRLZ44N drives this heater without a heatsink. The loss is conduction only; PWM frequency barely matters here.

Holding a position needs both directions and braking: an H-bridge. The encoder measures the angle, the PID computes the duty. Duty saturates at ±100 %.

Simulation

Position control: H-bridge, encoder, PID

Model: geared DC motor, 50:1, stall ≈ 4 A, output no-load ≈ 550 °/s, mechanical τ ≈ 50 ms. Sign–magnitude PWM with synchronous rectification: current stays continuous, terminal voltage averages u·VS. Hence an averaged model, step 50 µs. Encoder 12 CPR × 4 × 50 = 2400 counts/turn. PID at 1 kHz; derivative on measurement, 5 ms filter. High-side MOSFETs get 10 V from a bootstrap driver.

Diagonal pair

Q1+Q4 drive one way, Q3+Q2 the other. The two switches of one leg are never on together. The driver inserts dead time.

Why four N-MOSFETs?

An N-MOSFET has 2–3× lower RDS(on) than a P-MOSFET. The high-side gate must rise above VS. Half-bridge drivers with a bootstrap capacitor do that.

P · I · D

P drives in proportion to the error. D brakes on approach and reduces overshoot. I removes the error left by load torque; anti-windup is mandatory.

Worked: resolution, speed and Kp
V12 VR3 Ωk0.025 V·s/radGear50:1Encoder12 CPR
  1. Stall currentI = 12 / 34 A
  2. Output no-load speed(12 / 0.025) / 509.6 rad/s ≈ 550 °/s
  3. Counts per turn12 · 4 · 502400
  4. Resolution360° / 24000.15°
  5. Error for full duty1 / Kp = 1 / 0.0333°larger steps saturate
A 90° step saturates first, then settles with P+D. Resolution is 0.15°, so a ±1° band is easy to hold.

Hobby RC servo: the pulse width sets the position

  • A servo packs motor, gearbox, sensor, H-bridge and controller into one box.
  • Command: a 1–2 ms pulse every ~20 ms. Width = target angle.
  • The signal line carries no power. The servo draws from its own 5–6 V supply, amps while moving.
Mini demo

Servo pulse → angle

Mapping: angle = (tpulse − 1.5 ms) · 90°/ms. Beyond 1–2 ms is servo-specific and can hit the end stop. Slew rate 0.15 s/60°. Digital servos often accept up to 300 Hz.

Pulling in needs high current; holding needs far less. Peak-and-hold pulls in at full voltage, then lowers the current with PWM. Power falls with current squared, so the saving is large.

Simulation

Solenoid valve: peak-and-hold vs plain DC drive

Model: R = VS/1 A. Lopen = R·1.5 ms, Lclosed = R·5 ms, x² in between. State variable is flux λ = L·i: λ is conserved while the plunger moves, so the current dips (pull-in notch). Pull-in i > 0.65 A (closes in 6 ms), drop-out i < 0.2 A (opens in 8 ms). Command: first 150 ms of a 300 ms cycle. Hold PWM 20 kHz, diode VF = 0.7 V.

Diode only

At turn-off the current decays slowly with the coil’s τ = L/R. The valve releases late. The MOSFET sees only VS + 0.7 V.

Diode + zener

The zener applies VZ backwards and the current dies several times faster. The price: the MOSFET sees VS + VZ + VF. Check the VDS margin.

Best of both

During hold QZ shorts the zener: low ripple. At turn-off QZ opens: fast release. Injector drivers work this way.

Worked: 12 V valve, holding power and VDS
V12 VR12 ΩLclosed60 mHIhold0.34 AVZ24 V
  1. DC power12² / 1212 W
  2. Holding power0.34² · 121.4 W
  3. Saving1 − 1.4 / 1288 %
  4. Energy at turn-off½ · 0.06 · 0.34²3.5 mJburned in the zener
  5. Peak VDS12 + 24 + 0.736.7 Va 30 V part avalanches
Peak-and-hold cuts the power by 88 %. With a zener clamp, pick a MOSFET of at least 55–60 V.

Single pulse: pulse width → energy

  • Some loads get a single pulse: injectors, impact magnets, lock coils.
  • Pulse energy: resistor heat + magnetic field + mechanical work.
  • A pulse too short to pull in only makes heat.
Mini simulation

Single-pulse simulation

Same coil model, rail and turn-off clamp as above. Mechanical work from the energy balance: Esupply − ER − Eclamp. Switch drop ignored.

The same MOSFET does three different jobs. Which one sets the frequency, the source of loss and the protection.

On/off 0 – ~1 Hz

Where: lamps, pumps, relay replacement, hysteresis heater.

Transistor: fully on or off for long times. Loss ≈ I²·RDS(on).

Risk: inrush, turn-off kick, short circuit.

Continuous: PWM 0.1 Hz – 100 kHz

Where: LEDs, motor speed/position, heaters, SMPS.

Transistor: two edges per period. Loss = conduction + V·I·tedge·f.

Risk: slow gate drive, missing freewheel path.

Continuous: linear DC

Where: CC LED sinks, linear regulators, electronic loads, soft start.

Transistor: half on, continuously VDS·ID.

Risk: DC SOA. Switching MOSFETs die easily in linear duty.

Pulse µs – ms

Where: peak-and-hold, servo command, stepper pulses, one-shots.

Transistor: short, high peak; small average. IDM and Zθ(t) matter.

Risk: where the ½·L·I² energy goes at the end.

ApplicationControlFrequencyTopologyDominant loss / risk
LED stripPWM0.2–20 kHzLow-side N-MOSConduction; flicker at low f
Fan / pumpPWM16–25 kHzLow-side + flybackInrush, switching
Position actuatorPWM + PID16–40 kHzH-bridgeShoot-through, dead time
HeaterOn/off, slow PWM0.05–1 HzLow- / high-sideConduction
Solenoid valvePulse + hold PWMsingle + 20 kHzLow-side + clampTurn-off kick
RC servoPulse width50–300 HzSignal onlySupply sag
Stepper motorSTEP/DIR0–50 kHz steps2× H-bridge, chopperResonance, missed steps
Rule of thumbIf the load’s time constant is much longer than the PWM period, the load sees the average. If not, it sees the ripple: the LED flickers, the motor current chops, the heater oscillates.