Interactive PWM Waveform
Duty-Cycle Sweep and Comparison
| Duty | ON time | OFF time | Average voltage | RMS voltage | Average power | Compare value | Quantised duty |
|---|
Calculation History
Formula Used
Duty cycle (%) = ON time ÷ Period × 100
Period = 1 ÷ Frequency
ON time = Period × Duty fraction
OFF time = Period − ON time
Average voltage = Supply voltage × Duty fraction
RMS voltage = Supply voltage × √Duty fraction
Average resistive power = Full-duty power × Duty fraction
Edge-aligned frequency = Timer clock ÷ (TOP + 1)
Centre-aligned frequency ≈ Timer clock ÷ (2 × TOP)
Duty step ≈ 100 ÷ (TOP + 1)
How to Use
Select the quantity you need to solve. Enter the relevant timing or timer values. Choose units beside every measurement.
Add supply and load details for electrical estimates. Enter dead time for complementary switching analysis. Press Calculate PWM to view all results.
Use the sweep table to compare settings. Export results for documentation or testing. Verify hardware limits before implementation.
Example Data
| Application | Frequency | Duty | Supply | Expected ideal average |
|---|---|---|---|---|
| LED dimming | 1 kHz | 25% | 12 V | 3 V average command |
| DC motor control | 20 kHz | 60% | 24 V | 14.4 V average command |
| Resistive heater | 10 Hz | 40% | 230 V | 40% ideal power |
| 16 MHz timer | 1 kHz | 25% | Prescaler 1 | TOP near 15,999 |
PWM Design Notes
Average voltage describes the mean waveform level. RMS voltage predicts resistive heating more accurately. Motors and inductors smooth current dynamically.
Timer resolution decreases as PWM frequency rises. Prescalers extend frequency range but reduce timer speed. Integer registers create unavoidable quantisation error.
Complementary outputs require non-overlap dead time. Excessive dead time distorts small duty cycles. Gate-driver limits must always be checked.
Frequently Asked Questions
What is PWM duty cycle?
Duty cycle is the percentage of one period spent active. A 25% signal stays high for one quarter. Polarity can invert the electrical meaning.
How are frequency and period related?
Frequency is the number of cycles each second. Period is the duration of one cycle. They are mathematical reciprocals.
Is average voltage equal to RMS voltage?
No. Average voltage follows duty directly for ideal unipolar PWM. RMS voltage follows the square root of duty.
Why does timer duty differ from requested duty?
Hardware registers use integer counts. The requested value is rounded to an available compare count. This creates quantisation error.
What does dead time change?
Dead time prevents simultaneous transistor conduction. It removes conduction time around switching transitions. Small pulses are affected most strongly.
Which PWM frequency suits motors?
The best frequency depends on motor inductance and driver losses. Frequencies above audible range reduce whining. Higher frequency increases switching losses.
Does motor speed equal duty percentage?
Duty cycle gives a useful command estimate. Real speed depends on back EMF and load. Closed-loop control improves accuracy.
Does LED brightness scale linearly?
Electrical average current can scale approximately with duty. Human vision responds nonlinearly to brightness. Gamma correction improves visual steps.
What is centre-aligned PWM?
Centre-aligned PWM places pulses symmetrically around cycle centres. It can reduce harmonic asymmetry. Its timer frequency formula differs.
Can this calculator replace datasheet checks?
No. It provides ideal calculations and engineering estimates. Confirm timer architecture, driver timing, and thermal limits.