Harmonic compensation method for angle error of magnetic encoder

By constructing a harmonic compensation polynomial using the CORDIC algorithm and an adaptive notch filter, the angle error of the magnetic encoder is calculated in real time, solving the problems of storage dependence and linear interpolation error in existing technologies, and achieving high-precision, low-complexity angle compensation.

CN121994281APending Publication Date: 2026-05-08ONSAI MICROELECTRONICS (SHANGHAI) CO LTD

Patent Information

Application Number
CN202610465659.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-10
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing magnetic encoder angle error compensation methods rely on storage space size and require linear interpolation to introduce approximate errors, which cannot effectively compensate for harmonic drift.

Method used

The initial angle sequence is solved using the CORDIC algorithm. Harmonic components are extracted using an adaptive notch filter, a harmonic compensation polynomial is constructed, and the harmonic compensation is calculated in real time during actual measurement. The initial angle value is then subtracted to obtain the accurate angle.

Benefits of technology

It eliminates the need for external reference signals and large amounts of storage space, improves compensation accuracy, reduces computational complexity, adapts to environmental changes, and achieves efficient and high-precision angle measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121994281A_ABST
    Figure CN121994281A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a harmonic compensation method for an angle error of a magnetic encoder, and the method comprises the steps: enabling the magnetic encoder to rotate at a constant speed in a setting mode, collecting sine and cosine signals outputted by the magnetic encoder, and carrying out the calculation through CORDIC, thereby obtaining an initial angle sequence containing a fundamental wave error and a harmonic wave error; extracting each harmonic component through an adaptive wave trap, constructing a harmonic compensation polynomial, and storing each coefficient; in an application mode, a magnetic encoder signal is collected in real time, a current initial angle value is solved, a harmonic compensation amount is calculated according to a current fundamental wave angular frequency and a stored coefficient, and an accurate angle value is obtained by subtracting the compensation amount from the initial angle value. According to the method, external reference signals and a large amount of storage space are not needed, each harmonic error is directly eliminated through a harmonic compensation polynomial, and approximate errors caused by traditional linear interpolation are avoided; and the compensation precision can be improved only by increasing polynomial terms, and the storage requirement is not obviously increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of magnetoelectric encoder technology, and specifically to a harmonic compensation method for angle error of a magnetoelectric encoder. Background Technology

[0002] Magnetoelectric encoders are angle measurement sensors widely used in industrial automation, robotics, automotive electronics, and other fields. Their basic principle is to sense the changing magnetic field generated by the rotor's rotation using a magnetic sensor chip, converting it into analog sine and cosine signals. These signals are then converted to digital signals and decoded to obtain the rotor's precise position information. Compared to photoelectric encoders, magnetic encoders have advantages such as strong resistance to contamination, fast response speed, and low cost. However, their accuracy is relatively lower, requiring error compensation to meet the demands of high-precision applications.

[0003] Currently, the mainstream methods for magnetic encoder angle error compensation can be mainly divided into the following categories:

[0004] 1. Compensation method based on table lookup and linear interpolation

[0005] This is currently the most widely used traditional compensation method. Its basic steps are: select N reference points with uniform step sizes within the range of 0° to 360°, measure the angle error of each reference point using a high-precision reference device, and establish an error compensation table; when the actual detected angle is between two reference points, calculate the compensation value of the current angle through linear interpolation, thereby achieving error correction.

[0006] However, this type of method has inherent limitations: First, the compensation accuracy is directly proportional to the number of reference points, and improving the accuracy requires collecting more calibration points, which leads to a significant increase in storage space requirements; Second, the compensation data between two points can only be obtained through linearization approximation, introducing interpolation errors; Third, each compensation operation involves multiplication and division, which takes a lot of time to implement through digital circuits, resulting in low computational efficiency; Fourth, this method cannot effectively compensate for harmonic drift caused by temperature changes.

[0007] 2. Harmonic Compensation Method Based on Fourier Transform

[0008] To overcome the limitations of the lookup table method, researchers have proposed a compensation method based on harmonic analysis. Patent CN117516596A published by Huazhong University of Science and Technology proposes an online compensation scheme: multiple points are sampled every revolution of the motor rotor, harmonic components are obtained through FFT calculation, harmonics in the X and Y channel signals are removed, orthogonality correction is performed, and harmonic parameters can be iteratively updated to achieve online temperature compensation. This method can adapt to harmonic drift caused by temperature changes, but it requires FFT calculation every revolution, resulting in high computational complexity.

[0009] 3. Compensation method based on specified harmonic extraction

[0010] This method utilizes a dual-synchronous rotating coordinate system to transform the sine and cosine signals of the magnetic encoder. A forward and reverse decoupling network is then used to extract harmonic components of a specified order, which are then fed back into the original signal for subtraction, forming a closed-loop compensation. This method can accurately compensate for harmonics of specific orders, but the system structure is relatively complex, involving multiple coordinate transformations and decoupling operations.

[0011] 4. Intelligent compensation methods based on machine learning and deep learning

[0012] In recent years, researchers have attempted to introduce artificial intelligence technology into the field of magnetic encoder error compensation. One scholar proposed a hybrid prediction model based on improved deep belief networks, combining variational mode decomposition feature engineering and particle swarm optimization algorithms. This model incorporates temperature into the prediction feature sequence, effectively reducing the interference of errors on the prediction results through feature engineering, thus improving accuracy from 0.22° to 0.0025°. While this method offers high compensation accuracy, it requires a large amount of training data and significant computational resources, making it difficult to deploy in resource-constrained embedded systems.

[0013] 5. Real-time tracking compensation method based on phase-locked loop

[0014] To address dynamic errors under variable speed conditions, some researchers have proposed an angle calculation method based on a high-order phase-locked loop (PLL). This method uses an adaptive filter to remove noise and harmonic effects from orthogonal signals, effectively eliminating steady-state estimation errors during speed changes. While applicable to dynamic conditions, this method places high demands on the design of filter parameters. Summary of the Invention

[0015] To address this, embodiments of the present invention provide a harmonic compensation method for the angle error of a magnetic encoder, thereby solving the technical problem that the compensation accuracy of existing technologies depends on the size of the storage space and that linear interpolation between two points introduces approximate errors.

[0016] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0017] According to a first aspect of the present invention, a harmonic compensation method for angle error of a magnetic encoder is provided, the method comprising:

[0018] While the magnetic encoder is rotating at a constant speed, its output sine and cosine signals are collected, and the initial angle sequence containing the fundamental wave and harmonic errors is obtained by CORDIC algorithm.

[0019] Harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component and construct a harmonic compensation polynomial.

[0020] Store the coefficients of the harmonic compensation polynomial;

[0021] During the actual angle measurement process, the sine and cosine signals output by the magnetic encoder are acquired in real time, and the initial angle value at the current moment is obtained by the CORDIC algorithm.

[0022] Calculate the harmonic compensation amount based on the fundamental angular frequency at the current moment and the stored harmonic compensation polynomial coefficients;

[0023] Subtract the harmonic compensation amount from the initial angle value to obtain the compensated accurate angle value.

[0024] Furthermore, harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component, and a harmonic compensation polynomial is constructed, including:

[0025] An adaptive notch filter is used to filter the initial angle sequence to extract the fundamental frequency and each harmonic component, and the amplitude of each harmonic is obtained.

[0026] Furthermore, the center frequency of the adaptive notch filter tracks the change in the fundamental angular frequency.

[0027] Furthermore, in the harmonic compensation polynomial, the harmonic order ranges from 2 to 8.

[0028] Furthermore, harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component and construct a harmonic compensation polynomial, which also includes:

[0029] The initial angle sequence of multiple cycles is collected under uniform rotation, and the amplitude of each harmonic is obtained by Fourier transform or adaptive notch filter.

[0030] Furthermore, based on the current fundamental angular frequency and the stored harmonic compensation coefficients, harmonic compensation is calculated, including:

[0031] The fundamental angular frequency is determined in real time by measuring the current rotational speed of the magnetic encoder.

[0032] Furthermore, the magnetic encoder is an AMR magnetoresistive encoder, whose output sine and cosine signals are 45 degrees phase.

[0033] Furthermore, the CORDIC algorithm converts Cartesian coordinates to polar coordinates through iterative rotation to calculate the initial angle value.

[0034] Furthermore, the constructed harmonic compensation polynomial contains only cosine terms.

[0035] Furthermore, when it is necessary to improve the compensation accuracy, the number of terms in the harmonic compensation polynomial is increased.

[0036] The embodiments of the present invention have the following advantages:

[0037] This invention includes a setting mode and an application mode. In the setting mode, the magnetic encoder rotates at a constant speed, and its output sine and cosine signals are collected. The initial angle sequence, including fundamental and harmonic errors, is obtained through CORDIC calculation. Harmonic components are extracted using an adaptive notch filter, a harmonic compensation polynomial is constructed, and the coefficients are stored. In the application mode, the magnetic encoder signal is collected in real time, and the current initial angle value is calculated. The harmonic compensation amount is calculated based on the current fundamental angular frequency and the stored coefficients. The accurate angle value is obtained by subtracting the compensation amount from the initial angle value. This invention requires no external reference signal or large storage space. It directly eliminates harmonic errors through the harmonic compensation polynomial, avoiding the approximation errors caused by traditional linear interpolation. Improving compensation accuracy only requires increasing the number of polynomial terms, with no significant increase in storage requirements. It has the advantages of low storage overhead, high computational efficiency, high compensation accuracy, and strong environmental adaptability. Attached Figure Description

[0038] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0039] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0040] Figure 1 A schematic flowchart illustrating a harmonic compensation method for angle error of a magnetic encoder provided in an embodiment of the present invention;

[0041] Figure 2 This is a schematic diagram illustrating the application principle of a harmonic compensation method for angle error of a magnetic encoder provided in an embodiment of the present invention. Detailed Implementation

[0042] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0043] To address the technical problems mentioned above, the accuracy of compensation in existing technologies depends on the size of the storage space and requires linear interpolation between two points, which introduces approximate errors.

[0044] refer to Figure 1 and Figure 2 This invention discloses a harmonic compensation method for the angle error of a magnetic encoder, the method comprising:

[0045] While the magnetic encoder is rotating at a constant speed, its output sine and cosine signals are collected, and the initial angle sequence containing the fundamental wave and harmonic errors is obtained by CORDIC algorithm.

[0046] Harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component and construct a harmonic compensation polynomial.

[0047] Store the coefficients of the harmonic compensation polynomial;

[0048] During the actual angle measurement process, the sine and cosine signals output by the magnetic encoder are acquired in real time, and the initial angle value at the current moment is obtained by the CORDIC algorithm.

[0049] Calculate the harmonic compensation amount based on the fundamental angular frequency at the current moment and the stored harmonic compensation polynomial coefficients;

[0050] Subtract the harmonic compensation amount from the initial angle value to obtain the compensated accurate angle value.

[0051] Furthermore, harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component, and a harmonic compensation polynomial is constructed, including:

[0052] An adaptive notch filter is used to filter the initial angle sequence to extract the fundamental frequency and each harmonic component, and the amplitude of each harmonic is obtained.

[0053] Furthermore, the center frequency of the adaptive notch filter tracks the change in the fundamental angular frequency.

[0054] Furthermore, in the harmonic compensation polynomial, the harmonic order ranges from 2 to 8.

[0055] Furthermore, harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component and construct a harmonic compensation polynomial, which also includes:

[0056] The initial angle sequence of multiple cycles is collected under uniform rotation, and the amplitude of each harmonic is obtained by Fourier transform or adaptive notch filter.

[0057] Furthermore, based on the current fundamental angular frequency and the stored harmonic compensation coefficients, harmonic compensation is calculated, including:

[0058] The fundamental angular frequency is determined in real time by measuring the current rotational speed of the magnetic encoder.

[0059] Furthermore, the magnetic encoder is an AMR magnetoresistive encoder, whose output sine and cosine signals are 45 degrees phase.

[0060] Furthermore, the CORDIC algorithm converts Cartesian coordinates to polar coordinates through iterative rotation to calculate the initial angle value.

[0061] Furthermore, the constructed harmonic compensation polynomial contains only cosine terms.

[0062] Furthermore, when it is necessary to improve the compensation accuracy, the number of terms in the harmonic compensation polynomial is increased.

[0063] The method proposed in this embodiment of the invention includes two stages: a setting mode and an application mode.

[0064] I. Setting Mode

[0065] The purpose of setting the mode is to obtain the harmonic components in the angle error of the magnetic encoder and to establish a harmonic compensation model.

[0066] First, mount the AMR magnetoresistive encoder to be calibrated onto a precision turntable, ensuring that the turntable's rotation axis is coaxial with the encoder's rotation axis. Start the turntable to drive the encoder rotor to rotate at a constant angular velocity to ensure sufficient data collection cycles.

[0067] During uniform rotation, the magnetic encoder outputs two signals: a sine signal sinθ and a cosine signal cosθ. These two signals are sampled by an analog-to-digital converter and sent to the CORDIC algorithm module. Through iterative rotation, the rectangular coordinates are converted to polar coordinates, and the initial angle value s(t) is calculated. Due to factors such as magnetic circuit inhomogeneity, installation eccentricity, and temperature drift inherent in the magnetic encoder, s(t) contains not only the ideal linearly increasing angle but also the fundamental frequency and various harmonic errors.

[0068] Next, harmonic analysis is performed on s(t). In this embodiment, an adaptive notch filter is used to extract the fundamental frequency and each harmonic component. s(t) is input to multiple cascaded adaptive notch filters, each locked to a different frequency. The notch filter parameters are adjusted using an adaptive algorithm so that the output is the component of the corresponding frequency. After processing by the adaptive notch filter, the fundamental frequency component and each harmonic component can be separated, and the amplitude of each harmonic can be obtained.

[0069] After obtaining the amplitude values ​​of the fundamental frequency and each harmonic, a harmonic compensation polynomial is constructed:

[0070]

[0071] Where n is the harmonic order, C n ω0 is the compensation coefficient for the corresponding harmonics, and ω0 is the fundamental angular frequency. According to the error characteristics of the AMR magnetic encoder, its main error is concentrated in the 2nd to 8th harmonics, therefore, in this embodiment, n=2 to 8 is selected.

[0072] The calculated coefficients C2 to C8 are saved to the non-volatile memory of the encoder system, such as EEPROM or Flash, for use in mode calls.

[0073] II. Application Mode

[0074] Application mode is the normal operating mode of the encoder in a real working scenario.

[0075] After the encoder is powered on and initialized, it reads the pre-stored harmonic compensation coefficients C2~C8 from the memory. During actual angle measurement, the encoder acquires the sinusoidal signal sinθ and the cosine signal cosθ in real time, and calculates the initial angle value s at the current moment using the CORDIC algorithm. meas(t) .

[0076] Based on the current fundamental angular frequency ω0 and the stored harmonic compensation coefficient C n Substituting the current initial angle value into the harmonic compensation polynomial, the harmonic compensation amount f is calculated. meas(t) .

[0077] Finally, subtract the harmonic compensation amount from the initial angle value to obtain the accurate angle value after compensation:

[0078] θcomp(t) = s meas(t) -f meas(t)

[0079] θcomp(t) is the final high-precision angle value. This signal is a relatively pure sine or cosine signal, resulting in a relatively pure fundamental component, which can be applied to servo control, robot joint position feedback, and other applications.

[0080] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.

Claims

1. A method for harmonic compensation of angle error in a magnetic encoder, characterized in that, The method includes: While the magnetic encoder is rotating at a constant speed, its output sine and cosine signals are collected, and the initial angle sequence containing the fundamental wave and harmonic errors is obtained by CORDIC algorithm. Harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component and construct a harmonic compensation polynomial. Store the coefficients of the harmonic compensation polynomial; During the actual angle measurement process, the sine and cosine signals output by the magnetic encoder are acquired in real time, and the initial angle value at the current moment is obtained by the CORDIC algorithm. Calculate the harmonic compensation amount based on the fundamental angular frequency at the current moment and the stored harmonic compensation polynomial coefficients; Subtract the harmonic compensation amount from the initial angle value to obtain the compensated accurate angle value.

2. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, Harmonic analysis is performed on the initial angle sequence to extract the amplitude of each harmonic component, and a harmonic compensation polynomial is constructed, including: An adaptive notch filter is used to filter the initial angle sequence to extract the fundamental frequency and each harmonic component, and the amplitude of each harmonic is obtained.

3. The harmonic compensation method for angle error of a magnetic encoder as described in claim 2, characterized in that, The center frequency of the adaptive notch filter tracks the change in the fundamental angular frequency.

4. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, In the harmonic compensation polynomial, the harmonic order ranges from 2 to 8.

5. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, The process includes performing harmonic analysis on the initial angle sequence, extracting the amplitude of each harmonic component, and constructing a harmonic compensation polynomial, further comprising: The initial angle sequence of multiple cycles is collected under uniform rotation, and the amplitude of each harmonic is obtained by Fourier transform or adaptive notch filter.

6. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, Based on the current fundamental angular frequency and the stored harmonic compensation coefficients, calculate the harmonic compensation amount, including: The fundamental angular frequency is determined in real time by measuring the current rotational speed of the magnetic encoder.

7. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, The magnetic encoder is an AMR magnetoresistive encoder, with a 45-degree phase difference between its two sets of output sine and cosine signals.

8. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, The CORDIC algorithm converts Cartesian coordinates to polar coordinates through iterative rotation, thereby calculating the initial angle value.

9. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, The constructed harmonic compensation polynomial contains only cosine terms.

10. The harmonic compensation method for angle error of a magnetic encoder as described in claim 1, characterized in that, When it is necessary to improve the accuracy of compensation, the number of terms in the harmonic compensation polynomial is increased.

Citation Information

Patent Citations

  • Harmonic calibration system and method and error harmonic component coefficient calculation system and method

    CN112904261A

  • High-precision magnetic encoder decoding method for compensating specified subharmonics

    CN114061632A

  • Harmonic error compensation method and circuit of magnetic encoder

    CN121783225A

  • Magnetic encoder apparatus

    US20150077092A1

  • Vibration compensation controller with neural network band-pass filters for bearingless permanent magnet synchronous motor

    US20230008153A1

Cited By

  • Temperature compensation method and system for magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filter

    CN122170748A