Understanding the duty cycle calculator — concept and principle
The duty cycle is the fraction of each period that a pulse signal is ON. It is the key number in PWM (pulse-width modulation), used to dim LEDs, control motor speed and regulate power supplies. This calculator converts between pulse width, period, frequency and OFF time, and gives the average and RMS voltage.
How it is calculated
- Duty cycle D = ton ÷ T × 100%, with period T = 1 ÷ f = ton + toff.
- Average (DC) value of a 0-to-Vhigh rectangular wave = D × Vhigh.
- RMS value = Vhigh × √D, which sets the heating power in a resistor.
- Rise and fall times are assumed negligible.
The principle
A load that responds slowly, such as a motor or the eye looking at an LED, effectively averages a fast pulse train. Switching fully on and off wastes little power in the switch, yet the average delivered can be set precisely by the share of time it is on. Heating in a resistor depends on the square of voltage, so the RMS value (√D times the peak) is what determines power, not the average.
Worked example
Default inputs: pulse width 2 ms, period 10 ms, high level 5 V.
- D = 2 ÷ 10 × 100% = 20%.
- Frequency = 1 ÷ 0.010 s = 100 Hz; OFF time = 10 − 2 = 8 ms; ON time 2 ms; period 10 ms.
- Average voltage = 0.20 × 5 = 1 V.
- RMS voltage = 5 × √0.20 ≈ 2.236 V.
| Period (ms) | Duty cycle (%) |
|---|---|
| 2.5 | 80 |
| 5 | 40 |
| 7.5 | 26.67 |
| 10 | 20 |
| 12.5 | 16 |
| 15 | 13.33 |
| 20 | 10 |
How to read the result
A 20% duty cycle delivers one fifth of the full average voltage, but power into a resistor is D × Vhigh² ÷ R, i.e. 20% of full power, matching (2.236 V)² ÷ R. Choose a PWM frequency high enough that the load averages it: LEDs often use hundreds of hertz or more to avoid visible flicker; motors often use kilohertz ranges.
Common mistakes
- Using the average voltage to compute resistor heating (use RMS).
- Confusing duty cycle with frequency.
- Choosing a PWM frequency so low that LEDs flicker.
- Ignoring rise and fall times at high frequencies.
Frequently asked questions
What does a 50% duty cycle mean?
The signal is on for half of each period.
How do I calculate duty cycle from frequency?
D = pulse width × frequency (with consistent units).
Why is RMS higher than average for PWM?
RMS weighs by voltage squared; for a pulse train it equals the peak × √D, which exceeds peak × D when D < 1.
Sources: Horowitz, P. & Hill, W., The Art of Electronics, 3rd ed. Cambridge University Press (PWM) · IEEE Std 194-1977, Standard Pulse Terms and Definitions