Off-axis magnetic encoder data calibration compensation method
By forcing the motor to rotate and calculating the ideal mechanical angle through sensorless control, the calibration data is directly stored in the motor. This solves the data accuracy issues caused by off-axis magnetic encoder installation deviation and magnetic field unevenness, and achieves efficient and accurate magnetic encoder calibration. It is suitable for magnetic encoders with various installation methods.
Patent Information
- Application Number
- CN202511073402.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-10-10
AI Technical Summary
During the installation process, off-axis magnetic encoders are prone to mechanical deviations such as bracket tilt and eccentricity, and magnetic field unevenness leads to poor data roundness, affecting the accurate acquisition of the relative position relationship between the motor rotor and stator. Existing calibration methods introduce systematic errors, making it difficult to improve data accuracy.
A sensorless control method is used to force the motor rotor to rotate, and the stator magnetic field is used to calibrate the motor. By calculating the ideal mechanical angle and compensation value, the calibration data is directly stored in the motor to avoid system errors caused by external devices and achieve high-precision data calibration.
Without the need for external equipment, the coaxiality and roundness of the magnetic encoder data can be improved, system errors can be reduced, and the motor drive efficiency and stability can be improved. It is suitable for magnetic encoders with various installation methods.
Smart Images

Figure CN120760774A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of magnetic encoder data processing, and in particular to a data calibration and compensation method for an off-axis magnetic encoder. Background Art
[0002] In low-speed FOC motor control, the magnetic encoder is used to obtain the accurate relative position relationship between the motor rotor and stator, which is indispensable for achieving precise control.
[0003] However, in actual applications, off-axis magnetic encoders have the following problems: In terms of mechanical installation deviation, due to the characteristics of the off-axis installation method itself, the bracket is prone to tilt and eccentricity, which leads to misalignment between the encoder and the motor axis, and is difficult to avoid due to space and processing accuracy limitations; the magnetic field of the magnet is uneven, such as manufacturing defects of the permanent magnet and uneven magnetic field inside the motor, which will cause the encoder to detect data deviation, manifested as data roundness difference, etc. The interaction between the two leads to detection data deviation, manifested as roundness difference, affecting the acquisition of the accurate relative position relationship between the motor rotor and stator, thereby affecting the stable control of the motor.
[0004] Currently, calibration of magnetic encoders on the market typically requires installing the encoder on the motor. Using other equipment to rotate the motor coaxially, transmit the correct angle to the motor, and write the calibration data. This method introduces systematic errors, has limited improvement on data with poor coaxiality and roundness from off-axis magnetic encoders, and may negatively impact data with smaller errors. Summary of the Invention
[0005] The purpose of the present invention is to provide a method for calibrating and compensating off-axis magnetic encoder data. The method does not require external equipment, has a small amount of algorithm calculation, and the data after calibration has high coaxiality and good roundness, which can improve the quality of magnetic encoder data. At the same time, the compensation data is stored for easy access, providing a high-quality data environment for motor drive, so as to solve the problems of off-axis magnetic encoder data misalignment and poor roundness, improve data accuracy, and ensure efficient and stable operation of the motor.
[0006] To achieve the above object, the present invention provides the following technical solution: a method for calibrating and compensating off-axis magnetic encoder data, comprising the following steps:
[0007] S1. Calibration initialization: Initialize the peripherals, calibration parameters and encoder chip used to prepare for calibration;
[0008] S2, force the motor to record the calibration starting position;
[0009] S3, force the motor to rotate to the ideal electrical angle;
[0010] S4. Calculate the ideal mechanical angle;
[0011] S5, determine whether the motor has completed one mechanical cycle rotation, calculate the compensation value and store it;
[0012] S6. Reading calibration data from the memory;
[0013] S7, control initialization, read the encoder original data;
[0014] S8, look up the table and select calibration data;
[0015] S9, output the compensated angle.
[0016] Preferably, in step S1, the peripheral device includes a motor control chip and a motor drive circuit, the motor control chip is electrically connected to the motor drive circuit, and the calibration parameters include motor pole pair number parameters, calibration point and recording point parameters, encoder data format parameters and motor control parameters.
[0017] Preferably, in step S2, a sensorless control method is used to forcibly drag the motor rotor to rotate to the current electrical angle 0 position, and this position is set as the motor's mechanical angle 0 position. The encoder's uncalibrated 0 position data is read at the motor's 0 position, and the calibration starting position is recorded.
[0018] Preferably, in step S3, the electrical angle is increased at a uniform speed and in equal steps. The increased electrical angle is used as the ideal electrical angle, which is also the target electrical angle. The motor rotor is dragged to rotate to the target electrical angle position using a sensorless control method, and the output data of the uncalibrated encoder is read.
[0019] Preferably, in step S4, the increased ideal electrical angle and the number of motor pole pairs are used to calculate the ideal mechanical angle value with the starting calibration point as the 0 angle position, which is used for subsequent calculation of the angle compensation error.
[0020] Preferably, in step S5, the ideal mechanical angle is converted into ideal binary integer data that conforms to the sensor output result, and the ideal binary integer data is subtracted from the output data of the uncalibrated encoder to obtain the encoder raw data compensation value, which is stored in the memory;
[0021] A complete mechanical angle cycle is evenly divided into 1024 calibration points. The encoder output angle raw data is binary data. The area between every two calibration points is evenly divided into 8 recording points. The data of each calibration point is the average of the compensation values of the 8 recording points.
[0022] In step S5, it is also necessary to determine whether the motor has completed one mechanical cycle rotation. If not, the motor is controlled to continue rotating by increasing the ideal electrical angle and performing the calibration operation until one rotation is completed, thereby ending the calibration calculation process.
[0023] Preferably, in step S6, it is also necessary to determine whether there is calibration data in the memory. If there is no calibration data, the process returns to step S1 to perform the calibration process. When there is calibration data, the operation of reading the calibration data from the memory is re-executed.
[0024] Preferably, in step S7, the peripherals and sensors used by the controller are initialized, and the controller directly reads the uncalibrated encoder raw data through the peripherals.
[0025] Preferably, in step S8, the first 10 bits of the uncalibrated encoder original binary data are used as the basic index n of the calibration data, and the calibration data is retrieved from the calibration data table in combination with the motor rotation direction;
[0026] If the motor rotates in the direction of increasing data, (n+1) is used as the index to retrieve data from the 1024 data tables; if the motor rotates in the direction of decreasing data, n is used as the index to retrieve data, and the retrieved data is used to compensate and correct the original encoder data.
[0027] Preferably, in step S9, the uncalibrated encoder raw data is summed with the calibration data to obtain the calibrated data, the calibrated data is converted through the encoder data protocol, the integer base data is converted into floating-point mechanical angle data of 0 to 360, and the calibrated mechanical angle is output.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] 1. The calibration method of the present invention does not require the use of other equipment to drive the motor to rotate coaxially for calibration. It directly uses the stator magnetic field to calibrate the motor, avoiding the system error caused by external equipment. It can obtain the accurate relative position relationship between the electronic magnetic field and the rotor magnetic field, making the motor rotate more smoothly at low speed, with higher driving efficiency and smaller driving dead zone. It also has an improvement effect on the data of various coaxiality and roundness errors of the off-axis magnetic encoder;
[0030] 2. The calibration method of the present invention has simple logic and calculation, small algorithm calculation amount, and the calculation results are stored in the FLASH memory of the motor, which is convenient for use during operation and does not bring excessive calculation burden to the system;
[0031] 3. The data after calibration of the present invention has small error, high coaxiality and good roundness, and can make the motor rotate smoothly after calibration of data that originally could not drive the motor to rotate.
[0032] 4. The calibration method of the present invention has wide applicability. Commonly used magnetic encoding chips, such as AS5047 and KTH7812, can use this method, regardless of whether they are installed on the axis or off the axis. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1This is a flow chart of calibration data calculation of the present invention;
[0034] Figure 2 A flow chart for outputting calibration data for the present invention;
[0035] Figure 3 The waveform diagram of the original encoder angle, the motor angle after calibration and the ideal motor angle of the present invention;
[0036] Figure 4 This is the error waveform diagram between the ideal motor angle and the calibrated motor angle, and the ideal motor angle and the original encoder angle before calibration. DETAILED DESCRIPTION
[0037] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0038] See also Figures 1-4 The present invention provides a technical solution: a method for calibrating and compensating off-axis magnetic encoder data, comprising the following steps:
[0039] S1. Calibration initialization: Initialize the peripherals, calibration parameters and encoder chip used to prepare for calibration;
[0040] S2, forced drag motor alignment: Use sensorless control to force the motor rotor to rotate to the nearest electrical angle 0 position, and record the calibration starting position;
[0041] S3. Motor rotation calculation and calibration data: Use sensorless control to force the motor rotor to rotate, slowly increase the electrical angle, calculate the ideal encoder output, read the encoder raw data output, and record the encoder data compensation result using the encoder raw data as the index;
[0042] S4, storage calibration structure: according to the encoder raw data output, after the motor completes a full mechanical angle cycle rotation, the recorded calibration data is stored in the FLASH memory;
[0043] The sensorless control method is based on field-oriented control (FOC) technology. It does not rely on the magnetic encoder to feedback real-time angle data. It directly generates a control signal through the preset target electrical angle to drive the motor rotation.
[0044] During control, the current electrical angle (0) is clearly defined as the target position the rotor needs to reach. This serves as the control benchmark, and FOC technology is used to decompose the stator current into excitation current and torque current. Based on the set target electrical angle (0), the control algorithm generates corresponding current commands, adjusting the excitation current and torque current components to produce a specific rotating magnetic field in the stator winding. This rotating magnetic field interacts with the magnetic field of the rotor's permanent magnets to generate electromagnetic torque.
[0045] Since the target electrical angle is fixed at 0, the stator magnetic field will continue to generate electromagnetic force pointing to this position, forcing the rotor to rotate by overcoming mechanical resistance such as friction. Under the action of electromagnetic torque, the rotor is forcibly dragged to form a stable relative position relationship with the stator magnetic field at 0 angle position, that is, reaching the target 0 electrical angle position.
[0046] At this time, by maintaining the current stator current command, the stator magnetic field and the rotor magnetic field remain relatively stationary, achieving stable locking of the rotor at this position, providing a fixed reference for subsequent calibration processes, such as recording the starting position.
[0047] This sensorless control method does not rely on real-time angle feedback from the magnetic encoder. It can force the rotor to a specified electrical angle position simply by presetting the target and controlling the current. This avoids interference from the encoder's raw data deviation in the dragging process and ensures the accuracy of the calibration starting position.
[0048] S3. Force the motor to rotate to the ideal electrical angle: The electrical angle is increased at a uniform speed and in equal steps. The increased electrical angle is used as the ideal electrical angle, which is also the target electrical angle. The motor rotor is rotated to the target electrical angle position using a sensorless control method. The output data of the uncalibrated encoder is read as the data source for calculating the compensation value.
[0049] During the calibration initialization phase, the electrical angle step size (i.e., the fixed angle increment and the frequency of the increment) is pre-set. The step size selection should be based on the number of motor pole pairs and the required calibration accuracy. For example, 1024 calibration points should be evenly distributed across the mechanical cycle to ensure uniform increments and coverage of the full electrical angle cycle.
[0050] The control chip uses a built-in algorithm to continuously generate an increasing target electrical angle sequence based on a preset step size and frequency. For example, starting from an initial electrical angle of 0, the electrical angle is accumulated at a set step size at each fixed time interval, forming a linearly increasing ideal electrical angle curve, which serves as the target trajectory for motor rotation. This generated ideal electrical angle sequence directly serves as the input for the sensorless control method, driving the motor rotor. Based on the real-time target electrical angle, the control chip adjusts the stator current using field-oriented control (FOC) technology to generate a corresponding rotating magnetic field, forcing the rotor to rotate in accordance with the target electrical angle. Since the electrical angle increases at a constant rate in fixed steps, the rotor also rotates uniformly, ensuring that the raw data for each calibration point is collected at a stable and uniform position interval, providing a uniformly distributed reference baseline for subsequent compensation value calculations.
[0051] S4. Calculate the ideal mechanical angle: Calculate the ideal mechanical angle value with the starting calibration point as the 0 angle position using the increased ideal electrical angle and the number of motor pole pairs. This is used to calculate the angle compensation error later. There is a fixed conversion relationship between the electrical angle and the mechanical angle of the motor, and the formula is:
[0052] Electrical angle = mechanical angle × number of motor pole pairs;
[0053] This relationship stems from the structural characteristics of the motor: for every rotation of the motor rotor (360 mechanical degrees), the number of changes in the electrical signal induced by the stator winding is equal to the number of motor pole pairs. Therefore, the electrical angle change is the number of pole pairs × 360 degrees. Since the starting calibration point is set at the 0 angle position, 0 electrical angle corresponds to 0 mechanical angle. Therefore, the calculation directly uses the increased ideal electrical angle as input and substitutes it into the above formula.
[0054] For example, if the ideal electrical angle at a certain moment is α and the number of motor pole pairs is P, then the corresponding ideal mechanical angle at this time is α / P. This value is based on the starting calibration point 0 angle and increases uniformly with the uniform increase of the ideal electrical angle, covering the complete mechanical angle cycle.
[0055] S5. Calculate and store the compensation value: convert the ideal mechanical angle into ideal binary integer data that conforms to the sensor output result, subtract it from the output data of the uncalibrated encoder to obtain the encoder raw data compensation value, and store it in the memory; the motor control chip receives the ideal mechanical angle data, converts it into ideal binary integer data that conforms to the sensor output format according to a linear mapping relationship through a built-in algorithm, reads the raw binary data output by the uncalibrated encoder, and performs a difference operation between it and the above-mentioned ideal binary integer data to obtain the encoder raw data compensation value.
[0056] After the calibration calculation is completed, the calculated 1024 data are stored in the FLASH of the control chip, so that they can be directly used the next time the motor is powered on without the need for recalibration.
[0057] S6, reading calibration data from the memory;
[0058] S7, control initialization, reading encoder raw data: initialize the peripherals and sensors used by the controller, and the controller directly reads the uncalibrated encoder raw data through the peripherals;
[0059] S8, look-up table selection of calibration data: use the first 10 bits of the uncalibrated encoder raw binary data as the base index n of the calibration data, and use the calibration data from the calibration data table in combination with the motor rotation direction.
[0060] S9, output the compensated angle: sum the uncalibrated encoder raw data and the calibration data to obtain the calibrated data. The calibrated data is converted by the data protocol of the encoder to convert the integer binary data to 0 to 360 floating point type mechanical angle data, and the calibrated mechanical angle is output for use by other applications of the motor.
[0061] In step S1, the peripherals include a motor control chip and a motor drive circuit, and the motor control chip and the motor drive circuit are electrically connected. The motor control chip and the motor drive circuit are the same as in the prior art. The motor control chip uses a dedicated motor control MCU, such as a motor control dedicated model in the STM32 series. The motor drive circuit includes a power amplification circuit, a current detection circuit, a protection circuit, and a signal isolation circuit. These circuits work together to ensure that the motor can operate according to the instructions of the control chip, such as forced dragging to the target electrical angle, uniform speed rotation, and stable operation. They are the key execution components of the calibration process and normal operation of the motor, and will not be described in detail.
[0062] The motor control chip undertakes the calculation and logical processing of the entire calibration process and motor control, is responsible for performing calibration initialization, reading encoder data, calculating compensation values, controlling motor rotation operations, and is used to receive instructions from the control chip to drive the motor to rotate according to the ideal electrical angle, and to realize forced dragging of the motor to a specific angle and other actions.
[0063] In step S1, the calibration parameters include a motor pole pair number parameter, a pole pair number of the motor, which is a parameter for calculating the ideal mechanical angle, a calibration point and a recording point parameter, and an encoder data format parameter, such as the number of binary bits of the original data of the magnetic encoder. The magnetic encoder uses the MT6825 model, and the original data is based on 18-bit binary;
[0064] and data protocol conversion rules to ensure consistency of data reading and processing, and motor control parameters including the step size of the ideal electrical angle, drive parameters for inductive dragging, such as voltage and current threshold, to ensure stable rotation of the motor according to the preset trajectory.
[0065] Different motors and encoders have different hardware characteristics, such as different pole pairs and encoder resolutions. Initialization can configure unique parameters based on the specific device, so that the calibration process is based on a unified benchmark and avoids calculation errors caused by parameter mismatch.
[0066] Parameters such as the number of calibration points and recording points determine the density of data collection and the accuracy of compensation values. Specifying these parameters during initialization ensures that the entire calibration process is executed according to preset rules. For example, strictly collecting compensation data for all 1024 calibration points avoids omissions or redundancy in data collection, ensuring the integrity and consistency of calibration data. Initializing the ideal electrical angle step size and drag parameters allows the motor to rotate evenly and stably during sensorless drag, ensuring that the raw data for each calibration point is collected at a stable position on the motor, reducing the introduction of errors due to unstable motor rotation.
[0067] In step S5, a complete mechanical angle cycle is evenly divided into 1024 calibration points. The encoder magnetic compass outputs the original angle data as binary data. Every two calibration points are evenly divided into 8 recording points. The data of each calibration point is the average value of the compensation values of the 8 recording points.
[0068] In step S5, it is also necessary to determine whether the motor has completed one mechanical cycle rotation. If not, the motor is controlled to continue rotating by increasing the ideal electrical angle and performing the calibration operation until one rotation is completed, thereby ending the calibration calculation process.
[0069] In step S6, it is necessary to determine whether there is calibration data in the memory. If there is no calibration data, the process returns to step S1 to perform the calibration process. If there is calibration data, the operation of reading the calibration data from the memory is executed again to avoid data loss due to memory damage or power failure.
[0070] In step S8, if the motor rotates in the direction of increasing data, (n+1) is used as the index to obtain data from the 1024 data tables; if the motor rotates in the direction of decreasing data, n is used as the index to obtain data, and the obtained data is used to compensate and correct the original encoder data.
[0071] The compensation values in the calibration data table are stored in mechanical angle order. The correct index must be selected based on the direction of change in the original data to ensure that the compensation value used accurately corresponds to the current mechanical position.
[0072] When the motor rotates in the forward direction, the encoder's raw binary data increases as the mechanical angle increases. At this point, the direction of change in the raw data is consistent with the direction of increment of the calibration table index. Since the first 10 bits of the raw data, n, may be between two calibration points, taking n+1 can be closer to the compensation value of the next calibration point, reducing the compensation error caused by data jumps. For example, if n = 50, when the motor rotates in the forward direction, the actual mechanical position is closer to the position corresponding to n = 51 in the calibration table, so the compensation value of n+1 = 51 is used;
[0073] When the motor rotates in the reverse direction, the encoder's raw binary data decreases as the mechanical angle increases. At this point, the raw data changes in the opposite direction to the index increment in the calibration data table. The current n already reflects the calibration point corresponding to the current mechanical position, so there's no need to add 1. Simply use the compensation value for n to match. For example, if the current n = 50, when the motor rotates in the reverse direction, the actual mechanical position corresponds to n = 50 in the calibration table, so the compensation value for n = 50 is used.
[0074] The calibration compensation method was actually applied on a demonstration motor used for testing to verify the effectiveness of the method.
[0075] Verify the structure as Figure 3 The following figure shows the waveforms of the ideal motor angle, the calibrated motor angle, and the encoder's original angle before calibration when the motor is rotated using the ideal electrical angle sensorless method. The horizontal coordinate is the time period in seconds, and the vertical coordinate is the rotation axis angle.
[0076] As can be seen from the figure, the uncalibrated data fluctuates around the ideal data line, with significant deviations from the ideal angle. This indicates that the raw data quality is poor, with significant deviations from the ideal motor angle at at least four locations within one rotation, and the data circularity is not ideal. The calibrated angle, on the other hand, almost completely overlaps with the ideal motor angle line, indicating that the calibrated magnetic encoder data is of high quality, nearly consistent with the ideal motor angle, with the data axis aligned with the motor's rotation axis, and the circle formed by the data is nearly a perfect circle.
[0077] Among them, blue is the motor angle after calibration; green is the original angle of the encoder; purple is the ideal motor angle. In the figure, the blue and purple lines almost completely overlap.
[0078] like Figure 4 As shown, when the ideal electrical angle is used to drag the motor to rotate without a sense of movement, the error waveforms between the ideal motor angle and the motor angle after calibration, and between the ideal motor angle and the original encoder angle before calibration are presented. The horizontal axis is the time period in seconds, and the vertical axis is the error angle value.
[0079] The uncalibrated magnetic encoder original data error waveform has four extreme values, the maximum value is 4.73° and the minimum value is-3.45° in a rotation period, and the amplitude is 8.18°. In the motor with 11 pairs of poles, when the angle error is greater than 8.18°, the rotation torque will become 0, and this error will cause the motor output torque loss of 38.46%-100%, combined with the influence of moment of inertia and friction, the motor cannot rotate. The calibrated magnetic encoding data error waveform has no obvious extreme value, and the error changes between 0.39 and-0.43 in a rotation period, and the amplitude is 0.82°. Compared with before calibration, the error waveform range is reduced to 10.0%, which greatly reduces the influence of data roundness and off-axis problem on the motor, and significantly improves the data quality of the magnetic encoder.
[0080] In the formula, orange is the error waveform of the ideal motor angle and the motor angle after calibration; and red is the error waveform of the ideal motor angle and the original angle of the encoder before calibration.
[0081] In order to further prove the effectiveness of the method of the present application, actual motor rotation experiments were carried out. The same motor and hardware conditions were used, and when the motor used the original data of the magnetic encoder as the data source to rotate in the FOC, the torque was set to 8000, and the motor was blocked in one position and could not rotate smoothly for one week. When the motor used the calibrated magnetic encoder data as the data source to rotate in the FOC, the torque was only set to 800, and the motor could rotate smoothly and continuously.
[0082] From the above experimental results, it can be seen that the calibration method of the present application has a significant effect on the original data, and can greatly improve the data quality, providing a high-quality data environment and conditions for the off-axis magnetic encoder data used for motor driving, and effectively proving the effectiveness and superiority of the method of the present application in practical application.
[0083] Although the embodiments of the present application have been shown and described, it can be understood by those of ordinary skill in the art that various changes, modifications, replacements and variations can be made to these embodiments without departing from the principles and spirits of the present application, and the scope of the present application is defined by the appended claims and their equivalents.
Claims
1. A method for calibrating and compensating off-axis magnetic encoder data, characterized in that: The following steps are involved: S1. Calibration initialization: Initialize the peripherals, calibration parameters and encoder chip used to prepare for calibration; S2, force the motor to record the calibration starting position; S3, force the motor to rotate to the ideal electrical angle; S4. Calculate the ideal mechanical angle; S5, determine whether the motor has completed one mechanical cycle rotation, calculate the compensation value and store it; S6. Reading calibration data from the memory; S7, control initialization, read the encoder original data; S8, look up the table and select calibration data; S9. Output the compensated angle.
2. The off-axis magnetic encoder data calibration and compensation method according to claim 2, characterized in that: In step S1, the peripheral device includes a motor control chip and a motor drive circuit, the motor control chip and the motor drive circuit are electrically connected, and the calibration parameters include motor pole pair number parameters, calibration point and recording point parameters, encoder data format parameters and motor control parameters.
3. The off-axis magnetic encoder data calibration and compensation method according to claim 3, characterized in that: In step S2, the motor rotor is forced to rotate to the current electrical angle 0 position using a sensorless control method, and this position is set as the motor's mechanical angle 0 position. The encoder's uncalibrated 0 position data is read at the motor's 0 position, and the calibration starting position is recorded.
4. The off-axis magnetic encoder data calibration and compensation method according to claim 3, characterized in that: In step S3, the electrical angle is increased at a uniform speed and in equal steps. The increased electrical angle is used as the ideal electrical angle, which is also the target electrical angle. The motor rotor is dragged to rotate to the target electrical angle position using a sensorless control method, and the output data of the uncalibrated encoder is read.
5. The off-axis magnetic encoder data calibration and compensation method according to claim 3, characterized in that: In step S4, the ideal mechanical angle value with the starting calibration point as the 0 angle position is calculated using the increased ideal electrical angle and the number of motor pole pairs, which is used for subsequent calculation of the angle compensation error.
6. The off-axis magnetic encoder data calibration and compensation method according to claim 3, characterized in that: In step S5, the ideal mechanical angle is converted into an ideal binary integer data that conforms to the sensor output result, and the ideal binary integer data is subtracted from the output data of the uncalibrated encoder to obtain the encoder raw data compensation value, which is stored in the memory; A complete mechanical angle cycle is evenly divided into 1024 calibration points. The encoder output angle raw data is binary data. The area between every two calibration points is evenly divided into 8 recording points. The data of each calibration point is the average of the compensation values of the 8 recording points. In step S5, it is also necessary to determine whether the motor has completed one mechanical cycle rotation. If not, the motor is controlled to continue rotating by increasing the ideal electrical angle and performing the calibration operation until one rotation is completed, thereby ending the calibration calculation process.
7. The off-axis magnetic encoder data calibration and compensation method according to claim 2, characterized in that: In step S6, it is also necessary to determine whether there is calibration data in the memory. If there is no calibration data, the process returns to step S1 to perform the calibration process. If there is calibration data, the operation of reading the calibration data from the memory is executed again.
8. The off-axis magnetic encoder data calibration and compensation method according to claim 2, characterized in that: In step S7, the peripherals and sensors used by the controller are initialized, and the controller directly reads the uncalibrated encoder raw data through the peripherals.
9. The off-axis magnetic encoder data calibration and compensation method according to claim 6, characterized in that: In step S8, the first 10 bits of the uncalibrated encoder raw binary data are used as the basic index n of the calibration data, and the calibration data is retrieved from the calibration data table in combination with the motor rotation direction; If the motor rotates in the direction of increasing data, (n+1) is used as the index to retrieve data from the 1024 data tables; if the motor rotates in the direction of decreasing data, n is used as the index to retrieve data, and the retrieved data is used to compensate and correct the original encoder data.
10. The off-axis magnetic encoder data calibration and compensation method according to claim 6, characterized in that: In step S9, the uncalibrated encoder raw data is summed with the calibration data to obtain the calibrated data. The calibrated data is converted through the encoder data protocol, and the integer base data is converted into floating-point mechanical angle data of 0 to 360, and the calibrated mechanical angle is output.
Citation Information
Cited By
Motor encoder calibration method and calibration device
CN121655599A
Magnetic encoder calibration method and system
CN121783231A
