Language: EN


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, …).

For more information, see the entry Exponential bandpass and bandstop filter in Arduino

User Manual


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

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

// Get the last Band Stop filtered value


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.


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