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 2/2022
In the latest issue 2/2022 of SEEIM you can read more about the success of Endrich´s development team in recent weeks and months at domestic and international exhibitions and forums. The whole article you will find here...
SiC power devices by Microchip Technology are rugged, robust and apt for demanding applications within the transportation segment. A strong portfolio of standard, custom packaging options provide customers with flexibility in design. More details - here...
Two of the prime characteristics of Slovenian electronics industry are fast growth and high value-added. In fact, the industry is the fastest growing manufacturing branch in Slovenia. More information you may find here...
The Turkish electronics industry began to develop rapidly in the second half of the 80’s. Today there are approximately 2033 manufacturing companies in the field of electronics in the country. More about the current state of PCB manufacturing in Turkey read in the article here...