Method, apparatus, and medium for determining signal offset of a rotational angle sensor
By collecting data points in a rotation angle sensor and fitting a circle to determine the signal offset value, the problem of high calibration cost and low accuracy of rotation angle sensors in the prior art is solved, and fast and accurate signal offset compensation is achieved, which can adapt to temperature changes and device aging.
Patent Information
- Application Number
- CN202611507393.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-06
AI Technical Summary
Existing methods for calibrating the signal offset of rotation angle sensors are costly, have low accuracy, and insufficient responsiveness, and cannot effectively compensate for offset drift caused by temperature changes and device aging.
By collecting data points from a rotation angle sensor, a circle is fitted to determine the signal offset value. The signal offset value is determined using a triangle formed by at least three data points, reducing the dependence on the extreme values of signal sampling and improving accuracy and response speed.
It reduces the error in determining signal offset values, decreases calibration costs, improves the measurement accuracy and dynamic response of the rotation angle sensor over a wide temperature range, and supports offset drift compensation during long-term use.
Smart Images

Figure CN123045195A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of sensor signal processing technology, and in particular to a method, apparatus and medium for determining the signal offset of a rotation angle sensor. Background Technology
[0002] In modern industrial automation and automotive electronics, reliable measurement of the angular position of rotating components is a crucial requirement. For example, in motor control systems, knowing the real-time position of the motor rotor is a prerequisite for achieving efficient and stable operation.
[0003] To achieve non-contact angle measurement, rotation angle sensors are widely used in the industry. Rotation angle sensors can be implemented through different technical approaches, such as photoelectric, inductive, or magnetic sensing. Among them, rotation angle sensors based on the magnetic sensing principle output angle information by sensing changes in the magnetic field. They are characterized by simple structure and good environmental adaptability, and are a relatively common type of implementation.
[0004] Among various types of magnetically sensitive rotation angle sensors, anisotropic magnetoresistive (AMR) sensors are widely used due to their reliable performance and high cost-effectiveness. Taking an AMR sensor as an example, its basic working principle is: a magnet rotating synchronously with the rotating component generates a magnetic field with changing direction on the stationary AMR sensor. For example... Figure 1 As shown, the AMR sensor can convert changes in the magnetic field angle into two mutually orthogonal analog voltage signals: a sine signal Vsin and a cosine signal Vcos. Ideally, the angular position of the rotating component can be calculated using the arctangent function.
[0005] However, in actual production and applications, due to manufacturing process tolerances, material inhomogeneity, and environmental variations such as temperature, the output signals of rotation angle sensors, including AMR sensors, cannot reach an ideal state, exhibiting multiple error sources. Among these, signal offset (signal deviation) has a significant impact on angle measurement results. Specifically, the center voltages of the Vsin and Vcos signals are not ideal zero-point references, but rather possess their own signal offset values Os and Oc. If these two signal offset values are not effectively compensated for and directly used for angle calculation, it will lead to deviations in the measurement results.
[0006] To address the aforementioned signal offset problem, several calibration methods have been proposed in the prior art.
[0007] One type is the static calibration method at the end of the production line. This method involves performing calibration on the production line using testing equipment before the product leaves the factory. For example, single-temperature calibration involves driving the sensor to rotate a full circle in a fixed room temperature environment, and calculating the fixed signal offset values Os and Oc at that temperature by measuring the maximum and minimum values of the Vs and Vc signals. This method is relatively simple to implement, but its drawback is that it cannot compensate for the temperature drift of the signal offset value caused by temperature changes. To solve this problem, dual-temperature calibration has been proposed, which involves measuring at both low and high temperatures to calculate the temperature coefficient of the signal offset value, thereby compensating for temperature drift to some extent. However, this type of method has some common limitations: it is costly and complex, requiring precision turntables, high and low temperature chambers, and other testing fixtures. Furthermore, the temperature cycling and measurement processes are time-consuming, increasing production costs. In addition, it is a one-time factory calibration and cannot compensate for the performance degradation of the sensor due to device aging during long-term use.
[0008] Another type is the traditional dynamic calibration method. This method aims to eliminate the need for factory calibration by determining signal offset values online and adaptively during normal equipment operation. A typical approach involves continuously tracking and recording the maximum and minimum sampled values (Vs_max, Vc_max and Vs_min, Vs_min) of the Vs and Vc signals as the rotating component continues to rotate. The signal offset value is then calculated using the formulas Os = (Vs_max + Vs_min) / 2 and Oc = (Vc_max + Vc_min) / 2. However, this traditional dynamic calibration method has the following drawbacks: First, in digital systems, signal acquisition is discrete. The acquired maximum sampled value is often smaller than the actual physical peak value, and the minimum sampled value is often larger than the actual physical valley value. Using these biased extreme points to calculate the signal offset value introduces a certain systematic error, affecting the accuracy of the signal offset value determination. Secondly, in order to make the sampled extreme value as close as possible to the true extreme value, this method needs to accumulate a large number of data samples over multiple rotation cycles, which results in a relatively long time to obtain a usable signal offset value in the early stages of system startup; when the operating temperature changes rapidly, this method also needs to go through multiple cycles to track the new offset state, and the dynamic response capability needs to be improved.
[0009] In summary, how to effectively and quickly acquire and compensate for the signal offset of a rotation angle sensor, while taking into account low cost, wide operating temperature range adaptability, and long-term stability, remains a problem that needs to be solved in this field. Summary of the Invention
[0010] To address the shortcomings of existing technologies, this application provides a method, apparatus, and medium for determining the signal offset of a rotation angle sensor, particularly an AMR sensor. The purpose is to solve or improve the problems of high cost, low accuracy, and slow convergence caused by existing calibration methods relying on specific temperature points or inaccurate signal extreme values.
[0011] To achieve the above objectives, in a first aspect, this application provides a method for determining the signal offset of a rotation angle sensor, wherein the rotation angle sensor outputs a voltage signal when the rotation angle changes.
[0012] Equation (1)
[0013] Equation (2)
[0014] in:
[0015] A represents the amplitude;
[0016] The rotation angle;
[0017] Os is the sine offset value of the signal to be determined, and Oc is the cosine offset value of the signal to be determined.
[0018] The method includes:
[0019] S1. When the rotation angle changes, the rotation angle sensor collects a set of data points (Vs, Vc);
[0020] S2. Select at least three data points from the set of data points (Vs, Vc) to fit a circle;
[0021] The center coordinates of the fitted circle are the signal offset values Os and Oc.
[0022] Optionally, the fitting in step S2 includes least squares fitting.
[0023] Optionally, selecting at least three data points includes selecting a first data point, a second data point, and a third data point. These three data points can form a triangle with their vertices. The triangle can determine a unique circumcircle, which is the fitted circle.
[0024] Optionally, the first, second, and third data points are chosen such that they can form an acute triangle with themselves as vertices.
[0025] Furthermore, acute triangles include equilateral triangles.
[0026] Optionally, the first data point, the second data point, and the third data point are selected as follows:
[0027] Determine a first data point and a second data point from the set of data points (Vs, Vc), where the distance between the first data point and the second data point is equal to the diameter of the set of data points (Vs, Vc).
[0028] Construct the perpendicular bisector of the line segment with the first data point and the second data point as endpoints, and
[0029] Determine the third data point from the set of data points (Vs, Vc), where the distance from the third data point to the perpendicular bisector is the smallest.
[0030] Optionally, the first data point, the second data point, and the third data point are selected as follows:
[0031] Select the data point with the maximum value Vsmax from the set of data points (Vs, Vc) as the first data point;
[0032] Select the data point with the minimum value Vsmin from the set of data points (Vs, Vc) as the second data point, and
[0033] The data point closest to the median (Vsmax + Vsmin) / 2 is selected as the third data point.
[0034] Optionally, the first data point, the second data point, and the third data point are selected as follows:
[0035] Select the data point with the maximum value Vcmax of Vc from the set of data points (Vs, Vc) as the first data point;
[0036] Select the data point with the minimum value Vcmin from the set of data points (Vs, Vc) as the second data point, and
[0037] The data point whose Vc is closest to the median (Vcmax + Vcmin) / 2 is selected as the third data point.
[0038] Optionally, after step S1 and before step S2, a step is included to determine whether the data in the collected data point set (Vs, Vc) is sufficient for calculating the offset of the rotation angle sensor signal, including:
[0039] S11. Calculate the change in rotation angle based on the data points (Vs, Vc) collected from the rotation angle sensor;
[0040] S12. Determine whether the mechanical rotation exceeds the predetermined number of revolutions based on the calculated change in rotation angle, so as to generate a set of Vs or Vc values including the maximum and minimum data points (Vs, Vc).
[0041] S13. If so, start by selecting at least three data points to fit a circle in order to calculate the signal offset values Os and Oc.
[0042] S14. If not, continue rotating, collect the data point set (Vs, Vc) from the rotation angle sensor, and return to step S11.
[0043] Optionally, the number of laps can be 1 / 4 lap.
[0044] Optionally, the method further includes: periodically repeating the step of selecting at least three data points from the set of data points (Vs, Vc) to fit a circle, so as to continuously update the signal offset values Os and Oc.
[0045] Optionally, the three vertices of the triangle are the first vertex (Vs1, Vc1), the second vertex (Vs2, Vc2), and the third vertex (Vs3, Vc3), and the signal offset values Os and Oc are determined by the following equations:
[0046] Equation (3)
[0047] Equation (4).
[0048] Alternatively, equations (3) and (4) are obtained by the following method:
[0049] Applying the selected first vertex (Vs1, Vc1), second vertex (Vs2, Vc2), and third vertex (Vs3, Vc3) to equations (1) and (2) yields the following equations:
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056] Considering Eliminate rotation angle With amplitude A, we obtain equations (3) and (4).
[0057] In some embodiments of the first aspect, the rotation angle sensor is an anisotropic magnetoresistive sensor.
[0058] Secondly, this application provides a method for measuring rotation angle using a rotation angle sensor, comprising the following steps:
[0059] In the first time period, the signal offset values Os and Oc are obtained using the method of the first aspect or any one of the first aspects;
[0060] In the second time period following the first time period, the rotation angle is measured, and the measured value of the rotation angle sensor is compensated based on the signal offset values Os and Oc obtained in the first time period.
[0061] Thirdly, this application provides an apparatus for measuring rotation angle using a rotation angle sensor, comprising:
[0062] The offset acquisition module is used to acquire signal offset values Os and Oc in a first time period using the first aspect or any one of the first aspects;
[0063] An angle measurement module, connected to an offset acquisition module, is used to measure the rotation angle in a second time period after the first time period, and to compensate the measured value of the rotation angle sensor based on the signal offset values Os and Oc acquired in the first time period.
[0064] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of the first aspect or any embodiment of the first aspect.
[0065] This application has at least the following beneficial effects:
[0066] This application provides a method for determining the signal offset of a rotation angle sensor. By collecting data points output by the rotation angle sensor and fitting a circle, the signal offset value is determined using the center coordinates of the circle, reducing the dependence on the extreme values of signal sampling. Compared to traditional estimation methods based on the maximum and minimum values of samples, this method does not require the sampled extreme values to approximate the true physical extreme values, which helps reduce errors introduced by discrete sampling and thus improves the accuracy of the signal offset value determination result. Furthermore, this method only needs to calculate the signal offset value once based on a limited number of collected data points, without accumulating a large amount of data over multiple rotation cycles to approximate the true extreme values. This reduces the convergence time for determining the signal offset value and improves the response speed to changes in the working environment. Simultaneously, this method can be executed during equipment operation without relying on specialized factory calibration fixtures and processes, helping to reduce the calibration cost of the rotation angle sensor and supporting continuous updates of the signal offset value throughout the equipment's lifecycle to adapt to offset drift caused by temperature changes or device aging.
[0067] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0068] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application or the background art will be described below.
[0069] Figure 1 This is a schematic diagram of a typical output signal waveform of a rotation angle sensor during one mechanical rotation cycle.
[0070] Figure 2 A schematic diagram of the shaft end mounting structure for a rotation angle sensor;
[0071] Figure 3 This application provides a schematic flowchart of a method for determining the signal offset of a rotation angle sensor.
[0072] Figure 4 A geometrical schematic diagram (Vs-Vc plane) illustrating the signal offset determination principle of this application.
[0073] Figure 5 This is a schematic flowchart illustrating a process for determining whether a predetermined number of revolutions has been exceeded and calculating a signal offset value, as provided in an embodiment of this application.
[0074] Figure 6 This is a flowchart illustrating a method for dynamically updating signal offset values provided in an embodiment of this application. Detailed Implementation
[0075] The specific embodiments of this application will now be described in detail with reference to the accompanying drawings. It should be noted that the described embodiments are only a part of the embodiments of this application, and not all of them. These embodiments are provided to make the disclosure of this application clearer and more complete, so that those skilled in the art can understand and implement this application, and should not be construed as limiting the scope of protection of this application. In all the drawings, the same reference numerals indicate the same or similar parts or elements.
[0076] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “the” used herein are also intended to cover the plural forms. For example, references to “a component” or “a link” refer not only to a single entity but also to two or more entities of that type. The term “and / or” is intended to include any and all possible combinations of one or more of the associated listed items.
[0077] Furthermore, the terms “comprising,” “including,” or any other variations thereof as used herein are intended to cover non-exclusive inclusion. This means that a system, apparatus, or method that includes a list of features, steps, operations, elements, or components includes not only those elements expressly listed but also other elements not expressly listed or inherent to the system, apparatus, or method. Unless otherwise specified, an element defined by the phrase “comprising one…” does not exclude the presence of other identical elements in the system or method that includes that element.
[0078] To facilitate understanding of the technical solutions in this application, the following explanations are provided for some of the technical terms and jargon used in this document:
[0079] Rotation angle sensor: refers to a sensor that can convert the angular change of a rotating component into an electrical signal output. In this application, the rotation angle sensor can output two analog voltage signals, namely a sine signal Vsin and a cosine signal Vcos (hereinafter referred to as Vs and Vc, respectively, for ease of description). The rotation angle sensor can be implemented through different technical paths, such as magnetic (including anisotropic magnetoresistive sensors, etc.), photoelectric, or inductive.
[0080] Anisotropic magnetoresistive sensor (AMR sensor): A specific type of rotation angle sensor that operates based on the anisotropic magnetoresistive effect. Under the influence of a changing magnetic field generated by a rotating magnet, the AMR sensor outputs Vs and Vc signals. Some embodiments in this application are described using AMR sensors as examples, but this does not constitute a limitation on the scope of this application.
[0081] Signal offset values Os and Oc: These refer to the DC bias of the center voltages of the Vs and Vc signals output by the rotation angle sensor relative to an ideal zero-point reference. Os is the sine offset value, and Oc is the cosine offset value. The existence of these signal offset values affects the accuracy of angle calculations. The method in this application aims to determine and compensate for Os and Oc.
[0082] The data point (Vs, Vc) set refers to the pair of coordinate values formed by the Vs and Vc signals simultaneously acquired from the rotation angle sensor at a certain sampling moment, called a data point (Vs, Vc). The set of multiple data points acquired over a period of time is called the data point (Vs, Vc) set. In the Vs-Vc plane, each data point corresponds to a coordinate position. Under ideal, noise-free conditions and with equal amplitudes in the sine and cosine channels, all data points acquired during a full rotation are distributed on the same circle. This set is used to select at least three data points for subsequent circle fitting to determine the signal offset value.
[0083] Fitted circle: refers to fitting a circle in the Vs-Vc plane based on at least three selected data points using a certain fitting standard, such as the least squares method. The center coordinates of the circle are (Os, Oc), and the radius corresponds to the signal amplitude A.
[0084] Mechanical rotation cycle / number of revolutions: refers to the period or number of times a rotating component completes one full physical rotation. For the AMR sensor used as an example in this application, each mechanical rotation cycle includes two electrical signal cycles (i.e., Vs and Vc each complete two complete waveform cycles). The "predetermined number of revolutions" mentioned in this application refers to the number of mechanical rotations.
[0085] Electrical signal cycle: refers to the process corresponding to the Vs or Vc signal completing a full 2π waveform change. For AMR sensors, one mechanical rotation cycle corresponds to two electrical signal cycles.
[0086] The following embodiments are only used to illustrate the technical solutions of this application more clearly, and are therefore only examples and should not be used to limit the scope of protection of this application.
[0087] The embodiments of the present invention are described in detail below. This application provides a method for determining the signal offset of a rotation angle sensor. This method involves selecting at least three data points from the data points output by the rotation angle sensor and fitting a circle, using the center coordinates of the circle as the signal offset value. By using the offset value determined in this application to compensate for the signal, the accuracy and dynamic response capability of the angle measurement results can be improved.
[0088] like Figure 2 As shown in the figure, a typical physical configuration for which the method of this application can be applied is illustrated. A rotation angle sensor 102 can be fixedly mounted on a printed circuit board (PCB) 101. A rotating component 103, such as a motor shaft, steering column, industrial robot joint, or other equipment component requiring angle measurement, can have a permanent magnet 104 mounted at its end. The permanent magnet 104 can rotate synchronously with the rotating component 103. In this embodiment, a common shaft-end mounting method can be used, wherein the magnetic pole direction of the permanent magnet 104 can be perpendicular to its rotation axis and opposite to the sensing plane of the rotation angle sensor 102. When the rotating component 103 rotates, the direction of the magnetic field generated by the permanent magnet 104 also changes. The fixed rotation angle sensor 102 can non-contactly sense this change in magnetic field direction and convert it into a corresponding voltage signal.
[0089] In this embodiment, the rotation angle sensor 102 is an AMR sensor. The two orthogonal outputs of the AMR sensor have equal or substantially equal amplitudes (i.e., As=Ac), which makes the acquired data points (Vs, Vc) approximately form a circle rather than an ellipse in the Vs-Vc plane, thus providing a basis for the method of fitting a circle based on data points and determining the signal offset value with the center coordinates of the circle in this application. When the rotating component 103 drives the permanent magnet 104 to rotate, the rotation angle sensor 102 can output two analog voltage signals that vary with the rotation angle θ, namely Vs and Vc signals. The ideal mathematical model of these two signals can be described by equations (1) and (2):
[0090] Equation (1)
[0091] Equation (2)
[0092] Where A is the amplitude of the signal, θ is the mechanical rotation angle of the rotating component, and Os and Oc are the signal offset values that are to be determined in this embodiment due to factors such as manufacturing tolerances of the rotation angle sensor or changes in the working environment. The coefficient 2 in the above equations (1) and (2) represents the number of electrical signal cycles contained in one mechanical rotation cycle.
[0093] It should be noted that this embodiment assumes that the amplitudes of the sine and cosine signals are equal (both are A). In practical applications, there may be a slight amplitude mismatch between the sine and cosine signals. In this case, the data points (Vs, Vc) will fall on an ellipse instead of a circle, which will introduce a very small residual. Since the amplitude mismatch of sensors such as AMR is usually very small (e.g., no more than ±1%), its impact on the offset calculation can be ignored when the predetermined accuracy requirement allows. Therefore, this application processes it according to amplitude matching. Under higher accuracy requirements, the amplitude normalization or elliptic correction of the sine and cosine signals can be performed first before applying this method.
[0094] Example 1
[0095] like Figure 3 As shown, in step S1, when the rotation angle changes, the rotation angle sensor collects a set of data points (Vs, Vc).
[0096] Specifically, when the rotation angle of the rotating component 103 begins to change, the voltage signal output by the rotation angle sensor 102 is continuously sampled, for example at a sampling rate of 10k, to obtain a set of data points (Vs, Vc) containing multiple discrete data points. The collected set of data points should preferably cover a sufficient range of rotation angles to select the feature data points required for subsequent calculations.
[0097] Step S2: Select at least three data points from the set of data points (Vs, Vc) to fit a circle; where the center coordinates of the fitted circle are the signal offset values Os and Oc.
[0098] Specifically, in an ideal scenario, the data points (Vs, Vc) collected by the rotation angle sensor are distributed on the same circle within the Vs-Vc plane, with the center coordinates of the circle being (Os, Oc) and the radius being the signal amplitude A. Therefore, determining the signal offset values Os and Oc is geometrically equivalent to determining the center of the circle using the collected data points. Based on this geometric relationship, step S2 involves selecting at least three data points for circle fitting and using the center coordinates of the fitted circle as the signal offset values Os and Oc.
[0099] There are several ways to fit a circle based on multiple discrete points. For example, in one implementation, the fitting includes least squares fitting. When more than three data points are selected, the least squares method is used to fit a circle to all selected data points to obtain statistically better circle center coordinates, thereby suppressing the influence of random noise from individual data points on the fitting result.
[0100] Example 2
[0101] In another implementation, only three data points are selected: a first data point, a second data point, and a third data point. These three data points form a triangle, which determines a unique circumcircle, and this circumcircle is the fitted circle.
[0102] Using three data points to determine the circumcircle with those points as vertices allows for the rapid calculation of the coordinates of the circumcircle's center, thus obtaining the signal offset value. This facilitates dynamic and rapid updating of the offset value during dynamic angle measurements, thereby improving measurement accuracy.
[0103] To ensure more stable fitting results, the three data points should ideally be selected such that they form an acute triangle with each other as vertices. When the three data points are relatively dispersed in the Vs-Vc plane and not concentrated in a small arc segment, such as 45 degrees, the circumcircle formed is relatively insensitive to small fluctuations in the position of the data points, which helps to improve the reliability of the signal offset value determination result.
[0104] Clearly, the acute triangle described above is preferably chosen as an equilateral triangle. In this case, the three data points are evenly distributed on the circle corresponding to the Vs-Vc plane, meaning the three points are approximately 120 degrees apart on the circumference. The resulting circumcircle is then least sensitive to minor fluctuations in the data point positions. This is because when the three points are evenly distributed on the circle, the small offset of any one point has a relatively balanced impact on the center of the circumcircle, and will not be amplified by the three points concentrating on a small arc segment.
[0105] Here, considering that the three data points that serve as the vertices of the triangle are discrete points of measurement, those skilled in the art will understand that the equilateral triangle mentioned above also includes an approximately equilateral triangle. That is to say, in this application, the definition of an equilateral triangle also includes an approximately equilateral triangle, in which the three sides of the equilateral triangle are equal or as close as possible.
[0106] There are several ways to select the three points that can form an equilateral triangle from a set of data points. For example, an enumeration method can be used to filter equilateral triangles from a discrete set of points based on area constraints. Specifically, all combinations of three points are traversed, and the area of the triangle formed by the three points of each combination is calculated. Based on the geometric principle that the equilateral triangle has the largest area among all inscribed triangles of a circle, the three points corresponding to the triangle with the largest area are selected as the final output. This effectively eliminates mismatches caused by local data fluctuations and ensures that the fitting results are true and reliable.
[0107] Example 3
[0108] In another embodiment, three data points are selected using the following method:
[0109] Determine a first data point and a second data point from the set of data points (Vs, Vc), where the distance between the first data point and the second data point is equal to the diameter of the set of data points (Vs, Vc).
[0110] Construct the perpendicular bisector of the line segment with the first data point and the second data point as endpoints, and
[0111] Determine the third data point from the set of data points (Vs, Vc), where the distance from the third data point to the perpendicular bisector is the smallest.
[0112] Here, the diameter of a point set refers to the distance between the two points that are furthest apart in the point set.
[0113] Example 4
[0114] To further improve the fitting speed, the inventors have discovered that a simpler method can balance fitting speed and fitting accuracy. This method includes:
[0115] Select the first data point: In the set of data points (Vs, Vc), select the data point with the maximum value Vsmax of Vs as the first data point.
[0116] Select the second data point: In the set of data points (Vs, Vc), select the data point with the minimum value Vsmin of Vs as the second data point.
[0117] Select the third data point: In the set of data points (Vs, Vc), select the data point whose Vs is closest to the median (Vsmax + Vsmin) / 2 as the third data point.
[0118] In the above method, firstly, the distance between the first and second data points is far enough. Secondly, the third data point is selected as close as possible to the middle of the two data points. In this way, although the three data points may not form an equilateral triangle, they will not be concentrated on a small arc. As a result, the circumcircle formed is relatively insensitive to small fluctuations in the position of the data points, but the three data points can be determined quickly.
[0119] In fact, if the first and second data points happen to be the two endpoints of a diameter of the target circle, then the three data points are basically distributed along the 180-degree arc of the target circle. In this case, the triangle is an approximate right triangle or an approximate isosceles right triangle.
[0120] Even if the first data point and the second data point do not form the two endpoints of a diameter of the target circle, the triangle formed by the first data point, the second data point, and the third data point can have the following two possibilities:
[0121] 1. If the three data points are distributed along an arc length greater than 180 degrees, then the triangle is an acute triangle;
[0122] 2. If the three data points are distributed along an arc length less than 180 degrees, then the triangle is an obtuse triangle;
[0123] In either case, due to the nature of the values obtained by this method, the three data points of the acute or obtuse triangle mentioned above have a relatively large interval, which is beneficial to the stable determination of the target circle.
[0124] The above-described selection based on the maximum, minimum, and median values of the Vs signal is merely an exemplary method. Those skilled in the art will understand that other selection methods exist. For example, selecting the data point with the maximum value of Vc as the first data point, selecting the data point with the minimum value of Vc as the second data point, and selecting the data point whose Vc value is closest to the median (Vcmax + Vcmin) / 2 or the closest to that median as the third data point—these two selection methods are technically equivalent.
[0125] To reiterate, in practical applications, due to limitations in sampling time and data point distribution, it is often difficult to select three data points that precisely form an equilateral triangle. Therefore, the resulting triangle can also be an approximate equilateral triangle. In fact, as long as the three selected data points are not excessively close on the target circle, relatively stable fitting results can be obtained. For example, when selecting three data points using the aforementioned method of selecting the maximum, minimum, and median values of Vs, the resulting triangle is usually close to an isosceles right triangle, and this distribution can also provide relatively reliable signal offset calculation results.
[0126] Furthermore, it should be understood that the terminology used in this specification for the purpose of clearly describing the embodiments of the present invention, such as "maximum," "minimum," and "closest," is not intended to constitute a strict limitation on the present invention. Those skilled in the art will understand that in actual implementation, selecting alternative values that have the same or substantially the same technical effect as the aforementioned extreme or optimal values, such as the second largest, second smallest, or nearest values, can also achieve the intended purpose. Therefore, the above terms should be interpreted as covering their corresponding suboptimal values and reasonable approximations, and all such variations are considered to fall within the equivalent scope of the present invention.
[0127] The robustness of the three-data-point solution depends primarily on the distribution span of the three points along the target arc, rather than on the extreme value characteristics of the data (e.g., it does not require Vsmin and Vsmax to correspond to the diameter of the target circle). Provided the three data points are sufficiently spaced and collinearity is avoided, the method can converge stably without relying on whether the data points are located at either end of the true diameter. Furthermore, the three-data-point method offers significant advantages in data requirements: compared to existing two-data-point methods, which typically require a large amount of dense data to obtain the effective diameter endpoints (often requiring dozens or even hundreds of sampling points), the three-data-point method only requires three effective measurement points, reducing the required data volume by approximately one to two orders of magnitude compared to the two maximum / minimum data-point method, greatly alleviating the sampling burden.
[0128] After obtaining a subset of data points containing the first, second, and third data points through the above steps, the signal offset values Os and Oc can be solved based on the circumcircle determined by the triangle by using these three data points as the first vertex (Vs1, Vc1), the second vertex (Vs2, Vc2), and the third vertex (Vs3, Vc3).
[0129] Specifically, firstly, the coordinates of the first vertex (Vs1, Vc1), the second vertex (Vs2, Vc2), and the third vertex (Vs3, Vc3) are applied to the signal models described by equations (1) and (2), respectively. These three fixed points are all acquired from the actual output signals of the sensor during the rotation process, and therefore all satisfy the signal model. Thus, the following set of equations can be obtained:
[0130] -- ①
[0131] -- ②
[0132] -- ③
[0133] -- ④
[0134] -- ⑤
[0135] -- ⑥
[0136] In the above formula, there are 3 angular positions. Amplitude A and signal offset value and It is unknown, while the rotation angle sensor data... , , , It is known.
[0137] Considering From equations ① and ②, ③ and ④, and ⑤ and ⑥, we can obtain the following respectively:
[0138] -- ⑦
[0139] -- ⑧
[0140] -- ⑨
[0141] Geometrically, the above equation shows that all the collected data points (Vs, Vc) fall on the same circle with the signal offset value (Os, Oc) as the center and the amplitude A as the radius, that is, satisfying (Vs-Os)²+(Vc-Oc)²=A². Figure 4 As shown. Therefore, determining the signal offset values (Os, Oc) is geometrically equivalent to determining the center of the circle by selecting the first vertex (Vs1, Vc1), the second vertex (Vs2, Vc2), and the third vertex (Vs3, Vc3). This application obtains Os and Oc by solving for the center coordinates based on this geometric relationship.
[0142] By observing the new set of equations consisting of equations ⑦, ⑧, and ⑨, the unknown amplitude parameter A can be eliminated by subtracting each equation from the others.
[0143] From equations ⑦ and ⑧, we can deduce:
[0144]
[0145] From equations ⑧ and ⑨, we can deduce:
[0146]
[0147] By performing these two formulas, the signal offset values Os and Oc of the rotation angle sensor can be calculated.
[0148] Equation (3)
[0149] Equation (4).
[0150] Equations (3) and (4) above are analytical expressions for the signal offset values obtained by eliminating the rotation angle θ and amplitude A. After determining the signal offset values Os and Oc within a certain time period through the above steps, these values can be stored in the processor's memory for subsequent real-time angle measurements.
[0151] Furthermore, to further improve the robustness of the calculated signal offset values, other methods can be used for circle fitting. For example, data points can be collected over a longer rotation period, and three different data points can be selected multiple times to calculate the corresponding signal offset values. The average of these calculated values is then used as the final signal offset values Os and Oc. Alternatively, the collected N data points (N≥3) can be substituted into the circle equation (Vs-Os)²+(Vc-Oc)²=A², and the center coordinates can be obtained through least-squares circle fitting, serving as the signal offset values Os and Oc. These methods can further average out random noise, sampling errors, and minor differences between different electrical cycles, thereby achieving higher statistical confidence and accuracy while maintaining the computational efficiency of this application.
[0152] In one implementation, such as Figure 5 As shown, after step S1 and before step S2, a step may be included to determine whether the set of collected data points (Vs, Vc) is sufficient for calculating the signal offset value. Specifically:
[0153] S11. Calculate the change in rotation angle based on the data points (Vs, Vc) collected from the rotation angle sensor;
[0154] S12. Determine whether the mechanical rotation exceeds the predetermined number of revolutions based on the calculated change in rotation angle, so as to generate a set of Vs or Vc values including the maximum and minimum data points (Vs, Vc).
[0155] S13. If the rotation has exceeded the predetermined number of revolutions, proceed to step S2 and start selecting at least three data points to fit a circle for calculating the offset values Os and Oc.
[0156] S14. If the rotation has not exceeded the predetermined number of revolutions, continue to rotate, continue to collect data points from the rotation angle sensor, and return to step S11.
[0157] Regarding the setting of the predetermined number of rotations, from the perspective of algorithmic feasibility, this predetermined number of rotations should preferably be set as the minimum amount of rotation required to acquire a set of reasonably distributed and effective data. As mentioned earlier, the method of this application requires at least three data points that are geometrically non-collinear and phase-separated. To facilitate the acquisition of such data points, the rotation amount during the acquisition process can be set to be greater than 1 / 4 of a mechanical rotation, for example, 1 / 4 rotation (i.e., 90 degrees). The method of this application can be executed when the conditions of the number of sampling points, the three points being non-collinear, and their reasonable distribution are met.
[0158] From the perspective of improving the stability and robustness of the calculation results, the predetermined number of revolutions can be set to a larger value to perform calculations based on data with longer periods and greater statistical significance. This helps to average out the effects of random noise, sampling errors, and small differences between different electrical cycles. For example, the predetermined number of revolutions can be set to 1 revolution, 5 revolutions, 10 revolutions, or even more. This setting is suitable for the periodic update mechanism of the method in this application. After the equipment is running stably, the offset value can be updated and calculated every relatively long number of revolutions (such as 5 revolutions), so that the signal offset value calculation results have better statistical stability and confidence.
[0159] In one embodiment, the method of this application further includes periodically repeating the step of selecting at least three data points from the set of data points (Vs, Vc) to fit a circle, so as to continuously update the signal offset values Os and Oc. Specifically, during the continuous rotation of the rotating component, the aforementioned steps can be periodically repeated to continuously update the signal offset values Os and Oc. Through such periodic updates, the method of this application can dynamically track the offset value drift caused by changes in the operating environment temperature or the aging of the rotation angle sensor itself, thereby helping to maintain good angle measurement accuracy throughout the equipment's lifespan. The update cycle can be flexibly set according to the actual application scenario, for example, performing an update after every few mechanical rotations, or performing updates at fixed time intervals.
[0160] The above embodiments describe a method for determining signal offset values Os and Oc during the operation of a rotation angle sensor. After obtaining the signal offset values, they can be applied to actual rotation angle measurements to compensate for offsets in the output signal of the rotation angle sensor, thereby improving the accuracy of the angle measurement results.
[0161] Secondly, this application provides a method for measuring rotation angle using a rotation angle sensor. This method may include two stages:
[0162] In the first time period, the signal offset values Os and Oc are obtained using the method described in any of the foregoing embodiments. For example, complete data acquisition, data point selection, and signal offset value calculation can be performed within the first few rotation cycles after the motor starts.
[0163] In the second time period, following the first time period, the rotation angle is measured, and the measured value of the rotation angle sensor is compensated based on the signal offset values Os and Oc acquired in the first time period. Specifically, for the newly acquired raw signal (Vs(t), Vc(t)) at the current moment, the system uses the signal offset values Os and Oc acquired and stored in the first time period to perform real-time signal compensation.
[0164] Vs_comp(t) = Vs(t) - Os
[0165] Vc_comp(t) = Vc(t) - Oc
[0166] Here, Vs_comp(t) and Vc_comp(t) represent the compensated signal values at time t. Substituting the compensated signal values into the arctangent function arctan2(Vs_comp(t), Vc_comp(t)) yields the corrected rotation angle. This angle value can then be provided to the upper-level control system.
[0167] It should be noted that the division of the first and second time periods mentioned above is not limited to one time. As previously stated, the method of this application can be repeatedly executed periodically. During the continuous operation of the rotating component, the first time period can be re-entered to re-execute the signal offset value determination process to update Os and Oc, and the updated signal offset value can be used for compensation in the subsequent second time period, thereby dynamically adapting to changes in the working environment.
[0168] In the above embodiments, the rotation angle sensor can be an AMR sensor. It should be noted that although the above embodiments are mainly described using an AMR sensor as an example, the method of this application can also be applied to other rotation angle sensors with orthogonal outputs and two signal amplitudes that are equal or approximately equal.
[0169] Thirdly, this embodiment provides a device for measuring rotation angle using a rotation angle sensor, the device including an offset acquisition module and an angle measurement module.
[0170] The offset acquisition module is used to receive a set of data points (Vs, Vc) output by the rotation angle sensor within a first time period, and to determine the signal offset values Os and Oc using the method of any of the foregoing embodiments.
[0171] The angle measurement module, connected to the offset acquisition module, is used to receive the output signal of the rotation angle sensor during the second time period after the first time period, and to compensate the output signal according to the signal offset values Os and Oc provided by the offset acquisition module, and then calculate the rotation angle based on the compensated signal.
[0172] Fourthly, this embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the foregoing embodiments.
[0173] To further illustrate the dynamic and adaptive characteristics of the method in this application, the following will be combined with the appendix. Figure 6 The flowchart illustrates a specific execution process.
[0174] This process can begin after the device containing the rotating component is powered on. When the rotating component begins to rotate, the method enters a data acquisition and judgment loop.
[0175] First, a rotation angle is calculated based on the data points (Vs, Vc) collected in real time from the rotation angle sensor. At this stage, no offset compensation is performed; the angle is calculated directly by substituting the raw, unprocessed voltage signal into the arctangent function. Since the input signal (Vs, Vc) at this point contains unknown signal offsets, the rotation angle calculated in this step is an uncorrected estimate.
[0176] Secondly, it is determined whether the accumulated rotation angle has exceeded the preset number of revolutions. As mentioned earlier, this preset number of revolutions can be flexibly set according to application requirements.
[0177] If the judgment result is "yes", that is, the rotation has exceeded the predetermined number of revolutions, it indicates that enough data has been collected. At this time, the process enters the "select appropriate data" step, that is, to execute the step of selecting at least three data points as described in the previous embodiment. After obtaining these data points, the process enters the "update Os, Oc" step. In this step, a set of new signal offset values Os and Oc are calculated by the aforementioned circle fitting method (e.g., by solving equations (3) and (4)). These newly calculated signal offset values will then be used in subsequent rotation angle calculations, thereby improving the accuracy of angle measurement. Through such a cyclical process, the method of this application realizes dynamic tracking and adaptive updating of signal offset values.
[0178] If the judgment result is "no", that is, the rotation has not reached the predetermined number of revolutions, it means that the currently collected data is not enough to perform a reliable calculation. At this time, the signal offset value calculation is skipped, the rotating part continues to rotate and collect data, and the process returns to the rotating part step, and the next judgment is performed at the next sampling time.
[0179] By using such a judgment loop, it can be ensured that the signal offset value calculation is always triggered only when the data acquisition is sufficient, thereby helping to ensure the validity and stability of the calculation results.
[0180] To more intuitively demonstrate the difference in performance between the method of this application and traditional methods, a verification example containing specific numerical values is used below to compare the computational accuracy of the method of this application and traditional methods.
[0181] In this verification embodiment, a reference base value for the signal offset is first obtained in advance, which is Os=0.19983756 and Oc=-0.1501246. This value is obtained by: under test conditions, the sensor measures multiple rotations. After collecting a sufficient number of data points, a traditional method is used (i.e., for Vs and Vc, the maximum and minimum values of the collected data are obtained respectively; when the data volume is large enough, the maximum and minimum values tend to stabilize, and the average of the two is calculated) to obtain a stable signal offset value. This offset value is used as the reference base value for this embodiment. The following table shows a set of discrete data points (Vs, Vc) collected from the rotation angle sensor. See Table 1 below for details:
[0182] Table 1. Collected discrete data points
[0183] First, let's examine the case of calculating signal offset using the traditional dynamic calibration method. This method requires finding the extreme values of the signal samples. By iterating through the data points mentioned above, we can determine that the maximum sample value of the Vs signal is 1.16725683, and the minimum sample value is -0.79394537; simultaneously, we determine that the maximum sample value of the Vc signal is 0.83685696, and the minimum sample value is -1.14889216. According to the traditional method's formula Offset=(Max+Min) / 2, the calculated signal offset values are Os≈0.18665573 and Oc≈-0.1560176. Comparing these calculation results with the reference values, the calculation error of Os is approximately 6.5963%, and the calculation error of Oc is approximately 3.9254%. This indicates that, due to the difficulty of accurately capturing the true physical extreme values through discrete sampling, the traditional method has certain calculation errors.
[0184] Now we calculate the signal offset value according to the method of Embodiment 4 of this application. First, following a point selection method described in the previous embodiment (i.e., selecting the maximum value of Vs, the minimum value of Vs, and the data point where Vs is closest to (Vsmax+Vsmin) / 2), three data points are selected from the above data points:
[0185] First data point: The maximum value of Vs, i.e., data point number 3 (Vs1, Vc1) = (1.16725683, -0.40379956)
[0186] The second data point: the minimum value of Vs, i.e., data point number 13 (Vs2, Vc2) = (-0.79394537, -0.25987491).
[0187] The third data point: The data point that Vs is closest to (Vsmax+Vsmin) / 2=0.18665573, that is, the data point with sequence number 8 (Vs3,Vc3)=(0.15294260,-1.14889216).
[0188] Substituting the coordinates of these three data points into equations (3) and (4) proposed in this application, the signal offset values are Os≈0.20000002 and Oc≈-0.15000000. Comparing these results with the theoretical values, the calculation error of Os is approximately 0.0813%, and the calculation error of Oc is approximately 0.0830%.
[0189] To further illustrate that the method of this application does not rely on signal extrema, the selected data points are not limited to those near the maximum or minimum values. Alternatively, three geometrically non-collinear data points can be selected using the point set diameter selection method described in the foregoing embodiments or other arbitrary methods. As an example, three data points can be randomly selected from the above data points, such as data points numbered 1, 5, and 9:
[0190] The three selected data points are: (-0.38360250, -0.96203959), (0.03840373, 0.83685696), and (0.98047143, -0.77519143).
[0191] Substituting the coordinates of these three data points into equations (3) and (4) for calculation, the signal offset values are Os≈0.19999993 and Oc≈-0.15000003. Compared with the theoretical values, the calculation error of Os is about 0.0813% and the calculation error of Oc is about 0.0829%.
[0192] Numerical comparisons in this verification embodiment show that, when processing the same set of discrete sampled data, the error between the signal offset value calculated by the traditional method and the reference value is much greater than that calculated by the method of this application. This indicates that the present application determines the signal offset value through an analytical method based on fitting circles to data points, avoiding direct dependence on sampling extrema, which helps reduce errors introduced by discrete sampling and improves the accuracy of the signal offset value determination result.
[0193] This application provides a method for determining the signal offset of a rotation angle sensor, which has at least the following advantages compared with the prior art:
[0194] This application avoids direct dependence on the extreme values of signal sampling by acquiring data points output by a rotation angle sensor, fitting a circle, and determining the signal offset value using the center coordinates of the circle. Compared to traditional estimation methods based on the maximum and minimum sampled values, this method does not require the sampled extreme values to approximate the true physical extreme values, which helps reduce errors introduced by discrete sampling, improves the accuracy of the signal offset value determination result, and thus provides a better foundation for subsequent angle correction.
[0195] Traditional dynamic calibration methods require accumulating a large number of data samples over multiple rotation cycles to obtain a relatively usable signal offset value in order to reduce sampling errors, resulting in long convergence times and slow dynamic responses. The method in this application only needs to calculate the signal offset value once based on a limited number of acquired data points, without accumulating a large amount of data over multiple rotation cycles. Therefore, it can reduce the convergence time for determining the signal offset value and improve the response speed to offset drift caused by changes in the operating environment temperature or device aging.
[0196] The method described in this application can be executed during equipment operation without relying on specialized factory calibration fixtures and processes, which helps reduce the calibration cost of rotation angle sensors. Furthermore, the method can continuously update the signal offset value through periodic repetition, thereby dynamically adapting to changes in the working environment and the effects of device aging throughout the equipment's lifespan.
[0197] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for determining the signal offset of a rotation angle sensor, characterized in that, When the rotation angle changes, the rotation angle sensor outputs a voltage signal: Equation (1) Equation (2) in: A represents the amplitude; The rotation angle; Os is the sine offset value of the signal to be determined, and Oc is the cosine offset value of the signal to be determined. The method includes: S1. When the rotation angle changes, the rotation angle sensor collects a set of data points (Vs, Vc); S2. Select at least three data points from the set of data points (Vs, Vc) to fit a circle; The center coordinates of the fitted circle are the signal offset values Os and Oc.
2. The method according to claim 1, characterized in that... The fitting in step S2 includes least squares fitting.
3. The method according to claim 1, characterized in that, The selection of at least three data points includes selecting a first data point, a second data point, and a third data point. These three data points can form a triangle with their vertices. The triangle can determine a unique circumcircle, which is the fitted circle.
4. The method according to claim 3, characterized in that, The first, second, and third data points are chosen such that they can form an acute triangle with themselves as vertices.
5. The method according to claim 4, characterized in that, The acute triangle includes equilateral triangles.
6. The method according to claim 3, characterized in that, The first data point, the second data point, and the third data point were selected as follows: Determine a first data point and a second data point from the set of data points (Vs, Vc), wherein the distance between the first data point and the second data point is equal to the diameter of the set of data points (Vs, Vc). Construct the perpendicular bisector of the line segment with the first data point and the second data point as endpoints, and A third data point is determined from the set of data points (Vs, Vc), wherein the distance from the third data point to the perpendicular bisector is the smallest.
7. The method according to claim 3, characterized in that, The first data point, the second data point, and the third data point were selected as follows: Select the data point with the maximum value Vsmax of Vs from the set of data points (Vs, Vc) as the first data point; From the set of data points (Vs, Vc), select the data point with the minimum value Vsmin of Vs as the second data point, and The data point closest to the median (Vsmax + Vsmin) / 2 is selected as the third data point.
8. The method according to claim 3, characterized in that, The first data point, the second data point, and the third data point were selected as follows: Select the data point whose Vc has a maximum value Vcmax from the set of data points (Vs, Vc) as the first data point; From the set of data points (Vs, Vc), select the data point with the minimum value Vcmin of Vc as the second data point, and The data point whose Vc is closest to the median (Vcmax + Vcmin) / 2 is selected as the third data point.
9. The method according to claim 1, characterized in that, The step following step S1 and preceding step S2 includes determining whether the data from the collected data point set (Vs, Vc) is sufficient for calculating the offset of the rotation angle sensor signal, including: S11. Calculate the change in rotation angle based on the data points (Vs, Vc) collected from the rotation angle sensor; S12. Determine whether the mechanical rotation exceeds the predetermined number of revolutions based on the calculated rotation angle change, so as to generate a set of Vs or Vc values including the maximum and minimum data points (Vs, Vc). S13. If so, start selecting the at least three data points to fit a circle for calculating signal offset values Os and Oc; S14. If not, continue rotating, collect the data point set (Vs, Vc) from the rotation angle sensor, and return to step S11.
10. The method according to claim 9, characterized in that, The predetermined number of laps is 1 / 4 lap.
11. The method according to claim 3, characterized in that, The method further includes: The step of selecting at least three data points from the set of data points (Vs, Vc) to fit a circle is repeated periodically to continuously update the signal offset values Os and Oc.
12. The method according to claim 3, characterized in that, The three vertices of the triangle are the first vertex (Vs1, Vc1), the second vertex (Vs2, Vc2), and the third vertex (Vs3, Vc3), and the signal offset values Os and Oc are determined by the following equations: Equation (3) Equation (4).
13. The method according to claim 12, characterized in that, Equations (3) and (4) are obtained by the following method: Applying the selected first vertex (Vs1, Vc1), second vertex (Vs2, Vc2), and third vertex (Vs3, Vc3) to equations (1) and (2) yields the following equations: Considering Eliminate the rotation angle With amplitude A, we obtain equations (3) and (4).
14. The method according to any one of claims 1-13, characterized in that, The rotation angle sensor is an anisotropic magnetoresistive sensor.
15. A method for measuring rotation angle using a rotation angle sensor, characterized in that, Including the following steps: In the first time period, signal offset values Os and Oc are obtained using the method described in any one of claims 1-13; In the second time period following the first time period, the rotation angle is measured, and the measured value of the rotation angle sensor is compensated based on the signal offset values Os and Oc obtained in the first time period.
16. A device for measuring rotation angle using a rotation angle sensor, characterized in that, include: An offset acquisition module is used to acquire signal offset values Os and Oc using the method described in any one of claims 1-13 during a first time period. An angle measurement module, connected to the offset acquisition module, is used to measure the rotation angle in a second time period after the first time period, and to compensate the measured value of the rotation angle sensor based on the signal offset values Os and Oc acquired in the first time period.
17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 13.
