Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 13, No. 3, 2024 310 Research on Sensor Non‐alignment Error Correction Zhiyu Lu*, Wu Kun, Simin Long College of Electronic and Information, Southwest Minzu University, Chengdu 610041, China *Corresponding author: Zhiyu Lu Abstract: Magnetic sensors play a crucial role in various applications, such as heading measurement, position tracking, and geomagnetic exploration. However, in practical applications, factors like improper installation, sensor misalignment, and manufacturing errors can introduce misalignment errors in the sensor’s measurement data. These errors lead to systematic deviations between the measured values and the actual magnetic field values, affecting the sensor’s measurement accuracy. To enhance the accuracy of magnetic sensors, error correction is necessary. The least squares method, a commonly used statistical technique, can effectively address this error correction. This paper employs the least squares method to correct the misalignment errors in magnetic sensors. Keywords: Three-axis fluxgate sensor, Least squares method, Error correction. 1. Introduction In recent years, with the advancement of military technology, submarines and anti-submarine warfare have become important technical means in naval battles, significantly influencing the progress of wars. Additionally, unexploded ordnance (UXO) still exists in areas affected by past conflicts, posing a constant threat to people’s lives[1]. In the civilian sector, effective technical solutions are urgently needed for applications like object recovery, resource exploration, and detection of buried objects like cables and pipelines[2]. Geomagnetic exploration offers significant advantages due to its resistance to environmental factors like climate and terrain, ease of measurement, and non-contact nature. With the widespread use of ferromagnetic materials, utilizing magnetic sensors to detect magnetic fields in the vicinity of magnetic targets has become an effective approach[3]. Three- axis fluxgate sensors, known for their compact size, lightweight, simple structure, high sensitivity, low power consumption, convenience of use, robustness, and high resolution, have emerged as important tools in the field of geomagnetic exploration[4]. Magnetic sensor arrays, composed of multiple magnetic sensors arranged in various configurations like cross, square, triangle, and right tetrahedron, are widely employed[5]. However, during the assembly of these arrays, non-alignment errors are inevitable, affecting the accuracy of magnetic measurements. Therefore, correcting and compensating for the non-alignment errors of fluxgate sensor arrays is crucial for improving magnetic measurement accuracy[6]. The least squares method is a mathematical technique commonly used for data fitting and parameter estimation. Its goal is to find a set of parameters that minimize the sum of squared residuals between the model calculated using these parameters and the observed data. When performing non- alignment error correction, estimating the error parameters is essential[7]. Hence, this paper employs the least squares method to correct the non-alignment errors of magnetic sensor arrays[8]. It is important to note that the non-alignment error correction discussed in this paper is based on the premise that the inherent errors of each sensor[9], such as non-orthogonality errors, have been corrected. Only when the three axes (X-axis, Y-axis, and Z-axis) of the sensors are orthogonal can further non-alignment error correction be performed[10]. 2. Error Analysis and Modeling 2.1. Error Parameter Analysis The non-alignment errors in magnetic sensor arrays arise from the misalignment of the three axes (X-axis, Y-axis, and Z-axis) between sensors during the assembly of the array structure. Ensuring alignment of the three axes of each sensor in the array is essential for maintaining the accuracy of the array’s detection capability. This section analyzes and mathematically models the non-alignment errors. As mentioned in the introduction, this paper assumes that the inherent errors of each sensor, such as non-orthogonality errors, have been corrected. Therefore, the starting point for modeling is that the three axes of each sensor are orthogonal. Taking two sensors, Sensor 1 and Sensor 2, that have undergone non-orthogonality error correction as examples: The position relationship between the three axes of sensor 1 and sensor 2 after orthogonal correction is shown in Figure 1. 311 X1 Y1 Z1 X2 Y2 Z2    O Figure 1. Positional Relationship Between the Three Axes of Sensor 1 and Sensor 2 After Orthogonal Correction where the axes and represent the three axes of Sensor 1 after non-orthogonal correction, and the axes and represent the three axes of Sensor 2 after non-orthogonal correction. The non-alignment correction involves rotating the axes of Sensor 2 around the axis by an angle and the axis by an angle , respectively, so that the axes align with the axes of Sensor 1. X1 Y1 Z1 X2 Y2 Z2    O   X21 Y21     Z21 Figure 2: Relationship of Rotation Angles for the Three Axes of Sensor 1 and Sensor 2 After Orthogonal Correction The rotation process is shown in Figure 2 First, rotate sensor 1 around the axis by an angle , then the axis rotates to the position of the axis, and the axis rotates to the position of the axis, where the axis is coplanar with the plane and the axis is coplanar with the plane, and the angle between the axis and the axis is , and the angle between the axis and the axis is . Then rotate sensor 1 around the axis (i.e., the axis) by an angle , then the axis rotates to the position of the axis (at this point, the axis rotates to the axis), and the axis rotates to the position of the axis, where the axis is coplanar with the plane and the axis coincides with the axis, and the angle between the axis and the axis is , and the angle between the axis and the axis is . Finally, rotate sensor 1 around the axis (i.e., the axis) by an angle , then the axis rotates to the position of the axis, and the axis rotates to the position of the axis, the axis coincides with the axis, and the axis coincides with the axis, and the angle between the axis and the axis is , and the angle between the axis and the axis is . So far, after rotating around the axis and the axis, they coincide with each other. The specific rotation matrix is shown in formula cos sin 0 cos 0 sin 1 0 0 = sin cos 0 0 1 0 0 cos sin 0 0 1 sin 0 cos 0 sin cos H                                         (1) Then, the relationship between the magnetic field components of sensor 1 and sensor 2 under orthogonal conditions is shown in formula (2). 1 2=t tB HB (2) That is: 1 2 1y 2y 1 2 cos cos sin cos cos sin sin sin sin cos sin cos sin cos cos cos sin sin sin cos sin sin sin cos sin cos sin cos cos x x z z B B B B B B                                                          正 正 正 正 正 正 (3) 312 The three-component magnetic field size of sensor 1 and sensor 2 after orthogonal correction can be obtained through the non-orthogonal correction model. For convenient expression, let 11 12 13 21 22 23 31 32 33 = h h h H h h h h h h          (3) Next, we will perform non-orthogonal correction on the three axes of sensor 2. From formula (3), we can obtain the model: zTyTxTzT zTyTxTyT zTyTxTxT BhBhBhB BhBhBhB BhBhBhB 2332322311 2232222211 2132122111    (4) According to formula (4), we can build a non-orthogonal correction model based on the least squares method in MATLAB, obtain the parameters, and then know the relationship between and the angle. We can obtain the specific value of according to the calculation. However, through the modeling, it can be seen that the value obtained can complete the error correction. If we put the non-orthogonal error angle obtained into the correction after solving it, the effect is not ideal, because the calculation involved in the process of solving will have numerical rounding and truncation, which will bring some calculation errors. In the actual processing of data, this method is not advisable, and the purpose of this paper is to achieve the best correction effect, so we only solve to complete the error correction. 2.2. Establishment of Error Parameter Estimation Model In the previous section, we built the error model. Now, we need to establish an error estimation model according to formula (4) and the least squares method. The specific model construction is as follows: 2 2 2 13221312221311221312 2 2 2 12 221112221311221211 2 2 2 11 213212211213212211 2 213212211 2 1 2132122111 )()( )( zyzxzyzy yxhzxyxx zyxzyx zyxx zyxx BhBBhhBBhhBBhhBh BBhhBBhhBBhhBh BhBhBhBhBhBh BhBhBhB BhBhBhB      (5)                 yz zx yx z y x BBb BBb BBb Bb Bb Bb 226 225 224 2 23 2 22 2 21                 13126 13115 12114 2 133 2 122 2 111 2 2 2 hha hha hha ha ha ha (6) Then, we can link the least squares solution by formula (5) and formula (6), specifically as follows:   6,)()()( 020 )( 1 6 1 2 1 1 6 1 6 1 6 11 6 1 2 1 2 1 6 1 2 1 1 2 6 1 2 1                                               nBibibiba bBba a Q BbairQ irBba n i j xj n i k j jkk j j n i k xkk j n i k xkk n i k xkk (7) Thus, we get 1111 yGaGG T   (8) Thus, we can solve and then deduce the value of according to formula (6). Similarly, the subsequent solution for and is constructed according to the above method. 3. Simulation Verification We use MATLAB for simulation verification. Taking a set of magnetic sensor data that has completed its own error correction as the ideal value, we add misalignment errors to the ideal three-component magnetic field data. The error parameters are set to the 9 parameters in the rotation matrix, i.e., . Because in the process of error estimation using the algorithm, there will be numerical rounding and truncation in each iteration calculation, which will also bring some errors. According to the completed correction model, in fact, it is only necessary to calculate the 9 parameters in the rotation matrix to complete the correction data inversion. This can not only reduce the calculation iteration error but also complete the correction. Therefore, this paper directly sets the error parameters to . The specific parameter settings are shown in Table 1. The ideal three-component magnetic field data is brought into formula (8) to estimate the rotation error parameters, and the estimation results are shown in Table 1. (See the appendix for the specific implementation code) Table 1. Simulation Verification Results Misalignment Error h h h h h h h h h True 0.8 0.75 0.55 1.05 0.95 0.65 0.3 1.35 0.45 Pre-value 0.8 0.75 0.549 1.049 0.949 0.65 0.3 1.349 0.45 4. Results Analysis By comparing the estimated error parameters with the set values in Table 1, it can be observed that the estimated values are in close agreement with the set values. The estimation accuracy of the error coefficients reaches the order of 10^-4, 313 demonstrating the effectiveness of the least squares method in parameter estimation. The estimated error parameters are then used to correct the simulated magnetic field data. It should be noted that the total magnitude of the magnetic field remains unchanged after the correction, as the magnitude correction is completed during the individual sensor calibration process. The correction performance is evaluated by examining the differences between the corrected and uncorrected magnetic field components. 5. Conclusion The results show that the differences between the corrected and uncorrected x and y components are on the order of 10^- 5, indicating good correction performance in these components. However, the difference in the z component is on the order of 10^-4, suggesting that the correction performance in the z component is relatively poorer compared to the x and y components. This implies that further improvements are needed for achieving better correction performance in the z component. (a) (b) (c) Figure 3. Differences in Magnetic Field Components Before and After Non-alignment Error Correction of the Magnetometer Acknowledgment The authors gratefully acknowledge the financial support from the Innovative Research Project for Graduate Students of Southwest Minzu University Grant (YB2023628). References [1] Deng, Y. C. (2015). On the application of high-precision magnetic method in polymetallic ore prospecting. Building Materials and Decoration, (48), 209-210. [2] Guo, H. (2020). Application of high-precision magnetic survey in iron ore exploration in the Ta Tou area of Pingdu. North China Natural Resources, (01), 11-15. [3] Zheng, Q. X. (2019). Research on the application of magnetic exploration in iron ore exploration. China Metal Bulletin, (11), 212-214. [4] [Shen, N. H. (1989). Progress in magnetic exploration technology. Geophysical Prospecting and Geochemistry, (05), 347-355. [5] Zhang, X. L., Tao, G., & Liu, X. R. (2006). Progress in oil and gas geophysical exploration technology. Progress in Geophysics, (01), 143-151. [6] Wang, D. (2019). Current status and development trend of geophysical technology in the oil and gas exploration field. China Petroleum and Petrochemical Standards and Quality, 39(06), 189-190. 314 [7] Zeng, Z. F., Chen, X., Li, J., Li, T. L., & Zhang, L. H. (2012). New progress in geothermal geophysical exploration. Progress in Geophysics, 27(01), 168-178. [8] Zhao, M., Sheng, Y., & Qi, L. G. (2019). Application of high- precision gravity and magnetic measurement in ore prospecting in covered areas: A case study of the Weishan iron-copper deposit pre-survey in Wuwei County. Geophysical Prospecting and Geochemistry, 43(6), 1211-1216. [9] Yang, Y. (2015). Research on magnetic target detection technology based on orthogonal basis decomposition. Dissertation, China Shipbuilding Research Institute. [10] Luo, J. G., Li, H. B., Liu, J. X., Li, H. H., & Zhang, F. (2019). Error correction method for three-axis fluxgate magnetometers. Navigation and Control, 18(03), 52-58.