下载

Freescale Semiconductor
Application Note
Document Number: AN4246
Rev. 3, 04/2013
© 2013 Freescale Semiconductor, Inc. All rights reserved.
Contents
1 Introduction
This application note provides the theory for the in-situ
calibration of a smartphone electronic compass
(eCompass) for hard and soft-iron effects. The
mathematical framework is that developed in AN4248
“Implementing a Tilt-Compensated eCompass using
Accelerometer and Magnetometer Sensors” and
AN4247 “Layout Recommendations for PCBs Using a
Magnetometer Sensor.” It is therefore highly
recommended to read these application notes first before
reading this document.
1.1 Key Words
eCompass, Geomagnetic, Magnetometer, Hard Iron, Soft
Iron, Calibration.
Calibrating an eCompass in the
Presence of Hard and Soft-Iron
Interference
by: Talat Ozyagcilar
Applications Engineer
11 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Key Words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 The Hard and Soft-Iron Model. . . . . . . . . . . . . . . . . . . . . 2
3 Applying Hard and Soft-Iron Corrections to the
Tilt-Compensated eCompass . . . . . . . . . . . . . . . . . . . . . 3
4 Relating the Locus of Magnetometer Measurements
to Calibration Coefficients . . . . . . . . . . . . . . . . . . . . . . . . 5
5 Imposing a Symmetric Constraint onto the Inverse
Soft-Iron Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6 Full Solution for Four Parameter Calibration . . . . . . . . . 11
7 Calibration Algorithms and Source Code . . . . . . . . . . . 16