Python Forum

Full Version: Signal filtering / smoothing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am interesting in mechanical vibrations. I have project with Teensy 4.0 and 24bit ADC. I collect data from ADXL1005. Then I send 30000 values from ADC/Teensy to Raspberry. On Raspberry I have Python code to calculate basic data like accleretaion and velocity and FFT. But what is important for me is the best solution how to clean noisy signal. I have sample rate 30k in 1 second = 30k samples.

Now I use to this to clean signal:

N  = 4    # Filter order
Wn = 0.05 # Cutoff frequency ???
B, A = signal.butter(N, Wn, output='ba')
v_data[0:SAMPLES] = signal.filtfilt(B,A, v_data[0:SAMPLES])
Another issue is, if I clean the signal, then I lost some important peak values, it means for example gRMS value is lower after signal clean.

Then I use butter bandpass - for FFT 10-1500Hz and FFT 500-14900Hz, for example:

lowcut_grms = 500.0
highcut_grms = 14900.0
grms_order = 4
SAMPLES = 30000
SPS = 30000
g_rms = butter_bandpass_filter(g_rms, lowcut_grms, highcut_grms, SPS, grms_order)  
Is this usage OK or is possible use better solution?
Thanks for any advice.