Nov 23, 2019 · Calibrate the MPU9250's magnetometer module The code can be downloaded from here. The magnetometer.ino is the code needed to be uploaded to the Arduino, and the magnetometer.py is a python 3 program for receiving the readings and write to a.csv file, which can be opened by Excel. Please enter your port name for the Arduino in the magnetometer.py. May 22, 2015 · The best Arduino script example of compass calibration I could find was the Comp6DOF_n0m1 Library by Noah Shibley & Michael Grant (and I will be cribbing heavily from their integer trig functions for roll, pitch & yaw…) Using the FreeIMU GUI Toolset. A post in Adafruits support forum suggested Varasano’s FreeIMU Calibration Application.