# Designing Matched Filters

Hi!

I’m trying to develop a prototype at the moment that includes a sensor to detect how fast someone is typing on a keyboard. Essentially this sensor is a microphone that will be able to detect keyboard taps and then count the number of taps in a certain time interval. So far I’ve just been using the instantaneous energy of the signal, and then counting the high energy impulses. The issue with this is that every sound is recorded, meaning that someone talking over the keyboard taps results in a false reading.

I need to try and design a filter that will only pass the keyboard taps and block any of the other sounds it might hear. I’ve read about matched filters, but am struggling on how to actually create one. I know I’ll need to convolve some characteristic ‘keyboard tap’ signal with the microphone recording, which should give me a signal with impulses at the start of each of the taps.

I’ve been using matlab to try and analyse these signals, but now need to turn that into a matched filter, which has left me pretty stumped! Any help on how to design one and any pointers on convolving signals on Arduino would be really appreciated!!!

Thanks,

Luke

I’m trying to design an intensity tracker for PC gamers btw

I understand the problem, but I don't know what a "matched filter" might be. Are you thinking of a "band pass filter"?

Paul

My recollection of the Matched Filter concept (many years ago in a college course) is that it’s the filter that provides maximum SNR at the receiver of a digital communications channel. Hence, it provides the best bit error rate. It has a transfer function that’s the complex conjugate of the input signal’s Fourier Transform. Or, something like that.

"If we care to write the impulse response h of the filter for the convolution system, it is simply the complex conjugate time reversal of the input s. " (from Wikipedia)

Isn't Google and Wikipedia fun ?

gfvalvo:
My recollection of the Matched Filter concept (many years ago in a college course) is that it’s the filter that provides maximum SNR at the receiver of a digital communications channel. Hence, it provides the best bit error rate. It has a transfer function that’s the complex conjugate of the input signal’s Fourier Transform. Or, something like that.

vaj4088:
"If we care to write the impulse response h of the filter for the convolution system, it is simply the complex conjugate time reversal of the input s. " (from Wikipedia)

The Frequency / Time domain equivalents of each other.

So the matched filter I’ve been using is implemented like this:

• take a segment of the signal that I want to detect I
• then invert the signal in the time domain and transform it to the frequency domain
• The convolute this with the frequency domain version of the signal I want analyse
• Inverse fourier transform, and this then gives the filter signal

The results are pretty cool, everything is suppressed except for instances of the signal I want to detect. I’ve added some simple matlab code that goes through it as well

Matched_filter_test2…txt (863 Bytes)

I believe that the convolution of two frequency domain functions and the inverse Fourier transform of the result is the equivalent of multiplying the time domain signals (within a factor of 2 pi). The multiplication is likely to be faster than the Fourier transform, the inverse Fourier transform, and a convolution, unless there is a way to do these thing (Fourier transform, inverse Fourier transform, convolution) very fast.

I am happy that you are happy with your result.