I am using the BNO055 IMU and the Adafruit Library. I want to store the calibration data and load them after the microcontroller is powered off and repowered on. The Adafruit Library provides an example for storing and restoring but, in actual facts, it does not work. It is always required to recalibrate the magnetometers, but even doing so, the library reperform the whole calibration including the accelerometers.

I would like to simply restore all the calibration data (including the magnetometers) so that no calibration needs to be performed when the IMU starts.

I have read a massive amount of posts on the argument, but I really could not figure out how to reliably load all the calibration data at boot and avoid recalibrating them.

Is there anyone who succeeded and can please share the code?

  • Actually no, it is not a duplicate at all. Indeed I am using a Teensy and Arduino. Also, that post does not show code.
    – L_T
    Dec 4, 2019 at 10:32
  • read the answer in the duplicate, not the question. there is no way to avoid automatic calibration. the stored calibration is only used while the automatic calibration finishes. don't waste your time on it.
    – Juraj
    Dec 4, 2019 at 10:39
  • Thanks. Then what I am supposed to do? The last comment says "I would ignore the calibration. The sensor handles it. After power-up make same movements and the sensor calibrates itself. " So should I avoid any calibration in the end? And should I avoid storing the calibration in the EEPROM at all?
    – L_T
    Dec 4, 2019 at 13:08
  • 1

1 Answer 1


I found the solution. It is enough to add a function that when reperfoming the calibration of the magnetometer, checks ONLY if the magnetometer is calibrated (while the calibration for the accelerometer and gyroscope is reloaded from the EEPROM).

void performMagCal(void) {
  uint8_t system, gyro, accel, mag;
  system = gyro = accel = mag = 0;

  while (mag != 3) {

    bno.getCalibration(&system, &gyro, &accel, &mag);

  Serial.println("\nMagnetometer calibrated!");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.