Jump to content
I2Cdevlib Forums
mhickman

Trying to calibrate offsets - what do you make of this data?

Recommended Posts

We have some Arduino MEGA 2560-based boards with an on-board MPU-6050 at the default I2C address 0x68. i2cdevlib is extremely helpful (thank you Jeff!), except we can't seem to generate offsets that zero the sensor outputs. 

 

I've been using luisrodenas' Arduino sketch, which he posted in this forum recently, to calculate MPU6050 offsets. I modified the output to print the mean (2000 samples in this case) of the sensor outputs and the revised offsets calculated based on those mean values each time through the loop. The full data is attached and I've included a sample from gyro_z below.

 

As you can see, the offsets change to try to move the mean values to zero. The sensors outputs seem to resist this adjustment, then at some offset threshold, the sensor values jump way past zero. This cycle then repeats. Only the gyro_y value responds as expected.

 

Does anyone have any ideas what could be causing this? I've verified this on several PCBs, so it doesn't seem to be a bad MPU. I saw similar results setting offsets manually, so I don't think the issue is in the calibration sketch.

 

Thanks,

Mike

 
MPU6050 connection successful
 
Reading sensors for first time...
 
Calculating offsets...
Configuration: buffersize=2000 acel_deadzone=16 giro_deadzone=2
mean_gz gz_offset
  492    140
  931   -170
  -93   -139
  -89   -110
  -88    -81
  -89    -52
  -88    -23
  -89      6
  934   -305
-1112     65
  934   -246
  -89   -217
  -89   -188
  -89   -159
  -89   -130
  -88   -101
  -89    -72
  -89    -43
  -89    -14
  -89     15
  934   -296
-1113     75

output.txt

Share this post


Link to post
Share on other sites

Luis, thanks for the offer of assistance. In pulling together the files for you I found the problem. Before zipping the files I decided to pull down a fresh copy of the i2cdevlib and diff my I2Cdev and MPU6050 files against it. Apparently I had somehow installed the older 2013-05-05 I2Cdev on my system. I swapped in the 2013-05-06 (current) version and everything worked as advertised. 

 

Thanks again,

Mike

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×