## Filtered PWM

Figure 1 shows the spectrum of an unfiltered PWM signal with a basic frequency of 5 kHz and a duty cycle of 25%. As you can see, the harmonics at multiples of the basic frequency gradually fall off in amplitude at higher frequencies. It is also worth noting that at this particular duty cycle the harmonics at 20 kHz and 40 kHz completely disappear: this is not the case for other values of duty cycle. At extreme values of duty cycle, for example 1% or 99%, where the signal consists of very narrow positive- or negative-going spikes, the spectrum consists of a series of low-amplitude peaks all of approximately the same height.

Depending on the ratio of its cutoff frequency to the PWM frequency, and on the sharpness of its response, a low-pass filter will pass part of the spectrum of the PWM signal and attenuate certain higher spectral components. As a result the residual ripple on the output signal will depend on the characteristics of the filter and on the PWM duty cycle. To give an idea of the extent of this effect, Table 1 shows some measured results using two ordinary RC low-pass filters with a rolloff of 6 dB/ octave and cutoff frequencies of 4.4 kHz and 2.2 kHz. The ‘rip-ple’ figure is the peak divergence of the output signal from the median value of the DC level generated. With a duty cycle of 100% the DC output level should in theory be 2.0 V.

You might think that by using a filter with a sharper cutoff we could obtain a clear improvement, and indeed that is indeed the case, at least for some values of ‘clear’. Using a 12-dB/octave filter improves the ripple at 2.2 kHz and a 50% duty cycle to just 0.50 Vpp and the DC level to 0.92 V. Of course it is possible to play around with Bessel and Chebyshev filters and the like, but it is questionable whether this is really worth the effort.

All those extra components cost money, and, so important these days, real estate on your printed circuit board. On the other hand, if we significantly reduce the cutoff frequency of the filter, the sluggishness of its response prevents us making rapid changes to the DC output value.