Close

Finite Impulse Response (FIR) Filter Generation

A project log for Hacking a $35 ECG nRF52 Fitness Tracker into EEG

nRF52832 ECG fitness tracker hacked into EEG glasses using Arduino code + detect concentration/relaxation with neural network web app

Curt WhiteCurt White 08/21/2018 at 06:530 Comments

I used Peter Isza's online FIR filter generation tool to generate all my filter coefficients. You can find the tool here: http://t-filter.engineerjs.com/

The filter coefficient arrays generated by the tool can be directly pasted into the Arduino FIR filter code. You can find the Arduino FIR filter library here: https://github.com/LeemanGeophysicalLLC/FIR_Filter_Arduino_Library


Building filters with the tool is super simple. Essentially, the more taps (coefficients) you produce the more accurate your filter will be BUT more taps also makes it slower. Since I'm running a bunch of filters at once while also either sending data over Bluetooth or activating a neural network I have to keep my filter coefficient arrays pretty small. 

I generated two FIR filters for each EEG wave band: one for low resolution filtering (15-25 taps) and one for higher resolution filtering (45-65 taps)

Here are screenshots of the FIR filters currently used by the EEG glasses as they were being generated in the online tool:

Delta (low resolution)

Delta (high resolution)

Theta (low resolution)

Theta (high resolution)

Alpha (low resolution)

Alpha (high resolution)

Beta (low resolution)

Beta (high resolution)

EMG (low resolution)

EMG (high resolution)

Discussions