PWM Duty Cycle Calculator
Calculate PWM duty cycle, frequency, period, on-time, and off-time.
Essential for motor control, LED dimming, and power electronics.
Pulse Width Modulation (PWM) is a technique for controlling power to devices using a digital signal that rapidly switches between on and off. By varying the ratio of on-time to off-time, PWM can control the effective voltage seen by a load — making it extremely efficient because the switching device (transistor or MOSFET) dissipates very little power compared to a linear regulator.
Key PWM Parameters
Period (T): The total time of one complete on/off cycle T = 1 / f (where f is frequency in Hz)
Duty Cycle (D): The percentage of the period when the signal is HIGH (on) D (%) = (t_on / T) × 100
On-Time (t_on): How long the signal is HIGH in each cycle t_on = D × T / 100
Off-Time (t_off): How long the signal is LOW in each cycle t_off = T − t_on
Average Voltage: For a digital signal with amplitude V_high: V_avg = V_high × D / 100
Practical Applications
| Application | Typical PWM Frequency |
|---|---|
| LED dimming | 200 Hz – 10 kHz (above flicker threshold) |
| DC motor speed control | 1 kHz – 20 kHz |
| Audio amplifier (Class D) | 200 kHz – 1 MHz |
| Servo motor control | 50 Hz (20 ms period) |
| Power supply switching | 20 kHz – 500 kHz |
| Fan speed control | 25 kHz (PC fans standard) |
Servo Control Special Case
Servo motors use a fixed 50 Hz (20 ms period) signal where:
- 1 ms on-time = 0° (or minimum position)
- 1.5 ms on-time = 90° (center)
- 2 ms on-time = 180° (or maximum position)
The duty cycle for servo control is only 5–10%, but the pulse width controls position.
LED Dimming and Flicker
For LED dimming, frequencies below 100 Hz can cause visible flicker, especially in video. Frequencies above 1 kHz are generally safe. Many LED dimming systems use 10–50 kHz to avoid any perceptible flicker even with high-speed cameras.
Arduino/Microcontroller PWM
Most Arduino boards have built-in PWM on pins 3, 5, 6, 9, 10, 11. The default PWM frequency is:
- Pins 5 and 6: ~980 Hz
- Pins 3, 9, 10, 11: ~490 Hz
The analogWrite() function takes 0–255 where 0 = 0% and 255 = 100% duty cycle.