To detect vibration I'm sampling the MPU6050 various times and averaging it with previous samples and the algo works very well, it's the following:
Force = sqrt((currentX - lastX) * (currentX - lastX) +
(currentY - lastY) * (currentY - lastY) +
(currentZ - lastZ) * (currentZ - lastZ) );
However, the problem is the result is always a positive number, and since I've been studying accelerometers I've noticed they often give negative values too. So I'd like to be able to get these negative values.
In the accelerometers initial state x, y can be negative depending on the axis, and y is never negative. I know x, y & z values can be changed by applying the DMP/quaternions/etc. Do I need to apply something like ypr or euler to get the proper G force? How do I get the full negative & positive values of G?
Thank you for your time