Method, device, apparatus, storage medium and program product for calibrating a magnetometer

By constructing a set of calibration formulas and solving them using the least squares method, the problem of insufficient measurement accuracy of the magnetometer was solved, and high-precision magnetic field strength calculation was achieved.

CN121805931BActive Publication Date: 2026-05-15UNIV OF SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF SCI & TECH OF CHINA
Filing Date
2026-03-09
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Portable magnetometers based on the fluxgate principle have limitations in measurement accuracy and cannot meet the high-precision requirements in the field.

Method used

By acquiring the standard magnetic field on the induction coil, digital values ​​are collected using an analog-to-digital converter and a digital-to-analog converter, a set of calibration formulas is constructed, and the least squares method is used to solve for the calibration coefficients. This reduces the influence of the internal front-end circuit and feedback loop of the magnetometer and improves the measurement accuracy.

Benefits of technology

This technology improves the measurement accuracy of magnetometers, enabling accurate calculation of the magnetic field strength of targets and meeting the high-precision requirements in the field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121805931B_ABST
    Figure CN121805931B_ABST
Patent Text Reader

Abstract

The application provides a method, device, equipment, storage medium and program product for calibrating a magnetometer, which can be applied to the technical field of magnetic field measurement. The method comprises the following steps: acquiring the size of a standard magnetic field applied to an induction coil corresponding to each axis within a predetermined period; collecting a plurality of first digital values output by a plurality of analog-to-digital converters and a plurality of second digital values input by a plurality of digital-to-analog converters in the case that all the first digital values output by the plurality of analog-to-digital converters are less than a first predetermined digital value within the predetermined period; constructing a calibration formula group by using a least square method according to a plurality of standard magnetic fields corresponding to three axes, the plurality of first digital values and the plurality of second digital values; and performing least square solving on the calibration formula group to obtain a calibration coefficient of the calibration formula, so that the magnetometer detects the magnetic field intensity of a target magnetic field according to the calibration formula.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of magnetic field measurement technology, and more specifically, to a method, apparatus, equipment, storage medium, and program product for calibrating a magnetometer. Background Technology

[0002] Magnetometers based on the fluxgate principle are classic instruments for measuring weak magnetic field vectors. Thanks to their high resolution, good reliability, and relatively mature technology, they have been widely used in geophysical exploration, space environment detection, and industrial non-destructive testing. However, portable fluxgate-based magnetometer devices (such as magnetometers) still have limitations in measurement accuracy, making it difficult to meet the urgent need for high precision in the field. Summary of the Invention

[0003] In view of this, the present invention provides a method, apparatus, device, storage medium and program product for calibrating a magnetometer.

[0004] One aspect of the present invention provides a method for calibrating a magnetometer, the magnetometer including induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter (ADC), and a digital-to-analog converter (DAC). The method includes: acquiring the magnitude of a standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; during the predetermined time period, when the first digital values ​​output by the ADCs are all less than a first predetermined digital value, acquiring multiple first digital values ​​output by the ADCs and multiple second digital values ​​input to the DACs, wherein the first digital values ​​are obtained by converting the induced signal of the induction coil of the corresponding axis to the standard magnetic field, and the second digital values ​​input to the DACs are obtained by converting the first digital values ​​output by the ADCs of the corresponding axes; the DACs adjust the magnetic field applied to the corresponding induction coils according to the input second digital values; constructing a calibration formula set using the least squares method based on the multiple standard magnetic fields, the multiple first digital values, and the multiple second digital values ​​corresponding to the three axes; and performing least squares solution on the calibration formula set to obtain calibration coefficients for the calibration formulas, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formulas.

[0005] According to another aspect of the present invention, an apparatus for calibrating a magnetometer is provided. The magnetometer includes induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter (ADC), and a digital-to-analog converter (DAC). The apparatus includes: an acquisition module for acquiring the magnitude of a standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; and a collection module for acquiring, within the predetermined time period, a plurality of first digital values ​​output by the plurality of ADCs and a plurality of second digital values ​​input to the plurality of DACs, wherein the first digital values ​​are the induction values ​​of the ADCs on the corresponding axes. The second digital value, obtained by converting the induced signal of the coil output against the standard magnetic field, is input to the digital-to-analog converter (DAC) by converting the first digital value output by the DAC of the corresponding axis. The DAC adjusts the magnetic field applied to the corresponding induction coil according to the input second digital value. A construction module is used to construct a calibration formula set using the least squares method based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes. A obtaining module is used to perform least squares solution on the calibration formula set to obtain the calibration coefficients of the calibration formula, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formula.

[0006] According to another aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to perform the method described above.

[0007] According to another aspect of the present invention, a computer-readable storage medium is provided storing computer-executable instructions, which, when executed, are used to implement the method described above.

[0008] According to another aspect of the present invention, a computer program product is provided, the computer program product including computer executable instructions, which, when executed, are used to implement the method described above.

[0009] According to an embodiment of the present invention, by acquiring the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; and by acquiring multiple first digital values ​​output by multiple analog-to-digital converters and multiple second digital values ​​input to multiple digital-to-analog converters within the predetermined time period when the first digital values ​​output by each of the multiple analog-to-digital converters are all less than a first predetermined digital value; and by constructing a calibration formula set based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes using the least squares method, a calibration formula can be obtained that represents the relationship between the data output by multiple analog-to-digital converters of the magnetometer and the data input to the digital-to-analog converters of the magnetometer and the standard magnetic field. Furthermore, the calibration formula set is solved using least squares to obtain the calibration coefficients of the calibration formulas. This achieves calibration of the magnetometer based on the relevant code values ​​of the internal front-end circuit and feedback loop of the magnetometer, reducing the influence of the internal front-end circuit and feedback loop of the magnetometer on the magnetic field strength detected by the magnetometer, and obtaining calibration coefficients of the calibration formula with higher accuracy. Subsequently, the magnetometer can accurately calculate the magnetic field strength of the target magnetic field based on the calibration coefficients of the calibration formula, the data output from the magnetometer's analog-to-digital converter corresponding to the target magnetic field, and the data input to the magnetometer's digital-to-analog converter corresponding to the target magnetic field, thus obtaining a highly accurate magnetic field strength. Attached Figure Description

[0010] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings.

[0011] Figure 1 A flowchart of a method for calibrating a magnetometer according to an embodiment of the present invention is shown.

[0012] Figure 2 A schematic diagram of the hardware system structure of a magnetometer according to an embodiment of the present invention is shown.

[0013] Figure 3 A schematic diagram of the logic control of an FPGA control module according to an embodiment of the present invention is shown.

[0014] Figure 4 A schematic diagram of a human-computer interaction interface according to an embodiment of the present invention is shown.

[0015] Figure 5 A flowchart of a method for calibrating a magnetometer according to another embodiment of the present invention is shown.

[0016] Figure 6A A graph showing the fitting effect between the predicted magnetic field and the measured magnetic field along the X-axis obtained by a magnetometer according to an embodiment of the present invention is shown.

[0017] Figure 6B It shows Figure 6AThe residual plot of the predicted magnetic field and the measured magnetic field on the X-axis obtained by the magnetometer in the image.

[0018] Figure 7 A block diagram of an apparatus for calibrating a magnetometer according to an embodiment of the present invention is shown.

[0019] Figure 8 A block diagram of an electronic device suitable for implementing a method for calibrating a magnetometer according to an embodiment of the present invention is shown. Detailed Implementation

[0020] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0021] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0022] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0023] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0024] Magnetometers based on the fluxgate principle (such as magnetometers) are classic instruments for measuring weak magnetic field vectors. With their high resolution, good reliability and relatively mature technology, they have been widely used in geophysical exploration, space environment detection and industrial non-destructive testing.

[0025] When calibrating fluxgate magnetometers (such as magnetometers), related technologies focus on sensor-level open-loop calibration, calibrating the already calculated vector output of the magnetometer, which contains errors. This is because the readings of the analog-to-digital converter and the digital-to-analog converter in the detection circuit of the magnetometer, used to detect magnetic field strength, inevitably contain errors such as quantization noise and circuit noise. This means that the inherent errors of the front-end circuit and feedback loop inside the sensor (i.e., inside the magnetometer) are "fixed" in its output value, which to some extent limits the practical accuracy that fluxgate magnetometers can ultimately achieve.

[0026] Therefore, portable fluxgate magnetometers (such as magnetometers) in related technologies still have limitations in terms of measurement accuracy, making it difficult to meet the urgent need for high precision in the field.

[0027] In view of this, embodiments of the present invention provide a method, apparatus, device, storage medium, and program product for calibrating a magnetometer, which can be applied to the field of magnetic field measurement technology.

[0028] Figure 1 A flowchart of a method for calibrating a magnetometer according to an embodiment of the present invention is shown.

[0029] like Figure 1 As shown, the method for calibrating the magnetometer includes operations S101 to S104.

[0030] For example, a magnetometer may include: induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter (ADC), and a digital-to-analog converter (DAC).

[0031] According to embodiments of the present invention, the induction coils, analog-to-digital converters, and digital-to-analog converters corresponding to the three mutually orthogonal axes are only some of the components of the magnetometer. Furthermore, the magnetometer may also include an FPGA (Field-Programmable Gate Array) control module, an excitation module, a fluxgate probe, an induction module corresponding to each axis, and a feedback module, etc.

[0032] A fluxgate magnetometer can measure the magnetic field strength corresponding to three axes. A fluxgate magnetometer may include three excitation coils, three induction coils, three feedback coils, and three magnetic cores, with the three excitation coils connected in series. The detection unit corresponding to each axis includes one excitation coil, one induction coil, one feedback coil, and one magnetic core, all wound on the same magnetic core. Multiple fluxgate magnetometers can be used; in this case, each fluxgate magnetometer can be configured with a corresponding excitation module, induction module, and feedback module, allowing multiple probes to be placed in different locations to measure the magnetic field.

[0033] The excitation module includes an LC oscillation unit that outputs excitation to the excitation coil, enabling the same LC oscillation unit to drive three sets of excitation coils simultaneously. This ensures that all magnetic cores are saturated with excitation at the same time and at the same frequency, which is the basis for the synchronous operation of the magnetometer hardware system.

[0034] The sensing module corresponding to each axis may include a front-end low-pass filter, a differential amplifier circuit, an analog-to-digital converter, a first resistor, and a second resistor. The front-end low-pass filter and the differential amplifier circuit can sequentially process the induced signal output by the induction coil relative to the standard magnetic field, and input the processed signal into the analog-to-digital converter, which outputs the corresponding first digital value.

[0035] The analog-to-digital converter (ADC) is electrically connected to the FPGA control module. The FPGA control module can convert the first digital value output by the ADC to obtain a second digital value. The second digital value can be the opposite of the first digital value.

[0036] The feedback module corresponding to each axis may include a digital-to-analog converter, a precision operational amplifier, and a voltage-controlled current source. The digital-to-analog converter may include a coarse-tuning DAC (MDAC) and a fine-tuning DAC (NDAC).

[0037] Both the coarse-tuning DAC and the fine-tuning DAC are electrically connected to the FPGA control module. The FPGA control module can choose whether to input the second digital value to the coarse-tuning DAC or the fine-tuning DAC. The coarse-tuning DAC and the fine-tuning DAC can perform digital-to-analog conversion on their respective second digital values ​​and output the corresponding analog voltage.

[0038] Meanwhile, the coarse-tuning DAC is connected in series with the first resistor and then to the inverting input of the precision operational amplifier. The fine-tuning DAC is connected in series with the second resistor and then to the inverting input of the precision operational amplifier. The resistance of the first resistor is less than the resistance of the second resistor, and the non-inverting input of the precision operational amplifier is grounded. For example, the ratio between the resistance of the second resistor and the resistance of the first resistor can be greater than 30 and less than 50. For example, the ratio between the resistance of the second resistor and the resistance of the first resistor can be 40.

[0039] The precision operational amplifier sums and amplifies the analog voltages output by the coarse-tuning DAC and the fine-tuning DAC proportionally, and inputs the amplified voltages into a voltage-controlled current source. The current output by the voltage-controlled current source is input to the feedback coil corresponding to each axis to adjust the magnetic field applied to the induction coil corresponding to each axis.

[0040] In operation S101, the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period is obtained.

[0041] According to an embodiment of the present invention, the standard magnetic field can be a magnetic field generated based on a Helmholtz coil.

[0042] In operation S102, during a predetermined time period, when the first digital values ​​output by each of the multiple analog-to-digital converters are all less than a first predetermined digital value, multiple first digital values ​​output by the multiple analog-to-digital converters and multiple second digital values ​​input to the multiple digital-to-analog converters are collected. The first digital value is obtained by converting the induction signal of the corresponding axis's induction coil to the standard magnetic field by the analog-to-digital converter. The second digital value input to the digital-to-analog converter is obtained by converting the first digital value output by the analog-to-digital converter of the corresponding axis. The digital-to-analog converter adjusts the magnetic field applied to the corresponding induction coil according to the input second digital value.

[0043] According to an embodiment of the present invention, a standard magnetic field can be detected multiple times using a magnetometer within a predetermined time period. For multiple detections, the magnitude of the standard magnetic field applied to the induction coil can be partially the same, completely different, or completely identical. Each detection yields a set of detection data. Each set of detection data includes the standard magnetic field corresponding to each of the three axes, a first digital value, and a second digital value. The detection data obtained for each detection corresponds to a sampling time.

[0044] In one embodiment, the digital-to-analog converter corresponding to each axis may include a coarse-tuning DAC and a fine-tuning DAC. In this case, the second digital value corresponding to each axis obtained at each sampling time is a second digital value input to the coarse-tuning DAC and a second digital value input to the fine-tuning DAC. The coarse-tuning DAC and the fine-tuning DAC can simultaneously adjust the magnetic field applied to the induction coil of the corresponding axis based on their respective input second digital values.

[0045] During each test, the FPGA control module in the magnetometer converts the first digital value for each axis and determines whether to input the converted second digital value to the coarse adjustment DAC or the fine adjustment DAC based on the relationship between the first digital value and the first and second predetermined digital values. The second predetermined digital value is greater than the first predetermined digital value. If the first digital value output by the analog-to-digital converter is less than the first predetermined digital value, the second digital value input to the coarse adjustment DAC can be equal to the first target digital value, and the second digital value input to the fine adjustment DAC can be equal to the second target digital value.

[0046] In another embodiment, the number of digital-to-analog converters corresponding to each axis can be one. The FPGA control module in the magnetometer can convert the first digital value of each axis and input the converted second digital value to the digital-to-analog converter, so that the digital-to-analog converter can adjust the magnetic field applied to the induction coil of the corresponding axis according to the input second digital value.

[0047] In operating S103, the least squares method is used to construct a set of calibration formulas based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes.

[0048] For example, in the case where the digital-to-analog converter corresponding to each axis includes a coarse adjustment DAC and a fine adjustment DAC, the multiple second digital values ​​corresponding to each of the three axes may include: during each detection process, and when the first digital value output by the analog-to-digital converter corresponding to each axis is less than a first predetermined digital value, the second digital value is input to the coarse adjustment DAC and the fine adjustment DAC corresponding to each axis.

[0049] For example, a calibration formula can be constructed for each axis using the least squares method, based on the first digital value, the second digital value, and the standard magnetic field at a predetermined sampling time corresponding to each axis. Alternatively, a calibration formula can be constructed for each axis using the least squares method, based on the system's inherent zero bias, the first digital value, the second digital value, and the standard magnetic field at a predetermined sampling time corresponding to each axis.

[0050] According to an embodiment of the present invention, the inherent zero bias characterizes the residual zero bias error introduced into the detection circuit corresponding to each axis by other devices in the magnetometer hardware system besides the analog-to-digital converter and digital-to-analog converter corresponding to each axis.

[0051] In operation S104, the least squares solution is performed on the calibration formula set to obtain the calibration coefficients of the calibration formula, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formula.

[0052] According to an embodiment of the present invention, by acquiring the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; and by acquiring multiple first digital values ​​output by multiple analog-to-digital converters and multiple second digital values ​​input to multiple digital-to-analog converters within the predetermined time period when the first digital values ​​output by each of the multiple analog-to-digital converters are all less than a first predetermined digital value; and by constructing a calibration formula set based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes using the least squares method, a calibration formula can be obtained that represents the relationship between the data output by multiple analog-to-digital converters of the magnetometer and the data input to the digital-to-analog converters of the magnetometer and the standard magnetic field. Furthermore, the calibration formula set is solved using least squares to obtain the calibration coefficients of the calibration formulas. This achieves calibration of the magnetometer based on the relevant code values ​​of the internal front-end circuit and feedback loop of the magnetometer, reducing the influence of the internal front-end circuit and feedback loop of the magnetometer on the magnetic field strength detected by the magnetometer, and obtaining calibration coefficients of the calibration formula with higher accuracy. Subsequently, the magnetometer can accurately calculate the magnetic field strength of the target magnetic field based on the calibration coefficients of the calibration formula, the data output from the magnetometer's analog-to-digital converter corresponding to the target magnetic field, and the data input to the magnetometer's digital-to-analog converter corresponding to the target magnetic field, thus obtaining a highly accurate magnetic field strength.

[0053] According to an embodiment of the present invention, the calibration formula set includes a calibration formula corresponding to each axis.

[0054] According to an embodiment of the present invention, for Figure 1 The operation S103 shown uses the least squares method to construct a calibration formula set based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes. It may include the following operations: For each axis, using the least squares method, a calibration formula corresponding to each axis is constructed based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at a predetermined sampling time corresponding to each axis, and the first and second digital values ​​at the predetermined sampling time corresponding to the three axes. The standard magnetic field at the predetermined sampling time corresponding to each axis is located on one side of the calibration formula corresponding to each axis, and the system's inherent zero bias corresponding to each axis and the first and second digital values ​​at the predetermined sampling time corresponding to the three axes are located on the other side of the calibration formula corresponding to each axis.

[0055] According to an embodiment of the present invention, for each axis, a calibration formula is constructed using the least squares method based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at a predetermined sampling time corresponding to each axis, and the first and second digital values ​​at predetermined sampling times corresponding to the three axes. The standard magnetic field at the predetermined sampling time corresponding to each axis is located on one side of the calibration formula, while the system's inherent zero bias and the first and second digital values ​​at predetermined sampling times corresponding to the three axes are located on the other side. The calibration formula set is solved by least squares to obtain the calibration coefficients of the calibration formula. This technique enables the magnetometer to be calibrated based on the correlation code values ​​of the magnetometer's internal front-end circuit and feedback loop, as well as the system's inherent zero bias. This reduces the influence of the magnetometer's internal front-end circuit and feedback loop on the magnetic field strength detected by the magnetometer, resulting in calibration coefficients of a calibration formula with higher accuracy.

[0056] According to an embodiment of the present invention, when constructing the calibration formula set, the inherent zero bias of the system is an unknown quantity. By performing least squares solution on the calibration formula set, the calibration value corresponding to the inherent zero bias of the system can be obtained.

[0057] According to an embodiment of the present invention, for each of the three axes (i.e., the target axis), the first and second digital values ​​corresponding to the predetermined sampling time of each axis and the first and second axes orthogonal to each axis are multiplied by the first, second, third, fourth, fifth, and sixth coefficients, respectively, and then added to the inherent zero bias of the system corresponding to each axis. Finally, an equality relationship is established with the standard magnetic field corresponding to the predetermined sampling time of each axis, thereby constructing a calibration formula for the predetermined sampling time corresponding to each axis, and thus obtaining a set of calibration formulas.

[0058] According to an embodiment of the present invention, each of the first, second, third, fourth, fifth, and sixth coefficients represents the influence coefficient of the digital value multiplied by each coefficient on the standard magnetic field corresponding to the target axis.

[0059] For example, the first coefficient represents the influence coefficient of the first digital value of each axis on the standard magnetic field corresponding to each axis; the second coefficient represents the influence coefficient of the second digital value of each axis on the standard magnetic field corresponding to each axis; the third coefficient represents the influence coefficient of the first digital value corresponding to the first axis orthogonal to each axis on the standard magnetic field corresponding to each axis; the fourth coefficient represents the influence coefficient of the second digital value corresponding to the first axis orthogonal to each axis on the standard magnetic field corresponding to each axis; the fifth coefficient represents the influence coefficient of the first digital value corresponding to the second axis orthogonal to each axis on the standard magnetic field corresponding to each axis; and the sixth coefficient represents the influence coefficient of the second digital value corresponding to the second axis orthogonal to each axis on the standard magnetic field corresponding to each axis.

[0060] For example, for each axis, using the least squares method, based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at the predetermined sampling time corresponding to each axis, and the first and second digital values ​​at the predetermined sampling times corresponding to the three axes, constructing the calibration formula corresponding to each axis may include: multiplying the first and second digital values ​​at the predetermined sampling times corresponding to each axis by the first and second coefficients respectively to obtain the first term of the calibration formula corresponding to each axis; multiplying the first and second digital values ​​at the predetermined sampling times corresponding to the first axis orthogonal to each axis by the third and fourth coefficients respectively to obtain the second term of the calibration formula corresponding to each axis; multiplying the first and second digital values ​​at the predetermined sampling times corresponding to the second axis orthogonal to each axis by the fifth and sixth coefficients respectively to obtain the third term of the calibration formula corresponding to each axis; and using the least squares method, constructing the calibration formula corresponding to each axis based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at the predetermined sampling time corresponding to each axis, and the first, second, and third terms of the calibration formula corresponding to each axis.

[0061] For example, the three axes can be the X-axis, Y-axis, and Z-axis. The first axis orthogonal to the X-axis can be the Y-axis, and the second axis orthogonal to the X-axis can be the Z-axis; alternatively, the first axis orthogonal to the X-axis can be the Z-axis, and the second axis orthogonal to the X-axis can be the Y-axis. This is not a limitation. Similarly, the first and second axes orthogonal to the Y-axis and the first and second axes orthogonal to the Z-axis can be obtained, which will not be elaborated further here.

[0062] For example, when the digital-to-analog converters corresponding to each axis include coarse-tuning DACs and fine-tuning DACs, calibration formulas corresponding to each of the three axes can be constructed according to formulas (1) to (3). The number of digital-to-analog converters corresponding to each axis is determined by using the second digital value corresponding to the corresponding number of digital-to-analog converters in formulas (1) to (3) to construct the calibration formula corresponding to each axis. This will not be elaborated further here.

[0063] According to an embodiment of the present invention, the purpose of least squares calibration is to make the formulas (1) to (3) more accurate. , , Minimum.

[0064] (1);

[0065] in, This represents the first digital value of the ADC output corresponding to the X-axis. This represents the second digital value of the coarse-tuning DAC corresponding to the X-axis. This represents the second digital value of the fine-tuning DAC corresponding to the X-axis input. This represents the first digital value of the ADC output corresponding to the Y-axis. This represents the second digital value of the coarse-tuning DAC corresponding to the Y-axis input. This represents the second digital value of the fine-tuning DAC corresponding to the input on the Y-axis. This represents the first digital value of the ADC output corresponding to the Z-axis. This represents the second digital value of the coarse-tuning DAC corresponding to the Z-axis. This represents the second digital value of the fine-tuning DAC corresponding to the Z-axis input. This represents the standard magnetic field corresponding to the X-axis.

[0066] express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, This represents the inherent zero bias of the system corresponding to the X-axis, used to compensate for the residual zero bias of the system along the X-axis. This represents the magnetic field measurement error corresponding to the X-axis, which includes external magnetic field noise.

[0067] (2);

[0068] in, This represents the standard magnetic field corresponding to the Y-axis. express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, This represents the inherent zero bias of the system corresponding to the Y-axis, used to compensate for the residual zero bias of the system along the Y-axis. This represents the magnetic field measurement error corresponding to the Y-axis, which includes external magnetic field noise.

[0069] (3);

[0070] in, This represents the standard magnetic field corresponding to the Z-axis. express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, express for Influence coefficient, This represents the inherent zero bias of the system corresponding to the Z-axis, used to compensate for the residual zero bias of the system along the Z-axis. This represents the magnetic field measurement error corresponding to the Z-axis, which includes external magnetic field noise.

[0071] The modeling process of formulas (1) to (3) will be explained in detail below in conjunction with formulas (4) to (11).

[0072] According to an embodiment of the present invention, a model can be built separately for each axis, its original digital code value can be converted into a preliminary magnetic field value, and the error of each channel can be compensated. The magnetic field vectors corresponding to the predetermined sampling times of the three axes conform to the models shown in formulas (4) to (6).

[0073] (4);

[0074] (5);

[0075] (6);

[0076] in, It represents the magnetic field vector corresponding to the ADC along the X-axis. Its magnitude is the first digital value output by the ADC corresponding to the X-axis. It represents the original digital code value of the fluxgate probe's sensing signal after analog front-end conditioning and analog-to-digital conversion. It is a first-level measurement quantity of the magnetic field. This represents the magnetic field vector corresponding to the coarse adjustment DAC on the X-axis. Its magnitude is the second digital value of the coarse adjustment DAC input to the X-axis, which is used to generate a large compensation magnetic field in the feedback loop so that the system operates in the linear region. This represents the magnetic field vector corresponding to the fine-tuning DAC on the X-axis. Its magnitude is the second digital value of the fine-tuning DAC input to the X-axis, used for fine compensation based on coarse adjustment, further improving linearity and resolution.

[0077] This represents the calibration coefficient to be calibrated, corresponding to the first digital value of the ADC output along the X-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the coarse adjustment DAC input to the X-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the fine-tuning DAC on the input X-axis. This represents the offset vector along the X-axis, used to compensate for zero offset. This represents the magnetic field vector value along the X-axis detected by the magnetometer.

[0078] It represents the magnetic field vector corresponding to the ADC along the Y-axis. Its magnitude is the first digital value output by the ADC corresponding to the Y-axis. It represents the original digital code value of the fluxgate probe's sensing signal after analog front-end conditioning and analog-to-digital conversion. It is a first-level measurement quantity of the magnetic field. This represents the magnetic field vector corresponding to the coarse adjustment DAC on the Y-axis. Its magnitude is the second digital value of the input coarse adjustment DAC on the Y-axis, which is used to generate a large compensation magnetic field in the feedback loop so that the system operates in the linear region. This represents the magnetic field vector corresponding to the fine-tuning DAC on the Y-axis. Its magnitude is the second digital value of the fine-tuning DAC input to the Y-axis, used for fine compensation based on coarse tuning to further improve linearity and resolution.

[0079] This represents the calibration coefficient to be calibrated, corresponding to the first digital value of the ADC output along the Y-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the coarse adjustment DAC on the input Y-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the fine-tuning DAC on the input Y-axis. This represents the offset vector along the Y-axis, used to compensate for zero offset. This represents the magnetic field vector value along the Y-axis detected by the magnetometer.

[0080] It represents the magnetic field vector corresponding to the ADC along the Z-axis. Its magnitude is the first digital value output by the ADC corresponding to the Z-axis. It represents the original digital code value of the fluxgate probe's sensing signal after analog front-end conditioning and analog-to-digital conversion. It is a first-level measurement quantity of the magnetic field. This represents the magnetic field vector corresponding to the coarse adjustment DAC on the Z-axis. Its magnitude is the second digital value of the input coarse adjustment DAC on the Z-axis, which is used to generate a large compensation magnetic field in the feedback loop so that the system operates in the linear region. This represents the magnetic field vector corresponding to the fine-tuning DAC on the Z-axis. Its magnitude is the second digital value of the fine-tuning DAC input to the Z-axis, used for fine compensation based on coarse tuning to further improve linearity and resolution.

[0081] This represents the calibration coefficient to be calibrated, corresponding to the first digital value of the ADC output along the Z-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the coarse adjustment DAC input to the Z-axis. This represents the calibration coefficient to be calibrated, corresponding to the second digital value of the fine-tuning DAC on the input Z-axis. This represents the Z-axis offset vector, used to compensate for zero offset. This represents the magnetic field vector value along the Z-axis detected by the magnetometer.

[0082] According to an embodiment of the present invention, , and These are the magnetic field vector values ​​of the three axes XYZ of the magnetometer, not the actual orthogonal magnetic field values. Due to manufacturing and assembly limitations, the three axes of the magnetometer cannot be perfectly orthogonal. It is necessary to compensate for the coupling error between the three axes to obtain the final accurate magnetic field vector. At this time, the corresponding modeling process is as shown in formulas (7) to (9).

[0083] (7);

[0084] (8);

[0085] (9);

[0086] in, express for The influence coefficient is the main scale factor of the X-axis. express for The influence coefficient is the cross-coupling coefficient corresponding to the first axis orthogonal to the X-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the Y-axis to the final result of the X-axis and is mainly used to compensate for the non-orthogonal error of the three axes. express for The influence coefficient is the cross-coupling coefficient corresponding to the second axis orthogonal to the X-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the Z-axis to the final result of the X-axis and is mainly used to compensate for the non-orthogonal error of the three axes. This represents the vector used to compensate for the residual zero bias of the three-axis coupling on the X-axis. It represents the true magnetic field vector of the X-axis, which is perfectly orthogonal, and its magnitude is the magnitude of the target magnetic field along the X-axis. This represents the X-axis magnetic field measurement error vector, which includes the magnetic field measurement noise vector.

[0087] express for The influence coefficient is the cross-coupling coefficient corresponding to the first axis orthogonal to the Y-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the X-axis to the final result of the Y-axis and is mainly used to compensate for the non-orthogonal error of the three axes. express for The influence coefficient is the main scale factor of the Y-axis. express for The influence coefficient is the cross-coupling coefficient corresponding to the second axis orthogonal to the Y-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the Z-axis to the final result of the Y-axis and is mainly used to compensate for the non-orthogonal error of the three axes. This represents the vector used to compensate for the residual zero bias of the triaxial coupling on the Y-axis. It represents the true magnetic field vector of the perfectly orthogonal Y-axis, and its magnitude is the magnitude of the target magnetic field along the Y-axis. This represents the Y-axis magnetic field measurement error vector, which includes the magnetic field measurement noise vector.

[0088] express for The influence coefficient is the cross-coupling coefficient corresponding to the first axis orthogonal to the Z-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the X-axis to the final result of the Z-axis and is mainly used to compensate for the non-orthogonal error of the three axes. express for The influence coefficient is the cross-coupling coefficient corresponding to the second axis orthogonal to the Z-axis. It quantifies the "leakage" or "interference" of the magnetic field signal of the Y-axis to the final result of the Z-axis and is mainly used to compensate for the non-orthogonal error of the three axes. express for The influence coefficient is the main scale factor of the Z-axis. This represents the vector used to compensate for the residual zero bias of the triaxial coupling along the Z-axis. It represents the true magnetic field vector of the perfectly orthogonal Z-axis, and its magnitude is the magnitude of the target magnetic field along the Z-axis. This represents the Z-axis magnetic field measurement error vector, which includes the magnetic field measurement noise vector.

[0089] By combining formulas (4) to (7), we can obtain formula (10).

[0090] (10).

[0091] Multiply both sides of the equation (10) by a common factor. Unit vectors in the same direction Convert the vector in formula (10) to a scalar to obtain formula (11).

[0092] (11);

[0093] in, express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express and The angle between them express The model, express The model, express The model, express The model.

[0094] By treating the coefficients preceding each digital value, each bias vector, and the X-axis magnetic field measurement noise vector in formula (11) as a whole and replacing them with a single symbol, we obtain formula (1).

[0095] Similarly, we can combine formulas (4) to (6) and formula (8), and then multiply both sides of the equation by a common factor. Unit vectors in the same direction, and then taking the coefficients of each digital value, each bias vector, and the Y-axis magnetic field measurement noise vector in the obtained formula as a whole, replacing them with a single symbol, we get formula (2). Formulas (4) to (6) and formula (9) can be combined, and the left and right sides of the equation after combining the formulas can be multiplied by a symbol. Unit vectors in the same direction, and then taking the coefficients in front of each digital value, each bias vector and the Z-axis magnetic field measurement noise vector in the obtained formula as a whole, and replacing them with a symbol, we get formula (3).

[0096] According to formulas (1) to (3) and (11), the first coefficient represents the coefficient related to the principal scale factor of each axis and the calibration coefficient corresponding to the first digital value of each axis; the second coefficient represents the coefficient related to the principal scale factor of each axis and the calibration coefficient corresponding to the second digital value of each axis; the third coefficient represents the coefficient related to the cross-coupling coefficient corresponding to the first axis orthogonal to each axis and the calibration coefficient corresponding to the first digital value of the first orthogonal axis; the fourth coefficient represents the coefficient related to the cross-coupling coefficient corresponding to the first axis orthogonal to each axis and the calibration coefficient corresponding to the second digital value of the first orthogonal axis; the fifth coefficient represents the coefficient related to the cross-coupling coefficient corresponding to the second axis orthogonal to each axis and the calibration coefficient corresponding to the first digital value of the second orthogonal axis; and the sixth coefficient represents the coefficient related to the cross-coupling coefficient corresponding to the second axis orthogonal to each axis and the calibration coefficient corresponding to the second digital value of the second orthogonal axis.

[0097] According to embodiments of the present invention, the method for calibrating a magnetometer provided by the present invention can calibrate the magnetometer based on the relevant code values ​​of the internal front-end circuit and feedback loop of the magnetometer. It can simultaneously reduce the influence of probe sensing error (reflected in the first digital value corresponding to the ADC), feedback loop error (reflected in the second digital value corresponding to the MDAC and NDAC), triaxial non-orthogonality, scale factor, zero bias and other systematic errors on the magnetic field strength detected by the magnetometer, and obtain a calibration formula with higher accuracy. Then, a magnetic field strength with higher accuracy can be obtained based on the calibration formula with higher accuracy.

[0098] According to embodiments of the present invention, for example, Figure 1 The operation S104 shown involves performing a least-squares solution on the calibration formula set to obtain the calibration coefficients of the calibration formula. This includes: determining the i-th row of the first matrix based on the predetermined value corresponding to the system's inherent zero bias and the first and second digital values ​​at the i-th sampling time corresponding to the three axes, where i is an integer greater than 0 and less than or equal to N, N is greater than the total number of calibration coefficients, and N is a positive integer; determining the i-th row of the second matrix based on the standard magnetic field at the i-th sampling time corresponding to the three axes; and obtaining the calibration coefficients of the calibration formula using the least-squares method based on the first and second matrices.

[0099] For example, the calibration formula set can be simplified to the matrix form shown in formula (12) according to formulas (1) to (3).

[0100] (12);

[0101] Where A is the design matrix, B is the parameter matrix, and B is the observation matrix. This is the magnetic field noise error matrix.

[0102] Wherein, parameter matrix As shown in formula (13). Parameter matrix It contains all the unknown coefficients to be determined.

[0103] (13).

[0104] For example, the first matrix can be the design matrix A. Design matrix Each row of data in A corresponds to one measurement, and there are N rows, corresponding to N measurements. The predetermined value corresponding to the system's inherent zero bias can be 1.

[0105] According to an embodiment of the present invention, after obtaining the calibration formula set, the design matrix A can be obtained according to formula (14). As shown in formula (14), each row of the design matrix A has 10 columns, corresponding to 9 original digital code values ​​and a constant term.

[0106] (14);

[0107] in, The superscript (1) indicates the first measurement. The superscript (2) in the text indicates the second measurement. The superscript (N) in the formula represents the Nth measurement. By analogy, we can obtain the definitions of each data in formula (14), which will not be repeated here.

[0108] For example, the second matrix can be the observation matrix B. Observation matrix Each row of the observation matrix B corresponds to the actual magnetic field value of one measurement (i.e., the actual magnetic field), and there are N rows corresponding to N measurements. The observation matrix B is shown in formula (15).

[0109] (15).

[0110] For example, according to formula (16), the least squares method can be used to obtain the calibration coefficients of the calibration formula based on the first matrix shown in formula (14) and the second matrix shown in formula (15), and then the parameter matrix can be obtained. .

[0111] (16).

[0112] According to an embodiment of the present invention, code for implementing the above calibration method can be implemented on a host computer. Then, the original digital code values ​​(i.e., first digital values) of the ADCs of the three axes, namely the X-axis, Y-axis, and Z-axis, the original digital code values ​​(i.e., second digital values) of the coarse-tuning DAC (MDAC) and the fine-tuning DAC (NDAC), and the standard magnetic field value of known strength are substituted into the code of the host computer to achieve the final coefficient calibration.

[0113] The obtained calibration coefficients can be written into the FPGA control module and substituted into the following formulas (17) to (19) to obtain the magnetic field strength of the target magnetic field.

[0114] (17);

[0115] (18);

[0116] (19);

[0117] in, The predicted magnetic field value of the X-axis magnetometer is calculated by the FPGA control module. The predicted magnetic field value of the Y-axis magnetometer is calculated by the FPGA control module. The predicted magnetic field value of the Z-axis magnetometer calculated by the FPGA control module. The predicted magnetic field value of the target magnetic field includes... , and The magnetic field strength of the target magnetic field can be represented by the predicted value of the target magnetic field.

[0118] According to an embodiment of the present invention, after the magnetometer is powered on, phase calibration is performed before acquiring the first and second digital values. Since the magnetometer hardware system needs to extract the second harmonic signal from the induced signal output by the induction coil for calibration calculation, the FPGA control module can scan the phase of the ADC sampling data and lock the phase point with the largest second harmonic amplitude as the optimal sampling time, thereby obtaining a stable second harmonic amplitude. The feedback digital value is determined by the coarse-tuning DAC and the fine-tuning DAC.

[0119] According to embodiments of the present invention, the method for calibrating a magnetometer provided in the embodiments of the present invention can be executed by a host computer, by an FPGA control module, or by a host computer and an FPGA control module working together.

[0120] According to an embodiment of the present invention, the digital-to-analog converter corresponding to each axis includes a first digital-to-analog converter and a second digital-to-analog converter, wherein the magnetic field strength range corresponding to the second digital value input to the first digital-to-analog converter is greater than the magnetic field strength range corresponding to the second digital value input to the second digital-to-analog converter, and the maximum number of bits of the second digital value input to the first digital-to-analog converter is equal to the maximum number of bits of the second digital value input to the second digital-to-analog converter.

[0121] According to an embodiment of the present invention, in Figure 1Based on the method for calibrating a magnetometer shown, the method for calibrating a magnetometer provided by the present invention may further include: when the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is greater than a second predetermined digital value, maintaining the second digital value input to the second digital-to-analog converter corresponding to any axis as 0, and simultaneously adjusting the second digital value input to the first digital-to-analog converter in the j-th round according to the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (j+1)-th round, until the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than or equal to the second predetermined digital value, thereby obtaining the first target digital value input to the first digital-to-analog converter corresponding to any axis, where j is a positive integer; when the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than or equal to the second predetermined digital value, and greater than... If the second digital value input to the first digital-to-analog converter corresponding to any axis is equal to the first predetermined digital value, the second digital value input to the second digital-to-analog converter corresponding to any axis is kept as the target second digital value. At the same time, based on the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (k+1)th round, the second digital value input to the second digital-to-analog converter corresponding to any axis in the kth round is adjusted by binary division until the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than the first predetermined digital value, thus obtaining the second target digital value input to the second digital-to-analog converter corresponding to any axis, where k is a positive integer. Within a predetermined time period, if the second digital value input to the first digital-to-analog converter corresponding to any axis is the first target digital value and the second digital value input to the second digital-to-analog converter corresponding to any axis is the second target digital value, the first digital value output by the analog-to-digital converter corresponding to any axis is collected.

[0122] According to an embodiment of the present invention, the second digital value input to the first digital-to-analog converter (DAC) of any axis in the (j+1)th round is adjusted by dividing the first digital value output by the DAC in the (j+1)th round according to the sign of the first digital value. This includes: dividing the first adjustment digital value in the (j+1)th round to obtain the first adjustment digital value in the (j+1)th round, wherein the initial value of the first adjustment digital value is a first predetermined initial digital value; if the first digital value output by the DAC of any axis in the (j+1)th round is greater than 0, subtracting the first adjustment digital value from the second digital value input to the DAC of any axis in the (j+1)th round to obtain the second digital value input to the DAC of any axis in the (j+1)th round; if the first digital value output by the DAC of any axis in the (j+1)th round is less than 0, adding the second digital value to the DAC of any axis in the (j+1)th round to obtain the second digital value input to the DAC of any axis in the (j+1)th round.

[0123] According to an embodiment of the present invention, the second digital value input to the second digital-to-analog converter (DDC) corresponding to any axis in the k+1th round is adjusted by dividing the second digital value based on the sign of the first digital value output by the DDC corresponding to any axis in the k+1th round. This includes: dividing the second adjustment digital value in the kth round to obtain the second adjustment digital value in the k+1th round, wherein the initial value of the second adjustment digital value is a second predetermined initial digital value; if the first digital value output by the DDC corresponding to any axis in the k+1th round is greater than 0, subtracting the second digital value input to the second DDC corresponding to any axis in the k+1th round from the second adjustment digital value in the k+1th round to obtain the second digital value input to the second DDC corresponding to any axis in the k+1th round; if the first digital value output by the DDC corresponding to any axis in the k+1th round is less than 0, adding the second digital value input to the second DDC corresponding to any axis in the k+1th round from the second adjustment digital value in the k+1th round to obtain the second digital value input to the second DDC corresponding to any axis in the k+1th round.

[0124] The feedback process will be further explained below with the coarse adjustment DAC being the first digital-to-analog converter, the fine adjustment DAC being the second digital-to-analog converter, and both the coarse adjustment DAC and the fine adjustment DAC being MAX542 chips.

[0125] The first step is to initialize the magnetometer hardware system and perform compensation corresponding to the coarse adjustment DAC: set the initial code value of both the coarse adjustment DAC and the fine adjustment DAC to 2. 15 This ensures the feedback voltage is zero, meaning the feedback current is zero. Both the first and second predetermined initial digital values ​​are 2. 15 .

[0126] Table 1. Output voltage values ​​of the MAX542 chip corresponding to the code values ​​input to the DAC.

[0127]

[0128] Wherein, DAC LATCH CONTENTS represents the data latched by the digital-to-analog converter. MSB represents the most significant bit, and LSB represents the least significant bit. ANALOG OUTPUT, V OUT This represents the analog output voltage. V REF This indicates the maximum feedback voltage. "+" indicates a positive feedback voltage, and "-" indicates a negative feedback voltage. V REF It is 2.5V.

[0129] Then, the coarse-tuning DAC compensation process is initiated: initially, j=1, and the first digital value is read. , It is a larger code value (i.e., the second predetermined digital value), if Then, based on the first digital value output by the ADC The positive and negative adjustments are fed back to the second digital value of the first digital-to-analog converter. Wherein, when j=1, the second digit of the j-th round is the initial value 2. 15 .

[0130] when At that time, the second digital value is input to the (j+1)th round of the first digital-to-analog converter. It equals the second digital value input to the j-th round of the first digital-to-analog converter. The first adjustment digital value in the (j+1)th round The difference, that is At this time, the feedback voltage output by the first digital-to-analog converter in the (j+1)th round The feedback voltage of the first digital-to-analog converter output in the j-th round The relationship is: .

[0131] For example, The feedback current corresponding to the -1.25V feedback voltage can be -1.25mA, and the feedback coil can provide a reverse magnetic field based on the -1.25mA feedback current.

[0132] when hour, ,at this time, .

[0133] For example, The feedback current corresponding to the +1.25V feedback voltage can be +1.25mA, and the feedback coil can provide a positive magnetic field based on the +1.25mA feedback current.

[0134] Subsequently, j is incremented by 1, and the above process is repeated until... If j reaches 16 and still has not converged, it is determined to be out of range. The magnetic field strength of the standard magnetic field is reduced, and the system re-enters the system initialization stage, setting the initial code values ​​of the coarse and fine DACs to 2. 15 That is, the feedback voltage is 0V.

[0135] Step 2: Initiate the fine-tuning of the DAC micro-compensation process. Initially, k=1, with the first predetermined digital value. For smaller code values. When and At that time, the second digital value is input to the (k+1)th round of the second digital-to-analog converter. It equals the second digital value input to the k-th round of the second digital-to-analog converter. The second adjustment digital value in the (j+1)th round The difference, that is At this time, the feedback voltage output by the second digital-to-analog converter in the (k+1)th round The feedback voltage of the second digital-to-analog converter output in the kth round The relationship is: .

[0136] when hour, ,Right now .

[0137] Subsequently, k is incremented by 1, and the above process is repeated until... If k reaches 16 and still has not converged, it is determined to be out of range. The magnetic field strength of the standard magnetic field is reduced, and the system re-enters the system initialization phase, setting the initial code values ​​of the coarse-tuning DAC and fine-tuning DAC to 2. 15 That is, the feedback voltage is 0V.

[0138] Step 3: Initiate the stable phase process. Make judgments periodically. and The size relationship, if Then it enters the fine-tuning stage of the DAC again, if If it does, it will remain in a stable phase.

[0139] According to an embodiment of the present invention, through the cascaded coordination of coarse and fine adjustment DACs, the magnetometer hardware system first achieves rapid magnetic field convergence through coarse adjustment, and then maintains stable accuracy with the help of fine adjustment. When the fine adjustment exceeds the compensation range, it automatically switches back to coarse adjustment, forming a complete adaptive control closed loop.

[0140] The method for calibrating a magnetometer according to embodiments of the present invention has the core advantage of achieving efficient synergy between rapid initial convergence and continuous disturbance suppression. This method can quickly adjust the compensating magnetic field to near the target operating point, completing the initial calibration. Furthermore, its closed-loop control mechanism continuously monitors changes in the ambient magnetic field. When minor external disturbances occur, it can detect magnetic field deviations in real time and drive a compensating magnetic field to offset them, thereby quickly pulling the system back to equilibrium. This real-time estimation and compensation capability for disturbances is key to achieving high precision and stability.

[0141] According to an embodiment of the present invention, in a precisely controlled magnetic field environment in a laboratory, the host computer collects a large number of data samples in multiple standard magnetic fields of known strength and direction. Each set of detection data includes triaxial induction raw code values ​​(i.e., the first digital values ​​corresponding to the three axes), the second digital values ​​input to the corresponding coarse / fine tuning DAC, and the true magnetic field vector (i.e., the magnitude of the standard magnetic field), preparing for the least squares calculation. Subsequently, in the host computer, these data are constructed into a design matrix A (containing all detection data) and an observation matrix B (containing all true magnetic fields), and 30 calibration coefficients are solved using formulas. These coefficients systematically compensate for triaxial non-orthogonality, scale factor error, and zero bias, thereby obtaining accurate parameter estimation results.

[0142] According to an embodiment of the present invention, an embodiment of the present invention also provides a magnetometer, which can detect the magnetic field strength of a target magnetic field according to the calibration formula obtained by the above-described method for calibrating a magnetometer.

[0143] It should be noted that the method for calibrating a magnetometer provided in this embodiment of the invention can also be used to calibrate other magnetometer devices based on the fluxgate principle, which will not be elaborated here.

[0144] Portable fluxgate magnetometers (such as magnetometers) used in related technologies have limitations in terms of functional integration, human-computer interaction, and measurement accuracy, making it difficult to meet the urgent needs of modern field real-time, high-precision, and convenient detection.

[0145] For example, in actual measurements, in terms of human-computer interaction, most magnetometers based on the fluxgate principle (i.e., magnetometers) still rely on a few physical buttons or non-intelligent touchscreens for operation. The menu hierarchy is complex, the parameter settings are cumbersome, and the intuitive "what you see is what you get" operation experience is not achieved, which is in stark contrast to the smooth touch interaction of current smart terminals.

[0146] In terms of measurement accuracy, traditional fluxgate technology is limited by inherent systematic errors in sensors, such as zero-point drift, triaxial non-orthogonality error, and scaling factor error. This, to some extent, restricts the practical accuracy and convenience that the instrument can ultimately achieve. Therefore, there is an urgent need for a portable fluxgate-based magnetometer (i.e., magnetometer) that integrates intelligent measurement, user-friendly interaction, high precision, and easy calibration to overcome the aforementioned limitations.

[0147] The purpose of this invention is to provide a portable magnetometer (e.g., a magnetometer) based on the fluxgate principle and its high-precision calibration method, aiming to solve the problems of low efficiency of human-computer interaction in the field, single function, and limited accuracy of traditional calibration methods in existing high-precision magnetometer devices (e.g., magnetometers).

[0148] In one aspect, the invention significantly improves the ease of operation and on-site data visualization and analysis capabilities of the device by integrating a multi-functional large-screen touchscreen LCD (Liquid Crystal Display) interface. In another aspect, the invention introduces an advanced calibration method (i.e., a method for calibrating a magnetometer), which can simultaneously compensate for multiple factors such as the sensor's own zero bias, scaling factor error, triaxial non-orthogonality error, and environmental magnetic interference, thereby achieving magnetic field measurements with nT-level or even higher precision.

[0149] To address the aforementioned issues, the overall system design of this invention is divided into hardware-level design and software-level design.

[0150] Figure 2 A schematic diagram of the hardware system structure of a magnetometer according to an embodiment of the present invention is shown.

[0151] like Figure 2 As shown, the magnetometer hardware system adopts an architecture that physically separates analog and digital hardware structures, ensuring that high-precision analog signals are protected from digital noise interference at the physical level. The specific structural components of the magnetometer hardware system are as follows.

[0152] The analog hardware structure includes: (1) an external high-precision fluxgate probe: using a MAGSON probe; (2) an excitation module: the excitation module includes an LC oscillation unit that outputs excitation to the excitation coil in the probe, converting the control signal output by the FPGA control module into an alternating magnetic field driving the probe; (3) an induction module: the induction module includes a front-end low-pass filter and a differential amplifier circuit, which collects the weak voltage signal output by the induction coil in the probe, containing information about the external magnetic field, and uses the ADC in the induction module to process the weak voltage signal and output the collected second harmonic to the FPGA control module; (4) a feedback module: the feedback module includes a high-precision coarse-tuning DAC (i.e., MDAC) and a fine-tuning DAC (i.e., NDAC) to generate a precise compensation magnetic field. That is, the FPGA control module converts the first digital value output by the ADC to obtain the second digital value, and inputs the second digital value into the corresponding DAC. The feedback module of the corresponding DAC processes the second digital value and outputs the processed signal to the feedback coil in the probe to generate a precise compensation magnetic field. This dual-DAC architecture, combined with different amplification resistor networks, achieves wide dynamic range and high-resolution compensation, which is the key to ensuring the linearity and accuracy of the system. The analog hardware circuit may include an excitation module, a sensing module, and a feedback module.

[0153] The digital hardware structure includes digital hardware circuits. The digital hardware circuits include: (1) an integrated large-size LCD touch screen, which provides the main human-machine interface and displays image data from the core board on the LCD touch screen; (2) a USB (Universal Serial Interface) module, including USB 2.0, for users to interact with the USB flash drive to store magnetic field data and for loading the 4G module; (3) an Ethernet, for transmitting Ethernet data (e.g., magnetic field data) from the core board to the host computer; (4) an SD card module, for storing the Linux boot program and data storage, wherein the SD card module includes SD storage and SD boot, SD storage is used to store magnetic field data from the core board in SD card 1 included in SD storage, and SD boot is used to send the boot file from SD card 2 included in SD boot to the core board; (5) a debug serial port, electrically connected to the host computer, for sending debug commands from the host computer to the core board and sending debug data from the core board to the host computer.

[0154] The core board of the system, which processes data from both analog and digital hardware architectures, includes a digital processing core module. This module utilizes a fully programmable system-on-a-chip (SoC) that integrates an FPGA control module and an ARM (Advanced RISC Machine) processor. The FPGA control module and the ARM processor are connected via AXI (Advanced eXtensible Interface).

[0155] The FPGA handles all high real-time tasks. Its programmable logic resources are used to implement precise timing control of excitation signals, synchronous sampling of multiple ADCs, and hardware acceleration of the critical binary search algorithm.

[0156] The ARM processor acts as the system controller, running a pre-defined embedded operating system. It is responsible for data storage, network communication, file system management, and driving upper-layer application interfaces developed based on the pre-defined framework.

[0157] The following will be based on Figure 2 The hardware system structure of the magnetometer shown is further explained along with the design and workflow of its related software system.

[0158] The software system and hardware architecture work closely together, consisting of three layers, to complete the entire process from signal acquisition to high-precision magnetic field value output. The three layers are: FPGA logic layer, ARM system layer, and host computer calibration layer.

[0159] Figure 3 A schematic diagram of the logic control of an FPGA control module according to an embodiment of the present invention is shown.

[0160] Figure 3 The FPGA logic layer shown includes an FPGA control module for hardware acceleration and real-time control.

[0161] like Figure 3 As shown, the FPGA control module can perform excitation control and phase calibration.

[0162] The FPGA control module can receive instructions from the ARM and perform corresponding control and data processing according to the instructions to realize instruction reception and data processing.

[0163] The FPGA control module generates excitation commands. The excitation control unit within the FPGA control module converts these commands into corresponding control signals, enabling the excitation module in the analog hardware circuit to generate a highly stable excitation signal based on these control signals. The FPGA control module automatically scans and locks the optimal sampling phase point of the ADC for the sensed signal based on the sampled values ​​output by the ADC, ensuring that data is acquired at the moment of maximum signal peak-to-peak value and highest signal-to-noise ratio, thereby achieving phase calibration.

[0164] The ADC control unit in the FPGA control module can output corresponding control signals to control the three-axis ADC to synchronously acquire data. The ADC control unit can control the high-resolution (such as 18-bit or 24-bit) ADC to synchronously sample and digitize the conditioned analog signal, and send the sampled values ​​to the FPGA control module.

[0165] The DAC control unit in the FPGA control module enables the feedback module to perform rapid binary search calibration. During system startup or periodic calibration, the binary search algorithm implemented in the FPGA's internal hardware logic begins operation. This algorithm quickly traverses the code value space of the coarse-tuned and fine-tuned DACs, locking in the optimal operating parameters that bring the ADC's average sampling value closest to zero. This hardware implementation reduces calibration time from seconds to milliseconds, significantly improving device readiness speed and user experience.

[0166] For example, the FPGA control module can scan the phase of the ADC sampled data based on instructions from the ARM, lock the phase point with the largest second harmonic amplitude as the optimal sampling time, and complete the phase calibration. The computing unit in the FPGA control module can calculate the average value of multiple consecutive sampled values ​​of the ADC (i.e., the first digital value). The feedback processing unit in the FPGA control module outputs a feedback code value (i.e., the second digital value) based on this average value. The code conversion unit in the FPGA control module calculates the predicted magnetic field based on the average value, the feedback code value, the standard magnetic field, and the calibration coefficients. The FPGA control module processes and packages the first digital value, the second digital value, and the predicted magnetic field, and then transmits them to the ARM.

[0167] According to an embodiment of the present invention, the predicted value obtained by triaxial calculation , , The final calculated value from the magnetometer is then stably transmitted to the ARM processor responsible for control via a high-speed internal data channel, such as the channel corresponding to the AXI interface, through the FPGA control module.

[0168] The ARM system layer, based on a predetermined system running on an ARM processor, reads preprocessed data from the FPGA control module via a kernel driver interface. Its backend service program is responsible for storing data with timestamps and location information (such as GPS) into an SD card or lightweight database and managing network communication. Its frontend human-machine interface is a graphical interface developed based on a predetermined framework, and its applications run on an LCD touchscreen.

[0169] Figure 4 A schematic diagram of a human-computer interaction interface according to an embodiment of the present invention is shown.

[0170] After receiving data, the ARM processor parses and processes it, then hands it over to the graphics software running on it. The graphics software can then drive... Figure 4 The human-computer interaction interface shown.

[0171] Users can interact with the display screen. For example, they can select the magnetic field detection direction as the X-axis, select probe 1, adjust the refresh interval to a suitable value, such as adjusting the refresh interval (i.e., the time difference between adjacent acquisition moments) to 0.2s, click "Start Plotting" to display the waveform corresponding to the magnetic field magnitude, and click "Redraw" to redraw the waveform.

[0172] The image processing software can display the magnitude and direction changes of the obtained magnetic field as real-time fluctuating curves, jumping numbers, and intuitive spectrum graphs on the human-computer interaction interface (i.e., touch screen), generating a magnetic field image on the touch screen for easy viewing by the user. It provides users with an intuitive touch operation experience, enabling functions such as parameter setting (e.g., range, filtering parameters), real-time display of magnetic field waveforms and values, historical data playback, and file operations.

[0173] Users can operate directly on the touchscreen, such as pausing measurements by tapping an empty area of ​​the screen or adjusting charts by double-tapping. All measurement results can be easily saved, either directly to the magnetometer's internal memory card or copied to a USB flash drive via serial port. Simultaneously, the magnetometer's built-in network cable and 4G module allow data to be instantly uploaded to a computer or cloud service for further analysis and sharing.

[0174] The host computer calibration layer performs the final system-level calibration in a controlled laboratory environment, which is the core of achieving nT-level or even higher accuracy. By placing the system in a series of standard magnetic fields of known strength, a large dataset containing raw readings and actual magnetic field values ​​is collected. Then, the least squares method is used for calculation and fitting to solve for the optimal set of calibration parameters that can compensate for various hardware errors such as triaxial non-orthogonality, scale factor error, and zero bias.

[0175] The specific process of calibrating the magnetometer using the least squares method in this invention is as follows: (1) Data acquisition: Place the magnetometer in a standard magnetic field of high uniformity and known intensity (such as the magnetic field generated by a Helmholtz coil). Run a program (such as a MATLAB program) on a host computer (such as a computer) to control the magnetometer to perform measurements under multiple standard magnetic fields of different directions and intensities, and simultaneously record a large number of original digital code values ​​of the ADC output of the three axes, namely the X-axis, Y-axis, and Z-axis, as well as the second digital values ​​input to the coarse-tuning DAC (i.e., MDAC) and the fine-tuning DAC (i.e., NDAC); (2) Calibration coefficient calibration: Write code for calibration using the least squares method based on the predetermined software to realize Figure 1 The method for calibrating a magnetometer is shown.

[0176] Figure 5 A flowchart of a method for calibrating a magnetometer according to another embodiment of the present invention is shown.

[0177] Figure 5 This invention describes the specific process for calibrating a magnetometer based on the dichotomy method.

[0178] like Figure 5 As shown, the method for calibrating a magnetometer in this embodiment includes operations S501 to S510.

[0179] When operating the S501, perform coarse DAC initialization.

[0180] During the operation of S502, fine-tuning the DAC initialization was performed.

[0181] When operating the S503, coarsely adjust the DAC binary polling method.

[0182] In operation S504, it is determined whether the coarse adjustment DAC has reached the set minimum value. Specifically, operation S504 mainly determines whether the polling number of the coarse adjustment DAC has reached the set minimum value.

[0183] If the coarse adjustment of the DAC reaches the set minimum value, proceed to operation S505 to confirm that the total magnetic field is out of range. Then return to operation S501. If the coarse adjustment of the DAC does not reach the set minimum value, proceed to operation S506 to confirm whether the ADC is out of range.

[0184] If the ADC exceeds its range, return to operation S503. If the ADC does not exceed its range, proceed to operation S507 to fine-tune the DAC's binary polling method.

[0185] The S508 operation determines whether the fine-tuning DAC has reached the set minimum value. Specifically, the S508 operation primarily determines whether the polling count for the fine-tuning DAC has reached the set minimum value.

[0186] If the fine-tuning of the DAC reaches the set minimum value, return to operation S501. If the fine-tuning of the DAC does not reach the set minimum value, proceed to operation S509 to determine if the ADC is out of range.

[0187] If the ADC exceeds its range, return to operation S507. If the ADC does not exceed its range, proceed to operation S510 to confirm that the magnetic field feedback is stable and obtain the final value. The final value is the first digital value and the second digital value acquired.

[0188] Figure 6A A graph showing the fitting effect between the predicted magnetic field and the measured magnetic field along the X-axis obtained by a magnetometer according to an embodiment of the present invention is shown. Figure 6B It shows Figure 6A The residual plot of the predicted magnetic field and the measured magnetic field on the X-axis obtained by the magnetometer in the image.

[0189] Figure 6A The calibration coefficients used in the magnetometer are obtained by the method for calibrating a magnetometer according to an embodiment of the present invention. Figure 6A The horizontal axis represents the measured magnetic field in nT (nanotesla), and the vertical axis represents the predicted magnetic field in nT (nanotesla). Figure 6B The horizontal axis represents the sample index, and the vertical axis represents the residual, with the unit being nT (nanotesla).

[0190] Depend on Figure 6A It can be seen that the slope of the fitted straight line is 0.999987. With the measured magnetic field being 0, the deviation of the predicted magnetic field along the X-axis detected by the magnetometer in this embodiment of the invention relative to the measured magnetic field is -0.179284. Figure 6B It can be seen that the residual between the predicted magnetic field and the measured magnetic field of the X-axis detected by the magnetometer in this embodiment of the invention is between -1.5nT and 2nT, indicating that the predicted magnetic field and the measured magnetic field of the X-axis detected by the magnetometer in this embodiment of the invention are relatively close, and the predicted magnetic field of the X-axis detected by the magnetometer in this embodiment of the invention is more accurate and has higher precision.

[0191] According to embodiments of the present invention, the advantages and positive effects of the portable high-precision vector magnetometer of the present invention are mainly reflected in the following aspects:

[0192] In terms of algorithms, the FPGA hardware-accelerated bisection search algorithm significantly shortens the calibration time of the probe feedback DAC parameters, achieving millisecond-level fast convergence and solving the problem of the long time consumption of traditional methods. The least squares method is used to accurately calibrate the probe coefficients, effectively reducing random errors and system biases. Thus, without necessarily pursuing the highest absolute accuracy, the repeatability and long-term reliability of the measurement are greatly improved.

[0193] At the system level, the highly integrated low-noise analog front-end circuit design, combined with the embedded pre-set system and rich interfaces such as LCD touch screen, network port, USB interface and SD storage, constitutes a truly integrated and portable measurement platform, which simplifies the field operation process. Its graphical interface and real-time data image display function enhance the intuitiveness and convenience of human-computer interaction.

[0194] Furthermore, the targeted hardware and software co-design of this invention ensures the device's anti-interference capability and continuous operational stability in complex electromagnetic environments, while its modular architecture provides flexibility for future functional expansion. In summary, this invention integrates high-precision vector measurement capabilities, excellent ease of use, and good reliability, providing a highly efficient, stable, and user-friendly solution for the field of geomagnetic measurement.

[0195] Based on the above-described method for calibrating a magnetometer, embodiments of the present invention also provide an apparatus for calibrating a magnetometer.

[0196] Figure 7 A block diagram of an apparatus for calibrating a magnetometer according to an embodiment of the present invention is shown.

[0197] like Figure 7 As shown, the device 700 for calibrating a magnetometer includes an acquisition module 710, a data collection module 720, a construction module 730, and a result module 740.

[0198] According to an embodiment of the present invention, the magnetometer includes induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter, and a digital-to-analog converter.

[0199] The acquisition module 710 is used to acquire the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period.

[0200] The acquisition module 720 is used to acquire, within a predetermined time period, multiple first digital values ​​output by multiple analog-to-digital converters and multiple second digital values ​​input to multiple digital-to-analog converters when the first digital values ​​output by multiple analog-to-digital converters are all less than a first predetermined digital value. The first digital value is obtained by converting the induction signal of the induction coil of the corresponding axis to a standard magnetic field by the analog-to-digital converter. The second digital value input to the digital-to-analog converter is obtained by converting the first digital value output by the analog-to-digital converter of the corresponding axis. The digital-to-analog converter adjusts the magnetic field applied to the corresponding induction coil according to the input second digital value.

[0201] Module 730 is used to construct a set of calibration formulas using the least squares method, based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes.

[0202] Module 740 is obtained, which is used to perform least squares solution on the calibration formula set to obtain the calibration coefficients of the calibration formula, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formula.

[0203] It should be noted that the device part for calibrating the magnetometer in the embodiments of the present invention corresponds to the method part for calibrating the magnetometer in the embodiments of the present invention. For a detailed description of the device part for calibrating the magnetometer, please refer to the method part for calibrating the magnetometer, which will not be repeated here.

[0204] Figure 8 A block diagram of an electronic device suitable for implementing a method for calibrating a magnetometer according to an embodiment of the present invention is shown. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0205] like Figure 8 As shown, an electronic device 800 according to an embodiment of the present invention includes a processor 801, which can perform various appropriate actions and processes according to a program stored in ROM 802 or a program loaded from storage portion 808 into RAM 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0206] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 executes various operations of the method flow according to embodiments of the present invention by executing programs in ROM 802 and / or RAM 803. It should be noted that programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also execute various operations of the method flow according to embodiments of the present invention by executing programs stored in one or more memories.

[0207] According to an embodiment of the present invention, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the input / output (I / O) interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.

[0208] According to embodiments of the present invention, the method flow according to embodiments of the present invention can be implemented as a computer software program. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the method shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of the embodiments of the present invention. According to embodiments of the present invention, systems, devices, apparatuses, modules, units, etc., can be implemented by computer program modules.

[0209] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.

[0210] According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0211] For example, according to embodiments of the present invention, a computer-readable storage medium may include ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803.

[0212] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of the present invention. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the methods provided in the embodiments of the present invention.

[0213] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this invention. According to embodiments of the invention, systems, apparatuses, modules, units, etc., can be implemented using computer program modules.

[0214] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0215] According to embodiments of the present invention, program code for executing the computer programs provided in the embodiments of the present invention can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0216] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of the present invention can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention can be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or pairings fall within the scope of this invention.

[0217] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of the invention is defined by the appended embodiments and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.

Claims

1. A method for calibrating a magnetometer, characterized in that, The magnetometer includes induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter, and a digital-to-analog converter; the method includes: Obtain the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; During a predetermined time period, when the first digital values ​​output by multiple analog-to-digital converters are all less than a first predetermined digital value, multiple first digital values ​​output by multiple analog-to-digital converters and multiple second digital values ​​input to multiple digital-to-analog converters are collected. The first digital value is obtained by converting the induction signal of the corresponding axis's induction coil to the standard magnetic field by the analog-to-digital converter. The second digital value input to the digital-to-analog converter is obtained by converting the first digital value output by the analog-to-digital converter of the corresponding axis. The digital-to-analog converter adjusts the magnetic field applied to the corresponding induction coil according to the input second digital value. Using the least squares method, a set of calibration formulas is constructed based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes. The calibration formula set is solved by least squares to obtain the calibration coefficients of the calibration formula, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formula.

2. The method according to claim 1, characterized in that, The calibration formula set includes calibration formulas corresponding to each axis. The calibration formula set is constructed using the least squares method based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes. For each axis, using the least squares method, a calibration formula is constructed based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at the predetermined sampling time corresponding to each axis, and the first and second digital values ​​at the predetermined sampling time corresponding to the three axes. The standard magnetic field at the predetermined sampling time corresponding to each axis is located on one side of the calibration formula, while the system's inherent zero bias corresponding to each axis and the first and second digital values ​​at the predetermined sampling time corresponding to the three axes are located on the other side of the calibration formula.

3. The method according to claim 2, characterized in that, For each axis, using the least squares method, based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at a predetermined sampling time corresponding to each axis, and the first and second digital values ​​at predetermined sampling times corresponding to the three axes, the calibration formula for each axis is constructed as follows: Multiply the first digital value and the second digital value corresponding to the predetermined sampling time for each axis by the first coefficient and the second coefficient respectively to obtain the first term of the calibration formula corresponding to each axis; Multiply the first and second digital values ​​at the predetermined sampling time corresponding to the first axis orthogonal to each axis by the third and fourth coefficients respectively to obtain the second term of the calibration formula corresponding to each axis; Multiply the first and second digital values ​​at the predetermined sampling time corresponding to the second axis orthogonal to each axis by the fifth and sixth coefficients respectively to obtain the third term of the calibration formula corresponding to each axis; Using the least squares method, a calibration formula corresponding to each axis is constructed based on the system's inherent zero bias corresponding to each axis, the standard magnetic field at the predetermined sampling time corresponding to each axis, and the first, second, and third terms of the calibration formula corresponding to each axis.

4. The method according to claim 3, characterized in that, The least-squares solution of the calibration formula set to obtain the calibration coefficients of the calibration formula includes: Based on the predetermined value corresponding to the inherent zero bias of the system and the first and second digital values ​​at the i-th sampling time corresponding to the three axes, the data of the i-th row of the first matrix is ​​determined, where i is an integer greater than 0 and less than or equal to N, N is greater than the total number of calibration coefficients, and N is a positive integer; The i-th row of data in the second matrix is ​​determined based on the standard magnetic field at the i-th sampling time corresponding to the three axes; Using the least squares method, the calibration coefficients of the calibration formula are obtained based on the first matrix and the second matrix.

5. The method according to claim 3, characterized in that, The digital-to-analog converters (DACs) corresponding to each axis include a first DAC and a second DAC, wherein the magnetic field strength range corresponding to the second digital value input to the first DAC is greater than the magnetic field strength range corresponding to the second digital value input to the second DAC, and the maximum number of bits of the second digital value input to the first DAC is equal to the maximum number of bits of the second digital value input to the second DAC; the method further includes: If the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is greater than the second predetermined digital value, the second digital value input to the second digital-to-analog converter corresponding to any axis is kept at 0. At the same time, according to the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (j+1)th round, the second digital value input to the first digital-to-analog converter corresponding to any axis in the jth round is adjusted by binary division until the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than or equal to the second predetermined digital value, and the first target digital value input to the first digital-to-analog converter corresponding to any axis is obtained, where j is a positive integer; If the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than or equal to the second predetermined digital value and greater than or equal to the first predetermined digital value, the second digital value input to the first digital-to-analog converter corresponding to any axis is kept as the target second digital value. At the same time, according to the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (k+1)th round, the second digital value input to the second digital-to-analog converter corresponding to any axis in the kth round is adjusted by binary division until the absolute value of the first digital value output by the analog-to-digital converter corresponding to any axis is less than the first predetermined digital value, and the second target digital value input to the second digital-to-analog converter corresponding to any axis is obtained, where k is a positive integer; Within a predetermined time period, when the second digital value input to the first digital-to-analog converter corresponding to any axis is the first target digital value, and the second digital value input to the second digital-to-analog converter corresponding to any axis is the second target digital value, the first digital value output by the analog-to-digital converter corresponding to any axis is collected.

6. The method according to claim 5, characterized in that, Based on the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (j+1)th round, the second digital value input to the first digital-to-analog converter corresponding to any axis in the jth round is adjusted by binary division, including: Divide the first adjustment digital value of the j-th round into two parts to obtain the first adjustment digital value of the (j+1)-th round, where the initial value of the first adjustment digital value is the first predetermined initial digital value; If the first digital value output by the analog-to-digital converter corresponding to any axis in the (j+1)th round is greater than 0, the second digital value input to the first digital-to-analog converter corresponding to any axis in the (j+1)th round is subtracted from the first adjustment digital value in the (j+1)th round to obtain the second digital value input to the first digital-to-analog converter corresponding to any axis in the (j+1)th round. If the first digital value output by the analog-to-digital converter corresponding to any axis in the (j+1)th round is less than 0, the second digital value input to the first digital-to-analog converter corresponding to any axis in the jth round is added to the first adjustment digital value in the (j+1)th round to obtain the second digital value input to the first digital-to-analog converter corresponding to any axis in the (j+1)th round.

7. The method according to claim 5, characterized in that, Based on the sign of the first digital value output by the analog-to-digital converter corresponding to any axis in the (k+1)th round, the second digital value input to the second digital-to-analog converter corresponding to any axis in the kth round is subjected to binary adjustment, including: Divide the second adjustment digital value of the kth round into two parts to obtain the second adjustment digital value of the (k+1)th round, where the initial value of the second adjustment digital value is the second predetermined initial digital value; If the first digital value output by the analog-to-digital converter corresponding to any axis in the (k+1)th round is greater than 0, the second digital value input to the second digital-to-analog converter corresponding to any axis in the (k+1)th round is subtracted from the second adjustment digital value in the (k+1)th round to obtain the second digital value input to the second digital-to-analog converter corresponding to any axis in the (k+1)th round. If the first digital value output by the analog-to-digital converter corresponding to any axis in the (k+1)th round is less than 0, the second digital value input to the second digital-to-analog converter corresponding to any axis in the (k+1)th round is added to the second adjustment digital value in the (k+1)th round to obtain the second digital value input to the second digital-to-analog converter corresponding to any axis in the (k+1)th round.

8. The method according to claim 3, characterized in that, The first coefficient represents the influence coefficient of the first digital value of each axis on the standard magnetic field corresponding to each axis; the second coefficient represents the influence coefficient of the second digital value of each axis on the standard magnetic field corresponding to each axis; the third coefficient represents the influence coefficient of the first digital value of the first axis orthogonal to each axis on the standard magnetic field corresponding to each axis; the fourth coefficient represents the influence coefficient of the second digital value of the first axis orthogonal to each axis on the standard magnetic field corresponding to each axis; the fifth coefficient represents the influence coefficient of the first digital value of the second axis orthogonal to each axis on the standard magnetic field corresponding to each axis; and the sixth coefficient represents the influence coefficient of the second digital value of the second axis orthogonal to each axis on the standard magnetic field corresponding to each axis.

9. A device for calibrating a magnetometer, characterized in that, The magnetometer includes induction coils corresponding to three mutually orthogonal axes, an analog-to-digital converter, and a digital-to-analog converter. The device includes: The acquisition module is used to acquire the magnitude of the standard magnetic field applied to the induction coil corresponding to each axis within a predetermined time period; The acquisition module is used to acquire multiple first digital values ​​output by multiple analog-to-digital converters and multiple second digital values ​​input to multiple digital-to-analog converters within a predetermined time period when the first digital values ​​output by multiple analog-to-digital converters are all less than a first predetermined digital value. The first digital value is obtained by converting the induction signal of the induction coil of the corresponding axis to a standard magnetic field by the analog-to-digital converter. The second digital value input to the digital-to-analog converter is obtained by converting the first digital value output by the analog-to-digital converter of the corresponding axis. The digital-to-analog converter adjusts the magnetic field applied to the corresponding induction coil according to the input second digital value. The module is used to construct a set of calibration formulas using the least squares method, based on multiple standard magnetic fields, multiple first digital values, and multiple second digital values ​​corresponding to each of the three axes. The module is used to perform least-squares solution on the calibration formula set to obtain the calibration coefficients of the calibration formula, so that the magnetometer can detect the magnetic field strength of the target magnetic field according to the calibration formula.

10. An electronic device, comprising: One or more processors; Memory, used to store one or more programs. The characteristic is that, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1 to 8.

11. A computer-readable storage medium having executable instructions stored thereon, characterized in that, When executed by the processor, this instruction causes the processor to implement the method of any one of claims 1 to 8.

12. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the method according to any one of claims 1 to 8.