Experimental Magnetometer Calibration for Nanosatellites’ Navigation System

AbstrAct: This article deals with the problem of Earth’s magnetic field sensors calibration in the context of low-cost nanosatellites’ navigation systems. The attitude of space vehicles can be determined from the state estimation using information from three-axis inertial and non-inertial sensors. This study considers a three-axis solid-state magnetometer. In the vehicle itself, the presence of ferrous materials and electronic devices creates disturbances, distorting the measured field. The sensor precision can be enhanced through calibration methods which calculate the systematic error. The objective here is to study and implement calibration combining a geometric method and the TWOSTEP algorithm. The methodology is based on numerical simulations, with the development of a database of the Earth’s magnetic field along the vehicle orbit, and experimental tests using a nanosatellite mockup, containing an embedded processor Arduino MEGA 2560 platform and the magnetometer HMC5843.


INTRODUCTION
A crucial requisite for an artificial satellite is the control of its spatial orientation, generally called attitude.The attitude must be stabilized and controlled for various reasons, concerning the spacecraft operational functions, like the correct antenna pointing for the communication, the appropriate orientation related to the Sun for the thermal control, and many others.The tasks associated to the satellite mission also demand the accuracy in the orientation of sensors and other devices for a suitable performance.Several phenomena can cause inaccuracies on the space vehicle orbit and attitude.In order to have the spacecraft controlled, the attitude must be known through the various stages of its life cycle.From the launch to final service orbit, the space vehicle attitude should be determined (Pisacane 2005).
Attitude determination implies the measurement of any quantity sensitive to the attitude.One of the most used phenomena in the determination procedures is the Earth's magnetic field.The local geomagnetic field vector is frequently one of the attitude information sources.A magnetometer measures the strength of a magnetic field in one, two or three directions.If B k is the value of a magnetic field in the spacecraft body coordinate system, as determined from the magnetometer in the time t k , and T k is the known value of the magnetic field in the inertial coordinates, then a simple model is (Pisacane 2005): where: A k is the rotation matrix describing the attitude.Thus the measurement of the magnetic field provides a measurement of the attitude relative to inertial coordinates.The vector is generally given by a geomagnetic reference field (1) model, which requires knowledge of the spacecraft position.The magnetometer does not measure the magnetic field in the body frame but in a frame fixed in the magnetometer.The measured magnetic field in the body frame is obtained from the measured field in the sensor frame according to: (Caruso 2000) and TWOSTEP (Alonso and Shuster 2002), respectively for ground and in-flight procedures.

THE MAGNETOMETER CALIBRATION ALGORITHMS
The magnetometer determines the direction and the magnitude of the magnetic field with several operational advantages such as low weight, small power consumption, and no moving parts; therefore, it does not interfere with vehicle dynamics.The main problem of this instrument is the low accuracy of its measurements as a function of considerable errors from Earth's magnetic field model.
Besides, the accuracy of the magnetometer can be disrupted by a series of magnetic disturbances generated in the spacecraft.The TWOSTEP algorithm was developed to determine the bias, i.e. the measurement systematic error.Besides, the accuracy of the magnetometer can be disrupted by a series of magnetic disturbances generated in the spacecraft.The TWOSTEP algorithm was developed to determine the bias, i.e. the measurement systematic error.Some algorithms have been proposed to avoid this type of calculation.

GeometricAl cAlibrAtion ApproAch
The first approach for the magnetometer calibration is an extension of the method proposed in Caruso (2000) and is developed as an application note for the LSM303DLH sensor module (ST Microelectronics 2012).Considering a tridimensional space, the relation between the geomagnetic field (H x , H y , H z ) and the measurements vector (B x , B y , B z ) can be expressed as: where: S mag k is the magnetometer alignment matrix, a proper orthogonal matrix that transforms representations from the magnetometer frame to the body frame.
Moreover, measurement of the magnetic field alone is not sufficient to determine the attitude.Therefore the magnetic field measurement, although a vector, has only two degrees of freedom that are sensitive to the attitude (namely, the direction).Since we need three parameters to specify the attitude, one vector measurement is not enough.Other sensors, e.g. the Sun sensor, are used to complete the necessary information to determine the attitude.
In the literature, there are a number of studies around the subject of magnetometer calibration.For instance, Juang et al. (2012) deals with the problem of magnetometer data based on orbit determination and the sensor calibration.The proposed solution applies an unscented Kalman filter for estimation of satellite position and velocity.The results show the adequacy of the extension strategy of orbit determination algorithm to the problem of magnetometer calibration.In Inamori and Nakasuka (2012), in the context of a scientific nanosatellite mission, the magnetometer calibration algorithm is also based on the unscented Kalman filter.
Three different algorithms are tested in terms of performance and computational costs in Crassidis et al. (2005): the TWOSTEP (Alonso and Shuster 2002), the extended Kalman filter, and the unscented Kalman filter.The study presented in Vasconcelos et al. (2011) formulates a maximum likelihood estimator to an optimal parameter calibration without using external attitude references.The proposed calibration procedure corresponds to an estimation of rotation, scaling and translation transformation and represents an interesting tridimensional refinement of the geometric method proposed in Caruso (2000).
The purpose of our study is to implement and evaluate two procedures in a quite simple and low-cost experimental setup.One dedicated to ground calibration and the other, to in-flight calibration.The adopted strategies, based on the precedent studies discussed above, are the geometric method where: M m is the misalignment matrix (between magnetic field and sensor frame axes); x sf , y sf and z sf are the scale factors; b x , b y and b z are the systematic errors due to strong magnetic disturbances (bias); and M si is a matrix that represents the weak magnetic distortion.
The calibration procedure can be done by data acquisition during rotations around the three axes (X, Y, Z) or randomly combined rotations (ST Microelectronics 2012).In the case of presence of strong or weak magnetic distortions, the measurement (2) (3) Experimental Magnetometer Calibration for Nanosatellites' Navigation System will reproduce these disturbs by a bent and displaced ellipsoid.This calibration procedure is able to compensate these disturbs that are solidary with the satellite body and to allow the magnetometer to measure the external field.An example of graphical representation of measurements taken during tridimensional and planar rotations is shown in Fig. 1.In this case, the sensor measurement is clearly affected by internal disturbances.The ellipsoid can be described by: the parameters x sf , y sf , z sf , b x , b y and b z .After these adjustments, the graphic representation of calibrated magnetometer data becomes a unitary sphere (Fig. 2).
where x 0 , y 0 and z 0 are offsets of b x , b y and b z caused by the strong magnetic distortion; x, y and z are the measurements (B x , B y , B z ); a 1 , a 2 and a 3 are the lengths of ellipsoid semi axes; a 4 , a 5 and a 6 represent the effects of cruised axes measurements, responsible for the ellipsoid inclination; and R is a geomagnetic field constant.When the weak magnetic distortion is negligible, the ellipsoid is not bent and M si is an identity matrix.Consequently, Eq. 4 can be simplified as follows: And the least square method provides the adjustment of the magnetometer data to the equation of an ellipsoid by determining Equation 5 can be rewritten as: Consequently, the non-calibrated magnetometer data (B x , B y , B z ) can be combined into a matrix N × 6 dimentional, T, where N is the number of measurements (N ≠ 0 and N ∈ N).Then, Eq. 6 becomes: The parameter vector U can be determined using least squares method (ST Microelectronics 2012): where: U(i), i= 1, ..., 6, are the components of U. Taking the differences, process.Through this mathematical operation, the highest order term of the cost function can be eliminated, finding a simplified mathematical model (Alonso and Shuster 2002).A more complete mathematical model of the magnetic field vector measurement is given by (Kim and Bang 2007): Equation 5 becomes: Finally, the scale factors for calibration can be computed: the twostep AlGorithm A method to estimate the magnetometer systematic error without the knowledge of the ship attitude is the verification scale, which minimizes the differences of the squares of the magnitudes from measured and modeled magnetic fields.The scalar verification is based on the principle that parameters, such as the magnitude of a vector, do not depend on the coordinate system.However, the disadvantage of this approach is that the resulting cost function to be minimized is an equation of the fourth degree with respect to the bias vector.
Some algorithms have been proposed to avoid this type of calculation.The TWOSTEP algorithm is an improvement of these methods, by discarding less data during the centering where: b is the magnetometer measurement systematic error (bias); ε k is the measurement noise considered, for simplicity, white and Gaussian, whose covariance matrix is Σ k .

Minimization of Measurement Systematic Error
For the scalar verification, the equations are defined as follows (Kim and Bang 2007): where: z k is defined as actual measurement and v k is defined as the effective noise measurement.
The negative log-likelihood function of magnetometer bias vector is given by Alonso and Shuster (2003): where: μ vk is the mean and σ vk 2 is the variance of the effective measurement noise, considered as Gaussian for simplicity; z k ʹ is the real value of z k .
where: tr(Σ k ) is the trace of matrices function.

The Centering Operation
By means of a mathematical operation called centering, the term of highest order can be removed.Therefore, the following weighted averages are defined (Alonso and Shuster 2002): The Procedure of the TWOSTEP Algorithm The TWOSTEP algorithm, as the name implies, consists of two steps.In the first step, the centered magnetometer systematic error estimate is calculated, as well as its covariance matrix.The need of an additional correction step due to the discarded central term is measured by a direct comparison of the centered and central Fisher information matrices.In the step two, the obtained centered bias vector value is used as an initial estimate.The TWOSTEP algorithm can be described by Alonso and Shuster (2003): Step one 1.Calculate the centered estimate of the magnetometer systematic error, b*, and the covariance matrix, P bb , using data from the centered quantities and the equations: where: F bb and F bb are the Fisher information matrices.If the diagonal elements of F bb are sufficiently smaller than the diagonal elements of F bb ([F bb ]mm < C [F bb ]mm, m = 1,2,3), the calculation of the magnetic field systematic error vector can be terminated at that point, and b* can be accepted as the best estimated value.The covariance matrix of the estimated error will be the inverse of F bb .
Step two 1.If the inequality from the previous step is not true, use the centered value b* as an initial estimate.The correction due to the central term is computed using the Gauss-Newton method: The Fisher information matrix (F bb ) is given by the equation: where the gradient vector g(b) is given by: 2. The previous step is repeated until η ii is less than a predetermined value, where: In this study, the adopted stopping criterion is η i ≤ 10 -5 .

THE EXPERIMENTAL SETUP
The experimental implementation and tests were based on a CubeSat mockup equipped with a processor device Arduino MEGA 2560 (Arduino 2005) and a solid state magnetometer HMC5843 (Honeywell 2009).This mockup was built to perform experimental simulations of attitude movements and embedded calibration procedures.The Arduino platform is a development device based on a single microcontroller conceived to make accessible the use of electronic embedded system.The platform consists of an open hardware equipped with an AVR Atmel ATmega2560 processor, memories, clock and with a number of convenient digital and analog I/O gates.The software comprises a standard programming language compiler (Wiring, a simplified C++), a bootloader executed by the processor itself, and an IDE environment.

the sAtellite mocKup
The experimental tests used a CubeSat mockup built to provide three-axis movements (X, Y and Z axis of the body coordinates frame).The CubeSat body is composed of transparent acrylic polyethylene plates, a system of bearings, and supports for the Arduino platform and for the magnetometer HMC5843. Figure 3 shows the CubeSat mockup.sAtellite mAneuvers for mAGnetic dAtA Acquisition The tests of magnetometer calibration use single mockup rotations around the three axes of the body coordinates frame (X, Y, Z), as can be seen in Fig. 4. The rotations are manually performed, without strict control of rapidity or duration of the motion, because these parameters are not important in the calibration tests.The calibration can also be done using aleatory motion combining rotations around all axes (Fig. 4).

tests of the Geometric cAlibrAtion ApproAch
The geometric method is applied for experimental tridimensional calibration of the magnetometer HMC5843.The experimental procedure consists of rotation of the satellite mockup around the three axes of magnetometer frame.The first rotation is around the Z axis, the second one, around Y axis, and the last rotation, around X axis.The resulting magnetic field measurements are shown in Fig. 5.
The results of parameters calculation for the calibration are shown in Table 1.   Figure 6 shows the graphics of H x , H y and H z measurements, obtained by the magnetometer HMC5843, calibrated by the geometric method applied to three-dimensions problem.
In the first step of TWOSTEP algorithm, the results are:

tests of the twostep AlGorithm
The first tests using TWOSTEP calibration algorithm comprehended numerical simulations using a CubeSat flying in typical orbit, with stabilized attitude keeping the X axis pointed to the Sun, and considering a simulated noise disturbing the magnetometer HMC5843 of magnitude σ 0 = 2.8 mG per axis.The resulting simulated geomagnetic field is shown in Fig. 7.The centralized Fisher information matrix is then obtained: And the Fisher information matrix for the central value correction is given by: The resulting factor is c = 2.604.In this case, where the satellite is stabilized, the error vector components are less observable.Consequently, the estimation of the systematic error obtained in the second step of the algorithm (see details of the iterations in Table 2) is: A second case for numerical simulation of the calibration

B x B y B z
In the first step of TWOSTEP algorithm, the results are: One can remark that σ v0 2 is bigger than the precedent case.
The vector b tends to be more distant from the magnitude of the geomagnetic field vector.The centralized Fisher information matrix is then obtained: And the Fisher information matrix for the central value correction is given by: In this case, the resulting factor is c = 18.527.Again, with the satellite body stabilized, the error vector components are weakly observable.The estimation of the systematic error obtained in the second step of the algorithm (see details of the iterations in Table 3) is: The experimental magnetometer calibration was performed using the algorithm TWOSTEP embedded in the satellite mockup.The main supposition for the tests is that the geomagnetic field is constant for a fixed point and for a short time period.This is not the case for a satellite orbiting the Earth at a high displacement speed.Meanwhile, the main purpose of these tests is to verify the performance of the calibration algorithm to filter noises in the magnetic field measurement.The results shown in Fig. 9 are related to data acquisition during aleatory maneuvers as illustrated in Fig. 4.
Considering the calculations of the first step of TWOSTEP algorithm, the results are: The Fisher information matrix is then obtained: For the centralized value correction, the Fisher matrix is calculated: In this case, the proportion factor is c = 0.696.It means that the second step of the calibration algorithm must continue.The estimation of systematic error with the centralized correction calculated after four iterations (the details of the iterations results are shown in Table 4) of the second step is: use of noisy data measured by magnetometer HMC5843 made the central values obtained in step two stay slightly outside the expected range.This leads to the need for investing in better magnetometers in order to improve the accuracy of the results.
As shown by simulations, the TWOSTEP algorithm works well in all phases of spaceship operation, especially in the case of artificial satellites, from the orbit injection phase, with the spacecraft spinning, to the moment when the ship has its attitude completely stabilized (with the Z axis, simulating the load direction, pointing to the Earth).The systematic error vector (bias) components are more observable when the Earth's magnetic field vector is changing regularly.Therefore, the best time to measure the systematic error is immediately after the orbit injection when the satellite is still spinning.In the tests, the worst time is when the satellite is fully stabilized, with its Z axis pointing to the Earth, when the components vary slightly.
The simulations also show that, for a spaceship in a geostationary orbit, with the attitude stabilized, the TWOSTEP algorithm will not converge.The estimate of the systematic error of the measured value tends to the magnetic field vector in this particular case.

CONCLUSION
This project presented a review and an experimental implementation of methods for magnetic field sensor calibration in the context of an embedded device for applications in vehicle navigation systems like artificial satellites.The Arduino MEGA 2560 was perfectly capable of performing the most complex mathematical calculations required by the geometric method.This method requires absolute attitude control during calibration.It also applies most commonly to small devices and vehicles.It is not ruled out, however, the need to recalibrate the magnetometer during the mission, using other methods.The test results showed that TWOSTEP algorithm is fast and robust in the calculation of the bias magnetic field vector.This method, despite the simplicity of the equations, requires accumulation of data to calculate some parameters preliminarily.Therefore, the primary bias was estimated from the first batch of magnetometer measurements.
Comparing these two implemented methods of calibration, it can be seen that all are fast and reach the desired results, with comparable estimates.However, the navigation system, (46) (47) In general, it appears that the use of a noisy magnetometer makes the results show less precisely in relation to those obtained by Alonso and Shuster (2002).In the case where the satellite is stabilized, with Z axis pointing to the Earth, it can be noted that the measurements of the Y axis of the magnetic field vector are hardly observable, even after the application of step two.This can be seen in Fig. 8, where there is little variation in the measured values.
In cases where the satellite is spinning at 15.1 rpm (X axis pointing to the Sun) or it is inertially stabilized (X axis pointing to the Sun) or it is stabilized (Z axis pointing to the Earth), the
the centered estimate, b*, calculate F bb and F bb through the above equations and the following equation: The following centered quantities are defined: That implies in (Alonso and Shuster 2002):

Figure 3 .
Figure 3.The CubeSat mockup for experimental tests of magnetometer calibration.

Figure 4 .
Figure 4. Two maneuvers of the CubeSat mockup for magnetometer data acquisition: rotation around one axis and aleatory motion.

Figure 5 .
Figure 5.The measurements of B x , B y and B z during the rotation maneuvers by using the sensor HMC5843.

6 .
The graphics of H x , H y and H z measurements of the sensor HMC5843 after calibration using 3-D geometric method.
same noise disturbing the magnetometer HMC5843, i.e. the magnitude per axis.But now the satellite keeps the Z axis pointed to the center of the Earth.The resulting simulated geomagnetic field is shown in Fig.8.

Figure 8 .
Figure 8. Simulated measurements of the geomagnetic field for the magnetometer calibration procedure, with Z axis of satellite pointed to the center of the Earth.

Table 1 .
Experimental Magnetometer Calibration for Nanosatellites' Navigation System Results of calibration process by geometric method.
Simulated measurements of the geomagnetic field for the magnetometer calibration procedure, with X axis of satellite pointed to the Sun.

Table 2 .
Results of iterations of the second step of the algorithm (σ 0 = 2.8 mG , satellite stabilized, axis X pointing to the Sun).

Table 3 .
Results of the second step of the algorithm (σ 0 = 2.8 mG, satellite stabilized, axis Y pointing to the center of the Earth).

Table 4 .
Results of the second step of the algorithm.Earth magnetic field measurements by the magnetometer embedded in the CubeSat mockup.