I'm revisiting a project of mine, the PCBs are done already - so i'm limited to software only.
I'm filtering the output of some accelerometers with a simple first order RC filter, with my cut off frequency at 100Hz, and being first order I've only got 20dB/decade of gain in the stopband. The ADC sampling frequency is 600Hz, so no aliasing issues there.
However, I'd like really to have more like 40dB/decade, therefore adding a software 1st order low pass filter will give me total 40dB/decade of roll off.
I don't want to move my -3dB point to less than 100Hz.
Cheers!
EDIT - I'm using this tool (http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html) but when I test it in Excel with some generic data, it doesn't filter per se - just reduces the amplitude, even if the input is within the passband. Clearly something fundamental I'm missing.
Additionally, the above clearly uses floating point math - whereas I'd like to stay integer... there must be a way to do this.
The list of taps is not long, iit is quite short, I worked with 300 on arduino, but the propagation delay is long with many taps (the "sharper" filter and more attenuation in stop band, the more taps you will need).
That is a digital filter you are looking for. You may use FIR or IIR - there are differences where to use which. But for a quick start to check the feasibility of the solution try with the above code, it is 100hz pass-band with 80db stop-band attenuation @ your 600Hz sampling rate. You may study how it behaves (you may use 16bit or 32bit int or floating point taps and calculations, the latter is most precise one, less noise, you may make it sharper with more stop band att - with much more taps however).
I cannot find the source with my code yet, but it works like:
#include "SampleFilter.c"
setup() {
...
SampleFilter My100Hz;
SampleFilter_init(My100Hz);
}
void() {
...
your loop:
int data = your_accel_data();
// put your new data into the filter
SampleFilter_put(My100Hz, data);
// get the filtered data out of the FIR filter
data_filtered = SampleFilter_get(My100Hz);
...
I've got an analog discovery, which has a built in programmable function generator so I'll test some up tomorrow with some frequency sweeps and see what happens.
Are the 'taps', what is commonly referred to by most sources as the filter coefficients?
"Tap" means a tap which provides a delayed input to the multiplication operation in the filter model (see its block diagram). A coefficient is related to a tap ("tap weight"). See the pictures in: