Hi
I'm trying to to use t filter http://t-filter.engineerjs.com/
, it generate two files, SampleFilter.c and SampleFilter.h , and i have compiling error ;
fatal error: SampleFilter.h: No such file or directory
I hope you are not trying to run this code on an AVR-based Arduino, like the Uno, Mega, etc. They don't support the double data type and given the magnitudes of the coefficients below, the filter won't work at all.
In any case, the coefficients seem utterly useless. What sort of filter are you trying to produce?
I suspect this is Windows giving you trouble. I suspect your "SampleFilter.h" file is actually named "SampleFilter.h.ino". Can you turn on the "show file extensions" option? For some illogical reason, Microsoft still thinks it's a good idea to hide file extensions by default.
There is no band pass filter effect , should be 55 dB attenuation
#include "SampleFilter.h"
int sensorPin = 0; //A0, pin number to use the ADC
int sensorValue = 0;
/////////////
float EMA_a = 0.3; //initialization of EMA alpha
int EMA_S = 0; //initialization of EMA S
////////////
void setup() {
Serial.begin(115200);
EMA_S = analogRead(sensorPin);
}
void loop() {
sensorValue = analogRead(sensorPin); //read the sensor value using ADC
EMA_S = (EMA_a * sensorValue) + ((1 - EMA_a) * EMA_S); //run the EMA
Serial.print( sensorValue);
Serial.print(" Low Pass Filter ");
Serial.print(" ");
Serial.println( EMA_S + 10);
delay(20);
}
This looks like a very low resolution signal (like +/- 10 steps), so your filtered signal will be low resolution too. What happens if you also make EMA_S a float?