How PWM works
PWM (pulse width modulation) is a way of controlling how much power reaches a load by switching a digital output fully on and fully off very quickly and varying how long it stays on in each cycle. The load responds to the average, so a motor turns slower, an LED looks dimmer or a heater runs cooler, even though the output is only ever on or off.
Two numbers define a PWM signal. The duty cycle is the percentage of each period the signal is on: 25% on and 75% off gives a quarter of the full power. The frequency is how many on-off cycles happen each second. With a 24 V supply, a 50% duty cycle delivers an average of 12 V, and 75% delivers 18 V.
PWM is efficient because the switch is either fully on, with almost no voltage across it, or fully off, with no current through it. Very little power is lost as heat, unlike a linear regulator or a resistor that burns off the difference. That is why PWM sits inside motor drives, LED drivers, switch-mode power supplies and almost every microcontroller.
Duty cycle, frequency and resolution
The frequency must be high enough that the load smooths the pulses rather than following each one. Motors and heaters have inertia, so they average naturally. LEDs do not, so the frequency must be high enough that the eye, and any camera watching, sees steady light.
Resolution is the number of steps between 0% and 100%. A PWM generator is normally a hardware timer that counts clock pulses and switches the output when the count passes a compare value. An 8-bit timer gives 256 steps; a 16-bit timer gives 65,536. At a fixed clock, higher resolution means a lower maximum frequency, so designs trade one against the other.
Typical PWM frequencies by application
There is no single right frequency. The table shows ranges commonly used in industrial and embedded designs.
| Application | Typical frequency | Why |
|---|---|---|
| Heaters (time-proportional control) | One cycle every 1–10 seconds | Thermal mass averages slow cycles; suits relays and solid-state relays |
| RC servos | 50 Hz, 1–2 ms pulse | Pulse width sets the position, not the power |
| Solenoids and proportional valves | Around 100 Hz to 1 kHz | Small dither keeps the valve spool moving freely |
| LED and backlight dimming | Several hundred Hz to tens of kHz | High enough to avoid visible flicker and camera banding |
| DC motors and brushless drives | Around 1–20 kHz | Higher frequencies move switching noise above hearing |
| 4-pin computer fans | 25 kHz (21–28 kHz) | Set by Intel’s 4-wire PWM fan specification |
| Switch-mode power supplies | 100 kHz to several MHz | Higher frequency allows smaller inductors and capacitors |
Switching faster is not free. Each transition costs a little energy in the switching transistor and creates electrical noise, so very high PWM frequencies need careful layout and filtering to meet EMC limits.
Where PWM is used in industrial systems
In automation, PWM turns a digital output into something close to an analogue control signal.
-
//
Motor speed control. DC motor drivers and variable frequency drives switch their output transistors with PWM to set speed and torque.
-
//
Valves and actuators. PWM outputs drive proportional valves and solenoids, with the duty cycle setting position or force.
-
//
Heating. PLCs and controllers use slow time-proportional PWM to hold an oven, platen or barrel at temperature through a contactor or solid-state relay.
-
//
Lighting and displays. LED backlights in industrial monitors and panel PCs are commonly dimmed with PWM from the display controller.
-
//
Cooling. Fan-cooled computers set fan speed by PWM from temperature sensors, while fanless computers remove the fan altogether.
PWM outputs on embedded and I/O hardware
Most microcontrollers and system-on-chip processors have hardware PWM timers, and on single-board computers some of the GPIO pins can be switched to a PWM function. These pins are logic level, usually 3.3 V, so they need a driver or relay stage before they can switch a valve, motor or heater.
For industrial wiring, PWM usually comes from an I/O module with buffered or isolated outputs. Several PC/104 analogue I/O modules in our range include four 24-bit pulse width modulators alongside their analogue outputs, and an FPGA-based PCIe MiniCard among our digital I/O modules can switch groups of lines into counter/timer and PWM modes. When choosing between a PWM output and a true analogue output, consider the load: a motor, heater or LED is happy with PWM, while a drive speed reference or a 4–20 mA loop needs a real analogue signal.
Quick answers on PWM
Pulse width modulation: common questions
What does PWM stand for?
Pulse width modulation. The width of each pulse, its on-time, is varied (modulated) to change the average power or to carry a value.
What is a PWM fan?
A fan with a fourth control wire. A 4-pin PWM fan keeps a steady 12 V supply and takes a 25 kHz PWM signal on the fourth pin to set its speed. A 3-pin DC fan is speed-controlled by varying its supply voltage instead.
What is the duty cycle in PWM?
The percentage of each cycle the signal is on. A 0% duty cycle is always off, 100% is always on, and 50% is on for half of every period, which delivers half the average voltage.
Does PWM dimming cause flicker?
It can at low frequencies. Below a few hundred hertz some people notice flicker, and cameras can show banding at much higher frequencies. Industrial displays used with cameras or for long shifts benefit from high-frequency or flicker-free dimming.
How is a PWM signal generated?
Usually by a hardware timer. A counter runs from a clock and the output switches when the count passes a compare register. Microcontrollers, FPGAs and dedicated PWM controller chips all work this way.
We fit I/O modules with PWM, counter and isolated outputs into our embedded and industrial computers as standard, and we can match the output type to the load you need to drive.