Filtering Sensor Values

Getting raw data readings from different sensors is usually pretty straightforward. However, before the aqcuired sensor data can be interpreted, it is usally advisable to remove any unwanted noise (caused by bad power supplies, radio frequency interference or similar).

A digital low-pass filter is a simple and flexible way to clean up and smooth sensor data, here is an example:

The filter can also be used on multiple sensor readings in a single line of code:


For a more detailed technical explanation and other digital filtering options, see page 18-29 from the application note below: