1

My situation:

  • I am able to communicate over i2c with my MPU6050 IMU
  • I can get accelerometer and gyro data
  • I can compute the sensor's orientation using my accelerometer

Issue:

  • when trying to compute the sensor's orientation using my gyroscope my values seem to be totally incorrect. I am computing the orientation using a complementary filter.

This is the code I use https://paste.ubuntu.com/p/vZmbnc23gj/

This is the computed orientation, when the sensor is lying on a table: https:https://paste.ubuntu.com/p/W7DzVKR9c7/ Those measurements are totally incorrect, because when moving the senor randomly around its axis it never goes above 1.8. (even when I do an 180 degree turn)

Could somebody give me some hints or explanation on why my results are incorrect and drifting so much?

2
  • Could you post a schematic of your connections? I understand you can communicate with it, but am interested in what you have.
    – Wendall
    Dec 30, 2019 at 23:01
  • @Wendall connection, are just typical "i2c connection" without pull ups
    – traducerad
    Dec 30, 2019 at 23:27

1 Answer 1

-1

You need to perform offset calibration, otherwise you'll get large drift errors. The MPU6050 has a dedicated Digital Motion Processor (DMP) where data from the gyro and accelerometer are fused for you. I recommend grabbing the results of that fusion from the DMP. As far as I know the only libraries that do this are ones based on Jeff Rowberg's work. For a detailed guide please see:

https://youtu.be/k5i-vE5rZR0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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