Jump to content
I2Cdevlib Forums

Another auto-offset calibration sketch


Recommended Posts

Hey everyone!

Thought I'd share my version of an auto-offset calibration sketch; it converges all offsets in about 20s or so. Just upload and watch the serial (at 38400bps)!

A note on how it works/converges:

- the code takes an initial guess for each offset (supplied at the top of the sketch), takes a certain number of readings from the MPU-6050 (the # of readings it takes is defined by countMax), and averages those number of readings. If that average is less than the value errorCheck, it assumes that axis has converged

- if the average isn't less than errorCheck, it will subtract a certain amount from the initial guess

- if the errorCheck you set is too small, or the initial guess is smaller than what the solution is, it wont converge - in this case either choose a larger value for errorCheck or a larger initial guess

I've given some initial guesses / settings which should help you get to where you need to be; just watch the serial - it'll tell you what the average reading from the MPU-6050 was for each guess, you'll want that average to be as close to 0 as possible for each axis.

Enjoy!

MPU6050_calibration.zip

Link to comment
Share on other sites

  • 8 months later...
  • 1 year later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

× Pasted as rich text. Paste as plain text instead

Only 75 emoji are allowed.

× Your link has been automatically embedded. Display as a link instead

× Your previous content has been restored. Clear editor

× You cannot paste images directly. Upload or insert images from URL.

Loading...
Share

×
×
  • Create New...

AltStyle によって変換されたページ (->オリジナル) /