Geomagnetic dynamic iron drift compensation method and device, storage medium and terminal equipment

By integrating an excitation coil into the geomagnetic sensor package to generate known magnetic field pulses and calculating soft and hard iron interference in real time, the geomagnetic sensor drift problem is solved, achieving high-precision, adaptive iron drift compensation and improving the accuracy and reliability of navigation and AR virtual-real fusion.

CN121804440AActive Publication Date: 2026-04-07XIAN YIPU COMM TECH
View PDF 16 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-09
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Geomagnetic sensors are susceptible to soft and hard iron drift caused by interference from the magnetic components inside smart terminal devices, which affects the accuracy and reliability of navigation positioning and AR virtual-real fusion. Existing compensation schemes require active user operation or are not adaptable enough.

Method used

By integrating an excitation coil within the geomagnetic sensor package, multi-directional known magnetic field pulses are generated. Combined with the geomagnetic sensor output, the soft iron interference matrix and hard iron offset vector are calculated in real time to achieve automated compensation.

Benefits of technology

It achieves high-precision, adaptive geomagnetic drift compensation without user intervention, improving user experience and correction robustness in complex environments, and ensuring long-term high accuracy and stability of geomagnetic data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121804440A_ABST
    Figure CN121804440A_ABST
Patent Text Reader

Abstract

The invention provides a geomagnetic dynamic iron drift compensation method and device, a storage medium and terminal equipment, and is applied to the technical field of electronic compass calibration. The method comprises the following steps: in response to a ground magnet drift compensation trigger condition, controlling an excitation coil integrated in a geomagnetic sensor package to sequentially generate excitation magnetic fields in at least three linearly independent positive and negative direction pairs according to a preset sequence; obtaining original magnetic field measurement data of the geomagnetic sensor in each direction of at least three linearly independent positive and negative direction pairs; based on the original magnetic field measurement data in each direction and the corresponding excitation magnetic field, a soft iron interference matrix is determined, and the soft iron interference matrix represents magnetic field distortion; determining a hard iron offset vector based on the soft iron interference matrix and the original magnetic field measurement data in any one of the directions; and compensating the real-time output of the geomagnetic sensor according to the soft iron interference matrix and the hard iron offset vector. The method is used for achieving the effect of high-precision, self-adaptive, real-time and dynamic compensation of earth magnet drift.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic compass calibration technology, and in particular to a method, device, storage medium and terminal equipment for geomagnetic dynamic iron drift compensation. Background Technology

[0002] In smart terminals such as smartphones, wearable devices, and augmented reality (AR) glasses, geomagnetic sensors are a core component for realizing electronic compass functions. Their measurement accuracy directly affects the accuracy of navigation and positioning, the reliability of attitude detection, and the spatial consistency of AR virtual-real fusion. However, due to interference from magnetic or ferromagnetic components such as speaker magnets, metal structural parts, and near field communication (NFC) coils inside smart terminal devices, geomagnetic sensors are susceptible to drift in soft and hard ferromagnetic magnetic fields, leading to geomagnetic data distortion. This, in turn, causes increased heading angle deviation, severely affecting navigation path planning, the accuracy of virtual-real alignment in AR scenes, and the reliability of health data.

[0003] In related technologies, the following two compensation schemes are mainly used to address the soft and hard iron drift problem of geomagnetic sensors: The first is to eliminate soft and hard iron drift by having the user manually perform an "8" calibration action and fitting an ellipsoidal model through multi-directional magnetic field sampling. However, this scheme requires active user cooperation and the standardization of operation is difficult to guarantee, resulting in a poor user experience. The second is to correct the geomagnetic data based on the preset temperature-magnetic field drift curve and temperature changes. However, this scheme is difficult to cope with complex and changing electromagnetic environments and dynamic stress interference, and its adaptability is insufficient, resulting in low compensation accuracy.

[0004] Therefore, there is an urgent need for a high-precision, adaptive, real-time dynamic geomagnetic drift compensation scheme. Summary of the Invention

[0005] This application provides a method, device, storage medium, and terminal equipment for geomagnetic dynamic iron drift compensation, which can achieve high-precision, adaptive, and real-time dynamic compensation for geomagnetic drift.

[0006] In a first aspect, this application provides a method for compensating for geomagnetic dynamic iron drift, comprising:

[0007] In response to the geomagnetic drift compensation triggering condition, the excitation coil integrated in the geomagnetic sensor package is controlled to generate an excitation magnetic field in at least three linearly independent pairs of positive and negative directions in a preset sequence.

[0008] Acquire raw magnetic field measurement data of the geomagnetic sensor in each of at least three linearly independent positive and negative direction pairs;

[0009] Based on the original magnetic field measurement data and the corresponding excitation magnetic field in each direction, the soft iron interference matrix is ​​determined, which characterizes the magnetic field distortion.

[0010] Based on the soft iron interference matrix and the original magnetic field measurement data in any direction, the hard iron offset vector is determined.

[0011] The real-time output of the geomagnetic sensor is compensated based on the soft iron interference matrix and the hard iron offset vector.

[0012] In one possible implementation, the soft iron interference matrix is ​​determined based on the original magnetic field measurement data in each direction and the corresponding excitation magnetic field, including:

[0013] For each of at least three linearly independent pairs of positive and negative directions, determine the difference between the original magnetic field measurement data corresponding to the positive direction and the original magnetic field measurement data corresponding to the negative direction, so as to eliminate the influence of the environmental geomagnetic field and constant hard iron offset.

[0014] The soft iron interference matrix is ​​determined based on the difference in magnetic field data for each positive and negative direction and the excitation magnetic field.

[0015] In one possible implementation, the soft iron interference matrix satisfies the following formula:

[0016]

[0017] in, For soft iron interference matrix; For the first A pair of axial unit vectors in opposite directions; For the first The difference in magnetic field data corresponding to each positive and negative direction; This is a constant value for the excitation coil; This represents the amplitude of the excitation current.

[0018] In one possible implementation, the geomagnetic drift compensation triggering condition includes at least one of the following:

[0019] When a terminal device integrating a geomagnetic sensor is first powered on and initialized;

[0020] The preset periodic magnet drift self-compensation time point is reached;

[0021] The monitored change in ambient temperature exceeds the first threshold.

[0022] An impact or acceleration event exceeding the second threshold was detected in the geomagnetic sensor;

[0023] An impact or acceleration event exceeding a third threshold was detected in the terminal device with the integrated geomagnetic sensor.

[0024] In one possible implementation, the excitation magnetic field is generated in three orthogonal axial pairs, which correspond to the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis, respectively.

[0025] In one possible implementation, the real-time output of the geomagnetic sensor is compensated based on the soft iron interference matrix and the hard iron offset vector using the following calculation formula:

[0026]

[0027] in, The geomagnetic data after compensation; For soft iron interference matrix; This is the hard iron offset vector; This is the real-time output of the geomagnetic sensor.

[0028] In one possible implementation, the raw magnetic field measurement data is obtained in the following manner:

[0029] For each of at least three linearly independent pairs of positive and negative directions, after generating an excitation magnetic field by applying an excitation current pulse, a preset time is delayed, and at the end of the preset time, the sampling window of the geomagnetic sensor is opened to collect stable raw magnetic field measurement data. The preset time is longer than the duration of the transient spike in the magnetic field caused by the excitation current pulse.

[0030] Secondly, this application provides a geomagnetic dynamic iron drift compensation device, comprising: a control unit, a geomagnetic sensor, and an excitation coil integrated within a geomagnetic sensor package, wherein:

[0031] An excitation coil is arranged around the sensing area of ​​the geomagnetic sensor to generate an excitation magnetic field in at least three linearly independent pairs of positive and negative directions under the control of the control unit.

[0032] A geomagnetic sensor, mounted on a packaged substrate, is used to collect raw magnetic field measurement data in each direction in at least three linearly independent pairs of positive and negative directions in response to sampling commands from a control unit.

[0033] The control unit is electrically connected to the geomagnetic sensor and the excitation coil, respectively, and is used to perform the geomagnetic dynamic iron drift compensation method as described in the first aspect.

[0034] In one possible implementation, the geomagnetic sensor and the excitation coil are fixed by a stress relief structure of the encapsulation cover. The stress relief structure is used to release the mechanical stress generated during the encapsulation process in order to maintain the relative positional accuracy of the geomagnetic sensor and the excitation coil.

[0035] In one possible implementation, the stress relief structure includes a plurality of microgrooves distributed along the surface of the package cover, the shape and depth of which are formed by a laser etching process.

[0036] Thirdly, this application provides a control unit, including: a memory and a processor;

[0037] The memory stores the instructions that the computer executes;

[0038] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0039] Fourthly, this application provides a terminal device, including the geomagnetic dynamic iron drift compensation device of the second aspect, or the terminal device includes the control unit of the third aspect.

[0040] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible embodiments of the first aspect.

[0041] In a sixth aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0042] The geomagnetic dynamic iron drift compensation method, apparatus, storage medium, and terminal device provided in this application include: responding to geomagnetic drift compensation triggering conditions, controlling an excitation coil integrated within a geomagnetic sensor package to sequentially generate excitation magnetic fields in at least three linearly independent pairs of positive and negative directions according to a preset sequence; acquiring original magnetic field measurement data of the geomagnetic sensor in each of the at least three linearly independent pairs of positive and negative directions; determining a soft iron interference matrix based on the original magnetic field measurement data in each direction and the corresponding excitation magnetic field, the soft iron interference matrix representing magnetic field distortion; determining a hard iron offset vector based on the soft iron interference matrix and the original magnetic field measurement data in any direction; and compensating the real-time output of the geomagnetic sensor according to the soft iron interference matrix and the hard iron offset vector. This application constructs an intelligent geomagnetic correction system integrating automatic sensing, autonomous decision-making, and real-time compensation. By introducing an intelligent triggering mechanism, it autonomously controls the excitation coil to generate multi-directional known magnetic field pulses, eliminating the traditional calibration mode that relies on user operation, achieving a seamless experience, and greatly improving the user experience. By further utilizing known excitation magnetic fields and raw magnetic field measurement data output by geomagnetic sensors, a highly efficient algorithm is used to quickly calculate soft and hard iron compensation parameters and complete iron drift compensation, significantly improving the correction robustness and geomagnetic pointing accuracy under complex dynamic electromagnetic environments. This closed-loop self-compensation mechanism can continuously and adaptively compensate for soft and hard iron drift throughout the entire lifecycle of the terminal device, ensuring that geomagnetic data maintains high accuracy and stability over a long period, meeting the high-quality requirements of spatial perception data for scenarios such as AR virtual-real fusion, highly reliable navigation, and precise health monitoring. Attached Figure Description

[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0044] Figure 1 A flowchart illustrating the geomagnetic dynamic iron drift compensation method provided in this application embodiment. Figure 1 ;

[0045] Figure 2 A flowchart illustrating the geomagnetic dynamic iron drift compensation method provided in this application embodiment. Figure 2 ;

[0046] Figure 3 A schematic diagram of the structure of the geomagnetic dynamic iron drift compensation device provided in the embodiments of this application. Figure 1 ;

[0047] Figure 4 A schematic diagram of the structure of the geomagnetic dynamic iron drift compensation device provided in the embodiments of this application. Figure 2 ;

[0048] Figure 5This is a schematic diagram of the control unit provided in an embodiment of this application.

[0049] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0051] The terms “first,” “second,” etc., used in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, products, or apparatus.

[0052] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0053] In related technologies, the following methods are mainly used to address the problem of soft and hard iron drift in geomagnetic sensors:

[0054] The first method, user calibration, requires users to manually perform a figure-eight calibration action. For example, when the terminal device detects a change in the external magnetic field, it sends a calibration notification to the user, who then performs the figure-eight calibration operation. However, this method requires active cooperation from the user, and the standardization of the operation is difficult to guarantee. Especially when the user frequently changes environments (such as moving from outdoors to an indoor area with dense metal), the operation is not only cumbersome, but the calibration effect is also greatly affected by the standardization of the user's operation, resulting in a decline in user experience.

[0055] The second method is the temperature compensation method, which uses a pre-stored temperature-magnetic field drift curve to correct the output based on temperature changes during operation. However, this method can only compensate for drift within a fixed temperature range and cannot address errors caused by non-temperature factors such as device drops or dynamic changes in environmental ferromagnetic materials. It has poor adaptability and cannot guarantee the accuracy of geomagnetic data in complex electromagnetic environments.

[0056] The third option is to use a one-time factory calibration scheme, which calibrates the geomagnetic sensor inside the equipment when it leaves the factory. However, this scheme is ineffective for subsequent environmental changes and has poor adaptability, making it difficult to meet the real-time self-calibration requirements in dynamic environments.

[0057] The fourth method uses Kalman filtering combined with Global Positioning System (GPS) or gyroscope to estimate changes in the external magnetic field. However, it cannot distinguish between changes in the external magnetic field and hard iron drift in indoor or static scenarios, resulting in insufficient compensation accuracy.

[0058] To address the aforementioned technical issues, this application provides a geomagnetic dynamic iron drift compensation scheme. This scheme integrates an excitation coil within the geomagnetic sensor package to construct a self-compensation system based on "active excitation-closed-loop detection." The system utilizes an intelligent triggering mechanism to automatically control the excitation coil to generate precisely known magnetic field pulses in multiple linearly independent directions as a detection scale. Combined with the geomagnetic sensor's output after excitation, it calculates and separates the soft iron interference matrix and hard iron offset vector in real time, thereby achieving dynamic and accurate compensation for magnetic interference in complex environments, all without user intervention.

[0059] Next, we will first explain the application scenarios of this application.

[0060] This application applies to smart terminal devices equipped with electronic compasses, such as smartphones, wearable devices, AR glasses, etc., and its typical application scenarios are not limited to:

[0061] AR or Virtual Reality (VR) scenarios: The terminal device needs to use a geomagnetic sensor to perceive the direction of the Earth's magnetic field in real time, and combine data from a gyroscope and accelerometer to achieve spatial positioning and alignment with the virtual and real scenes.

[0062] Sports and health monitoring scenario: The terminal device calculates gait direction and movement trajectory through geomagnetic data, and needs to maintain high accuracy in complex electromagnetic environments.

[0063] Navigation and positioning scenario: In indoor scenarios with weak GPS signals, geomagnetic data is used to correct positioning errors.

[0064] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0065] Figure 1 A flowchart illustrating the geomagnetic dynamic iron drift compensation method provided in this application embodiment. Figure 1 For example, the geomagnetic dynamic iron drift compensation method of this application embodiment can be applied to the control unit in the geomagnetic dynamic iron drift compensation device, which also includes a geomagnetic sensor and an excitation coil that are electrically connected to the control unit.

[0066] like Figure 1 As shown, the geomagnetic dynamic iron drift compensation method includes the following steps:

[0067] S101. In response to the geomagnetic drift compensation triggering condition, according to a preset sequence, the excitation coil integrated in the geomagnetic sensor package is controlled to generate an excitation magnetic field in at least three linearly independent positive and negative pairs in sequence.

[0068] The geomagnetic drift compensation trigger condition can be considered as an event that initiates the self-compensation process, such as the device's first power-on, periodic timing, and ambient temperature changes exceeding a threshold. For example, the excitation coil includes a micron-sized copper coil, which can be integrated into the geomagnetic sensor package using semiconductor technology, for example, positioned at the four corners of the package. When energized, the excitation coil generates a precisely controllable excitation magnetic field. The preset sequence includes a predefined set of instructions for controlling the excitation coil to sequentially generate excitation magnetic fields in different directions, such as the order of excitation directions (e.g., +X, -X, +Y, -Y, +Z, -Z), the duration of excitation in each direction, the interval between direction switching, and the amplitude and direction of the current applied to the excitation coil. Linearly independent positive and negative directions refer to mutually orthogonal axes in three-dimensional space and their opposite directions.

[0069] For example, when the magnet drift compensation trigger condition is detected, the control unit applies an excitation current pulse with a constant voltage of 1V, a pulse width of 100µs, a peak value of 125mA, and a single pulse energy consumption of 12.5µJ to the excitation coil via the drive circuit. The current direction is switched sequentially to generate magnetic field pulses (i.e., excitation magnetic fields) in at least three linearly independent positive and negative directions.

[0070] It should be understood that the excitation coil, under the action of the excitation current pulse, generates magnetic field pulses in at least six known directions. For example, at least three linearly independent pairs of positive and negative directions include the X-axis pairs (+X, -X), the Y-axis pairs (+Y, -Y), the Z-axis pairs (+Z, -Z), (+X+Y, -XY), and the diagonal pairs (+X+Z, -XZ). These at least three linearly independent pairs of positive and negative directions facilitate a complete characterization of the scaling, stretching, and rotational distortion effects of environmental disturbances on the magnetic field in any direction.

[0071] S102. Acquire raw magnetic field measurement data of the geomagnetic sensor in each of at least three linearly independent pairs of positive and negative directions.

[0072] For example, after excitation in each direction is completed, the control unit acquires the raw magnetic field measurement data in that excitation direction from a geomagnetic sensor (such as a triaxial magnetometer). For instance, if the geomagnetic sensor has an I2C interface rate of 400 kHz, the control unit reads the raw magnetic field measurement data output by the geomagnetic sensor through this I2C interface.

[0073] S103. Based on the original magnetic field measurement data in each direction and the corresponding excitation magnetic field, determine the soft iron interference matrix, which characterizes the magnetic field distortion.

[0074] Among them, the soft iron interference matrix is ​​used to describe the distortion effect of ferromagnetic materials (such as the metal frame of a mobile phone) on the Earth's magnetic field, including scaling, stretching and rotation transformations.

[0075] It should be understood that the raw magnetic field measurement data actually measured by the geomagnetic sensor is a vector sum of the ambient magnetic field (geomagnetic field and interference field) and the excitation magnetic field.

[0076] This step essentially utilizes an actively injected and known excitation magnetic field as a precise space detection scale. By analyzing the response mode of the geomagnetic sensor to this space detection scale, the systematic distortion law caused by environmental ferromagnetic interference to the original magnetic field is calculated and quantified in reverse, and represented in the form of a mathematical matrix.

[0077] For example, based on electromagnetic principles, a parameterized mathematical model describing the output of an "ideal geomagnetic sensor under known excitation and interference" is pre-established. The key parameters of this parameterized mathematical model are the soft iron interference matrix and the hard iron offset vector to be solved. Then, the grouped "excitation-response" data pairs (i.e., original magnetic field measurement data - excitation magnetic field) obtained in step S102 in multiple directions are substituted into the above parameterized mathematical model. Finally, the soft iron interference matrix is ​​obtained by solving the parameters of this parameterized mathematical model.

[0078] S104. Based on the soft iron interference matrix and the original magnetic field measurement data in any direction, determine the hard iron offset vector.

[0079] The hard iron offset vector represents the constant magnetic field bias generated by a permanent magnet (such as a speaker magnet).

[0080] The essence of this step is to separate and extract from the original magnetic field measurement data a constant magnetic field bias generated by permanent magnets, which is independent of the attitude of the geomagnetic sensor and the direction of the geomagnetic field, i.e., the hard iron offset vector.

[0081] For example, based on the preset software algorithm logic, the hard iron offset vector is calculated according to the soft iron interference matrix and the original magnetic field measurement data in any direction.

[0082] S105. Based on the soft iron interference matrix and the hard iron offset vector, compensate the real-time output of the geomagnetic sensor.

[0083] For example, the soft iron interference matrix and hard iron offset vector are used as real-time correction parameters and dynamically configured into the geomagnetic data fusion processing link to perform instantaneous and continuous mathematical transformation on the raw data stream of the geomagnetic sensor, thereby achieving high-precision and low-latency geomagnetic pointing output at the system level.

[0084] For example, in one possible implementation, compensation for the real-time output of the geomagnetic sensor can be achieved using the following calculation formula:

[0085]

[0086] in, The geomagnetic data after compensation; For soft iron interference matrix; This is the hard iron offset vector; This is the real-time output of the geomagnetic sensor.

[0087] For example, compensated geomagnetic data The data is immediately fed into the subsequent attitude calculation engine (such as for fusion filtering with gyroscopes and accelerometers). Therefore, from updating the geomagnetic sensor readings to updating the heading angle output, the latency of the entire link only adds the overhead of a matrix multiplication and vector subtraction, achieving "instant pointer updates" that are imperceptible to the user. The virtual pointer or compass rose that the user sees on AR glasses or a mobile map will respond in real time, smoothly, and accurately as the device rotates.

[0088] This application's embodiment introduces an intelligent triggering mechanism to autonomously control the excitation coil to generate multi-directional known magnetic field pulses, eliminating the traditional calibration mode that relies on user operation and achieving a seamless experience, greatly enhancing the user experience. Furthermore, utilizing the known excitation magnetic field and the raw magnetic field measurement data output by the geomagnetic sensor, a highly efficient algorithm quickly calculates the soft and hard iron compensation parameters and completes the compensation, significantly improving the correction robustness and pointing accuracy in complex dynamic electromagnetic environments. This closed-loop self-compensation mechanism can continuously and adaptively compensate for soft and hard iron drift throughout the entire lifecycle of the terminal device, ensuring that geomagnetic data maintains high accuracy and stability over a long period, meeting the stringent continuity requirements of spatial perception data in scenarios such as AR virtual-real fusion, highly reliable navigation, and precise health monitoring.

[0089] In some embodiments, the soft iron interference matrix is ​​determined based on the original magnetic field measurement data in each direction and the corresponding excitation magnetic field, specifically including:

[0090] S1031. For each of at least three linearly independent pairs of positive and negative directions, determine the difference in magnetic field data between the original magnetic field measurement data corresponding to the positive direction and the original magnetic field measurement data corresponding to the negative direction, so as to eliminate the influence of the environmental geomagnetic field and constant hard iron offset.

[0091] Among them, the difference in magnetic field data (denoted as , (Axial index) refers to the raw magnetic field measurement data (denoted as ) obtained by the geomagnetic sensor when a positive excitation (+X) is applied along the same axis (such as the X-axis). ), and the raw magnetic field measurement data measured by the geomagnetic sensor when the reverse excitation (-X) is applied (denoted as ), The difference between the two is the vector difference. This difference in magnetic field data reflects the net response of the geomagnetic sensor to this axial excitation.

[0092] For example, the control unit reads pairs of data from the memory. [512,120,-85], [-480, 115, -82], perform vector subtraction. [992,5,-3]. The same operation is performed on the positive and negative pairs of other axes to obtain... , .

[0093] The output of the geomagnetic sensor can be quantified as follows:

[0094]

[0095]

[0096] The known excitation magnetic field is usually calculated based on the applied excitation current pulse and the coil constant. ,in, This is a constant value for the excitation coil; The amplitude of the excitation current; It is a unit direction vector, such as (1,0,0), (-1,0,0), (0,1,0), ..., (0,0,-1).

[0097] Therefore, it can be seen that the unknown geomagnetic field is eliminated through the above forward and reverse difference operations. With hard iron offset vector This means that the effects of the environmental geomagnetic field and constant hard iron offset have been eliminated.

[0098] S1032. Based on the difference in magnetic field data for each positive and negative direction and the excitation magnetic field, determine the soft iron interference matrix.

[0099] For example, in one implementation, the soft iron interference matrix satisfies the following formula:

[0100]

[0101] in, For soft iron interference matrix; For the first A pair of axial unit vectors in opposite directions; For the first The difference in magnetic field data corresponding to each positive and negative direction; The constant of the excitation coil is expressed in nT / mA. As per factory calibration; This represents the amplitude of the excitation current.

[0102] For example, for each axis Establish relationships based on physical models , By combining the equations for the three axes, a system with nine unknowns is constructed. A system of linear equations (the 9 elements of the matrix) ,in yes The matrix is ​​expanded into a 9-dimensional vector by rows or columns. Solving this system of linear equations using the least squares method yields the vector. The optimal solution. Then, for the vector Reshape(s) to restore the soft iron interference matrix. .

[0103] In other words, by simultaneously solving the difference equations in multiple directions (at least three linearly independent directions), a system of linear equations is formed with the elements of the soft iron disturbance matrix as unknowns. By solving this system of equations, the soft iron disturbance matrix that completely describes the spatial distortion of the magnetic field can be uniquely determined.

[0104] Based on this, the hard iron offset vector can be determined by using the soft iron interference matrix. Substitution The equation is solved to obtain the result, where, It can be estimated from the output of the geomagnetic sensor when no excitation is applied.

[0105] In this embodiment, a precisely known excitation magnetic field is used as a benchmark. The soft ferromagnetic interference matrix and the hard ferromagnetic offset vector, which characterize the nature of environmental disturbances, are directly decoupled using a mathematical difference method. This eliminates the dependence on the unknown and variable absolute value of the geomagnetic field, allowing the compensation process to be performed in any orientation and geographical location. Furthermore, the solution process is a deterministic linear operation, resulting in fast compensation speed, low computational resource consumption, and extremely high modeling accuracy and robustness against complex and dynamic mixed ferromagnetic disturbances, thereby significantly reducing pointing errors.

[0106] In some embodiments, the excitation magnetic field is generated in three orthogonal axial pairs, which correspond to the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis, respectively.

[0107] It should be understood that the pairs of positive and negative directions along the three orthogonal axes form a set of linearly independent and information-complete basis vectors in three-dimensional space. This is also the only way to uniquely calculate the soft iron interference matrix with all nine parameters. Theoretically, the minimum data requirement.

[0108] In this embodiment, only the excitation current needs to be controlled to switch between forward and reverse directions on three fixed axes, eliminating the need to synthesize complex diagonal current vectors, thus reducing the requirements for the complexity and accuracy of the drive circuit. Furthermore, the number of excitations required to complete a full self-compensation cycle is minimized (only 6 times), thereby reducing the overall self-compensation process time, facilitating rapid response to trigger conditions, and also reducing energy consumption, better meeting the stringent requirements of terminal devices for long battery life and high responsiveness.

[0109] In some embodiments, the geomagnetic drift compensation triggering condition includes at least one of the following:

[0110] When a terminal device integrating a geomagnetic sensor is first powered on and initialized;

[0111] The preset periodic magnet drift self-compensation time point is reached;

[0112] The monitored change in ambient temperature exceeds the first threshold.

[0113] An impact or acceleration event exceeding the second threshold was detected in the geomagnetic sensor;

[0114] An impact or acceleration event exceeding a third threshold was detected in the terminal device with the integrated geomagnetic sensor.

[0115] Specifically, the trigger condition for geomagnetic drift compensation is the initial power-on initialization of the terminal device. For example, when a terminal device such as a smartphone, AR glasses, or smartwatch starts up from a completely powered-off state and completes the basic system loading, the control unit detects the device initialization and automatically executes the geomagnetic sensor self-compensation process.

[0116] The trigger condition for geomagnetic drift compensation is the achievement of a preset periodic geomagnetic drift self-compensation time point. For example, the terminal device, in normal operation or standby mode, is periodically triggered by a built-in timer. Optionally, the period can be configurable. For instance, in high-precision mode, the self-compensation process is triggered every 5 minutes; high-precision mode includes demanding scenarios such as AR navigation and precise map orientation. In balanced mode, the self-compensation process is triggered every 30 minutes; balanced mode is suitable for daily use, balancing accuracy with power consumption. In low-power mode, the self-compensation process is triggered every 2 hours; low-power mode is suitable for scenarios where the device is idle or where battery life is extremely important.

[0117] The trigger condition for geomagnetic drift compensation is: the monitored change in ambient temperature exceeds a first threshold. For example, the terminal device's built-in temperature sensor (which can be independent or integrated into the main control chip, geomagnetic sensor, etc.) collects the ambient temperature and synchronizes it to the control unit. The control unit continuously records the sampled ambient temperature values ​​and calculates their moving average. When the absolute value of the difference between the current ambient temperature and the average temperature at the time of the last successful self-compensation exceeds the first threshold, the self-compensation process is immediately triggered. The first threshold is, for example, [missing information]. 5℃. For example, if a terminal device is moved from an indoor temperature of 22℃ to an outdoor temperature of 32℃, the change in ambient temperature reaches 10℃, which triggers the self-compensation process.

[0118] The trigger condition for geomagnetic drift compensation is as follows: an impact or acceleration event exceeding a second threshold is detected in the geomagnetic sensor. For example, the impact or acceleration event can be detected by an accelerometer, gyroscope, or dedicated impact sensor built into the vicinity of the geomagnetic sensor package or within the same module. Upon detection of an impact or acceleration event exceeding the second threshold, an interrupt trigger signal is sent to the control unit. The control unit responds to the interrupt trigger signal and triggers the self-compensation process. The second threshold is, for example, 4 to 10 gravitational accelerations (i.e., 4G to 10G). This threshold is set to detect extreme impacts that may directly cause microscopic deformation of the geomagnetic sensor chip or package structure. Triggering the self-compensation process upon detecting an impact or acceleration event exceeding the second threshold in the geomagnetic sensor can compensate for transient or permanent iron drift caused by solder joint microcracks, drastic changes in package stress, etc.

[0119] For the geomagnetic drift compensation trigger condition: an impact or acceleration event exceeding a third threshold is detected in the terminal device with the integrated geomagnetic sensor. For example, the impact or acceleration event is detected via the terminal device's built-in main accelerometer, gyroscope, or dedicated impact sensor. When an impact or acceleration event exceeding the third threshold is detected, an interrupt trigger signal is sent to the control unit. The control unit responds to the interrupt trigger signal and triggers the self-compensation process. The third threshold is, for example, 2 to 8 gravitational accelerations (i.e., 2G to 8G). The setting of the third threshold is used to detect common events such as user falls, severe impacts, or rough handling. Triggering the self-compensation process when an impact or acceleration event exceeding the third threshold is detected in the terminal device with the integrated geomagnetic sensor can compensate for minor displacements that may occur due to magnetic components such as speaker magnets and motors inside the device, or new internal stresses generated by the metal frame.

[0120] This application's embodiments utilize a multi-dimensional triggering mechanism to achieve full lifecycle compensation protection from initial power-on to daily use, and from environmental changes to unexpected impacts, enhancing the algorithm's environmental adaptability. Furthermore, the relatively energy-intensive multi-directional excitation process is initiated only when the geomagnetic drift compensation triggering condition is met, avoiding ineffective continuous operation and significantly reducing the system's average power consumption. This achieves an optimal balance between power consumption and accuracy, ensuring consistently high accuracy of geomagnetic data throughout its entire lifecycle.

[0121] When a step or pulse current is applied to the excitation coil, the current will not reach a stable value instantaneously due to the parasitic inductance, distributed capacitance of the excitation coil, and its interaction with the switching transistors in the drive circuit. Instead, ringing will occur on the rising and falling edges. This transient current will generate a correspondingly rapidly changing and unpredictable transient magnetic field spike. If the geomagnetic sensor samples during this phase, the data will contain a large amount of noise, leading to severe distortion in subsequent calculations.

[0122] Therefore, in some embodiments, the raw magnetic field measurement data is obtained by: for each of at least three linearly independent pairs of positive and negative directions, after generating an excitation magnetic field by applying an excitation current pulse, delaying for a preset time, and at the end of the preset time, controlling the opening of the sampling window of the geomagnetic sensor to collect stable raw magnetic field measurement data, wherein the preset time is longer than the duration of the transient spike in the magnetic field caused by the excitation current pulse.

[0123] Among these, the duration from the generation to complete decay of a transient magnetic field spike can be determined through extensive experiments or simulations. By designing a larger than Fixed delay time (i.e., preset duration, such as 30µs) to ensure that when the sampling window of the geomagnetic sensor is opened, the excitation magnetic field has entered a stable plateau period determined by the constant current.

[0124] For example, for each excitation direction (e.g., the +X axis direction), the following precise timing sequence is followed: at time... The control unit applies a constant current pulse with an amplitude of 125mA and a pulse width of 100µs to the excitation coil. At this point, the excitation coil begins to generate an excitation magnetic field, but this is accompanied by strong transient spikes; the system timer waits. At any moment + Once the transient spike has largely decayed and the magnetic field has entered a stable state, the control unit sends a "start sampling" command to the geomagnetic sensor. The geomagnetic sensor then activates its analog-to-digital conversion circuit and samples the triaxial magnetic field multiple times within a short sampling window (e.g., 50µs), averaging the samples to output the original magnetic field measurement data in that excitation direction. When the excitation current pulse ends, the end time of the sampling window should be designed to be before the end of the excitation current pulse, i.e., the duration of the sampling window should be less than or equal to the pulse width of the excitation current pulse, to ensure that the entire sampling process is completed in a stable excitation magnetic field environment.

[0125] In this embodiment, after applying an excitation current pulse to the excitation coil, the system actively waits for and avoids electromagnetic interference spikes caused by the transient process of the current, and only activates the geomagnetic sensor to sample after the magnetic field reaches a stable state. This improves the signal-to-noise ratio of the original magnetic field measurement data, thereby ensuring that the collected original magnetic field measurement data truly reflects the steady-state value of the excitation magnetic field, and thus improving the accuracy of iron drift compensation.

[0126] Based on the above embodiments, a specific embodiment will be used to describe the geomagnetic dynamic iron drift compensation method in detail. Figure 2 A flowchart illustrating the geomagnetic dynamic iron drift compensation method provided in this application embodiment. Figure 2 ,like Figure 2 As shown, the geomagnetic dynamic iron drift compensation method includes:

[0127] S201. In response to the geomagnetic drift compensation trigger condition, the excitation coil integrated in the geomagnetic sensor package is controlled to generate an excitation magnetic field in three linearly independent positive and negative directions in a preset sequence.

[0128] The triggering conditions for geomagnetic drift compensation include at least one of the following: the terminal device with integrated geomagnetic sensor is powered on and initialized for the first time; the preset periodic geomagnetic drift self-compensation time point is reached; the monitored change in ambient temperature is greater than a first threshold; an impact or acceleration event greater than a second threshold is detected in the geomagnetic sensor; or an impact or acceleration event greater than a third threshold is detected in the terminal device with integrated geomagnetic sensor.

[0129] For example, when any of the above-mentioned magnet drift compensation trigger conditions are detected, the control unit applies an excitation current pulse with a constant voltage of 1V, a pulse width of 100µs, a peak value of 125mA, and a single pulse energy consumption of 12.5µJ to the excitation coil through the drive circuit. The current direction is switched sequentially to generate magnetic field pulses (i.e., excitation magnetic fields) in six directions: +X, -X, +Y, -Y, +Z, and -Z.

[0130] S202. Obtain the raw magnetic field measurement data of the geomagnetic sensor in each of the three linearly independent positive and negative direction pairs.

[0131] For example, after excitation in each direction is completed, the control unit acquires the raw magnetic field measurement data in that excitation direction from a geomagnetic sensor (such as a triaxial magnetometer). For instance, if the geomagnetic sensor has an I2C interface rate of 400 kHz, the control unit reads the raw magnetic field measurement data output by the geomagnetic sensor through this I2C interface.

[0132] S203. For each of the three linearly independent pairs of positive and negative directions, determine the difference between the original magnetic field measurement data corresponding to the positive direction and the original magnetic field measurement data corresponding to the negative direction.

[0133] For example, the control unit reads pairs of data from the memory. [512,120,-85], [-480, 115, -82], perform vector subtraction. [992,5,-3], yielding the magnetic field data difference along the X-axis. The same operation is performed on the other two axes in opposite directions to obtain... , .

[0134] S204. Based on the difference in magnetic field data for each positive and negative direction and the excitation magnetic field, determine the soft iron interference matrix.

[0135] For example, for each axis Establish relationships based on physical models , By combining the equations for the three axes, a system with nine unknowns is constructed. A system of linear equations (the 9 elements of the matrix) ,in yes A 9-dimensional vector formed by expanding a matrix by its rows or columns. 9 9 matrix, 9 Matrix. Applying the least squares method, solve the system of linear equations to obtain the vector. The optimal solution. Then, for the vector Reshape(s) to restore the soft iron interference matrix. .

[0136] S205. Based on the soft iron interference matrix and the original magnetic field measurement data in any direction, determine the hard iron offset vector.

[0137] For example, the soft iron interference matrix Substitution The hard iron offset vector is obtained by solving the equation. ,in, It can be estimated from the output of the geomagnetic sensor when no excitation is applied.

[0138] S206. Based on the soft iron interference matrix and the hard iron offset vector, compensate the real-time output of the geomagnetic sensor.

[0139] For example, substitute the soft iron interference matrix and the hard iron offset vector into... The equation calculates the compensated geomagnetic data.

[0140] Figure 3 A schematic diagram of the structure of the geomagnetic dynamic iron drift compensation device provided in the embodiments of this application. Figure 1 ,like Figure 3 As shown, the geomagnetic dynamic iron drift compensation device 30 includes: a control unit 31, a geomagnetic sensor 32, and an excitation coil 33 integrated within the geomagnetic sensor package, wherein:

[0141] The excitation coil 33 is arranged around the sensing area of ​​the geomagnetic sensor 32 and is used to generate an excitation magnetic field in at least three linearly independent positive and negative directions under the control of the control unit 31.

[0142] For example, the excitation coil 33 can be rectangular, ring-shaped, or spiral, and is symmetrically arranged around the sensing area of ​​the geomagnetic sensor 32. Symmetrically distributed auxiliary coils can also be added inside the package to form a multi-directional excitation array. By adjusting the current path and magnetic field coverage of the excitation coil, the uniformity and coverage accuracy of the multi-directional magnetic field excitation can be improved.

[0143] For example, such as Figure 4 A schematic diagram of the structure of the geomagnetic dynamic iron drift compensation device provided in the embodiments of this application. Figure 2 As shown, the excitation coil 33 is electroplated at the four corners of the package, for example, four turns of copper micro-coil are electroplated at each corner. The excitation magnetic field generated by this coil forms a vector superposition at the central geomagnetic sensor position. The copper micro-coil has a line width of 15µm, a thickness of 12µm, and a DC resistance of 8Ω, for example. One end of the excitation coil 33 is grounded, and the other end is connected to the four PMOS drive pins on the control unit 31. Multilayer ceramic capacitors (MLCCs) of, for example, 22µF and 1pF can be connected in parallel between the drive pins and ground to reduce interference. The excitation coil 33 is powered by the four PMOS drive pins on the control unit 31 to generate a multi-directional excitation magnetic field with a known direction.

[0144] The geomagnetic sensor 32 is mounted on the packaged substrate and is used to collect raw magnetic field measurement data in each direction in at least three linearly independent positive and negative direction pairs in response to the sampling command of the control unit 31.

[0145] For example, the geomagnetic sensor 32 is typically a bare die containing a triaxial magnetoresistive sensing element, mounted to the center of a package substrate using a chip mounting process (such as eutectic bonding or conductive adhesive), for example, mounted on a 2.0 × 1.8 mm wafer-level chip-scale package (WLCSP). The I2C interface of the geomagnetic sensor 32 has a rate of, for example, 400 kHz. The control unit 31 transmits sampling commands to the geomagnetic sensor 32 and reads the raw magnetic field measurement data output by the geomagnetic sensor 32 through this I2C interface.

[0146] The control unit 31 is electrically connected to the geomagnetic sensor 32 and the excitation coil 33 respectively, and is used to execute the geomagnetic dynamic iron drift compensation method in the above embodiment.

[0147] For example, the control unit 31 is typically a functional module of the system-on-a-chip or a standalone microcontroller. It is also connected to the system bus of the terminal device to receive trigger signals from other modules (such as temperature sensors and accelerometers) and output compensated geomagnetic data.

[0148] In this embodiment, by integrating the excitation coil and the geomagnetic sensor within a single package, miniaturization and integration are achieved without the need for external calibration components, making it suitable for space-sensitive terminal devices. Because the excitation coil and the geomagnetic sensor are extremely close, a microampere-level current is sufficient to generate a sufficiently strong excitation magnetic field, and the direction of the magnetic field is controllable, significantly reducing the energy consumption per cycle of the entire self-compensation process. Furthermore, the package structure provides a defined and stable mechanical and electromagnetic environment for the geomagnetic sensor and the excitation coil, effectively shielding them from external high-frequency noise and uncertain magnetic circuit interference. Simultaneously, the packaging process ensures that the relative positions of the excitation coil and the geomagnetic sensor are highly consistent in each geomagnetic dynamic iron drift compensation device during mass production, enhancing production consistency.

[0149] In some embodiments, the geomagnetic sensor and the excitation coil are fixed by a stress relief structure of the encapsulation cover. The stress relief structure is used to release the mechanical stress generated during the encapsulation process in order to maintain the relative positional accuracy of the geomagnetic sensor and the excitation coil.

[0150] The encapsulation cover can be made of stainless steel or a composite material, which includes a metal layer with high fatigue resistance (such as titanium alloy) and a metal layer with magnetic permeability (such as stainless steel), thereby balancing the mechanical strength and magnetic field shielding performance of the encapsulation.

[0151] For example, the stress relief structure is located on the inner surface or a specific area of ​​the package cover and is made using femtosecond laser micromachining technology. For instance, the stress relief structure is a microgroove or a mesh-like recess.

[0152] In this embodiment, the mechanical stress during the packaging process and the externally transmitted thermomechanical stress are effectively released by the stress relief structure, thereby maintaining the geometric positional relationship between the excitation coil and the geomagnetic sensor in a long-term and stable manner, thereby improving the accuracy of the magnetic field excitation direction and ensuring the long-term stability of the self-compensation algorithm.

[0153] In some embodiments, the stress relief structure includes a plurality of microgrooves distributed along the surface of the package cover, the shape and depth of which are formed by a laser etching process.

[0154] For example, the microgrooves are either annular or spiral in shape.

[0155] For example, the surface of the encapsulation cap is etched with a 50µm × 5µm grid of stress relief grooves, 8µm deep, using a 2µJ femtosecond laser. The grid shape can be rectangular, hexagonal, etc.

[0156] It should be noted that the microgrooves are mainly located in the area of ​​the package cover corresponding to the edge of the geomagnetic sensor chip and above the excitation coil trace path, avoiding electrical connection points and sealing areas.

[0157] In this embodiment, stress relief is achieved through laser-etched microgroove structures, improving the uniformity of stress distribution in the encapsulation cover. This further reduces the impact of encapsulation stress on the relative position of the geomagnetic sensor and the excitation coil, thereby enhancing the stability of magnetic field excitation and further optimizing the robustness of the compensation algorithm.

[0158] Optionally, the stress relief structure can also employ a multi-level stress relief groove structure. Through layered design, stress is dispersed to different depths, avoiding displacement of the geomagnetic sensor-excitation coil caused by stress concentration. This resolves the contradiction between mechanical strength and magnetic field shielding in traditional packaging materials, optimizes packaging stability through multi-level stress relief, extends the service life of the geomagnetic sensor, and ensures long-term reliability of the compensation process.

[0159] It should be noted that the specific numerical values, data thresholds, and durations (e.g., in the embodiments of this application) involved in the above embodiments are not specified. The 5℃ first threshold, 4G second threshold, etc., are merely illustrative examples used to explain the implementation principle of the technical solution. In practical applications, the above parameters can be adaptively adjusted and set according to specific equipment configurations, technical standards, and actual business needs. This application does not limit the specific values ​​of the relevant parameters.

[0160] Figure 5 This is a schematic diagram of the control unit provided in an embodiment of this application. Figure 5 As shown, the control unit 31 provided in this embodiment includes at least one processor 311 and a memory 312. Optionally, the control unit 31 further includes a communication component 313. The processor 311, memory 312, and communication component 313 are connected via a bus 314.

[0161] In a specific implementation, at least one processor 311 executes computer execution instructions stored in memory 312, causing at least one processor 311 to perform the above-described method.

[0162] The specific implementation process of processor 311 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0163] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0164] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0165] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0166] This application provides a terminal device, including the geomagnetic dynamic iron drift compensation device in the above embodiments, or the terminal device includes the control unit in the above embodiments.

[0167] For example, the terminal device is not limited to smartphones, wearable devices, augmented reality glasses, virtual reality glasses, etc.

[0168] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0169] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0170] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0171] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0172] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0173] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0174] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0175] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0176] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0177] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for compensating for dynamic iron drift in geomagnetic fields, characterized in that, include: In response to the geomagnetic drift compensation triggering condition, the excitation coil integrated in the geomagnetic sensor package is controlled to generate an excitation magnetic field in at least three linearly independent pairs of positive and negative directions in a preset sequence. Acquire raw magnetic field measurement data of the geomagnetic sensor in each of the at least three linearly independent pairs of positive and negative directions; Based on the original magnetic field measurement data and the corresponding excitation magnetic field in each direction, a soft iron interference matrix is ​​determined, which characterizes the magnetic field distortion. Based on the soft iron interference matrix and the original magnetic field measurement data in any of the directions, the hard iron offset vector is determined. The real-time output of the geomagnetic sensor is compensated based on the soft iron interference matrix and the hard iron offset vector.

2. The geomagnetic dynamic iron drift compensation method according to claim 1, characterized in that, The determination of the soft iron interference matrix based on the original magnetic field measurement data and the corresponding excitation magnetic field in each direction includes: For each of the at least three linearly independent pairs of positive and negative directions, the difference between the original magnetic field measurement data corresponding to the positive direction and the original magnetic field measurement data corresponding to the negative direction is determined to eliminate the influence of the environmental geomagnetic field and constant hard iron offset. The soft iron interference matrix is ​​determined based on the difference in magnetic field data for each positive and negative direction and the excitation magnetic field.

3. The geomagnetic dynamic iron drift compensation method according to claim 2, characterized in that, The soft iron interference matrix satisfies the following formula: in, This refers to the soft iron interference matrix; For the first A pair of axial unit vectors in opposite directions; For the first The difference in magnetic field data for each positive and negative direction; This is a constant value for the excitation coil; This represents the amplitude of the excitation current.

4. The geomagnetic dynamic iron drift compensation method according to claim 1, characterized in that, The geomagnetic drift compensation triggering condition includes at least one of the following: When the terminal device integrating the geomagnetic sensor is first powered on and initialized; The preset periodic magnet drift self-compensation time point is reached; The monitored change in ambient temperature exceeds the first threshold. An impact or acceleration event exceeding a second threshold is detected in the geomagnetic sensor; An impact or acceleration event exceeding a third threshold was detected in the terminal device integrating the geomagnetic sensor.

5. The geomagnetic dynamic iron drift compensation method according to any one of claims 1 to 4, characterized in that, The excitation magnetic field is generated in three orthogonal axial pairs of positive and negative directions, which correspond to the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions, respectively.

6. The geomagnetic dynamic iron drift compensation method according to any one of claims 1 to 4, characterized in that, The original magnetic field measurement data were obtained in the following way: For each of the at least three linearly independent pairs of positive and negative directions, after generating an excitation magnetic field by applying an excitation current pulse, a preset time is delayed, and at the end of the preset time, the sampling window of the geomagnetic sensor is opened to collect stable raw magnetic field measurement data. The preset time is longer than the duration of the transient spike in the magnetic field caused by the excitation current pulse.

7. The geomagnetic dynamic iron drift compensation method according to any one of claims 1 to 4, characterized in that, The real-time output of the geomagnetic sensor is compensated based on the soft iron interference matrix and the hard iron offset vector using the following calculation formula: in, The geomagnetic data after compensation; This refers to the soft iron interference matrix; The hard iron offset vector; This is the real-time output of the geomagnetic sensor.

8. A geomagnetic dynamic iron drift compensation device, characterized in that, include: The control unit, the geomagnetic sensor, and the excitation coil integrated within the geomagnetic sensor package, wherein: The excitation coil is arranged around the sensing area of ​​the geomagnetic sensor and is used to generate an excitation magnetic field in at least three linearly independent positive and negative directions under the control of the control unit. The geomagnetic sensor is mounted on the packaged substrate and is used to collect raw magnetic field measurement data in each direction of the at least three linearly independent positive and negative direction pairs in response to the sampling command of the control unit. The control unit is electrically connected to the geomagnetic sensor and the excitation coil, respectively, and is used to perform the geomagnetic dynamic iron drift compensation method as described in any one of claims 1 to 7.

9. The geomagnetic dynamic iron drift compensation device according to claim 8, characterized in that, The geomagnetic sensor and the excitation coil are fixed by a stress relief structure of the encapsulation cover. The stress relief structure is used to release the mechanical stress generated during the encapsulation process in order to maintain the relative positional accuracy of the geomagnetic sensor and the excitation coil.

10. The geomagnetic dynamic iron drift compensation device according to claim 9, characterized in that, The stress relief structure includes a plurality of microgrooves distributed along the surface of the encapsulation cover, the shape and depth of which are formed by a laser etching process.

11. A terminal device, characterized in that, It includes the geomagnetic dynamic iron drift compensation device as described in any one of claims 8 to 10.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed, are used to implement the geomagnetic dynamic iron drift compensation method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and apparatus for data fusion of a three axis magnetometer and three axis accelerometer

    CN104884902A

  • A Calibration Method For Magnetic Field Sensing Devices, Corresponding System, Apparatus And Computer Program Product

    CN106483475A

  • Navigation method and system, storage medium and device

    CN109540158A

  • Heart rate calculation method, wearable electronic equipment and storage medium

    CN113925482A

  • Underwater target positioning method and system based on acoustic-magnetic combined detection

    CN121454538A