PWM Frequency Calculator
Calculate PWM frequency, period, duty cycle and pulse width for electronics and microcontroller projects.
Common PWM Frequencies
| Application | Typical Frequency |
|---|---|
| LED Dimming | 200Hz – 1kHz |
| DC Motor Control | 1kHz – 20kHz |
| Servo Motors | 50Hz |
| Audio PWM | 20kHz+ |
| Arduino Default PWM | 490Hz / 980Hz |
Arduino PWM Pins
3, 5, 6, 9, 10, 11
PWM Formula Reference
f = 1 ÷ T
T = 1 ÷ f
D = (PW ÷ T) × 100
PW = T × D
What Is PWM?
PWM stands for pulse width modulation. It is a method of rapidly switching a signal on and off to control the average amount of power delivered to a device. Instead of reducing voltage directly, PWM changes how long the signal stays on during each cycle.
PWM is widely used in electronics because it is efficient, simple to control, and works well with microcontrollers such as Arduino, ESP32, Raspberry Pi Pico, and other development boards.
What Does PWM Frequency Mean?
PWM frequency is the number of complete on-off cycles per second. It is measured in hertz (Hz). For example, a PWM frequency of 1,000 Hz means the signal completes 1,000 cycles every second.
The right frequency depends on the application. LED dimming, motor control, servo control, audio circuits, and switching power supplies may all use different PWM frequency ranges.
What Is Duty Cycle?
Duty cycle describes the percentage of each PWM cycle where the signal is on. A 50% duty cycle means the signal is on for half the cycle and off for the other half. A 25% duty cycle means it is on for one quarter of the cycle.
In practical terms, a higher duty cycle usually delivers more power to the load. For an LED, this can make it appear brighter. For a DC motor, it can increase speed. For a heater, it can increase average power.
Frequency, Period, and Pulse Width
PWM calculations often use three related values: frequency, period, and pulse width. Frequency tells you how many cycles happen per second. Period is the time taken for one complete cycle. Pulse width is the amount of time the signal stays on during each cycle.
- Frequency: cycles per second, measured in Hz
- Period: time for one full cycle
- Pulse width: on-time during the cycle
- Duty cycle: on-time as a percentage of the full cycle
Common PWM Applications
LED Dimming
PWM is commonly used to dim LEDs. By changing the duty cycle, the LED is turned on and off faster than the eye can normally notice. A low duty cycle makes the LED appear dimmer, while a high duty cycle makes it appear brighter.
DC Motor Speed Control
PWM is often used to control DC motor speed. Instead of wasting energy as heat through a linear control method, PWM rapidly switches power to the motor. This makes it an efficient option for robotics, fans, pumps, and small motor projects.
Servo Control
Hobby servos usually use a low-frequency control signal, often around 50 Hz. The position of the servo is controlled by pulse width rather than simple power level.
Microcontroller Projects
Arduino, ESP32, Raspberry Pi Pico, and similar boards often include PWM output pins. These can be used for LEDs, buzzers, motors, simple audio output, and control signals.
Typical PWM Frequency Ranges
| Use Case | Typical PWM Frequency |
|---|---|
| LED dimming | 200 Hz to 1 kHz |
| DC motor control | 1 kHz to 20 kHz |
| Hobby servo signal | About 50 Hz |
| Audio-related PWM | 20 kHz or higher |
| Arduino default PWM | Often around 490 Hz or 980 Hz depending on the pin |
Choosing the Right PWM Frequency
There is no single perfect PWM frequency for every project. The best choice depends on what you are controlling. For LEDs, the frequency should be high enough to avoid visible flicker. For motors, it may need to balance smooth control, noise, efficiency, and driver limitations.
Very low PWM frequencies can cause flicker, pulsing, or vibration. Very high frequencies may increase switching losses or exceed the capabilities of the driver circuit. The correct value depends on the hardware being used.
Common PWM Formulas
- Frequency: f = 1 ÷ T
- Period: T = 1 ÷ f
- Duty Cycle: Duty Cycle = Pulse Width ÷ Period × 100
- Pulse Width: Pulse Width = Period × Duty Cycle
When using milliseconds, remember that 1 second equals 1,000 milliseconds. A frequency of 1,000 Hz has a period of 1 millisecond.
Example PWM Calculation
If a PWM signal has a frequency of 1,000 Hz, the period is 1 ms. If the duty cycle is 50%, the pulse width is 0.5 ms. If the duty cycle is 25%, the pulse width is 0.25 ms.
This is useful when setting up timers, configuring microcontroller PWM outputs, or checking whether a signal is suitable for a component or driver module.
Frequently Asked Questions
What is a good PWM frequency for LED dimming?
For many basic LED dimming projects, a frequency between 200 Hz and 1 kHz is usually suitable. Higher frequencies may be used where flicker needs to be reduced further.
What is a good PWM frequency for motors?
DC motor PWM frequencies often fall between 1 kHz and 20 kHz. Higher frequencies can reduce audible noise, but the motor driver must support the chosen frequency.
Does PWM change voltage?
PWM does not usually lower voltage directly. Instead, it changes the average power by switching the signal on and off rapidly. The load responds to the average effect of that switching.
Is higher PWM frequency always better?
No. Higher PWM frequency can reduce flicker or noise, but it may also increase switching losses or create problems for some drivers. The best frequency depends on the circuit.
Can PWM be used with Arduino?
Yes. Arduino boards commonly support PWM on selected pins. On an Arduino Uno, the usual PWM pins are 3, 5, 6, 9, 10, and 11.
