ElectroCalc

PWM Calculator

Calculate PWM period, on/off times, and average voltage from frequency and duty cycle — or find the duty cycle needed to achieve a target average voltage.

PWM Parameters

%
V

Results

Period (T)1.000 ms
tON500.0 µs
tOFF500.0 µs
Average voltage (Vavg)2.500 V
VavgtONtOFFVp

Vavg = Vpeak × D/100

Common PWM Frequencies by Application

ApplicationTypical Frequency
DC motor speed control1–20 kHz
Servo motor control50 Hz
LED dimming100 Hz – 20 kHz
Switching power supply20 kHz – 2 MHz
Class D audio amplifier40 – 400 kHz
Piezo buzzer tone1 – 20 kHz

How PWM Works

Pulse-Width Modulation (PWM) is a technique for encoding analog information in a digital signal by varying the fraction of time the signal is high (the duty cycle). The average voltage seen by the load equals the peak voltage multiplied by the duty cycle.

A low-pass filter on the output converts the PWM waveform to a true DC analog voltage equal to Vavg. Without a filter, the load itself may integrate the switching (e.g., a motor's inductance or an LED's phosphor persistence).

Average Voltage

Vavg = Vpeak × D / 100

Period and Timing

T = 1 / f | tON = T × D/100

Key Points

  • Higher frequency: smoother output but higher switching losses
  • D = 0% = always off; D = 100% = always on
  • Motor control: higher frequency reduces audible noise (>20 kHz)
  • Servos use 50 Hz with 1–2 ms pulse width to encode angle
  • LED dimming: >100 Hz prevents visible flicker
  • PWM resolution: an N-bit timer gives 2ᴺ steps of duty cycle

Applications

  • Motor speed and direction control
  • LED brightness dimming
  • Servo position control
  • Switching power supply duty cycle
  • DAC via RC low-pass filter