A brushless DC motor position detection method and system

Through the cooperation of the incremental encoder and the built-in eQEP module of DSP, the rotation increment of the motor rotor position is detected and position compensation is performed, which solves the problem of low position detection accuracy of the motor rotor in the prior art, and realizes high-precision position detection. Reduces manufacturing costs and improves control accuracy.

CN114629385BActive Publication Date: 2024-12-20SHANDONG XINSONG IND SOFTWARE RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011441580.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-08
Publication Date
2024-12-20
Estimated Expiration
2040-12-08

AI Technical Summary

Technical Problem

In the existing position servo control system, the motor rotor position detection accuracy is low, resulting in low position control accuracy. Especially when the motor rotor position stays near the Z pulse signal, the position counting error caused by motion vibration is large.

Method used

The incremental encoder is used to cooperate with the built-in quadrature encoding module eQEP of DSP. By detecting the Z pulse signal, the rotation increment of the rotor position is calculated, and the position compensation is performed according to the rotation direction. It is divided into two parts to calculate the rotor position and start from the motor. The amount of position that occurs at the time to the first Z pulse signal and the amount from the first Z pulse signal to the current position are added to realize high-precision rotor position detection.

Benefits of technology

It effectively improves the accuracy of motor rotor position detection, reduces the manufacturing cost of position servo system, does not increase hardware cost, and has strong portability and modularity of position detection software algorithms, and has fast execution speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114629385B_ABST
    Figure CN114629385B_ABST
Patent Text Reader

Abstract

The present invention relates to a brushless DC motor position detection method and system. The method and system initialize the eQEP module and various variable parameters; detect the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly read the value of the position calculator in the eQEP module as the current motor rotor position; when the first Z pulse signal is detected, first calculate the rotation increment of the rotor position, then judge the rotation direction of the rotor, and according to the judgment of the rotation direction, perform position compensation through the Z point, and then calculate the rotor position. The method and system use the eQEP module built into the main control chip DSP to analyze the pulse signal of the incremental encoder, and design a high-precision position detection software algorithm to accurately detect the current motor rotor position information, effectively improving the position accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of brushless DC motor drive control, and in particular to a brushless DC motor position detection method and system. Background Art

[0002] In the position servo control system, position following performance is the foundation of the position servo system and the most important indicator of position response performance. Obtaining accurate rotor position is the basis of DC brushless motor vector control. Whether the accurate motor rotor position can be obtained directly affects the effect of the servo system position loop control and determines the output performance. According to the detection device, the current position servo system is mainly divided into two categories of position detection methods, position sensorless position detection method and mechanical position sensor position detection method. The rotor position signal as the inverter switch commutation conduction timing signal is still indispensable. For the position sensorless position detection method, although it replaces the mechanical position sensor, it reduces the complexity of the motor structure by increasing the complexity of the circuit and control algorithm. The R&D cost is high and the implementation is difficult.

[0003] Commonly used mechanical position sensors include Hall sensors, absolute encoders, incremental encoders and other sensors. When using Hall sensors to obtain the motor rotor position, only six position information can be obtained through three Hall signals when the motor rotates one circle, and the accuracy of the rotor position information is greatly reduced. For absolute encoders, although they have high accuracy, their prices are relatively high, which increases the manufacturing cost of the entire position servo control system.

[0004] The main control core of the common position servo driver on the market is DSP. The enhanced orthogonal encoding module eQEP inside the chip can parse the rotor position information obtained by the incremental encoder. The prior art also proposes to use the Z pulse signal of the incremental photoelectric encoder to limit the technical error of the A and B orthogonal pulse signals used in the rotor position calculation to within one circle. Its accuracy range is relatively low. For position servo control with higher requirements, the error within one circle is relatively large; especially when the motor rotor position stays near the Z pulse signal, due to motion vibration, the Z pulse signal is not accurately obtained, resulting in a large error in the position count, which greatly reduces the position control accuracy. Summary of the invention

[0005] The embodiment of the present invention provides a method and system for detecting the position of a brushless DC motor, so as to at least solve the technical problem that the existing position servo control system has low detection accuracy for the motor rotor position.

[0006] According to an embodiment of the present invention, a method for detecting the position of a brushless DC motor is provided. The method cooperates with an incremental encoder and a main controller DSP. The incremental encoder is arranged on the rotating shaft of the brushless DC motor. An orthogonal encoding module eQEP is configured inside the main controller DSP. The method for detecting the position of the brushless DC motor comprises the following steps:

[0007] S100: Initialize and set the eQEP module and various variable parameters;

[0008] S200: Detecting the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly reading the value of the position calculator in the eQEP module as the current motor rotor position;

[0009] S300: When the first Z pulse signal is detected, the rotation increment of the rotor position is first calculated, and then the rotation direction of the rotor is judged. Based on the judgment of the rotation direction, position compensation through point Z is performed, and then the rotor position is calculated; the rotor position is divided into two parts, the first part is the position from the moment the motor starts to the time when the first Z pulse signal appears, and the second part is the position from the first Z pulse signal to the current position. The final actual motor rotor position is equal to the sum of the two parts.

[0010] Furthermore, step S200 also includes: recording the encoder value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; QEPPosInitToZ is the position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

[0011] Furthermore, the software variables involved in the position detection method are: the number of lines of the incremental encoder code disk is N, then after the 4-times frequency of the eQEP module, the number of lines corresponding to one rotation of the motor rotor is 4N; the current rotor position is QEPPos, and the rotor position detected at the last moment is QEPPosOld; EQep1Regs.QPOSCNT is the position calculator inside the eQEP module, and EQep1Regs.QPOSMAX is the maximum position count value set by EQep1Regs.QPOSCNT; EQep1Regs.QPOSMAX is set to 0xffffffff, and 0xffffffff is converted to a signed number of -1; the clockwise direction is set to increase, and the counterclockwise direction is set to decrease;

[0012] In step S300, the rotation increment of the rotor position temp=QEPPos-QEPPosOld;

[0013] In step S300, according to the determination of the rotation direction, position compensation is performed through point Z, and then the rotor position is calculated, including:

[0014] Determine the forward and reverse rotation of the motor. In the forward rotation case, determine whether the rotation increment temp is less than 0. If so, perform forward position compensation temp=temp+4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ.

[0015] Determine whether the motor is rotating forward or reverse. In the reverse case, determine whether the rotation increment temp is less than 0. If so, perform reverse position compensation temp=temp-4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ.

[0016] Furthermore, the position detection method uses an interrupt cycle to perform calculations.

[0017] Furthermore, the position detection method further comprises the steps of:

[0018] S400: The motor rotor position value at the current moment is updated in each interruption cycle, and the rotor position value is periodically updated to QEPPosOld=QEPPos.

[0019] Furthermore, N=1000 is set.

[0020] Furthermore, the incremental encoder outputs two pulse signals A and B that differ by 90° electrical angle from each other, and also outputs a Z pulse signal used as a reference zero position; the incremental encoder only sends out one Z pulse signal for each rotation of the code disk.

[0021] According to another embodiment of the present invention, a brushless DC motor position detection system is provided, which cooperates with an incremental encoder and a main controller DSP, wherein the incremental encoder is arranged on the rotating shaft of the brushless DC motor, and an orthogonal encoding module eQEP is configured inside the main controller DSP. The position detection system comprises:

[0022] Initialization unit, used to initialize the eQEP module and various variable parameters;

[0023] A first position detection unit is used to detect the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly read the value of the position calculator in the eQEP module as the current motor rotor position;

[0024] The second position detection unit is used to first calculate the rotation increment of the rotor position when the first Z pulse signal is detected, and then determine the rotation direction of the rotor. According to the determination of the rotation direction, position compensation through the Z point is performed, and then the rotor position is calculated; wherein the rotor position is divided into two parts, the first part is the position quantity from the moment the motor is started to the time when the first Z pulse signal appears, and the second part is the position quantity from the first Z pulse signal appears to the current position, and finally the actual motor rotor position is equal to the sum of the two parts.

[0025] Furthermore, the first position detection unit is also used to record the code disk value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; QEPPosInitToZ is the position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

[0026] Furthermore, the position detection system also includes:

[0027] The rotor position value periodic updating unit is used to update the motor rotor position value at the current moment in each interruption cycle.

[0028] The brushless DC motor position detection method and system in the embodiment of the present invention adopts the incremental encoder commonly used in the current position servo system as a feedback device for detecting the motor rotor position. It is inexpensive and effectively reduces the manufacturing cost of the entire position servo system. At the same time, the eQEP module built into the main control chip DSP is used to analyze the pulse signal of the incremental encoder, and a high-precision position detection software algorithm is designed to accurately detect the current motor rotor position information. The position detection method and system have small calculation results errors, and compared with other equivalent position detection device designs, the position accuracy is effectively improved without increasing any hardware costs. In addition, the position detection software algorithm has strong portability and modularity, and has a fast execution speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0030] Figure 1 It is a flow chart of the method for detecting the position of a brushless DC motor of the present invention;

[0031] Figure 2 It is a preferred flow chart of the brushless DC motor position detection method of the present invention;

[0032] Figure 3 It is a detection scheme diagram of the present invention;

[0033] Figure 4This is an example diagram of the actual counting form of the incremental encoder;

[0034] Figure 5 It is the flow chart of the position detection software algorithm;

[0035] Figure 6 It is a module diagram of the brushless DC motor position detection system of the present invention;

[0036] Figure 7 This is a preferred module diagram of the brushless DC motor position detection system of the present invention. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. 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 creative work should fall within the scope of protection of the present invention.

[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0039] Example 1

[0040] According to an embodiment of the present invention, a method for detecting the position of a brushless DC motor is provided, which cooperates with an incremental encoder and a main controller DSP. The incremental encoder is arranged on the rotating shaft of the brushless DC motor, and an orthogonal encoding module eQEP is configured inside the main controller DSP. Figure 1 , the position detection method comprises the following steps:

[0041] S100: Initialize and set the eQEP module and various variable parameters;

[0042] S200: Detecting the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly reading the value of the position calculator in the eQEP module as the current motor rotor position;

[0043] S300: When the first Z pulse signal is detected, the rotation increment of the rotor position is first calculated, and then the rotation direction of the rotor is judged. Based on the judgment of the rotation direction, position compensation through point Z is performed, and then the rotor position is calculated; the rotor position is divided into two parts, the first part is the position from the moment the motor starts to the time when the first Z pulse signal appears, and the second part is the position from the first Z pulse signal to the current position. The final actual motor rotor position is equal to the sum of the two parts.

[0044] The brushless DC motor position detection method in the embodiment of the present invention adopts the incremental encoder commonly used in the current position servo system as a feedback device for detecting the motor rotor position. It is inexpensive and effectively reduces the manufacturing cost of the entire position servo system. At the same time, the eQEP module built into the main control chip DSP is used to analyze the pulse signal of the incremental encoder, and a high-precision position detection software algorithm is designed to accurately detect the current motor rotor position information. The position detection method and system calculation result have small errors, and compared with other equivalent position detection device designs, the position accuracy is effectively improved without increasing any hardware costs. In addition, the position detection software algorithm has strong portability and modularity, and has a fast execution speed.

[0045] As a preferred technical solution, step S200 also includes: recording the code disk value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; QEPPosInitToZ is the position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

[0046] As a preferred technical solution, the software variables involved in the position detection method are: the number of lines of the incremental encoder code disk is N, then after the 4-fold frequency multiplication of the eQEP module, the number of lines corresponding to one rotation of the motor rotor is 4N; the current rotor position is QEPPos, and the rotor position detected at the last moment is QEPPosOld; EQep1Regs.QPOSCNT is the position calculator inside the eQEP module, and EQep1Regs.QPOSMAX is the maximum position count value set by EQep1Regs.QPOSCNT; EQep1Regs.QPOSMAX is set to 0xffffffff, and 0xffffffff is converted to a signed number of -1; the clockwise direction is set to increase, and the counterclockwise direction is set to decrease;

[0047] In step S300, the rotation increment of the rotor position temp=QEPPos-QEPPosOld;

[0048] In step S300, according to the determination of the rotation direction, position compensation is performed through point Z, and then the rotor position is calculated, including:

[0049] Determine the forward and reverse rotation of the motor. In the forward rotation case, determine whether the rotation increment temp is less than 0. If so, perform forward position compensation temp=temp+4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ.

[0050] Determine whether the motor is rotating forward or reverse. In the reverse case, determine whether the rotation increment temp is less than 0. If so, perform reverse position compensation temp=temp-4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ.

[0051] As a preferred technical solution, the position detection method uses an interrupt cycle method for calculation.

[0052] As a preferred technical solution, see Figure 2 , the position detection method also includes the steps of:

[0053] S400: The motor rotor position value at the current moment is updated in each interruption cycle, and the rotor position value is periodically updated to QEPPosOld=QEPPos.

[0054] As a preferred technical solution, N=1000 is set.

[0055] As a preferred technical solution, the incremental encoder outputs two pulse signals A and B with an electrical angle difference of 90°, and also outputs a Z pulse signal used as a reference zero position; the incremental encoder only sends out one Z pulse signal for each rotation of the code disk.

[0056] The method of the present invention is described in detail below with a specific embodiment. The software variables involved in the position detection software algorithm of the present invention are as follows:

[0057] Assuming the number of lines of the incremental encoder disk is N, after the 4-times frequency of eQEP, the number of lines corresponding to one rotation of the motor rotor is 4N. The current rotor position is QEPPos, the rotor position detected at the last moment is QEPPosOld, and the position count from the moment the motor is powered on to the arrival of the first Z pulse signal is QEPPosInitToZ.

[0058] Since the position calculator EQep1Regs.QPOSCNT inside the eQEP is an unsigned integer, it needs to be forcibly converted into a signed integer when used, and the eQEP works in orthogonal mode counting. When the counter EQep1Regs.QPOSCNT increases to the set maximum position count value EQep1Regs.QPOSMAX, the next count pulse arrives and it is reset to 0. When the count is reduced to 0, the next pulse arrives and it is reset to the maximum value set by EQep1Regs.QPOSMAX. The eQEP is initialized again so that the position calculator EQep1Regs.QPOSCNT is reset every time it encounters a Z pulse signal. Here, EQep1Regs.QPOSMAX is set to 0xffffffff, and 0xffffffff is converted to a signed number of -1, and N is set to 1000. When the rotor rotates one circle, the eQEP detects a code value of 4000. Set the clockwise direction as the increasing direction and the counterclockwise direction as the decreasing direction. From the actual numerical value in the software algorithm, the detected counting form is as follows Figure 4 shown.

[0059] See also Figure 5 The specific steps of a brushless DC motor position detection method of the present invention are as follows:

[0060] 1) Initialize the eQEP module and various variable parameters.

[0061] 2) The Z pulse signal of the incremental encoder is detected through the eQEP module. When the first Z pulse signal is not detected, the value of the position calculator EQep1Regs.QPOSCNT is directly read, which is the current motor rotor position, and the value of the code disk when the Z pulse signal occurs is recorded by updating the value of the variable QEPPosInitToZ in real time.

[0062] 3) When the first Z pulse signal is detected, the rotation increment of the rotor position is first calculated, and then the rotation direction of the rotor is determined. According to the determination of the rotation direction, the position compensation through the Z point is performed, and then the rotor position is calculated. The rotor position is divided into two parts. The first part is the position from the moment the motor starts to the first Z pulse signal, and the second part is the position from the first Z pulse signal to the current position; the actual motor rotor position is equal to the sum of the two parts.

[0063] 4) Since this method uses an interrupt cycle to perform calculations, the motor rotor position value at the current moment must be updated in each interrupt cycle so that the next cycle can be accurately calculated. This incremental design concept effectively improves the accuracy of motor rotor position detection.

[0064] Example 2

[0065] According to another embodiment of the present invention, a brushless DC motor position detection system is provided, which cooperates with an incremental encoder and a main controller DSP. The incremental encoder is arranged on the rotating shaft of the brushless DC motor, and an orthogonal encoding module eQEP is configured inside the main controller DSP. Figure 6 , the position detection system includes:

[0066] Initialization unit 201, used to initialize and set the eQEP module and various variable parameters;

[0067] The first position detection unit 202 is used to detect the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly read the value of the position calculator in the eQEP module as the current motor rotor position;

[0068] The second position detection unit 203 is used to first calculate the rotation increment of the rotor position when the first Z pulse signal is detected, and then determine the rotation direction of the rotor. According to the determination of the rotation direction, position compensation through the Z point is performed, and then the rotor position is calculated; wherein the rotor position is divided into two parts, the first part is the position quantity from the moment the motor is started to the time when the first Z pulse signal appears, and the second part is the position quantity from the first Z pulse signal appears to the current position, and finally the actual motor rotor position is equal to the sum of the two parts.

[0069] The brushless DC motor position detection system in the embodiment of the present invention adopts the incremental encoder commonly used in the current position servo system as a feedback device for detecting the motor rotor position. It is inexpensive and effectively reduces the manufacturing cost of the entire position servo system. At the same time, the eQEP module built into the main control chip DSP is used to analyze the pulse signal of the incremental encoder, and a high-precision position detection software algorithm is designed to accurately detect the current motor rotor position information. The position detection method and system calculation result have small errors, and compared with other equivalent position detection device designs, the position accuracy is effectively improved without increasing any hardware costs. In addition, the position detection software algorithm has strong portability and modularity, and has a fast execution speed.

[0070] As a preferred technical solution, the first position detection unit 202 is also used to record the code disk value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; QEPPosInitToZ is the position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

[0071] As a preferred technical solution, see Figure 7 , the position detection system also includes:

[0072] The rotor position value periodic updating unit 204 is used to update the motor rotor position value at the current moment in each interruption period.

[0073] The system of the present invention is described in detail below with reference to specific embodiments.

[0074] The entire position detection system is as follows Figure 3 As shown in the figure, in the position detection system, the rotor position detection device of the brushless DC motor includes an incremental encoder and an internal module eQEP of the main controller DSP, as well as a designed position detection software algorithm. The actual position of the motor rotor is measured by the incremental encoder installed on the rotating shaft of the brushless DC motor. During the rotation of the brushless DC motor, the incremental encoder outputs two pulse signals A and B with a 90° electrical angle difference from each other, and also outputs a Z-phase mark pulse signal used as a reference zero position, referred to as a Z pulse signal; the incremental encoder's code disk only sends out one Z pulse signal for each rotation. DSP / eQEP analyzes the A, B-phase pulse signals and the Z-phase mark pulse signal output by the incremental encoder, and designs the corresponding position detection software algorithm in the DSP, and finally obtains the accurate actual position of the motor rotor.

[0075] The software variables involved in the position detection software algorithm of the present invention are as follows:

[0076] Assuming the number of lines of the incremental encoder disk is N, after the 4-times frequency of eQEP, the number of lines corresponding to one rotation of the motor rotor is 4N. The current rotor position is QEPPos, the rotor position detected at the last moment is QEPPosOld, and the position count from the moment the motor is powered on to the arrival of the first Z pulse signal is QEPPosInitToZ.

[0077] Since the position calculator EQep1Regs.QPOSCNT inside the eQEP is an unsigned integer, it needs to be forcibly converted into a signed integer when used, and the eQEP works in orthogonal mode counting. When the counter EQep1Regs.QPOSCNT increases to the set maximum position count value EQep1Regs.QPOSMAX, the next count pulse arrives and it is reset to 0. When the count is reduced to 0, the next pulse arrives and it is reset to the maximum value set by EQep1Regs.QPOSMAX. The eQEP is initialized again so that the position calculator EQep1Regs.QPOSCNT is reset every time it encounters a Z pulse signal. Here, EQep1Regs.QPOSMAX is set to 0xffffffff, and 0xffffffff is converted to a signed number of -1, and N is set to 1000. When the rotor rotates one circle, the eQEP detects a code value of 4000. Set the clockwise direction as the increasing direction and the counterclockwise direction as the decreasing direction. From the actual numerical value in the software algorithm, the detected counting form is as follows Figure 4shown.

[0078] See also Figure 5 The specific steps of a brushless DC motor position detection system of the present invention are as follows:

[0079] 1) Initialize the eQEP module and various variable parameters.

[0080] 2) The Z pulse signal of the incremental encoder is detected through the eQEP module. When the first Z pulse signal is not detected, the value of the position calculator EQep1Regs.QPOSCNT is directly read, which is the current motor rotor position, and the value of the code disk when the Z pulse signal occurs is recorded by updating the value of the variable QEPPosInitToZ in real time.

[0081] 3) When the first Z pulse signal is detected, the rotation increment of the rotor position is first calculated, and then the rotation direction of the rotor is determined. According to the determination of the rotation direction, the position compensation through the Z point is performed, and then the rotor position is calculated. The rotor position is divided into two parts. The first part is the position from the moment the motor starts to the first Z pulse signal, and the second part is the position from the first Z pulse signal to the current position; the actual motor rotor position is equal to the sum of the two parts.

[0082] 4) Since the system uses an interrupt cycle to perform calculations, the motor rotor position value at the current moment must be updated in each interrupt cycle so that the next cycle can be accurately calculated. This incremental design concept effectively improves the accuracy of motor rotor position detection.

[0083] The present invention designs a brushless DC motor position detection method and system, which uses an incremental encoder as the actual rotor position measurement device. The enhanced orthogonal encoding module eQEP inside the DSP is used to parse the output pulses from the incremental encoder, and the actual motor rotor position can be accurately measured through the position detection software algorithm designed inside the DSP. Compared with other motor rotor position detection methods, the brushless DC motor position detection method and system of the present invention does not increase any hardware cost. Under the same precision incremental encoder, through the designed position detection software algorithm, compared with other invention methods, it is not necessary to determine the number of incremental encoder Z pulse signals, and the number of motor rotor rotation incremental pulses is used as the cumulative count, which eliminates the counting error of more than one circle caused by inaccurate Z pulse signal detection, greatly improves the position detection accuracy of the motor rotor, and the algorithm is highly modular and versatile, and easy to transplant.

[0084] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0085] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0086] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the system embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, 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 interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0087] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0088] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0089] 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 storage medium. Based on this understanding, the technical solution of the present invention, in essence, 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, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0090] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for detecting the position of a brushless DC motor, in cooperation with an incremental encoder and a main controller DSP, wherein the incremental encoder is arranged on the rotating shaft of the brushless DC motor, and an orthogonal encoding module eQEP is configured inside the main controller DSP, characterized in that: The position detection method comprises the following steps: S100: Initialize and set the eQEP module and various variable parameters; S200: Detecting the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly reading the value of the position calculator in the eQEP module as the current motor rotor position; S300: When the first Z pulse signal is detected, the rotation increment of the rotor position is first calculated, and then the rotation direction of the rotor is determined. According to the determination of the rotation direction, the position compensation of the Z point is performed, and then the rotor position is calculated; wherein the rotor position is divided into two parts, the first part is the position amount from the motor start-up moment to the first Z pulse signal, and the second part is the position amount from the first Z pulse signal to the current position, and finally the actual motor rotor position is equal to the sum of the two parts; The software variables involved in the position detection method are: the number of lines of the incremental encoder code disk is N, then after the 4-times frequency of the eQEP module, the number of lines corresponding to one rotation of the motor rotor is 4N; the current rotor position is QEPPos, and the rotor position detected at the last moment is QEPPosOld; EQep1Regs.QPOSCNT is the position calculator inside the eQEP module, and EQep1Regs.QPOSMAX is the maximum position count value set by EQep1Regs.QPOSCNT; EQep1Regs.QPOSMAX is set to 0xffffffff, and 0xffffffff is converted to a signed number of -1; the clockwise direction is set to increase, and the counterclockwise direction is set to decrease; In step S300, the rotation increment of the rotor position temp=QEPPos-QEPPosOld; In step S300, according to the determination of the rotation direction, position compensation is performed through point Z, and then the rotor position is calculated, including: Determine the forward and reverse rotation of the motor. In the forward rotation case, determine whether the rotation increment temp is less than 0. If so, perform forward position compensation temp=temp+4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ. Determine whether the motor is rotating forward or reverse. In the reverse case, determine whether the rotation increment temp is less than 0. If so, perform reverse position compensation temp=temp-4N. If not, calculate the rotor position value QEPPos=QEPPosOld+temp+QEPPosInitToZ.

2. The brushless DC motor position detection method according to claim 1, characterized in that: Step S200 also includes: recording the encoder value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; the QEPPosInitToZ is a position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

3. The method for detecting the position of a brushless DC motor according to claim 1, wherein: The position detection method uses an interrupt cycle to perform calculation.

4. The method for detecting the position of a brushless DC motor according to claim 3, characterized in that: The position detection method further comprises the steps of: S400: Update the motor rotor position value at the current moment in each interrupt cycle, and the rotor position value is periodically updated to QEPPosOld=QEPPos.

5. The method for detecting the position of a brushless DC motor according to claim 1, characterized in that: Set N=1000.

6. The method for detecting the position of a brushless DC motor according to claim 1, characterized in that: The incremental encoder outputs two pulse signals A and B with an electrical angle difference of 90°, and also outputs a Z pulse signal used as a reference zero position; the code disk of the incremental encoder only sends out one Z pulse signal for each rotation.

7. A brushless DC motor position detection system, used to implement the detection method according to any one of claims 1 to 6, specifically: cooperate with an incremental encoder and a main controller DSP, the incremental encoder is arranged on the rotating shaft of the brushless DC motor, and the main controller DSP is internally configured with an orthogonal encoding module eQEP, characterized in that: The position detection system comprises: Initialization unit, used to initialize the eQEP module and various variable parameters; A first position detection unit is used to detect the Z pulse signal of the incremental encoder through the eQEP module, and when the first Z pulse signal is not detected, directly read the value of the position calculator in the eQEP module as the current motor rotor position; The second position detection unit is used to first calculate the rotation increment of the rotor position when the first Z pulse signal is detected, and then determine the rotation direction of the rotor. According to the determination of the rotation direction, position compensation through the Z point is performed, and then the rotor position is calculated; wherein the rotor position is divided into two parts, the first part is the position quantity from the moment the motor is started to the time when the first Z pulse signal appears, and the second part is the position quantity from the first Z pulse signal appears to the current position, and finally the actual motor rotor position is equal to the sum of the two parts.

8. The brushless DC motor position detection system according to claim 7, characterized in that: The first position detection unit is also used to record the code disk value when the Z pulse signal occurs by updating the value of the variable QEPPosInitToZ in real time; the QEPPosInitToZ is the position count from the moment the motor is powered on to the arrival of the first Z pulse signal.

9. The brushless DC motor position detection system according to claim 7, characterized in that: The position detection system also includes: The rotor position value periodic updating unit is used to update the motor rotor position value at the current moment in each interruption cycle.