PWM Frequency Calculator
Convert frequency ↔ period, compute on/off time from duty cycle, and estimate PWM frequency from timer settings.
How to Use
- Enter Frequency or Period (either one is enough).
- Add Duty Cycle if you want On-Time and Off-Time.
- Optional: Use Timer Mode inputs (clock, prescaler, TOP) to estimate PWM frequency.
- Open Show Work to see formulas and steps.
Timer Mode (Optional)
Estimate PWM frequency from clock, prescaler, and TOP. (Tool works without this section too.)
f = f_clk / (N × (1 + TOP))Show Work (step-by-step)
Formulas
- Frequency ↔ Period:
f = 1 / T,T = 1 / f - Duty Cycle:
D = Ton / T,Ton = D × T,Toff = T − Ton - From on/off time:
T = Ton + Toff,f = 1 / (Ton + Toff) - Fast PWM (common):
f_pwm = f_clk / (N × (1 + TOP)) - Phase Correct (common):
f_pwm = f_clk / (2 × N × TOP)(implementation may vary by MCU)
FAQ
What PWM frequency should I use for LEDs?
Many setups avoid visible flicker by using ~500 Hz to several kHz. Cameras can still show banding depending on shutter speed.
Why do motors often use 20 kHz PWM?
20 kHz is above most human hearing, reducing audible whine. Tradeoffs include switching losses and driver limitations.
How do Ton and Toff relate to duty cycle?
Duty is the fraction of the period spent “on”: D = Ton / (Ton + Toff).
Why doesn’t my MCU’s PWM match the formula exactly?
Some timers use TOP vs TOP+1, center-aligned counting, or special clock sources. Always confirm with your MCU reference manual.
Tool Info
Last updated:
Updates may include additional timer formulas, presets, and edge-case handling.