Magnetic encoder self-calibration method, system, storage medium and electronic device
By calculating the real-time difference and average value of Hall signal pairs, predicting the intersection point value at the next moment, the problem of angle correction lag of magnetic encoder is solved, and higher correction accuracy and sensitivity are achieved.
Patent Information
- Application Number
- CN202310561990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-05-18
AI Technical Summary
The existing angle correction method of magnetic encoders causes hysteresis due to Hall signal waveform distortion, resulting in inaccuracy.
By calculating the real-time difference and real-time average of each Hall signal pair, the intersection value at the next moment is predicted, and the angle deviation correction is performed based on this, and the intersection prediction formula and the root mean square calculation are used to improve the correction accuracy.
The angle correction accuracy of the magnetic encoder is improved, the error caused by changes in Hall signal waveform is reduced, and the sensitivity and response speed of the magnetic encoder is enhanced.
Smart Images

Figure CN116499349B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of magnetic encoders, and in particular to a magnetic encoder self-calibration method, device, storage medium and electronic equipment. Background Art
[0002] A magnetic encoder is a high-precision sensor for selecting the position or linear displacement of a vehicle. It usually consists of a rotating or linearly moving permanent magnet and a magnetic field sensor. The magnetic field sensor can be a Hall effect sensor. The Hall effect sensor can convert magnetic field changes into voltage changes based on the Hall effect. Magnetic encoders are widely used in robot control, machine tools, medical equipment and other fields that require high-precision position measurement due to their high resolution and high precision.
[0003] In a rotary magnetic encoder based on a Hall sensor, the magnetic field values measured by the three Hall signals are sine or cosine functions. The accuracy of the magnetic encoder is related to each Hall signal. The Hall signal is sensitive to magnetic field intensity interference. When the magnetic field intensity of the permanent magnet changes, the waveform of the Hall signal becomes distorted, thereby affecting the measured angle deviation of the magnetic encoder.
[0004] To address the problem of angular deviation caused by changes in the magnetic field strength of the permanent magnet, the existing technology uses a cross-point correction method that combines the Hall signals of three Hall sensors. Cross-points will be generated between the Hall signals of different paths. By measuring and calculating the cross-points of the Hall signals, the magnetic encoder is corrected, thereby reducing the angular deviation caused by changes in the magnetic field strength.
[0005] However, the existing correction method using intersection points performs correction based on the previous intersection point of the two Hall signals. Since the waveform of the distorted Hall signal changes all the time, the method of using intersection points for direct correction has a lag, resulting in inaccurate angle correction for the magnetic encoder. Summary of the Invention
[0006] The present application provides a magnetic encoder self-correction method, device, storage medium and electronic device, which predicts the value of the second intersection point at the next moment based on the real-time difference and real-time average value of each Hall signal pair, and corrects the angular deviation of the magnetic encoder in real time based on the value of the second intersection point, thereby improving the accuracy of the angle correction.
[0007] In a first aspect, the present application provides a magnetic encoder self-calibration method, which is applied to a magnetic encoder, wherein the magnetic encoder includes at least three Hall sensors, a permanent magnet, and a controller, wherein the permanent magnet is used to provide a magnetic field, and the at least three Hall sensors are used to measure the magnetic field strength of the permanent magnet and generate corresponding Hall signals. The method includes:
[0008] The controller obtains the Hall signals generated by the at least three Hall sensors at a current moment, and calculates a real-time difference and a real-time average value of each Hall signal pair, wherein the Hall signal pairs are formed by combining the Hall signals in pairs;
[0009] If the difference of the target Hall signal pair in the at least one Hall signal pair is less than the set first threshold, respectively obtaining the value of the first intersection point of each Hall signal pair, where the value of the first intersection point is the voltage amplitude of the intersection point of the Hall signal pair at the previous moment;
[0010] Based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair, the value of the second intersection point of each Hall signal pair is calculated, and based on the value of the second intersection point of each Hall signal pair, the angle deviation of the magnetic encoder is corrected, where the value of the second intersection point is the voltage amplitude of the predicted intersection point of the Hall signal pair at the next moment.
[0011] By adopting the above technical solution, the second intersection point at the next moment is predicted based on the first intersection point at the previous moment according to the real-time difference and real-time average value of each Hall signal pair, so that the value of the upcoming intersection point can be predicted in advance based on the actual value of the real-time Hall signal, thereby correcting the angle deviation of the magnetic encoder caused by the deviation of the Hall signal in advance. Compared with directly using the value of the first intersection point for angle correction, the accuracy of the angle correction of the magnetic encoder can be improved.
[0012] Optionally, the calculating the value of the second intersection point of each Hall signal pair based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair includes:
[0013] Calculate the value of the second intersection point of each Hall signal pair using an intersection prediction formula based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair;
[0014] The intersection prediction formula is:
[0015] CPx=DTx*(CPSx-AVGx) / TH1+AVGx;
[0016] In the formula, CPx is the value of the second intersection point of the x-th Hall signal pair, DTx is the real-time difference of the x-th Hall signal pair, CPSx is the value of the first intersection point of the x-th Hall signal pair, AVGx is the real-time average value of the x-th Hall signal pair, and TH1 is the set first threshold.
[0017] By adopting the above technical solution, the real-time difference of the Hall signal pair is used as a weighted value. For the Hall signal pair with a small real-time difference, the predicted value of the second intersection point is close to the real-time average value of the Hall signal pair. For the Hall signal pair with a large difference, the value of the second intersection point is weightedly predicted according to the real-time difference of the Hall signal pair, which can improve the accuracy of the numerical prediction of the second intersection point.
[0018] Optionally, before calculating the value of the second intersection point of each Hall signal pair using an intersection prediction formula based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair, the method further includes:
[0019] Determine whether the difference between the Hall signal pair is less than a set second threshold, and the set second threshold is less than the set first threshold;
[0020] If the difference between the Hall signal pairs is smaller than the set second threshold, the value of the first intersection point of the Hall signal pair is used as the value of the second intersection point of the Hall signal pair.
[0021] By adopting the above technical solution, when the difference between each Hall signal pair is less than the second threshold, it means that the Hall signal is less affected and each Hall signal pair is within the error range. At this time, the value of the second intersection point at the previous moment can be used as the value of the second intersection point at the next moment, which can reduce the amount of calculation for real-time prediction.
[0022] Optionally, the first threshold is a fixed value, and the value of the first threshold is determined by the noise level of the Hall sensor, the sensitivity, response speed and accuracy requirements of the magnetic encoder.
[0023] By adopting the above technical solution, the value of the first threshold is comprehensively considered from the above dimensions in practical applications, so as to ensure the accuracy and sensitivity of the numerical prediction of the second intersection point.
[0024] Optionally, if the difference between at least one Hall signal pair is less than the set first threshold, it also includes: obtaining the real-time temperature of the permanent magnet and a first correspondence table of changes in the magnetic field strength of the permanent magnet with temperature, and dynamically adjusting the value of the set first threshold based on the real-time temperature and the first correspondence table.
[0025] By adopting the above technical solution, the magnetic field strength of the permanent magnet is sensitive to temperature. By dynamically adjusting the value of the first threshold according to the real-time temperature of the permanent magnet through a table lookup method, the correction accuracy of the magnetic encoder can be further improved.
[0026] Optionally, the correcting the angle deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair includes:
[0027] Obtain a second correspondence table between the numerical value of the intersection point and the angular position of the magnetic encoder;
[0028] respectively obtaining values of a plurality of intersection points of each Hall signal pair before the current moment, and calculating a root mean square value of the values of the plurality of intersection points of each Hall signal pair before the current moment;
[0029] Obtaining a reference angular position of each Hall signal pair at the second intersection based on the root mean square value and the second corresponding relationship table;
[0030] Obtaining a predicted angular position of each Hall signal pair at the second intersection based on the value of the second intersection and the second correspondence table;
[0031] An angular deviation of the magnetic encoder is corrected based on the reference angular position and the predicted angular position.
[0032] By adopting the above technical solution, the corresponding reference angle position is obtained according to the root mean square value of the numerical values of the Hall signal pair at several intersection points before the current moment, and the predicted angle position at the second intersection point is obtained by looking up the table, so that the predicted angle position is further corrected based on the Hall signal pair.
[0033] Optionally, calculating the root mean square value of the values of a plurality of intersection points of each Hall signal pair before the current moment includes:
[0034] Calculate the root mean square value of the values of the plurality of intersection points of each Hall signal pair before the current moment using a root mean square value calculation formula;
[0035] The root mean square value calculation formula is:
[0036]
[0037] Among them, X rms is the RMS value, Xi is the value of the i-th intersection point before the current moment, and N is the number of intersection points before the current moment.
[0038] By adopting the above technical solution, the influence of noise when calculating the average of the values of several intersection points before the current moment can be reduced, and the error of the subsequent calculation results caused by the values of larger or smaller intersection points can be reduced.
[0039] In a second aspect, the present application provides a magnetic encoder self-calibration device, wherein the device comprises:
[0040] a Hall signal processing module, configured for the controller to obtain the Hall signals generated by the at least three Hall sensors at the current moment, and to calculate a real-time difference and a real-time average value of each Hall signal pair, wherein the Hall signal pairs are formed by combining the Hall signals in pairs;
[0041] a first intersection point acquisition module, configured to acquire a value of a first intersection point of each Hall signal pair if a difference value of a target Hall signal pair among the at least one Hall signal pair is less than a set first threshold, where the value of the first intersection point is a voltage amplitude of the intersection point of the Hall signal pair at a previous moment;
[0042] A second intersection correction module is configured to calculate the value of the second intersection of each Hall signal pair based on the value of the first intersection of each Hall signal pair and the real-time difference and real-time average of each Hall signal pair, and to correct the angular deviation of the magnetic encoder based on the value of the second intersection of each Hall signal pair, wherein the value of the second intersection is the voltage amplitude of the predicted intersection of the Hall signal pair at the next moment. In a third aspect, the present application provides a computer-readable storage medium storing a plurality of instructions suitable for being loaded by a processor and executing any one of the above methods.
[0043] In a third aspect, the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing any one of the methods described above.
[0044] In a fourth aspect, the present application provides an electronic device comprising a processor, a memory and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device performs any one of the above methods.
[0045] In summary, one or more technical solutions provided in the embodiments of the present application have the following technical effects or advantages: according to the real-time difference and real-time average value of each Hall signal pair, the second intersection point at the next moment is predicted based on the first intersection point at the previous moment, so that the value of the upcoming intersection point can be predicted in advance based on the actual value of the real-time Hall signal, thereby correcting the angle deviation of the magnetic encoder caused by the deviation of the Hall signal in advance. Compared with directly using the value of the first intersection point for angle correction, the accuracy of the angle correction of the magnetic encoder can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a sampling principle diagram of a magnetic encoder provided in an embodiment of the present application;
[0047] Figure 2 1 is a flow chart of a magnetic encoder self-calibration method provided in an embodiment of the present application;
[0048] Figure 3 1 is a structural diagram of a magnetic encoder self-correction device provided in an embodiment of the present application;
[0049] Figure 4 It is a structural diagram of an electronic device disclosed in an embodiment of the present application.
[0050] Explanation of the reference numerals: 100, Hall signal processing module; 200, first intersection point acquisition module; 300, second intersection point correction module; 400, electronic device; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0052] In the description of the embodiments of this application, words such as "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" or "for instance" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a concrete manner.
[0053] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0054] The technical solution provided in this application can be applied to magnetic encoder scenarios, specifically to magnetic rotary encoders.
[0055] See Figure 1, which is the sampling principle diagram of the magnetic encoder. In the figure, the permanent magnet part generates a magnetic field change during the rotation process. The Hall sensor detects the change of the multi-level magnetic flux of the rotating permanent magnet that is evenly arranged along the circumferential direction, and obtains an incremental pulse signal or an alternating magnetic flux signal. The Hall signals of multiple Hall sensors can be processed to obtain the rotational angle position of the permanent magnet.
[0056] In practice, the permanent magnet in the magnetic encoder is sensitive to temperature. When the temperature changes, the magnetic field strength of the permanent magnet will change significantly. In addition, when the magnetic encoder is reinstalled, the relative position between the permanent magnet and the Hall sensor changes, which will cause the value sensed by the Hall sensor to change significantly. This will significantly affect the accuracy of the magnetic encoder and require angle correction of the magnetic encoder.
[0057] In the prior art, when using the intersection points between Hall signals for correction, some methods use previous historical intersection points for correction. However, due to changes in the waveform of the Hall signal, this method causes the historical intersection points themselves to be inaccurate and the correction error to be large. Moreover, when the magnetic field strength changes between the two intersection points, using the previous historical intersection point for angle correction is also inaccurate.
[0058] Based on the above problems, the embodiment of the present application can timely monitor the real-time changes of multiple Hall signals, and at the same time predict the intersection point at the next moment based on the intersection point at the previous moment, and perform angle correction according to the predicted intersection point, thereby improving the accuracy of the angle correction of the magnetic encoder.
[0059] It should be noted that the implementation subject of this application is a magnetic encoder, which includes at least three Hall sensors, a permanent magnet and a controller. The permanent magnet is used to provide a magnetic field, and at least three Hall sensors are used to measure the magnetic field strength of the permanent magnet and generate corresponding Hall signals.
[0060] See Figure 2 , is a flow chart illustrating a magnetic encoder self-calibration method provided in an embodiment of the present application. This method can be implemented using a computer program, a single-chip microcomputer, or a von Neumann-based magnetic encoder self-calibration device. The computer program can be integrated into an application or run as a standalone tool. This embodiment of the present application uses a magnetic encoder controller as an example to provide a detailed description of the specific steps of the magnetic encoder self-calibration method.
[0061] In step S10 , the controller obtains Hall signals generated by at least three Hall sensors at the current moment, and calculates a real-time difference and a real-time average value of each Hall signal pair, where a Hall signal pair is composed of two Hall signals combined.
[0062] The Hall effect sensor is made based on the Hall effect. It can detect the changing magnetic field strength generated by the permanent magnet and linearly output a corresponding voltage signal. It can promptly reflect the changes in the magnetic field strength detected by the Hall sensor. The output voltage signal is the Hall signal.
[0063] A Hall signal pair is a combination of two Hall signals. For example, if three Hall signals are acquired, namely Hall signal A, Hall signal B, and Hall signal C, the Hall signal pairs are Hall signal pair AB, Hall signal pair AC, and Hall signal pair BC. If the number of Hall signals acquired is greater than three, the Hall signal pairs are combined in the same way.
[0064] The real-time difference of the Hall signal pair is the absolute value of the difference between the voltage amplitudes of the two Hall signals in the Hall signal pair, and the real-time average value of the Hall signal pair is the average value of the voltage amplitudes of the two Hall signals in the Hall signal pair.
[0065] In step S20, if the difference of the target Hall signal pair in at least one Hall signal pair is less than the set first threshold, the value of the first intersection point of each Hall signal pair is obtained respectively, and the value of the first intersection point is the voltage amplitude of the intersection point of the Hall signal pair at the previous moment.
[0066] After calculating the real-time difference of each Hall signal pair, the real-time difference of each Hall signal pair is judged in real time to determine whether there is a target Hall signal pair whose difference is less than a preset first threshold. If there is a target Hall signal pair whose difference is less than the first threshold, it means that the voltage amplitude difference of the two Hall signals of the target Hall signal pair is small. At the same time, the voltage amplitude difference of one Hall signal in the target Hall signal pair may become larger than that of the Hall signals in other Hall signal pairs. That is, the Hall signal of the acquired Hall sensor fluctuates greatly due to the change in magnetic field strength, and it is necessary to correct the angle of the magnetic encoder by predicting the intersection point.
[0067] In one embodiment, the value of the first threshold for determining whether angle correction is required is a constant value, and the value of the first threshold is determined by the noise level of the Hall sensor, the sensitivity, response speed and accuracy requirements of the magnetic encoder.
[0068] If the first threshold is too small, the encoder will only start self-calibration for large fluctuations, making it less sensitive and slowing down its response. If the first threshold is too large, the encoder will be overly sensitive and susceptible to external interference and noise. Furthermore, as a position measurement device, the magnetic encoder must also meet certain accuracy requirements, so this needs to be determined based on the actual application scenario.
[0069] In another embodiment, the value of the first threshold for determining whether angle correction is required is a dynamic value, and the real-time temperature of the permanent magnet and the first correspondence table of the change in the magnetic field strength of the permanent magnet with the temperature are obtained. Based on the real-time temperature and the first correspondence table, the value of the set first threshold is dynamically adjusted.
[0070] In the actual operation of the magnetic encoder, the temperature of the permanent magnet is more sensitive to the influence of the Hall signal. Therefore, the first threshold value can be dynamically adjusted according to the real-time temperature of the permanent magnet. The first relationship table of the change of the magnetic field strength of the permanent magnet with the temperature can be obtained according to Curie's law and thermodynamic formulas. The acquisition process will not be repeated here. It is sufficient to obtain the corresponding relationship between the magnetic field strength of the permanent magnet and the temperature of the permanent magnet. The temperature of the permanent magnet can be obtained through the temperature sensor, so as to dynamically adjust the value of the first threshold value.
[0071] The first intersection point is the intersection position of the Hall signal pair at the previous moment, and is the intersection point of the Hall signal pair closest to the current moment. The value of the first intersection point is the voltage amplitude when the two Hall signals intersect at the intersection point. It should be understood that if the phase angle of the intersection point changes due to the increase in the voltage amplitude of a certain Hall signal, the value of the first intersection point should also include the phase angle at the intersection point.
[0072] Step S30, based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair, calculate the value of the second intersection point of each Hall signal pair, and correct the angle deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair, where the value of the second intersection point is the voltage amplitude of the predicted intersection point of the Hall signal pair at the next moment.
[0073] The specific method of calculating the value of the second intersection point of each Hall signal pair is to use the intersection point prediction formula to calculate the value of the second intersection point of each Hall signal pair based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair;
[0074] The intersection prediction formula is:
[0075] CPx=DTx*(CPSx-AVGx) / TH1+AVGx;
[0076] In the formula, CPx is the value of the second intersection point of the x-th Hall signal pair, DTx is the real-time difference of the x-th Hall signal pair, CPSx is the value of the first intersection point of the x-th Hall signal pair, AVGx is the real-time average value of the x-th Hall signal pair, and TH1 is the set first threshold.
[0077] In the above calculation, the real-time difference between the Hall signal pairs is equivalent to the weighted value. The larger the real-time difference, the larger the predicted value of the corresponding second intersection point. At the same time, when the real-time difference gradually becomes smaller, the value of the second intersection point gradually approaches the real-time average value of the Hall signal pair, that is, the two Hall signals in the Hall signal pair are about to cross.
[0078] In one feasible embodiment, it is determined whether the difference between the Hall signal pairs is less than a set second threshold, and the set second threshold is less than the set first threshold; if the difference between the Hall signal pairs is less than the set second threshold, the value of the first intersection point of the Hall signal pair is used as the value of the second intersection point of the Hall signal pair.
[0079] By introducing a second threshold, when the real-time difference between the Hall signal pairs is less than a smaller second threshold, it indicates that the two Hall signals in the Hall signal pair are about to cross or have just crossed. This setting can reduce the amount of calculation for partial intersection prediction.
[0080] Specifically, in one method of performing angle correction, the correction method includes but is not limited to the following method, and the steps of correcting the angle deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair are as follows: Step S301, obtaining a second correspondence table between the value of the intersection point and the angular position of the magnetic encoder.
[0081] In the prior art of determining the angular position of the magnetic encoder by the value of the intersection point, the magnetic field direction on the stator side corresponding to the intersection point can be obtained according to the sector installation position of the Hall sensor, thereby corresponding to the angular position of the magnetic encoder on the stator side.
[0082] Step S302 , respectively obtaining the values of several intersection points of each Hall signal pair before the current moment, and calculating the root mean square value of the values of the several intersection points of each Hall signal pair before the current moment.
[0083] Without considering the change in the permanent magnet's rotation speed, the reference angle position at the next intersection can be predicted by the values of several intersection points before the current moment. At the same time, by calculating the root mean square value, the noise interference of the larger or smaller intersection point values can be reduced. The root mean square value calculation formula is:
[0084]
[0085] Among them, X rms is the RMS value, Xi is the value of the i-th intersection point before the current moment, and N is the number of intersection points before the current moment.
[0086] Step S303 : obtaining a reference angle position of each Hall signal pair at the second intersection based on the RMS value and the second corresponding relationship table.
[0087] By looking up the table, the reference angle position of each Hall signal pair at the second intersection is obtained. The second intersection is the position of the Hall signal pair when it crosses at the next moment. Each Hall signal pair corresponds to a second intersection.
[0088] Step S304 : obtaining the predicted angular position of each Hall signal pair at the second intersection based on the value of the second intersection and the second corresponding relationship table.
[0089] The second relationship correspondence table is stored in the memory of the magnetic encoder. After the value of the intersection point is predicted, the corresponding second relationship correspondence table is called to obtain the predicted angular position.
[0090] Step S305 , correcting the angle deviation of the magnetic encoder based on the reference angle position and the predicted angle position.
[0091] In one feasible implementation, based on the reference angular position, the angular position of the magnetic encoder is adjusted with reference to the predicted angular position so that the correction angle approaches the predicted angular position, and the adjustment weight is determined according to the difference between the reference angular position and the predicted angular position.
[0092] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0093] See Figure 3 , which shows a schematic diagram of the structure of a magnetic encoder self-calibration device provided by an exemplary embodiment of the present application. This device can be implemented as all or part of a device through software, hardware, or a combination of both. The device includes a Hall signal processing module 100, a first intersection point acquisition module 200, and a second intersection point calibration module 300.
[0094] The Hall signal processing module 100 is used to control the acquisition of Hall signals generated by at least three Hall sensors at the current moment and calculate the real-time difference and real-time average of each Hall signal pair. A Hall signal pair is composed of two Hall signals combined. The first intersection point acquisition module 200 is used to respectively acquire the value of the first intersection point of each Hall signal pair if the difference of the target Hall signal pair in at least one Hall signal pair is less than a set first threshold. The value of the first intersection point is the voltage amplitude of the intersection point of the Hall signal pair at the previous moment.
[0095] The second intersection point correction module 300 is used to calculate the value of the second intersection point of each Hall signal pair based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair, and correct the angular deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair. The value of the second intersection point is the voltage amplitude of the predicted intersection point of the Hall signal pair at the next moment.
[0096] Based on the above embodiment, as an optional embodiment, the first intersection point acquisition module 200 further includes: a first threshold determination unit and a first threshold adjustment unit, wherein:
[0097] The first threshold determination unit is configured to set the first threshold as a fixed value, wherein the value of the first threshold is determined by the noise level of the Hall sensor, the sensitivity, response speed, and accuracy requirements of the magnetic encoder.
[0098] The first threshold adjustment unit is used to obtain the real-time temperature of the permanent magnet and a first correspondence table of changes in the magnetic field strength of the permanent magnet with temperature, and dynamically adjust the value of the set first threshold based on the real-time temperature and the first correspondence table.
[0099] Based on the above embodiment, as an optional embodiment, the second intersection correction module 300 further includes: an intersection prediction unit and an intersection replacement unit, wherein:
[0100] A cross point prediction unit, configured to calculate a value of a second cross point of each Hall signal pair based on a value of the first cross point of each Hall signal pair and a real-time difference and a real-time average value of each Hall signal pair using a cross point prediction formula;
[0101] The intersection prediction formula is:
[0102] CPx=DTx*(CPSx-AVGx) / TH1+AVGx;
[0103] Wherein, CPx is the value of the second intersection of the x-th Hall signal pair, DTx is the real-time difference of the x-th Hall signal pair, CPSx is the value of the first intersection of the x-th Hall signal pair, AVGx is the real-time average value of the x-th Hall signal pair, and TH1 is the set first threshold.
[0104] The intersection replacement unit is used to determine whether the difference between the Hall signal pair is less than the set second threshold, and the set second threshold is less than the set first threshold; if the difference between the Hall signal pair is less than the set second threshold, the value of the first intersection of the Hall signal pair is used as the value of the second intersection of the Hall signal pair.
[0105] Based on the above embodiment, as an optional embodiment, the second intersection point correction module 300 further includes: an angle correction unit and a root mean square value calculation unit, wherein:
[0106] An angle correction unit, used to obtain a second correspondence table between the value of the intersection point and the angular position of the magnetic encoder;
[0107] Obtain the values of several intersection points of each Hall signal pair before the current moment respectively, and calculate the root mean square value of the values of the several intersection points of each Hall signal pair before the current moment;
[0108] Based on the root mean square value and the second corresponding relationship table, a reference angle position of each Hall signal pair at the second intersection is obtained;
[0109] Based on the value of the second intersection point and the second corresponding relationship table, obtaining the predicted angular position of each Hall signal pair at the second intersection point;
[0110] The angular deviation of the magnetic encoder is corrected based on the reference angular position and the predicted angular position.
[0111] a root mean square value calculation unit, configured to calculate the root mean square value of the values of a plurality of intersection points of each Hall signal pair before a current moment using a root mean square value calculation formula;
[0112] The formula for calculating the root mean square value is:
[0113]
[0114] Among them, X rms is the RMS value, Xi is the value of the i-th intersection point before the current moment, and N is the number of intersection points before the current moment.
[0115] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0116] The present application also provides a computer storage medium that can store multiple instructions, which are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 3 The magnetic encoder self-calibration method of the embodiment shown in the figure can be specifically implemented in the following manner: Figure 1-Figure 3 The detailed description of the illustrated embodiment will not be repeated here.
[0117] This application also discloses an electronic device. Figure 4 , Figure 4 The electronic device 400 may include: at least one processor 401 , at least one network interface 404 , a user interface 403 , a memory 405 , and at least one communication bus 402 .
[0118] The communication bus 402 is used to implement the connection and communication between these components.
[0119] The user interface 403 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.
[0120] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0121] The processor 401 may include one or more processing cores. The processor 401 utilizes various interfaces and lines to connect various parts of the entire server, and executes various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 405, as well as calling data stored in the memory 405. Optionally, the processor 401 may be implemented in the form of at least one hardware component selected from digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 401 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 401 and may be implemented separately on a single chip.
[0122] Among them, the memory 405 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 405 includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 405 may optionally be at least one storage device located away from the aforementioned processor 401. Refer to Figure 4 The memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application for self-calibration of a magnetic encoder.
[0123] exist Figure 4 In the electronic device 400 shown, the user interface 403 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 401 can be used to call a magnetic encoder self-calibration application stored in the memory 405. When executed by one or more processors 401, the electronic device 400 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited to the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.
[0124] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0125] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0126] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0127] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0128] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0129] The foregoing is merely an exemplary embodiment of the present disclosure and is not intended to limit the scope of the present disclosure. In other words, any equivalent variations and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the disclosure and the practical implications thereof.
[0130] This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not described herein. The description and examples are to be considered as exemplary only, and the scope and spirit of the present disclosure are to be defined by the claims.
Claims
1. A magnetic encoder self-calibration method, characterized in that: Applied to a magnetic encoder, the magnetic encoder includes at least three Hall sensors, a permanent magnet, and a controller. The permanent magnet is used to provide a magnetic field. The at least three Hall sensors are respectively used to measure the magnetic field strength of the permanent magnet and generate corresponding Hall signals. The method includes: The controller obtains the Hall signals generated by the at least three Hall sensors at a current moment, and calculates a real-time difference and a real-time average value of each Hall signal pair, wherein the Hall signal pairs are formed by combining the Hall signals in pairs; If the difference of the target Hall signal pair in at least one of the Hall signal pairs is less than the set first threshold, respectively obtain the value of the first intersection point of each Hall signal pair, where the value of the first intersection point is the voltage amplitude of the intersection point of the Hall signal pair at the previous moment; Calculating a value of a second intersection point of each Hall signal pair based on a value of a first intersection point of each Hall signal pair and a real-time difference and a real-time average value of each Hall signal pair, and correcting the angle deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair, where the value of the second intersection point is a voltage amplitude of a predicted intersection point of the Hall signal pair at a next moment; The calculating the value of the second intersection point of each Hall signal pair based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair includes: Calculate the value of the second intersection point of each Hall signal pair using an intersection prediction formula based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair; The intersection prediction formula is: CPx=DTx*(CPSx-AVGx) / TH1+AVGx; In the formula, CPx is the value of the second intersection point of the x-th Hall signal pair, DTx is the real-time difference of the x-th Hall signal pair, CPSx is the value of the first intersection point of the x-th Hall signal pair, AVGx is the real-time average value of the x-th Hall signal pair, and TH1 is the set first threshold.
2. The method according to claim 1, characterized in that Before calculating the value of the second intersection point of each Hall signal pair using the intersection point prediction formula based on the value of the first intersection point of each Hall signal pair and the real-time difference and real-time average value of each Hall signal pair, the method further includes: Determine whether the difference between the Hall signal pair is less than a set second threshold, and the set second threshold is less than the set first threshold; If the difference between the Hall signal pairs is smaller than the set second threshold, the value of the first intersection point of the Hall signal pair is used as the value of the second intersection point of the Hall signal pair.
3. The method according to claim 1, characterized in that The first threshold is a fixed value, and the value of the first threshold is determined by the noise level of the Hall sensor, the sensitivity, response speed and accuracy requirements of the magnetic encoder.
4. The method according to claim 1, wherein If the difference between at least one of the Hall signal pairs is less than the set first threshold, the method further includes: A first correspondence table of the real-time temperature of the permanent magnet and the magnetic field strength of the permanent magnet varying with temperature is obtained, and a value of the set first threshold is dynamically adjusted based on the real-time temperature and the first correspondence table.
5. The method according to claim 1, wherein The correcting the angle deviation of the magnetic encoder based on the value of the second intersection point of each Hall signal pair includes: Obtain a second correspondence table between the numerical value of the intersection point and the angular position of the magnetic encoder; respectively obtaining values of a plurality of intersection points of each Hall signal pair before the current moment, and calculating a root mean square value of the values of the plurality of intersection points of each Hall signal pair before the current moment; Obtaining a reference angular position of each Hall signal pair at the second intersection based on the root mean square value and the second corresponding relationship table; Obtaining a predicted angular position of each Hall signal pair at the second intersection based on the value of the second intersection and the second correspondence table; An angular deviation of the magnetic encoder is corrected based on the reference angular position and the predicted angular position.
6. The method according to claim 5, characterized in that Calculating the root mean square value of the values of the plurality of intersection points of each Hall signal pair before the current moment includes: Calculate the root mean square value of the values of the plurality of intersection points of each Hall signal pair before the current moment using a root mean square value calculation formula; The root mean square value calculation formula is: ; in, is the RMS value, Xi is the value of the i-th intersection point before the current moment, and N is the number of intersection points before the current moment.
7. A self-calibration device based on the magnetic encoder self-calibration method according to claim 1, characterized in that: The device includes: a Hall signal processing module, configured for the controller to obtain the Hall signals generated by the at least three Hall sensors at the current moment, and to calculate a real-time difference and a real-time average value of each Hall signal pair, wherein the Hall signal pairs are formed by combining the Hall signals in pairs; a first intersection point acquisition module, configured to respectively acquire a value of a first intersection point of each Hall signal pair if a difference value of a target Hall signal pair in at least one of the Hall signal pairs is less than a set first threshold value, where the value of the first intersection point is a voltage amplitude of the intersection point of the Hall signal pair at a previous moment; a second intersection correction module, configured to calculate the value of the second intersection of each Hall signal pair based on the value of the first intersection of each Hall signal pair and the real-time difference and real-time average of each Hall signal pair, and to correct the angular deviation of the magnetic encoder based on the value of the second intersection of each Hall signal pair, where the value of the second intersection is the voltage amplitude of the predicted intersection of the Hall signal pair at the next moment.
8. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: The electronic device comprises a processor, a memory and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device and system for encoding and decoding
CN103413160A
System and methods for coping with doppler effects in distributed-input distributed-output wireless systems
CN104603853A