The importance of choosing the right filter to suit your measurement application

When selecting sensors for displacement, position, distance and profile measurement tasks, engineers should consider the various types of sensor filtering before making a purchasing decision, says Chris Jones of Micro-Epsilon.

The quality and reliability of an output signal from a sensor is often affected by external or environmental factors (e.g. dirt, dust, scratches, water) that complicate interpretation and further processing of these output signals. Various forms of signal ‘noise’, invalid measurement values or signal peaks (spikes) are just some of the effects that can be reduced if the appropriate smart averaging or filter setting is used.

By applying the most appropriate filter setting or averaging technique for the application will help to smooth out or eliminate any spikes in the measurement values, allowing easier and more reliable interpretation of measurement results.

Although filtering is a factor that needs to be considered for all measurement sensors, it is particularly important when using non-contact laser displacement sensors, where typically faster measuring rates are present or where the target object being measured is moving (i.e. dynamic measurements).

It is therefore important to check the sensor supplier’s datasheets for information about the type of filtering or averaging technique the sensor employs. If the information is not included in the datasheet or is disguised in some way, you will need to ask for it. Some suppliers of lower cost laser sensors may quote a high measurement speed on the datasheet, which can only be achieved in the real world by applying a high mean averaging filter. Conversely, a good indicator of whether advanced/smart filtering is used by the sensor is if the datasheet provides information on both ‘static’ and ‘dynamic’ performance data (e.g. response time, resolution, linearity).

In general, high performance laser sensors use advanced or smart filtering to achieve real world measurement performance. Other lower cost laser sensors tend to use basic averaging filters such as ‘averaged measurements’ or ‘moving averages’, which often results in sluggish sensor performance.

Averaged measurements

Most lower cost laser sensors use ‘averaged measurements’. However, selecting this averaging technique is only recommended for static or slowly changing measured values. Depending on the type of sensor, either the measured values or the video signal can be averaged out using this technique. The averaging process for measured values is carried out in the sensor itself, after calculating the distance values and before output via the selected interface. The measurement rate or data rate is independent from averaging. However, a reduction of the output rate is normally possible. Below are three of the most common averaging techniques.

Arithmetic averaging 

The most basic of the averaging techniques is arithmetic averaging. The arithmetic average, M, is formed and output via the selectable number, N, of successive measured values. This method leads to a reduction of the output data volume as the measured values are collected initially and only output after every nth measured value.

Example, where N=3

…01234… turns into 2+3+4 / 3            average n

…34567… turns into 5+6+7 / 3            average n + 1

Moving average

The arithmetic mean value is calculated using the number N (1…128) of sequential measured values (window) and output according to the following formula:

Example, where N=7

…012345678 turns into 2+3+4+5+6+7+8 / 7      average n

…123456789 turns into 3+4+5+6+7+8+9 / 7     average n+1

When doing this, each new measured value is added to the window with the oldest value being removed. In this way, it is possible to achieve short transition response times even with relatively large measured value ‘jumps’.

Whilst the moving average technique can be used to smooth out measurement values (and improve the resolution), it should only be employed on target materials or objects with low surface roughness, as well as for applications with short transition response times, or where there is continuous signal noise without spikes.

Recursive average

In this method, each new measured value is added as a weighted value to the sum of the previous average values. Recursive averaging therefore enables very strong smoothing of measured values. However, it requires extremely long transient recovery times for measured value jumps (low-pass behaviour). For static measurements, recursive averaging permits a high degree of smoothing for signal noise without any strong spikes.

Although recursive averaging is not recommended for highly dynamic measurements, it can be useful in some dynamic measurement applications, for example, to eliminate roughness or structures on rough surfaces (e.g. parts with uniform grooves or roughly milled parts).


With the median technique, the values of a predefined number of measured values are sorted by size and the medium value (not the average value) is output. The median is used as a filter type primarily to suppress individual interference pulses. Actual smoothing of the signal is not very strong using the median approach. However, additional averaging can be applied later after calculation of the median.

Example, where N=7

…240124513…  measured values sorted 0112345 (Median = 2).

…401245134…  measured values sorted 1123445 (Median = 3).

The median technique is best used in harsh, dusty or dirty environments in order to eliminate interference from dirt particles (i.e. to suppress individual interference pulses). The technique can also be used where there are edge jumps and where short, strong signal peaks occur.

Smart Filtering

Some suppliers of high performance laser sensors have developed advanced (smart) filtering techniques to further optimise measurement results for their sensors. Some sensors even provide multiple filter types to enable users to select the most suitable for their measurement task. In contrast to averaging, these smart filters output or suppress measurement values only under specific preconditions.

Spike correction filter

This special form of filtering is used to remove very high spikes from a relatively constant course of measurement values, whilst retaining any smaller spikes. The use of a median would remove all of the spikes. The assessment of whether a measurement is a spike (outlier) is based on the mean of a particular number of previous valid readings. The permissible deviation from the next value is calculated using the tolerance range. If the new measured value deviates too much, it will be corrected to the previous value. A maximum number of consecutive measured values to be corrected must also be stated.

Spike correction eliminates spikes with an adjustable threshold and so can be used for highly dynamic data acquisition of fast moving objects. It is also suitable for measurement jumps, particularly those with interfering peaks, edge jumps and with some bent edge transitions. Spike correction can be carried out before other averaging techniques are used.

Dynamic noise rejection filter

Specific to Micro-Epsilon laser displacement sensors, this smart filter eliminates the noise of measured values but maintains the original bandwidth of the measuring signal. To do this, the noise band is calculated dynamically and a change of the measurement value is output only if the noise band is exceeded or not reached. However, value changes within the dynamically calculated limit values are ‘lost’ as information. The value that causes a signal change is greater than the calculated noise by a factor of 3. With direction changes in the signal, small hysteresis effects occur due to the limit values, as they must first be exceeded to cause a change.

Unlike other averaging methods, dynamic noise rejection is not based on a definition that originates from classic statistics, but on a software algorithm developed by Micro-Epsilon.

Edge filter

Also unique to Micro-Epsilon laser sensors is the edge filter technique, which smoothes signals at transitions such as edges or surface changes, thus avoiding signal overshooting. This enables the user to detect edges precisely and to avoid a slurring signal (change in slope). The filter threshold marks the value that must be exceeded for it to be recognised as a signal change and not as surface roughness.


Before choosing a laser sensor, always check the supplier datasheet for statements regarding averaging or filtering of measurements. If the information isn’t there, ask the supplier for more details. If in doubt, discuss your measurement application with the supplier, who should be able to recommend the most suitable sensor and filter for your task.

Check Also

New backing to transform the UK’s future through the modern Industrial Strategy

Business Secretary Greg Clark has announced new support for the UK’s leading aerospace sector and …