Inertial Navigation
   IMU and INS
   Your Application
   Unaided Position Estimate
Relative Attitude Determination

Orientation Sensors



   Sensor Model

Using the VN-100
   Embedded Library Example


A magnetometer is a type of sensor that measures the strength and direction of the local magnetic field. The magnetic field measured will be a combination of both the earth's magnetic field and any magnetic field created by nearby objects. The magnetic field is measured in the sensor reference frame.

Earth's Magnetic Field

The earth's magnetic field is a self sustaining magnetic field that resembles a magnetic dipole with one end near the Earth's geographic North Pole and the other near the earth's geographic South Pole. The strength of this magnetic field varies across the Earth with strengths as low as 0.3 Gauss in South America to over 0.6 Gauss in northern Canada. Although this magnetic field is relatively stable over time, electric currents in the ionosphere can cause daily alterations which can deflect surface magnetic fields by as much as one degree. Normally daily variations in field strength are on the order of 0.25 mGauss, which would equate to about a 0.03 degree variation in heading. This small of a change in heading is on the same order of magnitude as the resolution of most MEMS based magnetometers, so in most cases the Earth's magnetic field can be considered constant with respect to time.

Magnetometer Sensor Model

A sensor model is used to mathematically correct for errors in scale factor, misalignment, and bias. The magnetometers used in VectorNav's sensors, unless otherwise stated, use a linear sensor model.


This written out as algebraic equations gives the following:

magnetometer sensor model
Temperature calibration

To above calibration parameters will vary with changing temperature. To account for this all VectorNav sensors utilize a third order algebraic polynomial for each calibration coefficient as a function of temperature. Each calibration coefficient can be calculated as follows:

calibration coefficient
Hard and Soft Iron Distortions

Magnetic measurements will be subjected to distortion. These distortions are considered to fall in one of two categories; hard or soft iron. Hard iron distortions are created by objects that produce a magnetic field. A speaker or piece of magnetized iron for example will cause a hard iron distortion. If the piece of magnetic material is physically attached to the same reference frame as the sensor, then this type of hard iron distortion will cause a permanent bias in the sensor output. Soft iron distortions are considered deflections or alterations in the existing magnetic field. These distortions will stretch or distort the magnetic field depending upon which direction the field acts relative to the sensor. This type of distortion is commonly caused by metals such as nickel and iron. In most cases hard iron distortions will have a much larger contribution to the total uncorrected error than soft iron.

Visualizing Hard and Soft Iron Distortions

A common way of visualizing and correcting hard and soft iron distortions is to plot the output of the magnetometer on a 2D graph. The following plot shows measurements taken by the magnetometer as the device is slowly rotated around the Z-axis.

Case 1- No Distortions

In the event that there are no hard or soft iron distortions present, the measurements should form a circle centered at X=0, Y=0. The radius of the circle equals the magnitude of the magnetic field. Hard iron distortions will cause a permanent bias to be present in the outputs. The effect of hard iron distortions on the plot will be to shift the center of the circle.

magnetic measurements no distortions

Figure 1. No Distortions

Case 2 - Hard Iron Distortions

As shown in the plot the center of the circle with hard iron distortions is now at X=200, Y=100. From this we can conclude that there is 200 mGauss hard iron bias in the X-axis and 100 mGauss hard iron bias in the Y-axis. Hard iron distortions will only shift the center of the circle away from the origin. Hard iron distortions will not distort the shape of the circle. Soft iron distortions on the other hand distort and warp the existing magnetic fields. When you plot the magnetic output soft iron distortions are easy to recognize since they will distort the circular output. Soft Iron effects warp the circle into an elliptical shape. Below is an example of the magnetometer output when both hard and soft iron distortions are present.

magnetic measurements hard-iron distortions
Figure 2. Hard Iron Distortions
Case 3 - Hard and Soft Iron Distortions

As shown in the above magnetometer output, the circle has been distorted into an ellipse. The center of the ellipse is still located at X=200 mGauss and Y=100mGauss since the hard iron distortions are the same as before. Every ellipse has a major and minor axis which corresponds to the long and short dimensions respectfully. As shown in the above plot the ellipse has its major axis aligned 30 degrees up from the body frame X direction.

magnetic measurements hard and soft iron distortions

Figure 3. Soft and Soft Iron Distortions

How to Eliminate Hard and Soft Iron Distortions

It is possible to eliminate the effects of both hard and soft iron distortions on the magnetometer outputs. The VectorNav products use the following calibration model to correct for hard and soft iron distortions.

eliminate hard and soft iron distortions

The above model consists of 12 hard and soft iron compensation parameters. The first 9 parameters correct for the soft iron while the last three {C10, C11, C12} parameters compensate math_839568375 for the hard iron. In case shown in Figure 3, the hard and soft iron calibration parameters would be

eliminate hard and soft iron distortions

From the above parameters you can see that the hard iron parameters are set to the offset of the center of the ellipse as described in the previous section. Also, note that the hard an soft iron effect influences all the axes of the sensor and the above example could be repeated for both rotations about the X and Y axes.