rfetick / MPU6050_light

Lightweight, fast and simple library to communicate with the MPU6050
MIT License
126 stars 36 forks source link

physical position x, y and z axes #15

Closed zfranco55 closed 2 years ago

zfranco55 commented 3 years ago

I state that the mpu6050 module is combined with a qmc5883l module and I would like to use them for pitch, roll and compass on my off-road vehicle. the physical position of the modules is rotated 90 degrees with respect to the horizontal plane on which the axes are drawn. I have seen that with your library the mpu6050 module resets itself in any position, and from what I understand, the physical position of the module is indifferent, is it true ?. with the sketch of the example alldata I get this: 11: 03: 59.601 -> TEMPERATURE: 23.85 11: 03: 59.634 -> ACCELERATE X: 0.00 Y: -0.00 Z: 0.99 11: 03: 59.667 -> GYRO X: -0.01 Y: -0.34 Z: -0.08 11: 03: 59.700 -> ACC ANGLE X: -0.08 Y: -0.26 11: 03: 59.733 -> ANGLE X: -0.03 Y: -0.70 Z: -0.17 after 10 minutes, without touching the module, I get: 11: 13: 10.313 -> TEMPERATURE: 23.85 11: 13: 10.313 -> ACCELERATE X: -0.01 Y: 0.03 Z: 0.99 11: 13: 10.379 -> GYRO X: 0.05 Y: 0.09 Z: -0.10 11: 13: 10.412 -> ACC ANGLE X: 1.85 Y: 0.50 11: 13: 10.445 -> ANGLE X: 1.59 Y: 0.71 Z: 7.62

are the values ​​correct, especially for the Z angle? Also I would use it with the QMC5883L to compensate for the compass's x and y or z axes. can I use the filtered data or should I use the raw data? sorry for the long email. Greetings

rfetick commented 3 years ago

Hello,

I doubt it might be working well, since it indicates that your acceleration is 1g over the Z axis, whereas it should be on the X or Y axis due to your device orientation. The only issue is the calibration step, after the device can obviously be rotated in any position. You can deactivate the automatic calibration and use the setGyroOffsets and setAccOffsets methods directly.

Regarding data fusion between MPU6050 and QMC5883L, it might be better to use the raw data in a more accurate estimator, like a Kalman filter.

Kind regards, Romain