I'm trying to detect tap/tapping motion (possibly two taps) with MPU 6050. However I cannot find any information about the detecting taps on the internet. I've looked through the motion driver software from invensense but the code is too complicated for me to understand (sorry I'm new). I can load the DMP image and toggle the interrupt pins using DMP and motion interrupt status.
After looking through the internet for a while I found this comment saying it might not be possible. I would be really helpful if someone knew any better or had achieved this before.
P.S. I'm using the i2cdevlib library for communicating with the MPU.
you have a 3-axis Accelerometer and 3-axis Gyroscope inside the MPU. So the question you need to ask yourself is "how can a tap impact one or both of those"
➜ if the MPU is attached on a mobile or flexible element that can be impacted by the taps, then chances are that you'll measure a change from the sensors. if the MPU does not move (including rotate) at all when you tap, then the sensors won't record anything
it's probably not the easiest component to use to record a tap, a piezo mounted securely on the surface (ideally wood or metal to conduct sound / vibration well) usually works in an easy way
My MPU will have metal shell around, well actually the PCB containing the MPU and MCU will be inside a metal shell.
However how to I detect the taps, I'm guessing one can use the DMP (FIFO) and accelerometer to detect taps (I could be wrong) but the register map doc or the mpu6050 doc doesn't include anything about using (or how to use) the tapping feature
Yes it does. I've tried moving the MPU by hand and gently shaking it too.
But that's not the question, I want to know how to use the tap feature. I've been reading some 9250 code and made a callback for tap and I've registered it. But the function never gets called. I'm following the invensense motion driver code (6.x).
That's the issue I couldn't find anything related to tapping for MPU6050. I've seen the MPU9250 library, I've a 9250 I'll try checking if it's working on 9250 and use parts from that code for 6050.
You are way overthinking this. I have an MPU6050 connected to an ESP32 and some other stuff on the desk next to me. I tapped the MPU6050 and I get an immediate change in the raw accelerometer reading. This project isn't even using the DMP library.
Depends on how much distance you need between tap and noise. If the tap is going to be down near the noise floor, then you will probably want to use whatever features the DMP has to discriminate. If you're looking for a healthy knock, that's easy enough to detect by looking at the difference from the background.