kriswiner / MPU6050

Basic MPU6050 Arduino sketch of sensor function
715 stars 190 forks source link

MPU6050 Calibrated Acc and Gyro in different measurement range #56

Open williamesp2015 opened 2 years ago

williamesp2015 commented 2 years ago

If you see source code for IMU you will see using DMP or raw data but none has given more realistic solution for applied project. I'm using raw data and I get offset when MPU6050 is set to measure +/-2g and 250 DPS. I store them in an int16 array so aRes is Acc rang and gyro rang /32768.0. Now, when I read sensor in a loop, I have to get calibrated value: (float) (Ax-(offsetAX/ADIVIDER))aRes; (float) (Gx-(offsetGX/GDIVIDER))gRes; ADIVIDER for 2g is 1 and for 16g is 8 GDIVIDE for 250 DPS is 1 and for 2000 DPS is 8 Even though, the method is much better than others but in gyro I see offset about 1-7 as I expected to have 0.

bhupiister commented 2 years ago

Search for a library i2c_mpu6886_4khz by yururi. Mpu6886 and 6050 are identical and this library is easy to use for starters.

kriswiner commented 2 years ago

I would say that you should perform the calibration for each full scale setting you want to use. Not sure why you would want to change this dynamically, but if you do, you will need to calibrate the offset bias again.

On Fri, Jan 28, 2022 at 7:14 AM williamesp2015 @.***> wrote:

If you see source code for IMU you will see using DMP or raw data but none has given more realistic solution for applied project. I'm using raw data and I get offset when MPU6050 is set to measure +/-2g and 250 DPS. I store them in an int16 array so aRes is Acc rang and gyro rang /32768.0. Now, when I read sensor in a loop, I have to get calibrated value: (float) (Ax-(offsetAX/ADIVIDER))aRes; (float) (Gx-(offsetGX/GDIVIDER))gRes; ADIVIDER for 2g is 1 and for 16g is 8 GDIVIDE for 250 DPS is 1 and for 2000 DPS is 8 Even though, the method is much better than others but in gyro I see offset about 1-7 as I expected to have 0.

— Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/56, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQFHJVXPJE6D7LDFRLUYKXG5ANCNFSM5NBAJF7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>