Analog Waveform Generation from PWM Signal

Analog waveforms can be generated by averaging the PWM signals over one period using simple low-pass filters. In this application note, implementation of sine wave generation from high-speed PWM output is explained. If high-speed PWM is used to generate analog signals, the step-size between the analog levels depends on the resolution of the PWM signal. Duty cycle of the PWM signal determines the amplitude of the analog waveform. A duty cycle of 50% gives an analog signal with half the supply voltage, while 75% duty cycle gives an analog signal with 75% supply voltage. A real-time example of PWM waveform with varying duty cycle is shown in the following figure.
Figure 1. PWM Output with Varying Duty Cycle

The analog low-pass filter could be a simple passive RC-filter for instance. The filter removes the high PWM base frequency and lets through the analog signal. The filter crossover frequency must be chosen high enough to not alter the analog signal of interest. At the same time, it must be as low as possible to minimize the ripple from the PWM base frequency. The higher the base frequency is, the easier it is to attenuate the base frequency and thereby minimize the signal ripple. The selection of resolution versus base frequency is thus an application dependent trade-off.

Figure 2. Low-Pass RC-Filter

If the analog signal is fed to a low-impedance input, a buffer amplifier should be connected between the filter output and the load. This will prevent the load from discharging the capacitor and creating ripple voltages.