# SIGNAL CHAIN BASICS #48: Implementing averaging filters

(Editor's note: go to https://m.eet.com/images/common/planetanalog/2010/02/SCBlist.pdf for a complete, linked list of all previous installments of the Signal Chain Basics series.)

After my last article on active filters (Signal Chain Basics #43), a reader (thank you, Scott H.) wrote to ask me about averaging filters. In many sensor applications, a DC signal that occasionally changes is what’s being measured – weight and temperature are just two examples. In these cases, averaging the signal can help preserve resolution. You can average the signal in either the digital or analog domains. Let’s look at two example solutions.

If your measurement system uses an analog-to-digital converter (ADC), averaging its digital results is simple: the numbers to be averaged are summed, and the sum divided by the number of samples to be averaged. While simple, this increases the settling time of the signal considerably.

A faster-settling average can be obtained by two-point exponential averaging. This is done by the equation:

yi = axi +(1-a)yi-1 .

The response of an exponential filter can be easily varied from weak filtering with a quick step response (fast settling time) to strong filtering with a slow step response by varying the alpha coefficient, as shown in Figure 1 . Here, x is the signal to be measured, which includes some noise.

Figure 1: Exponential filter response to step in x for varying alpha over time.
(Click on image to enlarge)

This is a useful feature for many measurement systems. For example, in weigh scales, it is desirable to obtain a reading right away when a weight is placed on the scale. As more samples are taken, however, the weight can be determined more precisely by further averages. The exponential averager can be set to a high alpha when the scale is first loaded, and over time the alpha can be decreased to obtain more precise results.

In the analog domain, an RC-filter can be likened to the simple averager – a very low corner frequency will eliminate the most noise, but at the expense of settling time (Figure 2 ).

Figure 2: RC filter response to same input signal as Figure 1.
(Click on image to enlarge)

Scott sent me a paper (see Reference 1 ) that describes a circuit, shown in Figure 3 , to accomplish something similar to the exponential averager in the analog domain. Figure 4 shows the response of this circuit with different values for the capacitors in the circuit.

Figure 3: Analog averager described by Grimbleby.
(Click on image to enlarge)

Figure 4: Response of analog averager for different C values.
(Click on image to enlarge)

You can see that the circuit of Figure 3 offers a better step response than the simple RC filter, while accomplishing the averaging function. It would be more difficult to make this filter adaptable like the digital averaging described earlier, but it provides a unique response to solve the problem of averaging without paying too high a price in settling time.

References
1. Grimbleby, JB., “Averaging filter circuits for signal recovery applications,” J. Phys. E : Sci. Instrum., Vol. 13, 1980, retrieved from http://iopscience.iop.org/0022-3735/13/5/022.