Language: EN

libreria-arduino-double-ema

Arduino Library Double EMA Bandpass and Bandstop Filter

The Double EMA Filter library implements an exponential filter with double cutoff frequency. The library allows for bandpass and bandstop filtering. The Double EMA Filter class uses templates to allow it to work with different types (int, long, float, …).

User Manual

Constructor

The Double EMA filter is instantiated through its constructor, which receives the parameters AlphaLow and AlphaHigh, corresponding to the lower and upper cutoff frequency. The order of the parameters in the constructor is irrelevant, the function will correctly assign the values of Alpha based on their value.

DoubleEMAFilter<int> doubleEMAFilter(const size_t alpha1, const size_t alpha2);

Using the filter

// Add a new value to the filter and return the Band Pass filtered value
doubleEMAFilter.AddValue(value);

// Get the last Band Pass filtered value (the same as the one returned when adding the value to the filter)
doubleEMAFilter.GetBandPass();

// Get the last Band Stop filtered value
doubleEMAFilter.GetBandStop();

Examples

The Double EMA Filter library includes the following examples to illustrate its use.

  • DoubleEMAFilterInt: Example of filtering for integer variables.
  • DoubleEMAFilterFloat: Example of filtering for float variables.

Installation

  • Download the latest version from GitHub
  • Unzip the file
  • Copy to your libraries folder (usually My Documents\Arduino\libraries)
  • Restart the Arduino IDE

github-full