HipT Posted December 14, 2013 Report Share Posted December 14, 2013 Hi everyone, After searching in forums i found out that people have different values for the "setXGyroOffset/setYGyroOffset/setZGyroOffset/setZAccelOffset" functions. But i can't understand how i can find what values i need to use. Can somebody explain me how do i choose the parameters for those functions? Thanks in advance. lapedNok and Johnnydofs 2 Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted December 17, 2013 Report Share Posted December 17, 2013 What I do to get calibration values using Arduino is the following: - Put the MPU6050 in a flat and horizontal surface. Use an inclinometer to check that it is as horizontal as possible. - Modify the RAW program to put every offset to 0. ("setXGyroOffset/setYGyroOffset/setZGyroOffset/setZAccelOffset" =0 ). - Upload the RAW program to your arduino and open serial monitor so you can see the values it is returning. - Leave it operating for a few minutes (5-10) so temperature gets stabilized. - Check the values in the serial monitor and write them down. - Now modify your program again updating your offsets and run the sketch, with updated offsets. - Repeat this process until your program is returning 0 for every gyro, 0 for X and Y accel, and +16384 for Z accel. Once you achieve this, those are the offsets for that MPU6050, you will have to repeat this for every MPU6050 you use. *NOTES: - If you stop the sketch for a while, sensor's temperature will get lower. If you only stop it to reprogram new offsets, you dont need to wait those 5-10 minutes every time. - What you should try to achieve is to get the average of every gyro and XY accel to those values mentioned, so it is best if you modify the sketch to take, for example, 10000 measures, and just show on the serial monitor the average, because there is always some noise. - It is not so straigthforward to update your offset every time. In my case, I had to put my initial readings, negated (change sign) and divided by 4 (gyros) and by 7.8 (accels). Quote Link to comment Share on other sites More sharing options...
HipT Posted December 19, 2013 Author Report Share Posted December 19, 2013 Clear and easy to follow explaniation,much appreciated. Now i've another problem with the orientation of the quaternion output but i'll try to solve it myself before asking. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
maybee Posted September 1, 2015 Report Share Posted September 1, 2015 Hi , I know this is a very old thread and am a newbie with IMUs. I know this may seem like stupid question, do we need to calibrate the IMUs every time you use it or is setting the offsets one time sufficient. Thank you Quote Link to comment Share on other sites More sharing options...
edmundlee100 Posted September 29, 2015 Report Share Posted September 29, 2015 - It is not so straigthforward to update your offset every time. In my case, I had to put my initial readings, negated (change sign) and divided by 4 (gyros) and by 7.8 (accels). Can someone explain why we have to divide by 4 for gyro and divide by 8 (assuming that's a type and not 7.8) for accel Quote Link to comment Share on other sites More sharing options...
Eqbal Khan Posted July 16, 2016 Report Share Posted July 16, 2016 Hi, i know this is a very old thread but i just wanted to share my code that can auto calibrate the Gyroscope and Accelerometer of MPU6050. The code is increment based and after calibration all the values comes down to zero or close to it. I want to share this code so others can also test it and improve it. One of the things i haven't done is in z axis of accelerometer i haven't used +16384 offset. Calibration can be more fine tuned but the cost of doing it would be time. It will take more time to calibrate it closer to zero. Fining tuning is discussed in comments in code. I also noticed that the DMP takes 20secs(approx) to stabilize. So if you are using Yaw pitch Roll output then values of first 20 seconds are useless. Another problem is that this code sometimes work other times it fails. So do check. anyway here are the before and after calibration graph. This sketch output raw data (Time(in miliseconds) AX Ay Az Gx Gy Gz) https://www.dropbox.com/s/t0u4sv3nkoplnoz/MPU6050_auto_calibrationl_raw_data_output.ino.ino?dl=0 This sketch uses DMP and Output data in YAw pitch Roll or other formats. waits 20 seconds for stability before giving data.https://www.dropbox.com/s/hh2750l8x115eib/MPU6050_auto_calibration_output_yaw_pitch_roll.ino?dl=0 hkartadi 1 Quote Link to comment Share on other sites More sharing options...
hkartadi Posted July 29, 2016 Report Share Posted July 29, 2016 Hi Eqbal Khan, Thank you for sharing your experiment. I am doing an experiment where the MPU9250 DMP processing is going to sleep (after certain time of no activity) to save power, and wake up where there is a accelerometer motion. In Invensense eMPL library there is a function called mpu_lp_motion_interrupt(500, 1, 5); which put motion processing to sleep, uses accelerometer threshold only to wake up the system. Like what you have said, I observed the DMP (Quaternion / Euler / fusion data) needs certain time above 10 seconds to stabilize after the wake up interrupt. Up to this experiment, I have not done any calibration on the gyro or accel. I assumed the bias offset to be minimum and not to have significant effect. = In your opinion, do you think calibrating the gyro and accel would help to stabilize the fusion data faster when it wakes up from sleep? = Have you done experiment on sleep and wake up before, and measure how fast it stabilizes? Thank you Handi Quote Link to comment Share on other sites More sharing options...
an-erd Posted November 2, 2016 Report Share Posted November 2, 2016 Hi, I'm trying to understand what the accel offset are doing and which algorithm is used. Unfortunately, I didn't find the answer yet, neither in the forums nor in the data sheet. Since my MPU6050 is not mounted "flat" I need to transform the coordinate system. Can this be done with the functions to set the offset (accelgyro.setXAccelOffset(xAccelOff) ? Thanks for your support, Regards Andreas Quote Link to comment Share on other sites More sharing options...
renaud Posted March 16, 2017 Report Share Posted March 16, 2017 when i try to use Eqbal Khan calibration I got the error : Average.h: No such file or directory any idea? RobertFab 1 Quote Link to comment Share on other sites More sharing options...
jh4957 Posted July 31, 2017 Report Share Posted July 31, 2017 On 3/15/2017 at 11:26 PM, renaud said: when i try to use Eqbal Khan calibration I got the error : Average.h: No such file or directory any idea? Sorry to reopen this old topic and not sure if you already fixed this but doesn't that mean that you don't have the Average.h library. Where would you be able to find the Average.h library? Quote Link to comment Share on other sites More sharing options...
tds Posted September 19, 2017 Report Share Posted September 19, 2017 I have found the library "Average.h" on github. Worked for me! https://github.com/MajenkoLibraries/Average Quote Link to comment Share on other sites More sharing options...
islamdib Posted November 10, 2020 Report Share Posted November 10, 2020 On 7/31/2017 at 6:49 PM, jh4957 said: Sorry to reopen this old topic and not sure if you already fixed this but doesn't that mean that you don't have the Average.h library. Where would you be able to find the Average.h library? U have to add the librery called average.h 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.