How to Use Moving Average Filter to Counter Noisy Data Signal?
While working on smart appliances, engineers usually get noisy signals from sensors. I have briefly explained a step by step procedure to counter this issue.
Let’s take an example of a smart water dispenser for this scenario.
Challenges with EC and pH
A big problem during the calibration of EC and pH sensor probes that when we dip them in non-conductive body, it gives accurate values but for the real scenario when we dip these probes into the cool water tank of water dispenser which by all means is a conductive body, we experience abrupt changes in values of EC (Electrical Conductivity) of water.
Here you’ll need to apply some digital signal filtering techniques to smoothen noisy data coming from EC. The Moving Average Filter being one of the handy tools for Scientists and Engineers is used to filter unwanted noisy component from the intended data. It provides a mere estimation, so to get more accurate values, the reference meter of HANNA Instruments is the only solution to measure EC and pH in a non-conductive container.
Moving Average Filter:
The moving average filter is a simple Low Pass FIR (Finite Impulse Response) filter commonly used for regulating an array of sampled data/signal. It takes M samples of input at a time and takes the average of those to produce a single output point. As the length of the filter increases, the smoothness of the output increases, whereas the sharp modulations in the data are made increasingly blunt.
Implementation of MA Filter:
As described above the in the M-Samples methodology, I took almost 70 samples in time period of 10 seconds and recorded these values in Microsoft Excel sheet.
On the Data tab, in the Analysis group, click Data Analysis.
Select Moving Average and click OK.
Find “Moving Average & Click OK”
Divide the selected values by 2 and Plot a graph. In our case we have set the interval to 8 as the moving average is the average of the previous 7 data points and the current data point. As a result, peaks and valleys are smoothed out. The graph below shows forecasting values approaching to more accurate results.