Abstract
The geomagnetic sensor is a kind of highly sensitive sensor, which is easy to be interfered with by the outside in the process of measurement. To solve this problem, the author uses the least square method to estimate the gain value and sensitivity product value of the amplification circuit of the geomagnetic sensor and explores the solution of the bias voltage of the geomagnetic sensor by using the ellipsoid fitting model. By analyzing the error sources of the geomagnetic sensors in the measurement process, the error compensation model covering various error factors is constructed. All parameters of the error compensation model are obtained by fitting the experimental data of the turntable. After several experiments with different attitude angles, the validity of the compensation model is verified, and the measurement accuracy of the roll angle is improved, which meets the requirements of roll angle measurement.
Keywords
Introduction
The geomagnetic field is the inherent basic physical field of the earth. Geomagnetic intensity exists at any place in the near-earth space, and the intensity and direction will change with the longitude, latitude, and height, but in a relatively short time and a small space, the difference is not significant.1,2 Based on the characteristics of the geomagnetic field, the three-axis geomagnetic sensor can measure the projection of geomagnetic vector on the carrier coordinate system, so as to obtain the attitude of the carrier and provide technical support for navigation control. Attitude measurement technology is the key part of positioning and navigation technology. In geomagnetic navigation, three-axis geomagnetic sensor is the core component of attitude measurement system. Three-axis geomagnetic sensor has the characteristics of small volume, low cost, high precision, strong shock resistance, and overload ability. It is widely used in many fields such as guidance and control, navigation, and magnetic measurement.3–8
In practical application, geomagnetic sensor will be interfered by its own factors and external factors, resulting in errors in the measurement results. Due to the limitation of material and technology, the sensor will produce non-orthogonal error and DC bias in the manufacturing process, and the installation error will occur in the installation process. The soft magnetic error and hard magnetic error will be caused by the interference magnetic field in itself and environment. Therefore, the three-axis output of geomagnetic sensor cannot appear as a sphere, but an ellipsoid, so the optimal estimation of parameters in the relationship between input and output is needed for attitude measurement. At present, the method of parameter calibration and error compensation of geomagnetic sensor is usually divided into attitude angle based 9 and attitude independent calibration,10,11 which will introduce external equipment, which will increase the investment of actual cost. Therefore, this article explores the calibration and error compensation algorithm based on attitude angle.
Many scholars have studied the error compensation in the process of geomagnetic sensor measurement, for example, Wang et al. 12 established standard least square method, stable least square method, constrained least square method, and truncated least square method to analyze the sensor measurement data, which can effectively compensate the magnetic measurement. However, the least square method is too complex to solve the DC bias of geomagnetic sensor, so, it is not easy to establish the solution model; Crassidis et al. 13 uses the Extended Kalman filter and Unscented Kalman filter to calibrate the magnetic sensor error, but the filtering has limitations and cannot cover all error factors; Liu et al. 14 compensated the error of geomagnetic sensor by establishing differential magnetic field and compensated soft magnetic error and hard magnetic error by nonlinear least square method and changing the installation mode of three-axis geomagnetic sensor, but the compensation algorithm does not cover all error factors, and the operation process requires high requirements; Kok and Schön 15 used the inertial navigation system (accelerometer and gyroscope) to assist the geomagnetic sensor correction and used the jet plane flight experiment to verify the effectiveness of the algorithm. However, the calculation process is complex and not easy to solve; Vasconcelos et al. 16 proposed a fitting algorithm based on maximum likelihood estimation, which can directly obtain the error compensation matrix to compensate the magnetic measurement distortion. However, the iterative method is too complex to obtain the compensation matrix and the efficiency is not high; Wu and Shi 17 proposed an approximate quadratic maximum likelihood estimation based on four subjective functions to replace magnetic measurement calibration for magnetic measurement compensation. However, the calculation process is too complex and the efficiency is low. Liu et al. 18 calibrated the three-axis magnetic sensor by establishing particle swarm optimization algorithm, which effectively reduced the magnetic measurement accuracy, but the work efficiency was low, and the actual engineering application was low. Compared with the improved least square method, 19 maximum likelihood estimation fitting algorithm, 17 and Kalman filter algorithm, 20 this method establishes a complete error model, and the calculation process is simpler; compared with the use of inertial navigation system, 15 external magnetic field, 14 and intelligent optimization algorithm,21,22 this method can reduce the input of experimental steps and cost, and better meet the engineering application. Through the three-axis non-magnetic turntable test, this method can control the roll angle error within 2° and achieve the laboratory calibration accuracy under the same conditions and effectively improve the roll angle measurement accuracy. At the same time, it can improve the magnetic measurement accuracy by an order of magnitude.
The motivation of this article is that the product of the sensitivity of the sensor and the gain of the amplifier circuit is calibrated by using the least square method, and the bias voltage of the sensor is solved by using the ellipsoid fitting, and then, the error compensation matrix is solved by using the attitude angle experiment. The least square method can effectively solve the influence of installation error and non-orthogonal error on the sensor calibration process. The ellipsoid fitting method can effectively solve the influence of hard magnetic error and bias voltage on the sensor calibration process. Both of them can be used in the sensor calibration process at the same time, which can effectively improve the accuracy of sensor output parameter calculation. The method has low requirements for experimental environment and simple operation process, which is suitable for practical engineering application.
The rest of this article is as follows: the second section mainly introduces the calibration principle of the geomagnetic sensor; the third section analyzes the error source of the geomagnetic sensor and establishes the error compensation model based on the error analysis; the fourth section calculates the error compensation model through experiments and obtains the compensation effect of the compensation model through the measurement of roll angle. Finally, the fifth section summarizes the conclusion.
Calibration principle
In the process of geomagnetic navigation control, the x-axis of the geomagnetic sensor can measure the angle between the carrier axis and the geomagnetic vector, and the other two axes can measure the rolling attitude of the carrier and transmit the attitude of the carrier to the linkage rudder, which can control the flight direction and distance of the carrier. The direct output of the geomagnetic sensor is the voltage value, which cannot directly give the angle information needed in the geomagnetic navigation. It can be converted by the mathematical model shown in the following formula
In the above formula, Vx, Vy, and Vz are the direct output voltage values of X-axis, Y-axis, and Z-axis of geomagnetic sensor; Vx90°, Vy90°, and Vz90° are output voltage values of three-axis sensor when local magnetic sensor is in non-magnetic environment; Sx, Sy, and Sz are sensitivity of three-axis geomagnetic sensor; Kx, Ky, and Kz are the gain values of amplification circuit corresponding to three-axis geomagnetic sensor; B is the geomagnetic field strength; and θBx, θBy, and θBz are the angles between the three axes of the geomagnetic sensor and the geomagnetic vector. Generally, in the circuit design of the geomagnetic sensor measurement system, the three axes of the geomagnetic sensor are connected in series with their respective amplification circuits, so the product of the sensitivity and the gain value of the amplification circuit can be regarded as a variable L, that is, the expression is L = S*K. The sensitivity and zero drift value of the geomagnetic sensor are the attributes of the sensor. The gain value of the amplifier circuit is related to the selection of the amplifier circuit. The geomagnetic field strength B is the inherent attribute of the geomagnetic field, which can be calculated by the World Magnetic Model (WMM).
The final goal of sensor calibration is to get more accurate variable L and zero drift value, which can reduce the influence of system error for subsequent attitude test. It can be seen from formula 1 that the direct output voltage value of the geomagnetic sensor is a cosine function of the angle between the sensor sensitive axis and the geomagnetic vector. From the image characteristics of cosine function, the following formula can be obtained, which can be expressed by mathematical model as follows
In the above formula, Vbxmax and Vbxmin are the maximum and minimum values of the sensor output when the x-axis of the geomagnetic sensor rotates one circle around the axis perpendicular to the geomagnetic vector; Vbymax and Vbymin are the maximum and minimum values of geomagnetic sensor output when y-axis rotates around the axis perpendicular to the geomagnetic vector; Vbzmax and Vbzmin are the maximum and minimum output values of the geomagnetic sensor when the z-axis rotates around the axis perpendicular to the geomagnetic vector.
In the actual calibration experiment, it is not easy to determine the direction of geomagnetic vector, so it is necessary to analyze θBx, θBy, and θBz. Taking the North-Sky-East coordinate system as the basic coordinate system, represented by O-NSE, and taking the geomagnetic sensor coordinate system as the carrier coordinate system and represented by O-XYZ, the angle between the three axes of the geomagnetic sensor and the geomagnetic vector is analyzed. During the calibration experiment of geomagnetic sensor, the longitude, latitude, and altitude of the experimental site can be measured by satellite. Using the latest International Geomagnetic Reference Field (IGRF13) given by the International Association of Geomagnetism and Aeronomy (IAGA), the tilt angle and deflection angle of geomagnetic vector of the experimental site in the North Tianshan coordinate system can be obtained, which are expressed by I and D (the magnetic inclination angle is positive in the horizontal plane. the magnetic declination is positive from north to west). The mathematical model is expressed as
In the above formula, Bg represents the direction and size of the geomagnetic vector. Any attitude of the carrier in the North-Sky-East coordinate system can be transformed by the method shown in Figure 1:

Coordinate system transformation process.
In Figure 1, the geomagnetic sensor coordinate system was completely coincident with the North-Sky-East coordinate system at first. β, α, and γ were the rotation angles around Y-axis, Z-axis, and X-axis, respectively. Then, the attitude of carrier coordinate system in the North-Sky-East coordinate system was expressed as follows
It can be seen from the three formulas that the projection of geomagnetic vector on the three axes of the North-Sky-East coordinate system is BN, BS, and BE, which can be expressed by mathematical expression as BN = BcosIcosD, BS = BsinI, and BE = –BcosIsinD. If they are brought into the above formula, the projection of geomagnetic vector on the three axes of the carrier coordinate system can be obtained. The mathematical model is expressed as follows
By transforming the Sum-to-product Identities of the above formula, the following formula can be obtained
In the above formula
Another mathematical expression of variable L and zero-drift value can be obtained by taking equation (6) back to equation (2), as shown in the following formula
In the above formula, Vxmax and Vxmin are the maximum and minimum output values of the geomagnetic sensor when the X-axis rotates around the Z-axis; Vymax and Vymin are the maximum and minimum values of the geomagnetic sensor’s Y-axis rotation around the X-axis; Vzmax and Vzmin are the maximum and minimum values of the geomagnetic sensor’s Z-axis rotation around the X-axis.
Error compensation and modeling of geomagnetic sensor
Because the geomagnetic sensor in the manufacturing process, there are manufacturing errors, and affected by the environment, installation accuracy and other factors, inevitably produce errors. The error can be divided into three categories according to the causes: 23
The sensor itself. The sensor is affected by the manufacturing materials, manufacturing technology and manufacturing environment, which will cause the deviation between the sensitivity and zero drift value of the sensor and the standard value. The three sensitive axes cannot be completely orthogonal to each other in the manufacturing process; One is installation design error, including installation error and gain error of amplifier circuit;
Installation design error, including installation error and gain error of amplifier circuit;
Magnetic measurement error, including hard magnetic error and soft magnetic error.
Error analysis and modeling of geomagnetic sensor
Due to the limitation of installation technology, there is a certain deviation between the installation position of the three-axis geomagnetic sensor and the ideal position, which can be represented in Figure 2.

Installation error model.
In Figure 2, the coordinate system O-XYZ is the ideal installation position of the sensor three axes, the coordinate system O-X1Y1Z1 is the actual installation position of the sensor three-axis, and μ and ν are the installation error angles. The angle between the X1 axis and the OXZ plane is μ; the angle between the projection of the X1-axis in the OXZ0 plane and the X-axis is ν; the angle between the Z1 axis in the OXZ plane and the Z-axis is ν; the Y1-axis is perpendicular to the OX1Z1 plane and the included angle with the Y-axis is μ. The position of the coordinate system O-X1Y1Z1 in the coordinate system O-XYZ is expressed as follows
In equation (9), X, Y, and Z are the ideal geomagnetic intensity measured by the geomagnetic sensor triaxial, and X1, Y1, and Z1 are the geomagnetic intensity measured by the geomagnetic sensor with installation error.
The three axes of the geomagnetic sensor are orthogonal in design. However, in practical application, the three sensitive axes of the sensor cannot be strictly orthogonal, which leads to non-orthogonal error. The non-orthogonal model is shown in Figure 3.

Non-orthogonal model of three-axis geomagnetic sensor.
In Figure 3, the coordinate system O-X1Y1Z1 is the ideal sensor triaxial distribution, the coordinate system O-X2Y2Z2 is the actual sensor triaxial distribution, and ζ, η and ε are the non-orthogonal error angles between the three axes of the geomagnetic sensor. The angle between X2 axis and OX1Z1 plane is η, the included angle between the projection of X2 axis in plane OX1Z1 plane and X1 axis is ε, and the included angle between Z2 axis and Z1 axis in OX1Z1 plane is ζ. The non-orthogonal error model shown in the above figure can be expressed as
In equation (10), X2, Y2, and Z2 are the geomagnetic intensity measured by the three axes of the geomagnetic sensor with installation error and non-orthogonal error.
The sensitivity of sensor sensitive axis is the inherent attribute of sensor, which is used to measure the relationship between output and input. No two sensors have the same sensitivity. Usually in the design of measurement circuit, the sensitive axis of the sensor is connected with an amplifier circuit in series. The purpose of the amplification circuit is to enlarge the output by several times, so as to observe the change of the output of the sensor. In mathematics, when analyzing the calculation error, it is impossible to distinguish the sensitivity error from the gain value error of the amplifier circuit. Therefore, the product of the sensitivity and the gain value of the amplifier circuit is analyzed as a variable, that is, the variable L in the previous section. The error model of the variable L is shown in the following formula
In equation (11), X3, Y3, and Z3 are the geomagnetic intensity measured by the three axes of the geomagnetic sensor with installation error, non-orthogonal error, and sensitivity error, and Lx, Ly, and Lz are the variable L errors corresponding to the three axes of the geomagnetic sensor.
The soft magnetic error is caused by the external magnetic field induced by the geomagnetic sensor itself, which affects the output value of the geomagnetic sensor. In the calibration experiment of geomagnetic sensor, the static calibration of fixed location is adopted, the magnitude and direction of external magnetic field do not change, and the response of soft magnetic material can be regarded as linear change without lag. Assuming that the matrix of soft magnetic coefficient is expressed by Cr, the output value of the three axes of geomagnetic sensor is expressed as follows:
In equation (12), X4, Y4, and Z4 are the geomagnetic intensities with installation error, non-orthogonal error, variable L error and soft magnetic error.
Different from the soft magnetic error, the hard magnetism error is constant, which is the excess magnetic field removed from the geomagnetic field in the environment. The hard magnetism error model can be expressed as
In equation (13), P1, P2, and P3 are the sum of the hard magnetism error and zero drift error of the three axes of the geomagnetic sensor, while X5, Y5, and Z5 are the geomagnetic intensity with installation error, non-orthogonal error, variable L error, soft magnetism error, and bias measured by the three axes of the geomagnetic sensor.
The error model of geomagnetic sensor can be obtained by introducing equations (10)–(13) into equation (9), as shown in the following formula
In equation (14), Cr, Cl, Cf, and Ca are soft magnetic error coefficient matrix, variable L error coefficient matrix, non-orthogonal error coefficient matrix, and installation error coefficient matrix, respectively. Since Cr, Cl, Cf, and Ca are 3 × 3 matrices, their product must also be 3 × 3 matrices, and equation (14) can be rewritten into the following formula
Therefore, the error model of three-axis geomagnetic sensor can be expressed by 12 parameters in the above formula.
Error compensation and modeling of geomagnetic sensor
For the convenience of description, equation (15) can be rewritten as follows
In equation (24), BY0 and BZ0 have nothing to do with roll angle γ, so make γ be zero. BY0 and BZ0 can be obtained from equation (5)
After rolling a projectile with a roll angle of 0, it will rotate the angle of φ around the X0 axis of the geomagnetic sensor. The following formula can be obtained from equation (16)
The mathematical expressions of BY6 and BZ6 can be obtained by substituting equation (17) into the above formula, as shown in the following formula
In the above formula
The relationship between the output and input of the geomagnetic sensor can be obtained by introducing equation (19) into equation (1). When the roll angle φ rotates from 0° to 360°, it can be seen from equation (19) that the Y-axis and Z-axis of the geomagnetic sensor will output a maximum value and a minimum value. The mathematical model is expressed as follows
After simple mathematical transformation, the following formula can be obtained
In equations (24) and (25), Ly, a21, P2, and Vy90 are constant values for the same sensor, and Vwymax and Vwymin are the maximum and minimum values of the output voltage of the geomagnetic sensor Y-axis. α and β in A and Bx0 can be regarded as independent variables, Vwymax + Vwymin and Vwymax —Vwymin can be seen as contributing variables. From equations (24) and (25), it can be seen that Vwymax + Vwymin and Vwymax −Vwymin are the first-order functions of Bx0 and B × A, respectively. By using the least square method to fit the equations (24) and (25), Ly × a21 and Ly × sin(arccos a21) can be obtained, which can solve the specific solution of Ly. It can be expressed as follows
After simple mathematical transformation, the following formula can be obtained
In equations (27) and (28), Lz, a31, P3, and Vz90 are constant values for the same sensor, and Vwzmax and Vwzmin are the maximum and minimum values of output voltage of geomagnetic sensor Y-axis. α and β in A and Bx0 can be regarded as independent variables, and Vwzmax + Vwzmin and Vwzmax –Vwzmin can be seen as genetic variables. From equations (24) and (25), it can be seen that Vwzmax + Vwzmin and Vwzmax –Vwzmin are the first-order functions of BX0 and a respectively. Lz× a31 and Lz× sin (arccos a31) can be obtained by linear fitting equations (24) and (25) by least square method. It can be expressed as follows
In equation (16), the turntable is rotated around the ideal Y-axis of the geomagnetic sensor. Referring to the calculation method of equation (19), the following formula can be obtained
Bring the equation (30) into equation (1), σ changes from 0° to 360°, and the x-axis of geomagnetic sensor will output a maximum value and a minimum value, which can be expressed as follows
Lx can be obtained from the calculation method of equations (26) and (29), as shown in the following formula
Since the magnitude of geomagnetic intensity at a fixed location does not change with the direction, the equations (26), (29), and (31) are introduced into equation (1)
The zero-drift value of the three-axis of the geomagnetic sensor can be obtained by ellipsoid fitting method.
According to equation (16), the error compensation model of geomagnetic sensor can be obtained as follows
In equation (35), P1, P2, P3, a21, a31, and a12 can be solved from equations (24), (25), (27), (28), (31), and (32). Through the attitude angle experiment, the remaining six quantities can be solved, and the whole error compensation model can be solved.
Experimental verification
In order to verify the effectiveness of the compensation algorithm, we designed and manufactured a three-axis magnetic free experimental table and an aluminum table which can adjust the height. The turntable is placed on the table, and the height of the table leg is adjusted until the table level. The three-axis geomagnetic sensor is installed on the turntable, as shown in Figure 4. We selected a place in Chengdu; measured the local longitude, latitude, and altitude by theodolite; and obtained the geomagnetic parameters of the experimental site as shown in Table 1 by using the international geomagnetic reference field.

Non-magnetic turntable with three-axis geomagnetic sensor.
Geomagnetic parameters.
After installation, determine the magnetic north direction and then follow the following steps for data acquisition.
The pitch angle is raised to 0° and 20° and the yaw angle is increased in 5° steps, so that the turntable roll axis rotates for 5 turns, and the average values of maximum and minimum output values of geomagnetic sensor Y-axis and Z-axis are recorded;
The pitching angle is kept at 0° and the roll angle is increased in steps of 5° to make the turntable rotate horizontally for five turns. The average values of the maximum and minimum output values of the X-axis and Z-axis of the geomagnetic sensor are recorded;
The output data of the sensor’s three axes are recorded when the pitch angle is 30°, the yaw angle is 45° and −45°, and the roll angle is increased in 5° steps;
When the pitch angle is 20° and the roll angle is 0° and the pitch angle is 30° and the roll angle is 130°, the yaw angle is increased in steps of 5° and the data of the sensor’s three axes are recorded;
The above four steps need to be carried out twice to exclude the possibility that one experiment will produce random errors.
The measurement data are summarized, and the variable L can be obtained by fitting the data from the first two steps through the least square method, and the ellipsoid as shown in Figure 5 can be obtained by using the data obtained in the last two steps into MATLAB for programming. It can be seen that the interference of the measurement environment is large. The three-axis output data distribution of the geomagnetic sensor cannot get a sphere with the center of the sphere at the origin of the coordinate. At this time, the spherical center coordinates of the ellipsoid are the zero drift values of the sensor’s three axes. The variable l obtained by fitting and the zero-drift value of the three axes of the sensor are brought into the data for calculation, and 12 parameters in the error compensation model can be obtained. After being brought into the MATLAB program for fitting, the compensated output model can be obtained, as shown in Figure 6. The output signal after compensation can be basically restored to a sphere

Three-axis actual output model of geomagnetic sensor.

Geomagnetic component model measured by three-axis geomagnetic sensor after correction.
After calculating and summarizing the measured data, the geomagnetic intensity error measured by the three axes of the geomagnetic sensor and the geomagnetic intensity error obtained after compensation are shown in Figure 7, in which the dotted line represents the change of geomagnetic intensity error before compensation, and the solid line represents the change of geomagnetic intensity error after compensation. It can be seen from the figure that the geomagnetic intensity error before compensation can reach 4000 nT, and the geomagnetic intensity error after compensation is reduced by 4 times compared with that before compensation.

Variation of geomagnetic intensity error before and after error compensation.
Figure 8 shows the change of roll angle error before and after geomagnetic sensor output compensation, in which the dotted line represents the roll angle error before and after correction, and the solid line represents the change of roll angle error after correction. It can be seen from Figure 8 that after compensation, the roll angle error is reduced from ±6° to within ±2°.

Variation of roll angle measurement error before and after compensation by geomagnetic sensor.
Conclusion
In this article, the least square method and ellipsoid fitting model are used to estimate the optimal parameters in the input–output relationship of geomagnetic sensor. The more accurate parameter values are obtained by the non-magnetic turntable experiment. Based on the analysis of the error sources in the process of geomagnetic sensor measurement, an error compensation model covering all error factors is established. All parameters in the error compensation model are removed by fitting the experimental data of attitude angle. The error compensation model is brought back to the attitude angle experiment. The experimental results show that the magnetic field strength error before compensation can reach 5000 nT, while the geomagnetic intensity error after compensation is reduced to 1000 nT, and the measurement accuracy of geomagnetic intensity is improved by 5 times; the measurement error of roll angle is reduced from ± 6° to ± 2° and the measurement accuracy is increased by 3 times, which basically meets the requirements of attitude angle measurement. Since the error compensation method discussed in this article has very low requirements for the calibration environment, it is not necessary to calibrate the three-axis geomagnetic sensor in the magnetic measurement laboratory when using this method, which effectively reduces the cost of the geomagnetic sensor in attitude measurement.
Footnotes
Handling Editor: Francesc Pozo
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
