0
\$\begingroup\$

I extracted motion acceleration with MPU6050 and removed gravity. Now, the problem is when I put the sensor in no-move status, I read nearly zero acceleration in z-axis but when I turn it 180 degree and then put it in the rest it shows nearly -2. There is a constant of 2 and I don't know how to remove it. I want the sensor to show me a zero acceleration when it is not moving.

\$\endgroup\$
  • \$\begingroup\$ Make it easy for your readers. Add a link to the datasheet for the device in question. There's a link button on the editor toolbar. \$\endgroup\$ – Transistor Sep 12 at 12:31
1
\$\begingroup\$

You "removed gravity" from the Z axis by subtracting a constant. Obviously, this does not work if the Z axis no longer points "up".

If the sensor cannot be maintained in a particular orientation with respect to the gravity vector, then there is no simple way to remove gravity. You'll have to do a full 6-dimensional motion solution (3 axis accelerometer, 3-axis gyro) to determine position and attitude, and then derive your non-gravity accelerations from that.

Even then, your sensors will have long-term drift, so your solution will also need to have a means for compensating for that.

\$\endgroup\$
  • \$\begingroup\$ no i didn't subtract a constant, i remove gravity by using quaternion and rotation matrix and in the beginning of sensor working i see a zero motion acceleration and it's ok but when i turn it 180 deg , instead of showing zero again it shows -2. \$\endgroup\$ – Reza K Sep 12 at 13:03
  • 1
    \$\begingroup\$ Then there's something wrong with your math. We can't help you unless you show it to us. \$\endgroup\$ – Dave Tweed Sep 12 at 13:05
  • \$\begingroup\$ If gravity is removed, something is subtracting a constant somewhere. If it's not you, it's the accelerometer. \$\endgroup\$ – TimWescott Sep 12 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.