If you don't want to set up a graphical interface for calibration a magnetic sensor, you can do a simple hard iron calibration using just the serial interface. The nice thing about this is it will work for any and all boards, and does not require any additional software installation!

This example can be run by any Arduino compatible, from a Arduino UNO/ATmega328 or better

Step 1 - Upload the SensorLab hardiron simplecal Example

We have a simple sketch that will repeatedly read magnetometer data and calculate hard iron offsets

Open up the Adafruit_SensorLab->calibration->mag_hardiron_simplecal

Step 2 - Open Serial Port

Open the serial port to launch the SensorLab calibration. You should see your magnetometer detected

Spin the board around until you see the last three numbers settle closer to each other and range from 25uT to 65uT

The middle three numbers are the hard offsets in uTesla.

In this case shown below, the screenshot indicates x = -5.68, y = 7.48, z = 19.34

This guide was first published on Jan 26, 2020. It was last updated on Jan 26, 2020.

This page (Simple Magnetic Calibration) was last updated on Jan 23, 2020.

Text editor powered by tinymce.