Calibration of the MPU 9250

I have an older 9 DOF and was thinking about buying your newer product. I read the hookup guide for the 14001 board and can not find much on calibrating the unit, especially for the magnetometer. Can you point me to the calibration procedure.

Can you also indicate what the desired (most likely) magnetic offsets would be. What usable magnet offsets could be and what makes the unit unusable for getting a ± 2 degree mag bearing.

Thanks

Max

I read the hookup guide for the 14001 board and can not find much on calibrating the unit

The example firmware that comes with the 9DoF Razor IMU M0 does calibration automatically when power is applied. You do need to keep the board perfectly still for about 10 seconds for the auto calibration routine to work though.

Can you also indicate what the desired (most likely) magnetic offsets would be. What usable magnet offsets could be and what makes the unit unusable for getting a ± 2 degree mag bearing.

Unfortunately I don’t have any more information on this but the [data sheet might have what you’re looking for though.](https://cdn.sparkfun.com/assets/learn_tutorials/5/5/0/MPU9250REV1.0.pdf)

ok bought the board. Set it up. used the preloaded sketch. Then loaded the

SparkFun 9DoF Razor M0 Example Firmware

Jim Lindblom @ SparkFun Electronics

Original creation date: November 22, 2016

https://github.com/sparkfun/9DOF_Razor_IMU/Firmware

Powered up the board

left it still for 30 seconds and hey presto the heading is NOT indicating north. it is at least 45 degees off.

Printed on the board the mag and acc X are in different directions. I assume that north is oriented along the mag x direction

also should the board sit SD card up ie directions on x y down?

I assume that I do not need the SD card to be in the reader to get correct readings

What I left out of the conversation is that I am only interested in heading. I want to make sure that the magnetometer can be hard and soft iron calibrated and give a non drifting estimate of heading. If this IMU, libraries and code is not the best for a heading estimate can to point me to the best product that you sell.

I did load up the Quarternion sketch in the DMP library and that works reasonably well. At least the north was closer. For my purpose I need the best estimate of magnetic north I can get

regards

Max

I have just bought and been testing the Razor with MPU 9250. How do you calibrate the compass? I can’t find this anywhere in the software you provide.

The automatic calibration after 9 seconds is for the gyros only. Not the compass.

The compass values returned are way off. Not even close. But that is because it hasn’t been calibrated.

I had a look at the libraries by Kris Winer for your MPU breakout board that does include the required calibration code. But that is written to run on a Teensy 3.1 and I can’t get it to run on the Razor.

Have you done compass calibration anywhere that I have missed? Currently I can only get it to work with 6DoF. Your standard software does not seem to utilise the compass. Or rather it does without calibrating it first.

It looks like we added that to the firmware about a year ago, but the firmware that’s shipping is probably the original version. Check the GitHub link below for the newer firmware.

  • https://github.com/sparkfun/9DOF_Razor_ … 0_Firmware
  • No. That firmware does not do compass calibration either. The code that is needed is here …

    https://github.com/kriswiner/MPU6050/wi … alibration

    The routine at that link needs to be added to your firmware. It will probably need to store the compass offsets and biases in the Flash storage too just like the other parameters. You could even have a command to do the recalculation added to your other commands. It would stop the log, ask for you to wave the compass around, and save the new settings. This would not be hard to do. Without it the compass readings are useless - not just out a few degrees but complete garbage.

    I’ve now managed to get my own implementation working using the above code. It does not use your base drivers though, rather writing to the Wire interface itself using Winer’s libraries.

    Neither Kris Winer’s Madgwick/Mahony AHRS code nor the Sparkfun version thereof, for the MPU-9250, has ever worked properly, even if you carefully calibrate the sensor. It fundamentally misuses the magnetometer. The error has long been posted in the bug list, but has never been corrected.

    Working code for both MPU-9250 calibration and the Mahony filter is posted at https://github.com/jremington/MPU-9250-AHRS

    I strongly recommend to follow the calibration procedure described in https://thecavepearlproject.org/2015/05 … r-arduino/