*Stephen Woodward*

*EDN*

An inexpensive way to implement high-resolution digital-to-analog conversion is to combine microcontroller-PWM (pulse-width-modulated) outputs with precision analog-voltage references, CMOS switches, and analog filtering (Reference 1). However, PWM-DAC design presents a big design problem: How do you adequately suppress the large ac-ripple component inevitably present in the switch’s outputs? The ripple problem becomes especially severe when you use typical 16-bit microcontroller-PWM peripherals for DAC control; such high-resolution PWM functions usually have long cycles because of the large 216 countdown modulus of 16-bit timers and comparators. This situation results in ac-frequency components as inconveniently slow as 100 or 200 Hz. With such low ripple frequencies, if you employ enough ordinary analog lowpass filtering to suppress ripple to 16-bit – that is, –96-dB – noise levels, DAC settling can become a full second or more.

Figure 1. |
This DAC ripple filter combines a differential integrator, A_{1}, with a sample-and-holdamplifier, A _{2}, in a feedback loop operating synchronously with the PWM. |

The circuit in Figure 1 avoids most of the problems of lowpass filtering by combining a differential integrator, A_{1}, with a sample-and-hold amplifier, A_{2}, in a feedback loop operating synchronously with the PWM cycle, T_{2} in Figure 2. If you make the integrator time constant equal to the PWM cycle time – that is, R_{1} × C_{1} = T_{2} – and, if the sample capacitor, C_{2}, is equal to the hold capacitor, C_{3}, then the filter can acquire and settle to a new DAC value in exactly one PWM-cycle time. Although this approach hardly makes the resulting DAC exactly “high speed,” 0.01-sec settling is still 100 times better than 1-second settling. Just as important as speed, this improvement in settling time comes without compromising ripple attenuation. Ripple suppression of the synchronous filter is, in theory, infinite, and the only limit in practice is nonzero-charge injection from S_{2} into C_{3}. The choice of a low-injected-charge switch for S_{2} and an approximately 1-µF capacitance for C_{3} can easily result in ripple amplitudes of microvolts.

Figure 2. |
The DAC output settles within one cycle. |

Optional feedback-voltage divider R_{2}/R_{3} provides flexibility in a DAC-output span with common voltage references. For example, if R_{2}=R_{3}, then a 0 to 10 V output span will result from a 5 V reference. An additional advantage of this method of span adjustment is that output ripple remains independent of reference amplification.