The Power of Moving-Average Digital Filters
by Bonnie C. Baker, Microchip Technology Inc.
Often, analogue-to-digital converter users employ averaging algorithms with their controller or processor on the output of several samples from the converter. A converted signal can be smoothed by using this technique (see Figure 1), and the effective resolution can be improved by reducing system noise.
Smoothing converted data
The smoothing effect on the converted data is implemented by acquiring multiple signals at a constant sample rate, averaging a predetermined group or number of the samples, and then continuing this process with several groups over time. As Figure 1 shows, the aggregate of the averaged results produces a smoothed signal. This averaging technique essentially provides a low-pass filter on the converter output data. The effectiveness of the filtering can be controlled by selecting the appropriate number of samples for the averaged groups. If using more samples in each group, there will be a higher degree of smoothing. This averaging process eliminates spikes in the raw data as well as reducing the bandwidth of the final signal.
Another by-product of this averaging technique is that the conversion resolution or precision of the data increases. Ideally, an average of four samples (41) of a DC signal will increase the converter’s effective resolution by one. This is an increase in the Signal-to-Noise Ratio (SNR) of 6 dB. Sixteen averaged samples (42) will increase resolution by two and SNR by 12 dB. Theoretically, a group size of 4N will increase the number of effective bits from the conversion by N, but there are real-world limitations to this theory.
Real-world digital filtering
It is possible to increase the number of effective bits with an analogue-to-digital converter, as long as realistic goals are maintained and consideration is given to non-ideal conditions. For instance, improving a 12-bit converted result to 16 bits requires 44 samples for averaging. Four to the fourth is equivalent to 256. The first question that should be asked is; “Is there sufficient time to implement the required algorithm in the controller or processor?”. If the goal is a resolution higher than 16, the required sample size increases very quickly. Incidentally, the 12-bit converter in this discussion should have a few bits of noisy output to ensure that the averaging is effective. This noise should be gaussian in nature.
Non-ideal conditions that can affect the size of an averaging group include drift of the input over time, power-supply variations, voltage-reference changes, and temperature effects on the system. Any of these non-ideal conditions can change the output value of the conversion. The sample size for a non-ideal system can change from 2000 (with an ideal driftless system) to several hundred samples. If the sample size for this non-ideal system is increased, the results begin to become noisy. However, using Allan variance methods can be used to compute the optimum number of averages for the data set. Finally, the input signal should be examined to ensure that the conversion is not being attempted on an analogue signal that has a settling-time error or an interfering periodic signal, such as the mains frequency.
There are time-saving ways of implementing averaging algorithms that go beyond the simple, brute-force technique of collecting all of the data and then performing an average. For instance, a First In First Out (FIFO) can be implemented by adding in a new data point and subtracting the first data point accumulated in the group. Additionally, the size of the groups can be selected to enable the use of a shift right for the division of the total, such as group values of 4, 8, 16 or more.
Whether using simple techniques or more time-saving methods, moving-average digital filters can effectively smooth converted signals and improve resolution by reducing system noise.
LATEST issue 4/2019
The main topics of this year’s edition of the world’s leading trade fair for electronics development and production productronica 2019 are Smart Factory and Smart Maintenance. Mode details you can find here...
Тhis year’s edition of Europe’s trade fair for electronics design and manufacturing innovations and applications SEMICON Europa, traditionally co-located with productronica, will highlight smart technologies...