# How to filter out in-band noise at the same level as my signal?

I'm implementing a system wherein I'm detecting waves as they come trough my piezoelectric sensors in a board. Essentially, I would want to record the time these signals appeared in my sensors as I want to localize the position of the source.

Basically, I'm waiting for sound waves to appear in my sensors after someone taps the board. and from the time difference, localize its position.

However, the board (I'm talking to a whiteboard here) can also absorb sound waves from environment and depending on the environment, these can interfere on my signals.

One of the solutions we had is to raise our threshold level. The problem we had is that our intended signals usually starts small and before rising to levels above the noise. By the time the level of the signal is above the noise, the timing that we would have wanted had already passed.

Since the noise is also sound signals, they occur at the same frequency as our intended signal.

Would there be anyway for us to filter out this kind of noise?

• Some kind of correlation detector should be able to recognize the sound, even if it is buried in noise. But the detected sound must be matched very closely to the expected sound. Jun 8 '17 at 4:31
• In addition to signal detection, this is also a beam-forming question. Jun 8 '17 at 5:56
• "Since the noise is also sound signals, they occur at the same frequency as our intended signal." Seems like an unfounded guess. You should get some measurements of actual signals and noise first to be able to better estimate what can be used to differentiate. Jun 8 '17 at 9:50
• @JimmyB I've looked at them on a scope so I'm sure of it. Jun 8 '17 at 11:18
• Did you do analyses in the frequency domain on the scope? - Your sentence sounds like you just assume that both signals share a certain frequency and are thus not separable. You may have to look at more than one frequency to see the differences. An FFT would be a good first step. Jun 8 '17 at 11:45

When trying to detect a signal in noise, there are two filter stages to use.

1) Signal to noise improvement - removal of out-of-band noise

The first uses conventional filter concepts. The signal and the noise in question are at different frequencies, so you can separate them with a filter. You have to know the bandwidth of the signal, and design a filter with a nominally flat passband that preserves those. Often, the stopband does not need to be too severe, sometimes a few dBs improvement is enough to improve subsequent detection. If there are strong out-of-band interfering signals, say mains hum, 1/f noise shifting the DC level over seconds or minutes, or a large bandwidth of high frequency ambient noise, then a specific notch, high-pass filter or low pass filter respectively would be worthwhile to remove those specific bad signals.

2) Matched filter detection - spotting the signal

After the conventional filter, we are left with a signal, and noise in the same bandwidth as the signal. The best we can do is matched filtering. If the spectrum of the signal is known, but not the waveshape, we use a filter whose passband is the same spectrum as the signal, rather than flat. This optimises the signal to noise energy. If we do know the signal waveshape, then we can go one better and correlate the received signal with the target waveshape. A correlation automatically produces the good timing resolution that your location algorithm would demand.

Can we do better?

That's as far as we can go with linear filtering. If the signal has deeper structure, then we can employ smarter processing to improve detection accuracy. For instance, instead of one tap on the whiteboard, you could use a double tap, with the two taps some defined range of time apart, say 300mS to 600mS, I suspect most users would be able to hit a delay in a 2:1 range. If your linear signal detector produced a probability of detection, and looked for two candidates in the target range, you could improve the discrimination.

Note that valid target signals will always have a unique timing arrangement, due to the geometry of the board and piezo sensor placement. Using more than the minimum three required for XY location would give you redundancy, allowing you to confirm the timing relations. It's likely that ambient noise would not have the same timing relationships.

There are two types of error your discriminator can make. A false positive, where noise is taken for signal, and a false negative, where a valid signal is ignored. In any non-trivial system, it's not possible to get both rates down to zero. What you can do is shift the threshold systematically while testing the system, and plot how both failure rates change. Then, together with the knowledge of the penalty for either type of failure, you can optimise the threshold for best system usability.

UI/UX considerations

In your whiteboard case, you could reduce the penalty for false positives by requiring a 'confirm' signal within (say) 2 seconds of a command signal, and if not it would automatically be rejected. This could allow the threshhold to be set more sensitively, to improve the false negatives at the expense of false positives, but tolerate false positives more or less automatically.

Ultimately whether the system works or not as a system depends on whether the users feel it's usable. Do they demand failure rates below 1:1000, or can they struggle on with 1:10 failure rates? Maybe 1:10 false negative can be tolerated if you can get 1:1000 false positives?

What's a tap?

Are the taps on the board finger taps? With the pad or the finger nail? Or using the pen, or the back of the pen? Or a hard stylus? Or a signal-generating contact transducer? There are things you can do at the tapping end to make the signal that you pick up more unique.

Beamforming

As mkeith points out in his comment, this is really a beamforming problem. The nice thing about realising that your problem is actually an existing one is that it allows you to leverage a lot of ready-researched mathematics to get performance with well defined bounds, rather than hoping and poking around 'if times within x then y' sort of software. Beamforming involves putting all your received signals into a honkin' great matrix and crunching them, it's essentially using all the redundancy implicit in the multiple sensor locations in the optimum way to improve your detection. A lot of PhDs have been supported by a lot of military institutions for finding subs with hydrophones and missiles with radar for this sort of maths, and much has trickled down to the public domain, look for MUSIC and ESPRIT for example. If you find your signal to noise ratio is not good enough for the amateur way, then try doing it the beamforming way.

• That's every point I'd wanted to write and didn't have the time to do as well. Nice. (I've been involved in beamforming for some reasons you discussed.) +1
– jonk
Jun 8 '17 at 6:22
• I would start with delay-and-Sum beamforming, as it is the most intuitive method (albeit the worst). Jun 8 '17 at 6:56
• I would try matched filtering as you've suggested. This is very informative. Jun 8 '17 at 11:05

Filtering needs some special signal property that is nonexistent or at least has much lower level in the unwanted noise. In communication systems and radars one can design such detectable signal, but I believe you do not want to include for example a requirement to tap some special rhytmic pattern.

Include a sound-only mic and a gating circuit that rejects knocks that are simultaneous with loud sounds. To get smart check the waveform, too. That requires unfortunately some serious signal processing, but so does the filtering, too.