I have this accelerometer data from my phone:
http://imgur.com/a/cJoJH<p>The first artifact is when I lifted my phone from the table, the 3 bursts in the middle when I tapped on my phone 3 times and the last artifact when I placed it on the table again.<p>I want to detect the 3 taps in the middle algorithmically and ignore the other things.<p>I already have some working code that relies on thresholds, and another version that looks for high peaks followed by smaller peaks within a window.<p>But I think there should be a more reliable solutions to solve this, I assume this is a somewhat common problem. I also played around with FFT and power spectrums a little bit but I am not really satisfied. Maybe I should train a neural network or another machine learning algorithm?<p>How would you solve that?
So, from the second figure you can see that you have a series of decaying envelopes. For the individual taps you should be able to model this as some event at an unknown scale with an apriori rate of decay. You can easily discard the non-activity regions based upon some windowed estimates of the energy. That leaves you with what's essentially a template matching type of problem for each of the three areas where the signal is showing above noise levels of activity. The first and last region don't match the decaying exponential well and the middle one matches it fairly well with 3 distinct events.<p>That said, this approach introduces what may be more latency, coding complexity, and computational work than is desired.
I'd take a look at a spectrogram and see if there's some bandpass filter which makes it easier to see these events compared to the 'false activity'.
hn may not be the best place to ask this question.<p>a neural network is almost certainly overkill, and likely too slow for your purposes. you probably want some additional smoothing. i don't know why FFT doesn't work for you, since this accelerometer data can almost certainly be decomposed properly.<p>a window-based threshold approach is fine in my opinion as well.