Newbie titous Posted January 31, 2014 Report Share Posted January 31, 2014 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 limon and MCannist Like 2 Quote Link to comment Share on other sites More sharing options...
Newbie MCannist Posted October 28, 2014 Report Share Posted October 28, 2014 Hi titous Yesterday I've used your calibration sketch on a Tennsy 3.1 + MPU-9150 and worked perfectly. Now I'm getting really better raw values... :-) I've mentioned your post/sketch here: https://github.com/mjs513/FreeIMU-Updates/issues/7 Thank you for your efforts, Mario Quote Link to comment Share on other sites More sharing options...
Newbie yerzhik Posted December 24, 2015 Report Share Posted December 24, 2015 Wow great! But I suggest using the binary search . I think it will work out for accelerometer calibration. And gonna be faster Quote Link to comment Share on other sites More sharing options...
Newbie Eph Posted February 13, 2018 Report Share Posted February 13, 2018 Thanks a lot. After calibrating my sensor, it kinda stopped drifting. 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.