Arduino Filter

Filter is an Arduino data filtering library.

The Filter library provides Arduino programmers with data filtering routines on a configurable number of recent integer values. In particular, the code provides simple ways to perform basic statistical operations (e.g. mean, median, standard deviation) on a buffer of recently captured values. This is useful for smoothing the data coming from a sensor, or identifying when a threshold has been crossed despite noise in the input signal.

At this time, only integer and long inputs are supported. Future work may provide functions for other numeric types (e.g. float, double).

There is basic support for user-defined filtering functions, though this operation is likely to be useful only to intermediate/advanced Arduino programmers.

Code is available at github.com/karlward/Filter . You’ll also need the DataStream library. DataStream is a generic Arduino Stream-like interface, useful for storing non-character streams of data.

Installation of Arduino libraries (like Filter) is described here.