Component guide · Intermediate · 3 min read
Magnetometers and 9-Axis IMUs
BNO055, BNO085, MMC5603 and Compass Calibration
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
A 9-axis IMU adds a magnetometer to a gyroscope and accelerometer so it can give a stable heading as well as roll and pitch. Sensors such as the BNO055 and BNO085 do the sensor fusion on the chip and output orientation directly. A bare magnetometer gives raw field values that you must calibrate for hard-iron and soft-iron errors before using it as a compass.
Key specs at a glance
- Fusion chips
- BNO055, BNO085/BNO086 output orientation and quaternions
- Raw magnetometers
- MMC5603, BMM150, TMAG5273 (3D Hall)
- Interface
- I2C, SPI or UART
- Supply
- 3.3 V; Qwiic and STEMMA QT boards
- Industrial AHRS
- Serial or RS485 9-axis modules
- Output
- Euler angles, quaternion, raw data
Options
Pick between a fusion sensor and raw parts.
| Sensor | Output | Notes |
|---|---|---|
| BNO055 | Fused Euler angles and quaternion | Easy to use; occasionally needs recalibration |
| BNO085 / BNO086 | Fused rotation vector, gesture, step counter | Better fusion; more complex I2C/SPI protocol |
| MMC5603 / BMM150 | Raw magnetic field | You write the fusion and calibration |
| TMAG5273 | 3D Hall field, wide range | Great for magnet position, not a compass |
| Industrial AHRS (BWSENSING AH50, DMC630) | Attitude and heading over serial | For vehicles and equipment |
| MPU9250-class boards | Raw 9-axis data | Check availability; the MPU6050 has no magnetometer |
- BNO055
- Output:
- Fused Euler angles and quaternion
- Notes:
- Easy to use; occasionally needs recalibration
- BNO085 / BNO086
- Output:
- Fused rotation vector, gesture, step counter
- Notes:
- Better fusion; more complex I2C/SPI protocol
- MMC5603 / BMM150
- Output:
- Raw magnetic field
- Notes:
- You write the fusion and calibration
- TMAG5273
- Output:
- 3D Hall field, wide range
- Notes:
- Great for magnet position, not a compass
- Industrial AHRS (BWSENSING AH50, DMC630)
- Output:
- Attitude and heading over serial
- Notes:
- For vehicles and equipment
- MPU9250-class boards
- Output:
- Raw 9-axis data
- Notes:
- Check availability; the MPU6050 has no magnetometer
Compass calibration
Metal and magnets near the sensor bend the field. Hard-iron errors shift the whole reading, and soft-iron errors stretch it. To calibrate, rotate the board slowly through all orientations while logging the field. The ideal data forms a sphere centred on zero; subtract the centre offset and scale the axes to correct. Many libraries and BNO chips include calibration routines and status flags.
Heading, tilt and declination
A magnetometer finds magnetic north. Tilt compensation uses the accelerometer so the heading stays right when the board is not level. Add the local magnetic declination to get true north; in India this is only a few degrees. Keep the sensor away from motors, speakers, power wires and batteries. For vehicles and drones see GPS and compass.
Wiring and use
- 1Connect 3.3 V, GND, SDA and SCL; see I2C.
- 2Check the address with an I2C scanner.
- 3Install the vendor library and read orientation.
- 4Place the sensor far from motors and power cables.
- 5Calibrate in the final location, then save the offsets.
- 6Compare with a phone compass to check the direction.
Try it: Angle converter calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Calibrating the sensor outside the enclosure it will live in.
- Mounting next to motors or speakers.
- Using true north without declination.
- Assuming the MPU6050 has a magnetometer.
- Not waiting for the BNO calibration status to reach full.
Frequently asked questions
Do I need a magnetometer?
Only for heading. Roll and pitch work with an accelerometer and gyroscope.
BNO055 or BNO085?
BNO055 is simpler and cheaper. BNO085 has better fusion and extra features.
Why does my compass drift?
Nearby metal, electric currents and temperature all affect it.
What is sensor fusion?
Combining sensor data to get a stable orientation.
Can a magnetometer work indoors?
Yes, but steel and wiring distort the field.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 1 step-by-step build in our project library uses parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.





