PWM Duty Cycle Calculator
Calculate PWM duty cycle, frequency, average voltage, off-time, and RMS voltage from on-time and period parameters
Ideal rectangular pulse train · V_avg = D·V, V_rms = √D·VAPI slug pwm-duty-cycle
Inputs
Three periods from the timer
Standard values of Period
Select a row to use it| Period | Frequency | Period in Timer Ticks | Duty Resolution | Status |
|---|---|---|---|---|
| 1kHz | 16 000 | 13.97bits | PASS | |
| 2kHz | 8 000 | 12.97bits | PASS | |
| 5kHz | 3 200 | 11.64bits | PASS | |
| 10kHz | 1 600 | 10.64bits | PASS | |
| 20kHz | 800 | 9.64bits | PASS | |
| 25kHz | 640 | 9.32bits | PASS | |
| 50kHz | 320 | 8.32bits | PASS | |
| 100kHz | 160 | 7.32bits | CHECK | |
| 200kHz | 80 | 6.32bits | CHECK |
- Duty CycleD
- 50.0%PASS
- Frequencyf
- 100kHz
- Average VoltageVavg
- 1.65V
- Off Timetoff
- 5µs
- RMS VoltageVrms
- 2.333V
Formula
| Symbol | Quantity | Your value |
|---|---|---|
| D | Duty cycle (%) | 50.0 % |
| ton | On time (μs) | 5 µs |
| T | Period (μs) | 10 µs |
| Vcc | Supply voltage (V) | 3.3 V |
| Vavg | Average voltage (V) | 1.65 V |
| Vrms | RMS voltage (V) | 2.333 V |
Assumptions
5 items
- 01The output is an ideal rectangular pulse train: D = t_on/T, V_avg = D·V and V_rms = √D·V; an on-time longer than the period is taken as the whole period.
- 02As a timer makes it: the period is N = T × f_tim whole ticks (the auto-reload value + 1) and the on-time M = t_on × f_tim ticks (the compare value), each rounded to the nearest, a half up; the duty as set is M/N and the frequency f_tim/N.
- 03The duty resolution is log2 N bits, the steps one period offers the duty; the page passes it at or above the resolution you require (8 bits by default).
- 04Edge-aligned counting is assumed; centre-aligned counting halves the frequency for the same N. Rise and fall times, dead time and the load are not modelled.
- 05The drawing is three periods of the output beside the timer's counter ramping from 0 to N − 1.
Worked example
A 500 kHz converter from a 64 MHz timer
A controller drives a 500 kHz switching stage at 33.0 % duty from a timer clocked at 64 MHz. What duty does the timer really set, and how fine is its step?
| Step | Expression | Result |
|---|---|---|
| Period in ticks | 2 µs × 64 MHz | 128 |
| On-time in ticks | 660 ns × 64 MHz | 42.24 |
| Rounded to whole ticks | round(42.24) | 42 |
| Duty as set, against the 33.0 % asked for | 42 / 128 | 32.81 % |
| Duty resolution, short of the 8 bits required | log2(128) | 7.00 bits |
| Duty step | 1 / 128 | 0.78 % |
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).
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
5 questions
What is a typical duty cycle range?
Per motor and LED driver conventions: 0-100% theoretically possible, but 5-95% practical due to driver limitations. At D < 5%, minimum on-time constraints dominate. At D > 95%, bootstrap capacitor recharge fails in high-side drivers. LED drivers (TI TPS92515) specify 1-100% dimming range with dedicated <1% low-brightness mode. Motor drives typically limit to 10-90% to prevent stall and ensure reliable commutation.
How does duty cycle affect power delivery?
Average power Pavg = Ppeak × D for resistive loads. For inductive loads (motors): power relationship is nonlinear due to back-EMF. At 50% duty cycle, a 12 V/1 A motor draws approximately 0.6 A average (not 0.5 A) due to continuous current mode in the inductance. Per TI DRV8870 datasheet, actual power delivery is Pavg = (Vbus - Vbemf) × Iavg × D + Vbemf × Iavg.
Can PWM be used for analog-like control?
Yes — PWM combined with low-pass filtering creates pseudo-analog output. Per Analog Devices MT-015, an N-bit PWM with fc = fsw/2^N filter achieves N-bit analog resolution. Example: 16-bit PWM at 100 kHz with 1.5 Hz filter creates 16-bit DAC (0.0015% resolution). Limitations: response time inversely proportional to resolution, and noise floor set by filter component tolerance.
What PWM frequency is best for LED dimming?
Per IEEE 1789 (flicker safety standard): >3 kHz eliminates visible flicker at any duty cycle, >100 Hz acceptable for >10% duty cycle. Human eye detection threshold varies with brightness — at 1% duty cycle, flicker visible up to 2 kHz. Professional video lighting requires >25 kHz to avoid rolling shutter artifacts. Standard LED drivers (TI TPS92200) operate at 200-1000 Hz with proprietary flicker-reduction algorithms.
How does PWM resolution affect control precision?
Resolution = 1/2^N for N-bit timer. Per STM32 application note AN4013: 8-bit = 0.39% steps (256 levels), 10-bit = 0.1% steps (1024 levels), 16-bit = 0.0015% steps (65536 levels). For motor speed control, 8-10 bits sufficient (1% speed accuracy). For precision LED dimming (1000:1 ratio), 10+ bits required. For audio DAC, 16-bit minimum. Higher resolution requires longer timer period or faster clock: 16-bit at 20 kHz needs 1.3 GHz clock or prescaler adjustment.
Shop Components
As an Amazon Associate we earn from qualifying purchases.
- DC-DC Buck Converter ModulesAdjustable step-down converter modules for bench and prototype useAmazon →
- LDO Voltage Regulator KitAssorted low-dropout linear regulators for prototypingAmazon →
- Electrolytic Capacitor KitAluminum electrolytic capacitor kit for power supply filteringAmazon →
- Power Inductor KitAssorted shielded power inductors for switching supply designsAmazon →