Oscillators & Timers

pulse-width modulation (PWM)

/ P-W-M /

Pulse-width modulation is a clever way to deliver a smoothly adjustable amount of power using a switch that is only ever fully on or fully off. Instead of throttling a flow with a half-open valve (which wastes energy as heat), you flick the valve fully open and fully shut very rapidly, and control the average by changing what fraction of the time it stays open. Dim an LED by flashing it on and off faster than the eye can see, mostly on for bright, mostly off for dim, and you perceive a steady brightness in between.

Concretely, PWM is a square wave of fixed frequency whose duty cycle you vary to encode a control value. The average voltage delivered is duty cycle times the supply, so 0 percent gives 0, 100 percent gives full power, and anything in between is proportional. The load itself, or a simple low-pass filter, smooths the chopped wave into that average: a motor's inertia, an LED driven faster than the eye can follow, a heater's thermal mass, or an RC filter all do the smoothing. A microcontroller generates PWM trivially; a 555 in astable mode with a control voltage can too. Choose the frequency high enough that the load smooths it but not so high that switching losses pile up.

PWM is everywhere power must be controlled efficiently: motor speed, LED dimming and backlights, switching power supplies, class-D audio amplifiers, and servo position (where the pulse width itself carries the command). The reason it dominates is efficiency: because the switch is always fully on (low voltage across it) or fully off (no current through it), it dissipates very little, unlike a linear control that burns the difference as heat. The honest caveats: PWM chops current sharply, which generates electrical noise (EMI) that needs filtering and careful layout, and a too-low PWM frequency can be heard as an annoying whine or seen as flicker.

To dim an LED, drive it with a 1 kHz PWM signal. At 80 percent duty cycle it is lit for 0.8 milliseconds and dark for 0.2 milliseconds out of each 1 millisecond cycle; far faster than the eye, so you see roughly 80 percent brightness, while the driving transistor stays cool because it is always fully on or fully off.

Control average power by varying the on-fraction of a fast switch, not by throttling and wasting heat.

PWM is efficient precisely because the switch never lingers in its lossy middle region; but the sharp switching edges radiate EMI and demand good decoupling and layout. Too low a PWM frequency becomes audible whine or visible flicker, so pick the frequency deliberately.

Also called
PWMpulse width modulation脈衝寬度調變