Automatic identification method and system for closed-loop stepper motor encoder
By powering on and resetting the closed-loop stepper motor and measuring its parameters, the winding phase sequence was adjusted to match the encoder phase, thus solving the problem of mismatch between the motor winding wiring and the encoder feedback signal, and enabling the motor to operate normally and be effectively controlled.
Patent Information
- Application Number
- CN202210234007.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-03-09
AI Technical Summary
In closed-loop stepper motor applications, if the wiring of the motor windings does not match the wiring of the encoder feedback signal, the motor will not operate normally, resulting in control failure.
By powering on and resetting the motor, the motor is driven to rotate and relevant parameters are measured. The encoder resolution and the actual sequence of the feedback signal are obtained. The phase sequence of the motor windings is adjusted to match the encoder phase, and the pulse control quantity is automatically configured.
This achieves matching between the motor winding wiring and the encoder feedback signal, ensuring that the motor can operate normally and be effectively controlled.
Smart Images

Figure CN114744930B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of encoders, and in particular to a method and system for automatic identification of closed-loop stepper motor encoders. Background Technology
[0002] Closed-loop stepper motors are increasingly widely used in automation equipment. Users select stepper motors with encoders of varying feedback accuracy based on product control precision and cost considerations. Common encoder line counts in closed-loop stepper motor applications include: 256, 500, 512, 1000, 1024, 2000, 2049, 2500, 3600, and 5000. The encoder line count refers to the number of pulses output by the encoder for one revolution of the encoder shaft. For example, a 1000-line encoder outputs 1000 pulses per single-phase signal per revolution of the axial shaft.
[0003] When users apply closed-loop stepper motors with different line counts, they need to select a matching closed-loop stepper motor driver in order to achieve effective control of the motor. That is, when the wiring of the motor windings does not match the wiring of the encoder feedback signal, the motor will not run. Summary of the Invention
[0004] To address the issue of motor malfunction due to mismatch between motor winding wiring and encoder feedback signal wiring, this application provides a closed-loop stepper motor encoder automatic identification method and system.
[0005] The closed-loop stepper motor encoder automatic identification method and system provided in this application adopts the following technical solution:
[0006] Automatic identification method for closed-loop stepper motor encoders, including:
[0007] Power on and reset the motor;
[0008] The motor is driven to rotate by a drive device so that the encoder can measure the motor and obtain measurement results;
[0009] The resolution of the encoder is obtained based on the measurement results;
[0010] Based on the measurement results, obtain the actual sequence marker of the encoder feedback signal;
[0011] Based on the actual sequence flag, the phase sequence of the motor windings is adjusted so that the phase sequence is automatically matched with the phase of the encoder, and the pulse control equivalent of the motor is automatically configured.
[0012] By adopting the above technical solution, the motor is powered on and reset so that all relevant parameters of the motor are in the initial state. The motor is driven to rotate by the drive device, and the encoder measures the motor to obtain relevant parameters during motor operation. The number of encoder lines is obtained, which enables automatic configuration of pulse control equivalent based on the number of lines. The actual sequence mark of the encoder feedback signal is obtained, and the phase sequence of the windings is adjusted from inside the motor based on the actual sequence mark. When the wiring of the motor windings does not match the wiring of the feedback signal, the phase sequence can be adjusted to match the wiring of the motor windings with the encoder feedback signal, thereby driving the motor to run.
[0013] Optionally, the power-on reset of the motor includes:
[0014] The motor is driven to run to the initial electrical angle position by powering on the drive device according to the preset current. At this time, the current of each winding is the initial value.
[0015] The total number of feedback pulses, the number of positive motion feedback pulses, and the number of negative motion feedback pulses of the encoder are reset to zero.
[0016] By adopting the above technical solution, the drive device drives the motor to the position of the initial electrical angle and stops it, so that the current of the winding is set to the initial value, and the total feedback pulse count, the positive motion feedback pulse count and the reverse motion pulse count of the encoder are cleared, so that when the encoder is used for measurement, the encoder count starts from the initial position.
[0017] Optionally, the measurement results include the number of positive motion feedback pulses and the number of negative motion feedback pulses, and obtaining the encoder resolution based on the measurement results includes:
[0018] The motor is driven to rotate to the target position by the drive device;
[0019] The number of positive motion feedback pulses is measured and acquired during the rotation process;
[0020] The motor is driven by the drive device to run to the initial electrical angle;
[0021] During operation, the number of multiple reverse motion feedback pulses is measured and acquired.
[0022] The resolution of the encoder is calculated based on the number of positive motion feedback pulses and the number of negative motion feedback pulses.
[0023] By adopting the above technical solution, the motor is driven to rotate to the target position by the drive device and then driven to run to the initial electrical angle, so as to obtain the current of the motor winding and the number of positive motion feedback pulses, and to calculate the number of encoder lines by the number of positive motion feedback pulses and the number of negative motion feedback pulses.
[0024] Optionally, calculating the number of lines of the encoder based on the number of positive motion feedback pulses and the number of negative motion feedback pulses includes:
[0025] The total number of feedback pulses of the encoder is obtained by the driver based on the number of positive motion feedback pulses and the number of negative motion feedback pulses;
[0026] The number of lines of the encoder is obtained based on the total number of feedback pulses and the electrical angle.
[0027] By adopting the above technical solution, it is possible to obtain the total number of feedback pulses by the number of positive motion feedback pulses and the number of negative motion feedback pulses, and to obtain the number of encoder lines by the total number of feedback pulses and the electrical angle.
[0028] Optionally, the measurement result further includes a forward sequence flag and a reverse sequence flag, and the actual sequence flag for obtaining the encoder feedback signal based on the measurement result includes:
[0029] The status flag of the sequence flag of the encoder feedback signal is obtained based on the measurement results;
[0030] When the forward sequence status flag is 1 and the reverse sequence flag is -1, the actual sequence flag is set to 1;
[0031] When the forward sequence status flag is 0 and the reverse sequence flag is 0, the actual sequence flag is set to -1.
[0032] By adopting the above technical solution, the size of the actual sequence flag can be set by using the sizes of both the forward sequence status flag and the reverse sequence status flag.
[0033] Optionally, the measurement results also include the winding current in different rotation directions, and the step of adjusting the phase sequence of the motor windings based on the actual sequence mark to automatically match the phase sequence with the encoder phase, and automatically configuring the pulse control equivalent of the motor includes:
[0034] Determine whether the actual sequence flag is 1;
[0035] If so, it means the current sequence is correct and there is no need to adjust the current control sequence of the motor windings.
[0036] If not, it indicates an error in the current sequence. Adjust the current control sequence of the multiple windings to make the current meet the requirements.
[0037] By adopting the above technical solution, the current sequence can be adjusted by the size of the actual sequence flag.
[0038] In summary, this application includes at least one of the following beneficial technical effects:
[0039] 1. This application resets the motor and drives it to rotate, measures the number of positive motion feedback pulses and the number of negative motion feedback pulses, and calculates the encoder resolution based on the number of positive motion feedback pulses and the number of negative motion feedback pulses;
[0040] 2. When the wiring of the motor windings does not match the wiring of the feedback signal, the phase sequence can be adjusted to match the wiring of the motor windings with the wiring of the feedback signal, thereby driving the motor to run. Attached Figure Description
[0041] Figure 1 This is a flowchart of one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0042] Figure 2 This is a flowchart of step S110 in one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0043] Figure 3 This is a flowchart of step S130 in one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0044] Figure 4 This is a flowchart of step S350 in one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0045] Figure 5 This is a flowchart of step S140 in one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0046] Figure 6 This is a flowchart of step S150 in one embodiment of the closed-loop stepper motor encoder automatic identification method of this application;
[0047] Figure 7 This is a block diagram of the steps in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0048] Figure 8 This is a block diagram of the control MCU in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0049] Figure 9 This is a circuit diagram of the motor drive circuit in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0050] Figure 10 This is a circuit diagram of motor winding current processing in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0051] Figure 11 This is a circuit diagram of the signal transmission circuit in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0052] Figure 12 This is a circuit diagram of the identification completion indication circuit in one embodiment of the closed-loop stepper motor encoder automatic identification system of this application;
[0053] Figure 13 These are the current waveforms of the motor's A and B phase windings, the feedback waveform of the motor's forward motion encoder, and the feedback waveform of the motor's reverse motion encoder in this application.
[0054] Reference numerals in the attached diagram: 1. Reset module; 2. Drive measurement module; 3. Line count acquisition module; 4. Actual sequence flag acquisition module; 5. Phase sequence adjustment module. Detailed Implementation
[0055] The present application will be further described in detail below with reference to the accompanying drawings.
[0056] Stepper motor control methods are generally divided into two types: open-loop control and closed-loop control. Closed-loop control, a fundamental concept in control theory, refers to a control relationship where the controlled output returns to the control input in a certain way, exerting a control effect on the input. Closed-loop control of stepper motors uses position feedback and / or speed feedback to determine the phase transitions that correspond to the rotor position, which can greatly improve the performance of the stepper motor. In a closed-loop controlled stepper motor system, the operating speed range can be expanded while maintaining a given accuracy in tracking and feedback; tracking and positioning accuracy can be improved at a given speed; or limit speed and limit accuracy indicators can be obtained. However, when the number of wires in the closed-loop stepper motors used by the user is different, it is often necessary to select a closed-loop stepper motor driver that matches the corresponding number of wires. When the wiring of the motor windings does not match the wiring of the encoder feedback signal, the motor will not run. Therefore, this application discloses an automatic encoder identification method and system for closed-loop stepper motors to synchronize the encoder feedback signal with the closed-loop stepper motor.
[0057] Reference Figure 1 The automatic identification method for closed-loop stepper motor encoders includes the following steps:
[0058] S110. Power on and reset the motor.
[0059] In this embodiment, the motor is set as a closed-loop stepper motor with an arbitrary incremental encoder. When the motor is powered on and reset, all relevant parameters of the motor are initialized, such as setting the motor angle to the initial rotation angle, so as to facilitate the measurement of the motor rotation process and reduce the influence of the original motor data on the data in the motor measurement process.
[0060] S120. The motor is driven to rotate by the drive device so that the encoder can measure the motor and obtain the measurement results.
[0061] The drive device is a device that supplies power to the motor to drive the motor to rotate. Since the motor in this embodiment is a closed-loop stepper motor, the drive device is a device that inputs different phase drive signals to different motor windings. When the motor rotates, the encoder rotates synchronously with the closed-loop stepper motor and measures various rotation data of the motor to generate corresponding signals during the rotation process.
[0062] S130. Obtain the encoder resolution based on the measurement results.
[0063] An encoder is a device that encodes and converts signals or data into signals that can be used for communication, transmission, and storage. An encoder converts angular or linear displacement into electrical signals; the device that converts angular displacement into electrical signals is called a code disk, and the device that converts linear displacement signals into electrical signals is called a code scale. The number of lines on an encoder is its resolution, which is the number of pulses generated per revolution of the encoder.
[0064] S140. Obtain the actual sequence flag of the encoder feedback signal based on the measurement results.
[0065] In this application, the actual sequence mark of the encoder is represented by EDF, where ED indicates the wiring direction of the encoder.
[0066] S150: Adjust the phase sequence of the motor windings based on the actual sequence mark so that the phase sequence is automatically matched with the phase of the encoder, and automatically configure the pulse control equivalent of the motor.
[0067] The windings are coils wound inside the motor. When energized, the windings generate a rotating magnetic field. By using different power supply sequences, the windings are energized in a certain order in the forward or reverse direction, causing the motor to rotate in the forward or reverse direction or to lock. The phase sequence refers to the order of the phases. When the phase sequence of the motor windings is not installed correctly, the pulse control equivalent is automatically configured to adjust the current control sequence of the motor windings and thus adjust the phase sequence of the windings. In this application, the number of motor windings is set to two, namely winding A and winding B, that is, the motor of this application is a two-phase stepper motor.
[0068] The implementation principle of the closed-loop stepper motor encoder automatic identification method in this application embodiment is as follows: the motor is powered on and reset so that the relevant parameters of the motor are in the initial state. The motor is driven to rotate by the drive device, and the encoder measures the motor to obtain the relevant parameters of the motor during operation. The number of encoder lines is obtained to enable automatic configuration of pulse control equivalent based on the number of lines. The actual sequence mark of the encoder feedback signal is obtained. Based on the actual sequence mark, the phase sequence of the windings is adjusted from inside the motor. When the wiring of the motor windings does not match the wiring of the feedback signal, the phase sequence can be adjusted to match the wiring of the motor windings with the wiring of the feedback signal, thereby driving the motor to run.
[0069] Reference Figure 2 To power up and reset the motor, the following steps are involved:
[0070] S210. Drive the motor to the position of the initial electrical angle according to the preset current through the drive device. At this time, the current of different windings are all the initial values.
[0071] In this embodiment, the initial electrical angle is set to Θ = 0°. The stepper motor can be a two-phase stepper motor. Therefore, the stepper motor has two windings, namely the A-phase winding and the B-phase winding. The initial currents of the A-phase winding and the B-phase winding are IA = I and IB = 0, respectively.
[0072] S220, the total number of feedback pulses, the number of positive motion feedback pulses, and the number of negative motion feedback pulses of the zero encoder.
[0073] The total number of feedback pulses of the encoder is set to EP, the number of positive motion feedback pulses is set to EP+, and the number of negative motion feedback pulses is set to EP-. When the total number of feedback pulses, the number of positive motion feedback pulses, and the number of negative motion feedback pulses are cleared, EP, EP+, and EP- are all set to 0. One pulse of the encoder has a rising edge and a falling edge, so the number of encoder lines is four times the number of encoder pulses.
[0074] The implementation principle of power-on reset of the motor in this application embodiment is as follows: When powering on the motor, the motor needs to be driven to the position of the initial electrical angle first, and the total number of feedback pulses, the number of positive motion feedback pulses and the number of negative motion feedback pulses are all cleared to reduce the impact of data before the motor rotates on subsequent measurements.
[0075] Reference Figure 3 The measurement results include the number of positive motion feedback pulses and the number of negative motion feedback pulses. Based on the measurement results, the encoder resolution is obtained, including the following steps:
[0076] S310, drive the motor to rotate to the target position via the drive device.
[0077] The driving device is a motor drive circuit, which drives the motor to rotate to the target position. In this embodiment, the angle of the target position is set to Θ0 (0° < Θ0 < 360°). In other embodiments, it can be set to other angles as needed.
[0078] S320, Measure and acquire the number of positive motion feedback pulses during rotation.
[0079] When the drive device drives the motor to rotate, it reads and saves the number of feedback pulses from the forward motion encoder. In this embodiment, the number of encoder feedback pulses during forward operation is recorded as EP+. In other embodiments, different counting units can be set according to requirements.
[0080] S330, drive the motor to the initial electrical angle via the drive unit.
[0081] Specifically, when the motor is at the initial electrical angle, the initial electrical angle is set to Θ = 0°. When the motor rotates to the target position Θ = 0°, the motor rotates back to the initial position.
[0082] S340, during operation, the number of multiple reverse motion feedback pulses is measured and acquired.
[0083] When the drive device drives the motor to rotate in the opposite direction, the number of pulses generated by the encoder measuring the motor is recorded as the reverse motion encoder feedback pulse number, and the obtained reverse motion encoder feedback pulse number is recorded as EP-.
[0084] S350: The encoder resolution is calculated based on the number of positive motion feedback pulses and the number of negative motion feedback pulses.
[0085] Reference Figure 4 The encoder resolution is calculated based on the number of positive motion feedback pulses and the number of negative motion feedback pulses, including the following steps:
[0086] S410: The total number of feedback pulses of the encoder is obtained by the driver based on the number of positive motion feedback pulses and the number of negative motion feedback pulses.
[0087] The total number of feedback pulses of the encoder is set as EP, then EP = ((EP+) + |EP-|) / 2. When the total number of feedback pulses of the encoder is calculated by the driver, the value of the reverse pulse number EP- is negative. At this time, the absolute value of EP- needs to be calculated.
[0088] S420: The encoder resolution is obtained based on the total number of feedback pulses and the electrical angle.
[0089] When the number of lines is used as the unit of encoder resolution, the number of lines of the encoder, i.e., the resolution, is EN. The formula for calculating EN is: EN=(360*EP) / Θ.
[0090] The implementation principle of this application embodiment is as follows: the motor is driven to rotate to the target position by the driving device, and the number of forward motion feedback pulses, forward sequence mark, reverse motion feedback pulses and reverse sequence mark of the motor during the rotation process are measured. The driver obtains the total number of pulses by obtaining the number of forward motion feedback pulses and the number of reverse motion feedback pulses, and calculates the number of encoder lines based on the total number of pulses, that is, obtains the encoder resolution.
[0091] Reference Figure 13 The measurement results include feedback waveforms of the encoder for forward and reverse motion of the motor. The forward sequence flag is denoted as EDF+, and the reverse sequence flag is denoted as EDF-. Obtaining the actual sequence flag of the encoder feedback signal based on the measurement results involves the following steps:
[0092] S510, a status flag for obtaining the sequence flag of the encoder feedback signal based on the measurement results.
[0093] The status flag of the sequence flag of the feedback signal is denoted as EDF. The corresponding status flag EDF is obtained through the forward sequence flag and the reverse sequence flag, where ED represents the wiring direction of the encoder.
[0094] S520. When the forward sequence status flag is 1 and the reverse sequence flag is -1, the actual sequence flag is set to 1.
[0095] S530. When the forward sequence status flag is 0 and the reverse sequence flag is 0, the actual sequence flag is set to -1.
[0096] Specifically, when the motor moves in the forward direction, if the waveform of phase A winding first rises and then the waveform of phase B winding rises in the waveform diagram, EDF+ = 1; otherwise, it is 0. When the motor moves in the reverse direction, if the waveform of phase B winding EB first rises and then the waveform of phase A winding rises in the waveform diagram, EDF- = 1; otherwise, it is 0. The actual sequence flag of the encoder is EDF. When the forward sequence flag is 1, or the reverse sequence flag is 1 (i.e., EDF+ = 1 or EDF- = 1), the actual sequence flag EDF is set to 1. When both the forward and reverse sequence flags are 0 (i.e., EDF+ = 0 and EDF- = 0), the actual sequence flag EDF is set to -1.
[0097] Reference Figure 6 The measurement results include the current waveforms of the motor's A and B phase windings, as well as the current in the windings in different rotational directions. Based on the actual sequence markings, the phase sequence of the motor windings is adjusted to automatically match the encoder phase. The automatic configuration of the motor's pulse control equivalent includes the following steps:
[0098] S610. Determine if the actual sequence flag is 1.
[0099] S620. If yes, it means the current sequence is correct and there is no need to adjust the current control sequence of the windings.
[0100] When the judgment result is yes, i.e., EDF=1, there is no need to adjust the current control sequence of the motor A and B phase windings. That is, the current of the A phase winding is IA=I*cosΘ, and the current of the B phase winding is IB=I*sinΘ for current control.
[0101] S630. If not, it means that the current sequence is incorrect. Adjust the current control sequence of multiple windings to make the current meet the requirements.
[0102] When the judgment result is negative, i.e., EDF = -1, and the actual sequence number is -1, it indicates that the current control sequence of phase A winding and phase B winding does not meet the requirements and needs to be adjusted. At this time, the current of phase A winding is modified to IA = I*sinΘ, where Θ is the motor speed and can be set to (ωt), i.e., IA = I*sin(ωt); the current of phase B winding is modified to IB = I*cos(ωt), where ω is the motor speed and t is time. That is, by changing the motor speed and rotation period, the motor pulse is controlled, so that the modified current controls the phase of phase A winding and phase B winding respectively, thereby performing automatic configuration of pulse control equivalent.
[0103] Reference Figure 7 In another embodiment of this application, a closed-loop stepper motor encoder automatic identification system is also disclosed, including:
[0104] Reset module 1 is used to reset the motor upon power-on.
[0105] The drive measurement module 2 is used to drive the motor to rotate through the drive device so that the encoder can measure the motor and obtain the measurement results;
[0106] Line count acquisition module 3 is used to acquire the number of encoder lines based on the measurement results;
[0107] The actual sequence flag acquisition module 4 is used to acquire the actual sequence flag of the encoder feedback signal based on the measurement results.
[0108] Phase sequence adjustment module 5 is used to adjust the phase sequence of the motor windings based on the actual sequence mark so that the phase sequence is automatically matched with the phase of the encoder, and to automatically configure the pulse control equivalent of the motor.
[0109] The aforementioned drive device includes a motor drive circuit and a control MCU, see reference. Figure 8The control MCU in the system includes encoder feedback signal pins, motor drive control signal pins, recognition completion indicator pins, motor winding current sampling signal pins, and winding current sampling signal pins. The motor drive signal control pins are connected to the H-bridge drive circuit. The control MCU is used to issue drive signals so that the motor drive circuit drives the motor to run according to the drive signals.
[0110] Reference Figure 9 The motor drive circuit is configured as an H-bridge drive circuit. Since the number of motor windings in this embodiment is set to two, A-phase winding motor drive circuits and B-phase winding motor drive circuits are respectively configured for the number of motor windings, so that different windings are driven by different motor drive circuits. In other embodiments, if the number of windings changes, the number of motor drive circuits also changes accordingly. In this embodiment, the H-bridge drive circuit corresponding to the A-phase winding is equipped with corresponding protection resistors R20, R21, R22, and R23. The four MOSFETs are configured as enhancement-type NMOSFETs as required, and an A-phase current sampling sensor is connected in series with the MOSFET at one end to sense the current pulse in the A-phase winding and generate the A-phase feedback signal EA. The H-bridge drive circuit corresponding to the B-phase winding is equipped with corresponding protection resistors R24, R25, R26, and R27. The four MOSFETs are also configured as enhancement-type NMOSFETs as required, and a B-phase current sampling sensor is connected in series with the MOSFET at one end to sense the current pulse in the B-phase winding and generate the B-phase feedback signal EB.
[0111] The A-phase current sampling sensor senses the input signal from the A-phase winding current sensor, and the B-phase current sampling sensor senses the input signal from the B-phase winding current sensor. At this point, the motor winding current needs to be processed based on the input signals from the A-phase winding current sensor and the B-phase winding current sensor, referring to... Figure 10 , Figure 10 The circuit diagram for processing motor winding current is shown in this application. The number of windings in the circuit diagram is also set to two. For example, in the circuit diagram for processing the input signal of the winding current sensor of phase A, resistors R4, R5 and R6 are used for circuit protection, capacitor C1 is used for filtering, and the corresponding phase A winding current sensor input signal is amplified by an operational amplifier to generate the corresponding phase A winding current sampling signal. Similarly, the circuit diagram for processing phase B winding current processes the input signal of the phase B winding current sensor.
[0112] The encoder measures the rotation of phase A winding, generating a phase A feedback signal EA. Similarly, it measures phase B winding, generating a phase B feedback signal EB. When the motor rotates forward, the phase A feedback signal is EA+, and the phase B feedback signal is EB+; conversely, they are EA- and EB- respectively. Therefore, when the motor rotates forward and reverse, both phase A and phase B windings will generate corresponding signals EA+, EA-, EB+, and EB-. The control MCU receives and processes these signals. Therefore, a signal transmission circuit is also provided between the control MCU and the motor winding current processing circuit, as shown in the reference... Figure 11 The signal transmission circuit has corresponding protection resistors and filter capacitors connected in series for each encoder feedback signal. For example, during the signal transmission of the A-phase winding, the measured EA+ and EA- are of the same magnitude. Resistors R13 and R14 are connected in series between EA+ and EA- and the control MCU to protect the circuit. However, resistor R11 is connected in parallel between R13 and R14. Therefore, EA+ is transmitted to the corresponding pin B+ of the control MCU, and EA- is transmitted to the corresponding pin B- of the control MCU. When it is necessary to set the corresponding pins separately... Similarly, when transmitting the B-phase feedback signal transmitted in the B-phase winding, due to the setting of resistors R12, R15, and R16, EB+ is transmitted to the corresponding pin A+ of the control MCU, and EB- is transmitted to the corresponding pin A- of the control MCU, thus enabling the encoder feedback signals from the A-phase winding and the B-phase winding to be successfully transmitted to the control MCU respectively.
[0113] After the control MCU has completed the recognition of the encoder's line count, the corresponding line counts need to be set. After the encoder's line count recognition is complete, a completion indication also needs to be issued, as per [reference needed]. Figure 12 The identification completion indicator circuit is connected to the identification completion indicator pin of the control MCU. Before identification is completed, the control MCU controls the red light diode to be energized, that is, the R (Red) terminal is energized to emit red light. After identification is completed, the control MCU controls the green light diode to be energized, that is, the G (Green) terminal is energized to emit green light.
[0114] The implementation principle of the closed-loop stepper motor encoder automatic identification system in this application embodiment is as follows: the reset module 1 powers on and resets the motor, the drive measurement module 2 drives the motor to rotate through the drive device so that the encoder can measure the motor and obtain the measurement results, the line number acquisition module 3 obtains the number of encoder lines based on the measurement results, the actual sequence mark acquisition module 4 obtains the actual sequence mark of the encoder feedback signal based on the measurement results, and the phase sequence adjustment module 5 adjusts the phase sequence of the winding based on the actual sequence mark so as to automatically configure the pulse control equivalent of the motor.
[0115] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for automatic identification of a closed-loop stepper motor encoder, characterized in that, include: Power on and reset the motor; The motor is driven to rotate by a drive device so that the encoder can measure the motor and obtain measurement results; The resolution of the encoder is obtained based on the measurement results; Based on the measurement results, obtain the actual sequence marker of the encoder feedback signal; Based on the actual sequence flag, the phase sequence of the motor windings is adjusted to automatically match the phase of the encoder, and the pulse control equivalent of the motor is automatically configured. The step of powering on and resetting the motor includes: The motor is driven to run to the initial electrical angle position by powering on the drive device according to the preset current. At this time, the current of each winding is the initial value. Clear the total number of feedback pulses, the number of positive motion feedback pulses, and the number of negative motion feedback pulses of the encoder; The measurement results include the number of positive motion feedback pulses and the number of negative motion feedback pulses, and obtaining the encoder resolution based on the measurement results includes: The motor is driven to rotate to the target position by the drive device; The number of positive motion feedback pulses is measured and acquired during the rotation process; The motor is driven by the drive device to run to the initial electrical angle; During operation, the number of multiple reverse motion feedback pulses is measured and acquired. The resolution of the encoder is calculated based on the number of positive motion feedback pulses and the number of negative motion feedback pulses; The step of calculating the encoder's resolution based on the number of positive motion feedback pulses and the number of negative motion feedback pulses includes: The total number of feedback pulses of the encoder is obtained by the driving device based on the number of positive motion feedback pulses and the number of negative motion feedback pulses; The encoder's resolution is obtained based on the total number of feedback pulses and the electrical angle.
2. The method according to claim 1, characterized in that, The measurement results also include forward sequence flags and reverse sequence flags, and the actual sequence flags for obtaining the encoder feedback signal based on the measurement results include: The status flag of the sequence flag of the encoder feedback signal is obtained based on the measurement results; When the forward sequence status flag is 1 and the reverse sequence flag is -1, the actual sequence flag is set to 1; When the forward sequence status flag is 0 and the reverse sequence flag is 0, the actual sequence flag is set to -1.
3. The method according to claim 1, characterized in that, The measurement results also include the winding current in different rotation directions. The step of adjusting the phase sequence of the motor windings based on the actual sequence marker to automatically match the phase sequence with the encoder phase, and automatically configuring the pulse control equivalent for the motor, includes: Determine whether the actual sequence flag is 1; If so, it means the current sequence is correct and there is no need to adjust the current pulse control sequence of the winding. If not, it indicates an error in the current sequence. Adjust the current pulse control sequence of the multiple windings to make the current meet the requirements.
4. An automatic identification system for closed-loop stepper motor encoders, characterized in that, The automatic identification method for closed-loop stepper motor encoders according to any one of claims 1-3 includes: The reset module (1) is used to reset the motor upon power-on. The drive measurement module (2) is used to drive the motor to rotate through the drive device so that the encoder can measure the motor and obtain the measurement result. Line count acquisition module (3) is used to acquire the number of lines of the encoder based on the measurement results; The actual sequence flag acquisition module (4) is used to acquire the actual sequence flag of the encoder feedback signal based on the measurement result; The phase sequence adjustment module (5) is used to adjust the phase sequence of the motor windings based on the actual sequence mark so that the phase sequence is automatically matched with the phase of the encoder, and to automatically configure the pulse control equivalent of the motor.
5. The system according to claim 4, characterized in that, The driving device includes a motor drive circuit and a control MCU; The motor drive circuit is configured as an H-bridge drive circuit to drive the motor. The control MCU includes an encoder feedback signal pin, a motor drive control signal pin, an identification completion indicator pin, a motor winding current sampling signal pin, and a winding current sampling signal pin. The motor drive signal control pin is connected to the H-bridge drive circuit. The control MCU is used to issue drive signals so that the motor drive circuit drives the motor to run according to the drive signals.
6. The system according to claim 5, characterized in that, The phase sequence adjustment module includes a motor winding current processing circuit, which is connected to the control MCU. The motor winding current processing circuit is used to receive the input signal from the winding current sensor and output the winding current sampling signal.
7. The system according to claim 5, characterized in that, The line count acquisition module (3) includes an identification completion indication circuit, which is connected to the identification completion indication pin. The identification completion indication pin is used to indicate when the identification of the encoder's line count is completed.
Citation Information
Patent Citations
Phase sequence control method and device based on initial phase identification, and electronic equipment
CN112271965A