PWM Frequency Calculator

Calculate PWM frequency, period, timer prescaler, ARR, and duty cycle.

PWM Signal
PWM frequency and duty cycle waveform
STEP 1

What do you want to calculate?

PWM Frequency Calculate frequency from timer settings
PWM Period Calculate the time for one PWM cycle
Timer Prescaler Find the required prescaler (PSC)
ARR / TOP Value Calculate timer auto-reload value
Duty Cycle & CCR Calculate pulse width and compare register
STEP 2

Enter the values you know

Enter the clock frequency supplied to the timer peripheral.
PSC
Register value (PSC). Effective clock divider is (PSC + 1).
ARR
Timer auto-reload register value. Effective counter period is (ARR + 1).
Result

What is PWM?

PWM (Pulse Width Modulation) controls the average power delivered to a load by switching a digital signal ON and OFF at a fixed frequency while varying the pulse width.

PWM Frequency Formula (Edge-Aligned)

f_PWM = Timer Clock ÷ ((PSC + 1) × (ARR + 1))

PWM Period

T = 1 ÷ f_PWM

Duty Cycle & CCR

Duty Cycle % = (CCR ÷ (ARR + 1)) × 100

Example for STM32

For an STM32 timer running at 72 MHz with PSC = 71 and ARR = 999:

f_PWM = 72,000,000 ÷ ((71 + 1) × (999 + 1)) = 1,000 Hz = 1 kHz

Common PWM Applications

  • DC motor speed and direction control
  • LED brightness and RGB color mixing
  • RC Servo motor control (typically 50 Hz, 1-2 ms pulse)
  • SMPS and DC-to-DC converters (Buck / Boost)
  • Audio signal synthesis and class-D amplifiers