PWM Duty Cycle Calculator
Calculate PWM duty cycle, frequency, average voltage, off-time, and RMS voltage from on-time and period parameters
Formula
How It Works
The PWM duty cycle calculator determines on-time percentage, average voltage, and power delivery for pulse-width modulated signals — essential for motor speed control, LED dimming, and switching power converters. Embedded developers, motor control engineers, and power electronics designers use this tool to configure timer peripherals and optimize drive circuits. According to TI application note SPRAA88, PWM achieves near-lossless power control by switching fully on/off rather than linear regulation — a 50% duty cycle motor drive dissipates <2% of power in the MOSFET versus 50% in a linear regulator. The fundamental relationship Vavg = Vpp × D (where D = ton/T) provides average voltage seen by the load's mechanical or thermal inertia. Per Microchip AN964, PWM frequency must exceed load time constant by 10× minimum: motor mechanical time constant τ = J×R/K² (typically 10-100 ms) requires fsw > 1 kHz, while LED thermal time constant (~100 ms) allows 100+ Hz for flicker-free dimming. Resolution depends on timer clock and period: an 8-bit timer provides 256 steps (0.4% resolution), while 16-bit timers achieve 65,536 steps (<0.002% resolution).
Worked Example
Design PWM motor speed control for a 12 V DC motor with 500 RPM nominal speed. Requirements: 10-100% speed range, <5% speed ripple, minimum audible noise. Step 1: Calculate target frequency — Motor time constant τ = 50 ms (from datasheet J, R, K). For <5% ripple: fsw > 3/(0.05 × τ) = 1.2 kHz. For inaudible operation: fsw > 20 kHz (above human hearing). Select 25 kHz. Step 2: Determine timer configuration — Using STM32 at 72 MHz: Period = 72M / 25k = 2880 counts. Resolution = 1/2880 = 0.035% (excellent). Step 3: Calculate duty cycle for 50% speed — Assuming linear V-speed relationship: D = 50% for 250 RPM. Vavg = 12 × 0.5 = 6 V. Step 4: Verify MOSFET thermal — At 25 kHz with 20 ns switching time, Qg = 30 nC: Psw = 30n × 12 × 25k = 9 mW. Pcond at 5 A, 10 mΩ: 0.25 W. Total: 0.26 W — no heatsink required for SOT-23 package. Step 5: Add snubber — Motor inductance causes Vspike = L×di/dt. With 100 µH, 5 A turn-off in 50 ns: Vspike = 10 V. Total = 22 V, well within 30 V MOSFET rating.
Practical Tips
- ✓Per Infineon motor control application note, use center-aligned PWM for reduced EMI — symmetric switching creates 2× effective switching frequency with half the current ripple compared to edge-aligned
- ✓Implement soft-start ramp (100-500 ms) to prevent mechanical shock and inrush current — linearly increase duty cycle from 0% to target over 10-50 PWM cycles
- ✓Add RC low-pass filter (fc = fsw/100) after PWM for analog voltage output applications — 25 kHz PWM with 2.5 kHz filter and 10 µF capacitor creates <1% ripple DC voltage
Common Mistakes
- ✗Using PWM frequency below load bandwidth — a 100 Hz PWM on a motor with 20 ms time constant causes 15-20% speed variation per cycle; increase to 1+ kHz for smooth operation
- ✗Ignoring deadband at low duty cycles — gate driver propagation delay (10-50 ns) sets minimum effective on-time; at 1 MHz PWM, 50 ns minimum on-time limits resolution to 5% minimum duty cycle
- ✗Selecting audible PWM frequency (500 Hz - 15 kHz) for motor drives — electromagnetic acoustic noise from motor windings creates annoying whine; use <500 Hz or >18 kHz
Frequently Asked Questions
Shop Components
As an Amazon Associate we earn from qualifying purchases.
DC-DC Buck Converter Modules
Adjustable step-down converter modules for bench and prototype use
Related Calculators
General
555 Timer
Calculate 555 timer frequency, period, duty cycle, and pulse width for both astable oscillator and monostable one-shot configurations
Power
Switching Regulator Ripple
Calculate buck converter output voltage ripple, inductor current ripple, and ESR contribution for switching regulator design
Power
Buck Converter
Design a synchronous buck (step-down) converter: calculate duty cycle, inductor value, output capacitor, and input capacitor.
Power
Voltage Divider
Calculate voltage divider output voltage, current, Thévenin impedance, and power dissipation from Vin, R1, and R2. Ideal for bias networks and level shifting.