0% found this document useful (0 votes)
111 views4 pages

CalibofMag 2012 PDF

This document presents a new technique for calibrating all three axes of a 3D magnetometer. It involves a two-step procedure and exploits the relationship between body axis rates and Euler angles to define a limited rotation and associated optimization problem to determine calibration parameters like bias and scale factors. The technique aims to overcome limitations of traditional compass swinging calibration, which requires external heading information. An experimental setup is described using a 3-axis magnetometer, inertial measurement unit (IMU), and embedded system to collect magnetometer data during a full heading rotation. Existing 2D and 3D calibration methods are also discussed.

Uploaded by

Shrikant Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views4 pages

CalibofMag 2012 PDF

This document presents a new technique for calibrating all three axes of a 3D magnetometer. It involves a two-step procedure and exploits the relationship between body axis rates and Euler angles to define a limited rotation and associated optimization problem to determine calibration parameters like bias and scale factors. The technique aims to overcome limitations of traditional compass swinging calibration, which requires external heading information. An experimental setup is described using a 3-axis magnetometer, inertial measurement unit (IMU), and embedded system to collect magnetometer data during a full heading rotation. Existing 2D and 3D calibration methods are also discussed.

Uploaded by

Shrikant Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Calibration of 3-axis Magnetometers

K.S. Hemanth*, Viswanath Talasila**


Shrikant Rao***

*Honeywell Technology Solutions, Bangalore, 560076


India (Tel: +91-80-26588360; e-mails: *[email protected], **[email protected],
***[email protected]).

Abstract: Calibration of all 3 axes of a 3D magnetometer in cases where the true field strength is unknown involves
an elaborate test set-up and rotation of the unit about all three axes so as to cover a sphere/ellipsoid. This paper
presents an alternate method for calibrating all three axis of a magnetometer, i.e. estimating bias and scale factors for
all axes, using a simpler 2 step procedure. The proposed technique exploits the relation between the body axis rates
and the Euler angles to define a limited rotation and an associated optimization problem to determine the calibration
parameters.
Keywords: Magnetometer, Calibration, Scale factor, Bias, Optimization.

The classic compass swinging calibration technique


1. INTRODUCTION [Nathaniel Bowditch (1995)] is a heading calibration
Magnetometers are an important aiding sensor for navigation algorithm that computes scalar parameters using a least
systems. They enable attitude (magnetic heading) squares algorithm. The major shortcoming of this approach is
computation by comparing the measured earth’s magnetic the necessity of external heading information, which is a
field with geomagnetic charts. The outputs of magnetometers strong requirement in many applications. We adopt the
are corrupted by wide band measurement noise, stochastic technique from [Demoz, 2006] (which is not only
biases due to sensor imperfections, installation errors and conceptually similar to other standard techniques, but also
magnetic interference in the vicinity of the sensors. The provides a good theoretical justification); and we show that
unwanted or interfering magnetic fields can be classified into while 2D calibration is simple and straightforward; none of
two distinct groups. The first group consists of constant or the standard techniques are easily implementable in the 3D
slowly time-varying fields generated by ferromagnetic case. We propose to show a new technique for 3D calibration
structural materials in the proximity of the magnetometers. which overcomes these issues.
The field measurement errors resulting from such
interferences are referred to as hard iron biases. The second
2. EXPERIMENTAL SET UP AND INITIAL
group of interfering magnetic fields result from materials that
generate their own magnetic field in response to an externally VALUE ESTIMATION
applied field. This generated field is affected by both the In this section we outline the experimental set up for the
magnitude and direction of the externally applied magnetic calibration procedure and the truth reference. We also study
field. Such materials are called soft irons and the error they existing calibration routines and their limitations.
generate is referred to as a soft iron bias, which is time
varying [Demoz, 2006]. 2.1 The experimental set up

The magnetometer output with errors are modeled as The following experimental set up has been designed in our
2 2 2 lab. As a truth reference sensor for angular positions we use
hx Bx hy By hz Bz Ideal Aerosmith’s Position Table [Ideal, 2010], which has
h2 (1)
x y z
angular position accuracies better than 0.1°. The following
are the general specifications of our set up:
where
Bx , By , Bz are the hard iron parameters. Sensors
x, y, z
are the scale factor and soft iron error parameters. Micromag 3 – 3-axis Magnetometer, [PNI 2010]
ADIS16365 – 3-axis Inertial Measurement Unit, [Analog
hx , hy , hz are the actual magnetic field strength. 2010]
The calibration procedures then involve computing the above Communication Board
parameters, and there are well known techniques for doing Fox board with processor ETRAX100lx
this, e.g. [Nathaniel Bowditch (1995), Demoz (2006),
Vasconcelos et. al. (2008)].
2hx (t1 ) 2h y (t1 ) (h y (t1 )) 2 1
2hx (t 2 ) 2h y (t 2 ) (h y (t 2 )) 2 1
(4)
H .. .. .. 1
.. .. .. ..
2hx (t k ) 2h y (t k ) (h y (t k )) 2 1

Since v is assumed to be sufficiently small, an estimate of

x can be obtained by the least squares solution as
 

1
Figure (1): Experimental set up with 3axis magnetometer, HT H HT z (5)
IMU and FoxBoard embedded system The change in the parameters vector can be expressed as
1 (6)
Both the sensors are communicating through the Software x 2 By
SPI device driver code. Initially both sensors with 2

communication board are mounted on the position table as 4

shown in Figure (1). A data set of a 3-axes magnetometer is where


collected for one complete heading rotation of 360. 1 Bx
2
x
2.2 A 2D calibration procedure 2 2
y
2 2 2
The plot of the X vs. Y axes values of the magnetometer 4 2 By Bx h2 x

under a full heading rotation is as shown in Figure (2). The


plot looks like an off centred scaled ellipse. The main By algebraic manipulation we can compute the estimate of
consideration in the calibration procedure is to obtain a circle the initial conditions as
from the ellipse by finding the correction factors for hard iron Bx 1
and soft iron with scale factor error. 
x (2)
By 
x (3)
2 2
2 By Bx 4
x 2
h
2
x
y
2

To find the optimal values from the initial values


Since the ellipse equation is non linear, we use the
fsolve command in MATLAB to find the exact roots of the
equation to fit the magnetometer data to a circle with the
Figure (2): Magnetometer output under a full 360 initial conditions as calculated in Section 2.3. As the non
rotation. linear equation has numerous solutions, computing good
initial values is important for convergence to the correct
solution using the initialization technique described in
2.3 Initial value estimation from the data set to find the
Section 2.3. After calculating the exact roots the correction
hard iron and soft iron with scale factor errors:
The following method is adopted from [Demoz, 2006]. The factors are offset from the magnetometer data with respect to
basic form of the magnetometer equation as discussed before corresponding axis and the Figure 3 below shows the circle
in Section 1 is: fit after calibration.
2 2
2 hx B x hy B y (2)
h
x y

Expanding the above expression


2 2 2 2
hx 2 hx B x Bx hy 2 hy B y By (3)
h2 2 2
x y

In matrix form the standard equation will be written as


    
z Hx v where v is the noise vector, z is residual or the

error vector and x is the change in the parameters (magnetic

field values from the magnetometers). Assuming v , the noise
vector, is zero or too less comparatively with the gain factor
Figure (3): Magnetometer output after 2D calibration
of magnetometer, then by algebraic combination of the
expanded equations we get the H matrix as 2.4 Calibration does not require location information
In standard calibration routines where the ellipse is fit to a relationship is used to construct a cost function with the Z
circle in order to compute the scale factor and bias – a key axis calibration parameters being a solution to the cost
assumption is that the radius of the circle is a known quantity. function minima.
Scale factors are the soft iron disturbances and the bias is the
hard iron disturbances. The radius of the circle is in fact the
total strength of the true magnetic field. The true magnetic
field is location dependent, i.e. it can be computed only by 3. A 2-STEP PROCEDURE FOR 3-AXIS
knowing the (latitude, longitude, altitude). We propose a
simple procedure to compute scale factor and bias without MAGNETOMETER CALIBRATION
any knowledge of the true magnetic field – and hence the This section presents a new technique to calibrate
proposed procedure does not require location information! magnetometers in 3axes without requiring to cover a
The procedure is described now. (minimum area of a) sphere as discussed previously in
Section 2.4.
In a 2D calibration there are 4 unknowns: 2 scale factors (
sx , s y ) and 2 bias values ( bx , by ). If the true magnetic field is
3.1 Euler angle relationships with body rates
unknown then there are 5 parameters to be estimated:
(sx , s y , bx , by , r ) where r is the radius (or true magnetic The formulation of the Euler angles results in certain
field) and is the set of parameters to be estimated. unique relations between them. We make use of one
Since the radius of the circle affects only the computation of such relationship in order to formulate a new cost
the scale factors (this can be easily visualized geometrically), function, the solution of which gives optimal
and has no effect in estimating the bias values, the above estimates for the vertical axis errors. The
parameter set can be rewritten as: relationship is the following: whenever the
sx s y magnetometer rotates about its forward axis (i.e.
( , , bx , b y ) : ( sˆx , sˆ y , bx , by ) (7) roll rotation), then there must be no change in the
r r yaw angle. Let us see what happens to this
Now there are only 4 parameters to be estimated. Then we behaviour in our experimental set up, when only the
can pose a standard least squares problem, similar to what horizontal axes of the magnetometer has been
was done in Section 2.3, with these 4 parameters as the calibrated (as described before). From Figure 4 we
unknowns. can observe that as varies from -90 to +90°, there
This implies that the true magnetic field and hence the actual is a significant variation in the heading angle, , as
vehicle location is not required. This was the procedure
followed in the previous section. well. Here we see that φ varies by almost 40°. Note
that the truth reference is the angular position given
2.5 Problems with standard techniques when extending by the position table.

the calibration procedure to the 3D case


A common method to calibrate a magnetometer in 3 3.2 Formulation of a cost function
dimensions is to collect the data of all 3 axes by rotating in a
First note that standard transformations have been applied to
sphere. This is not feasible, as it requires an infinite number
convert magnetometer readings in the body frame to the
of circles to form a sphere. Hence for 3D calibration, see
inertial frame. The cost function is defined as the difference
[Demoz 2006, Vasconcelos et. al. (2008)], a minimum
between two computed heading values: one heading is
20˚strip of the sphere data is collected and calibration
computed when the platform is stationary and leveled; the
procedure in carried out. This would involve a failr elaborate
other when the platform is experiencing a roll rotation. The
set up for the calibration procedure. The least squares
cost function is:
technique does not converge when data collection is less than
20˚ strip, and it often fails to converge even when a 20˚ strip J ( L) ( R) (8)
is chosen. Finally, [Demoz, 2006] concludes that “for Where
relatively low cost magnetometers with relatively large (L) : is the Euler heading angle when the magnetometer is
magnitude output noise, this algorithm is not suitable unless a stationary and levelled,
large portion of the ellipsoid is available”. (R) : is the Euler heading angle when the magnetometer is
Hence for any practical application, there is a need for a undergoing a rolling motion.
simpler and accurate 3D calibration procedure. We illustrate
one such procedure below. Firstly, we calibrate the Ideally J should be 0 when the magnetometer is undergoing a
magnetometer in the horizontal plane. Next, we make use of My
roll. Note that tan 1
, and this in turn is related
a unique relationship between the Roll ( ) and Yaw ( ) Mx
Euler angles. Namely, that when the magnetometer is level, to the parameters ( Bz , ) to be estimated. Here M y , M x
and it undergoes a rotation about the forward direction (i.e. z

roll rotation) there must be no change in the . This are the magnetic field measurements in the horizontal plane.
along with pitch rate q using a gyro, then the measured
By using the fminsearch optimization routine in MATLAB, can be compared to the true change in heading computed
the solution to the minimum of the cost function can be analytically; and a simple cost function can be defined and
computed, and the solution gives the optimal values of Bz solved for obtaining the magnetometers Z-axis parameters.
and . In a more general case when the vehicle experiences both
z
pitch and roll motion the following relationship between the
After computing the optimal values of the Z axis parameters heading angle and body rates
the heading values are again plotted with the roll manoeuvre. sin (11)
 0 p q
The heading error is restricted to ±7˚ as shown in Figure (4), cos
except where the roll rotation comes close to +90◦. Note that can be used to define an appropriate cost function and solve
the error is computed with respect to the position table. for the magnetometer Z-axis parameters.

Finally note that the initial conditions for the optimization 5. CONCLUSIONS
routine have not been chosen carefully, and we could use the
procedure described in Section 2.3 to compute accurate initial We have presented a simple technique for performing 3D
values which could further reduce the above heading error. magnetometer calibration.
The resulting heading error after our calibration has been
reduced to 7° - further reduction in the error can be obtained
by controlling measurement errors (e.g. modelled as white
Heading- Roll Plot
100 noise), misalignment errors, and by improving our initial
condition estimates for the Z-axis calibration parameters.
50
The complicated procedure of having to gather a large
0 amount of data by rotating the magnetometer in a sphere is
avoided. Instead, the problem is simplified to only having to
-50
rotate the sensor only about its roll axis.
Euler angles

-100 Further refinement of this procedure would involve obtaining


good initial conditions for the Z-calibration parameters;
-150
extracting a much larger dataset with the sensor in roll
-200 motion, and estimating measurement noise and incorporating
Heading Z axis Mag calibrated these into the optimization procedure described in this work.
-250 heading Z axis mag not calibrated
Roll
-300
0 100 200 300 400 500 600
Number of samples
700 800 900 1000
REFERENCES
Fig (4): Comparison of Heading calibrated and not calibrated Demoz Gebre-Egziabher et. al. (2006), Calibration of
with Roll Plot Strapdown Magnetometers in Magnetic Field Domain, J.
Aerosp. Engrg. 19:2(87).
4. FUTURE WORK Nathaniel Bowditch (1995), The American Practical
In this paper we have presented a detailed result on Navigator, Defence Mapping Agency, Hydrographic/
calibrating a 3-axis magnetometer in the presence of a pure Topographic Center, Bethesda, Maryland, USA.
roll manoeuvre. In many cases, e.g. for ground vehicles the Ideal Aerosmith (2010), 1310-L Series Manual Tilt and Turn
magnetometer needs to be calibrated in the presence of pitch Table, Ideal Aerosmith, USA.
motion as well. Thus calibration is required when both pitch Analog Devices (2010), ADIS 16365: Six degrees of freedom
and roll motions are present. The technique outlined in this inertial sensor, USA
paper can be extended to this case as follows. There is an PNI Sensor Corporation (2010), Micromag3: 3-axis magnetic
analytical relationship in a change in the heading angle when sensor module, USA
a vehicle is undergoing a pure pitch motion. Consider the J. F. Vasconcelos, G. Elkaim, C. Silvestre, P. Oliveira, and B.
standard transformation between body rates and Euler angles: Cardeira, (2008), A Geometric Approach to Strapdown
Magnetometer Calibration in Sensor Frame, IFAC
 1 sin tan cos tan p Workshop on Navigation, Guidance, and Control of
 0 cos sin q
Underwater Vehicles (NGCUV), Killaloe, Ireland.
 sin cos r (9)
0
cos cos

Then we see
sin (10)
 q
cos
If the Euler angles , can be measured (e.g. using an
accelerometer under a constant acceleration assumption),

You might also like