accelquestion Posted August 23, 2018 Report Share Posted August 23, 2018 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 Quote Link to comment Share on other sites More sharing options...
zenman Posted August 25, 2018 Report Share Posted August 25, 2018 Aren't the negatives just indicating the direction? Whereas the pythagorean theorem is giving you a magnitude of the force. So if you move up with a force of 5 newtons or down with a force of 5 newtons, it's on the same axis so the magnitude of the force on that axis could be the same, but the direction would be different. Of course, take this all with a grain of salt. I honestly don't remember from trig class, if you have three different axis' is it still square root or should it be cube root? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.