PWM Frequency Calculator – Calculate PWM Output Frequency
Calculate PWM frequency based on clock speed, prescaler, and resolution. Essential for motor control and power electronics.
Apply the Prescaler
The prescaler divides the input clock frequency. A prescaler of 64 means the timer counts once for every 64 clock cycles, effectively slowing down the base frequency before PWM generation.
Account for Resolution
Resolution in bits determines the PWM counter range. An 8-bit resolution means 2^8 = 256 steps. Higher resolution gives finer duty cycle control but lowers maximum frequency.
Calculate Final Frequency
PWM frequency equals clock frequency divided by (prescaler × 2^resolution). The period is simply the inverse – how long one complete PWM cycle takes in seconds or microseconds.
**Motor Speed Control**
PWM frequency affects motor performance. Too low causes audible whine and torque ripple. Too high increases switching losses. Typical motor control uses 8-20 kHz for optimal efficiency.
**LED Dimming**
LED drivers use PWM for smooth dimming. Frequencies above 200 Hz prevent visible flicker. High-end lighting uses 1-10 kHz for camera-compatible, flicker-free operation.
**Power Supply Regulation**
Switch-mode power supplies rely on PWM. Higher frequencies allow smaller inductors and capacitors but increase switching losses. Typical SMPS operates at 50 kHz to 2 MHz.
**Audio Signal Generation**
Class-D amplifiers use PWM to reproduce audio. Frequencies must exceed 20 kHz (above human hearing) with careful filtering. High-quality audio PWM runs at 300-500 kHz.
Common PWM Frequency Ranges
| Application | Typical Frequency | Resolution | Notes |
|---|---|---|---|
| DC Motor Control | 8-20 kHz | 8-10 bit | Above audible range |
| LED Dimming | 200 Hz - 10 kHz | 8-12 bit | Flicker-free visible light |
| Switch-Mode PSU | 50 kHz - 2 MHz | 8-16 bit | Trade-off: size vs efficiency |
| Servo Control | 50-400 Hz | 10-12 bit | Standard hobby servo protocol |
| Class-D Audio | 300-500 kHz | 16-24 bit | Ultrasonic carrier frequency |
What is a good PWM frequency for motors?
For DC motors, 8-20 kHz works well. Below 8 kHz causes audible noise; above 20 kHz increases switching losses without benefit. Brushless motors often use 16-32 kHz. Stepper motors benefit from 20-40 kHz for smooth microstepping.
How does PWM resolution affect frequency?
Higher resolution means more steps per cycle, which lowers maximum frequency. Doubling resolution (e.g., 8 to 9 bits) halves the max frequency. Choose resolution based on control precision needs, not just maximum frequency.
What does the prescaler do in PWM?
The prescaler divides the clock before it reaches the PWM timer. Common values are 1, 8, 64, 256. It lets you achieve lower frequencies without changing resolution, useful when your clock is too fast for your application.
Why is my PWM making noise?
Audible noise means your PWM frequency is below 20 kHz. Motors and inductors physically vibrate at the PWM frequency. Increase frequency above 20 kHz or add mechanical damping. Check for loose components resonating at your PWM frequency.
Can I change PWM frequency on Arduino?
Yes, by modifying timer prescalers and registers. Arduino Uno defaults to ~490 Hz (pins 5,6: ~980 Hz). You can reconfigure timers for frequencies from a few Hz to 62.5 kHz, but it requires direct register manipulation.
Other Free Tools
Frequency Calculator
Frequency Calculator – Calculate Frequency from Period and More
Duty Cycle Calculator
Duty Cycle Calculator – Calculate PWM Duty Cycle
Rc Time Constant Calculator
RC Time Constant Calculator – Calculate RC Circuit Time Constant
Rl Time Constant Calculator
RL Time Constant Calculator – Calculate RL Circuit Time Constant
Rlc Resonance Calculator
RLC Resonance Calculator – Calculate Resonant Frequency
0 100 Acceleration Estimator
0-100 Acceleration Estimator – Calculate 0 to 100 km/h Time