Stepping motor driving line sequence identification method and system, and driver
By using pulse signal and current detection technology in stepper motor drivers, the motor wire sequence is automatically identified and matched, and the operation problems caused by wiring errors are solved, wiring efficiency and user experience are improved, and the motor is operated normally.
Patent Information
- Application Number
- CN202411004703.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-12-03
AI Technical Summary
The wrong wiring between the stepper motor and the driver causes the running direction to be reversed or completely unable to run, which may damage the motor and the driver. The existing technology distinguishes the line sequence through color identification, but due to the different colors of different merchants, the user's risk of wiring errors is high, resulting in user experience. Not good.
By using pulse signals and current detection in the driver to determine the line sequence of the stepper motor, avoid cross-connection of different phase loops, use the current signal of the preset timing to drive the motor to generate position change, and identify the positive and negative ends according to the position change, thereby Automatically define the line sequence of four pulse ports to realize automatic wiring identification and matching.
It effectively avoids motor damage caused by wiring errors, improves the wiring efficiency and user experience of stepper motors, reduces the need to manually identify the wire sequence, and ensures the normal operation of the motor.
Smart Images

Figure CN119070675A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of motor drive technology, and in particular to a stepper motor drive line sequence identification method, system and driver. Background Art
[0002] A stepper motor is a device that converts electrical pulse signals into angular displacement or linear displacement. It has the characteristics of high precision and high reliability and is widely used in the field of automation, such as machine tool control, automated control equipment, and electronic product manufacturing.
[0003] The stepper motor needs to be driven by a driver to run. When connecting the stepper motor to the driver, it is necessary to connect the A+, A-, B+ and B- lines of the stepper motor to the A+, A-, B+ and B- ports of the driver in the order of the A+, A-, B+ and B- lines of the stepper motor so that the stepper motor can work properly. Otherwise, the stepper motor may run in the opposite direction to the expected direction or may not run at all, which may damage the stepper motor and the driver.
[0004] In order to avoid damage to the stepper motor and driver due to incorrect wiring, the four wires A+, A-, B+ and B- of the stepper motor are currently marked with different colors to distinguish them, such as red, blue, black and green. However, since the colors of the markings of different merchants may be different, the line sequence may not be the same, so users may make mistakes when wiring, and there is also the risk of damaging the stepper motor and driver, resulting in a poor user experience. Summary of the invention
[0005] The embodiments of the present application provide a stepper motor drive line sequence identification method, system and driver, which can solve the problem of poor user experience, improve the wiring efficiency of the stepper motor, and enhance the user experience.
[0006] In a first aspect, an embodiment of the present application provides a stepper motor drive line sequence identification method, which is used for a stepper motor driver, the driver includes four pulse ports, the pulse ports are used to connect to the wiring of the stepper motor, and at least three pulse ports are correspondingly connected to a current sampling module. The stepper motor drive line sequence identification method includes:
[0007] receiving a power-on signal, and in response to the power-on signal, controlling the first pulse port to send a first pulse signal;
[0008] Collecting a first current value through a current sampling module;
[0009] Determine a pulse port having a first current value greater than zero as a second pulse port corresponding to the first pulse port;
[0010] Control the third pulse port to send a second pulse signal, and collect the second current value through the current sampling module;
[0011] Determine the pulse port having a second current value greater than zero as a fourth pulse port corresponding to the third pulse port;
[0012] Controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing;
[0013] The position change of the stepper motor based on the current signal is collected through the encoder;
[0014] The line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are determined according to the position change amount.
[0015] Further, the preset timing includes a forward drive timing;
[0016] Controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing sequence, including:
[0017] Control the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a forward driving timing sequence;
[0018] Determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port according to the position change amount includes:
[0019] When the position change is in the positive direction, determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port;
[0020] When the position change is in the reverse direction, the control channels of the first pulse port and the second pulse port are exchanged, or the control channels of the third pulse port and the fourth pulse port are exchanged;
[0021] Determine the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port after the control channel exchange process is completed.
[0022] Further, controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to sequentially send current signals according to a forward driving timing sequence includes:
[0023] The first line sequence definitions of the predefined first pulse port, the second pulse port, the third pulse port and the fourth pulse port are respectively the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port and the second negative phase pulse port;
[0024] Control the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to the forward driving timing, and the order of sending current signals corresponding to the forward driving timing is the first positive phase pulse port, the second positive phase pulse port, the first negative phase pulse port and the second negative phase pulse port corresponding to the first line sequence definition;
[0025] When the position change is in the positive direction, the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is determined, including:
[0026] When the position change is in the positive direction, determining the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is the first line sequence definition;
[0027] Determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port after the control channel exchange process is completed includes:
[0028] When the control channels of the first pulse port and the second pulse port are exchanged, the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are determined to be the first negative phase pulse port, the first positive phase pulse port, the second positive phase pulse port and the second negative phase pulse port in sequence;
[0029] When the third pulse port and the fourth pulse port are subjected to control channel exchange processing, the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are determined to be the first positive phase pulse port, the first negative phase pulse port, the second negative phase pulse port and the second positive phase pulse port respectively.
[0030] Further, after the line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are determined according to the position change, the method includes:
[0031] A first reminder signal is generated and transmitted to the reminder module to prompt that the wiring is correct.
[0032] Further, after collecting the first current value through the current sampling module, the method includes:
[0033] When the first current value is zero, a second reminder signal is generated;
[0034] The second reminder signal is transmitted to the reminder module to prompt that the wiring is incorrect.
[0035] Controlling the third pulse port to send a second pulse signal, and collecting the second current value through the current sampling module, includes:
[0036] When the second current value is zero, a second reminder signal is generated;
[0037] The second reminder signal is transmitted to the reminder module to prompt that the wiring is incorrect.
[0038] In a second aspect, an embodiment of the present application provides a driver, including a control chip, a driving module, a current sampling module and an encoder;
[0039] The control chip is connected with the drive module, the current sampling module and the encoder;
[0040] The driving module is provided with four pulse ports, at least three of which are connected to the current sampling module;
[0041] The control chip is used to receive a power-on signal, and in response to the power-on signal, control the first pulse port to send a first pulse signal; collect a first current value through a current sampling module; determine a pulse port whose first current value is greater than zero as a second pulse port corresponding to the first pulse port; control the third pulse port to send a second pulse signal, and collect the second current value through the current sampling module; determine a pulse port whose second current value is greater than zero as a fourth pulse port corresponding to the third pulse port; control the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port to send current signals in sequence according to a preset timing;
[0042] The encoder is used to collect the position change of the stepper motor based on the current signal through the encoder;
[0043] The control chip is also used to determine the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change amount.
[0044] Furthermore, the driving module includes a pre-stage driving unit and a switch unit;
[0045] The control chip is connected to the first end of the front-stage driving unit;
[0046] The second end of the front-stage driving unit is connected to the first end of the switch unit;
[0047] The second end of the switch unit is connected to the sampling module, and the third end of the switch unit is provided with four pulse ports, wherein at least three pulse ports are connected to the current sampling module through the interior of the switch unit.
[0048] Furthermore, the driver also includes a reminder module;
[0049] The reminder module is connected to the control chip, and is used for receiving the first reminder signal or the second reminder signal, and performing corresponding reminder based on the received first reminder signal or the second reminder signal.
[0050] Furthermore, the driver also includes a voltage division module;
[0051] The first end of the voltage divider module is connected to the control chip, and the second end of the voltage divider module is used to connect to the motor bus.
[0052] In a third aspect, an embodiment of the present application provides a stepper motor drive line sequence identification system, comprising a stepper motor and a driver of the second aspect;
[0053] The stepper motor is connected to the four pulse ports of the driver through wiring.
[0054] In a fourth aspect, an embodiment of the present application provides a stepper motor drive line sequence recognition device, including:
[0055] memory and one or more processors;
[0056] A memory for storing one or more programs;
[0057] When one or more programs are executed by one or more processors, the one or more processors implement the stepping motor drive line sequence identification method of the first aspect.
[0058] In a fifth aspect, an embodiment of the present application provides a storage medium storing computer executable instructions, which, when executed by a computer processor, are used to execute the stepper motor drive line sequence identification method as in the first aspect.
[0059] In the embodiment of the present application, after the stepper motor and the driver are connected and powered on, the driver receives the power-on signal, and in response to the power-on signal, controls the first pulse port to send the first pulse signal, collects the first current value through the current sampling module, and determines the pulse port with the first current value greater than zero as the second pulse port corresponding to the first pulse port; controls the third pulse port to send the second pulse signal, collects the second current value through the current sampling module, and determines the pulse port with the second current value greater than zero as the fourth pulse port corresponding to the third pulse port; controls the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing, collects the position change of the stepper motor based on the current signal through the encoder, and determines the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change. By adopting the above-mentioned technical means, the first phase loop formed by the first pulse port and the second pulse port and the second phase loop formed by the third pulse port and the fourth pulse port can be determined through the sending of pulse signals and current detection, so as to avoid the damage to the motor caused by rashly starting the motor after the loops of different phases are cross-connected, thereby ensuring that the motor can rotate normally; on this basis, the motor is driven by the current signal with a preset timing to produce a position change, and the corresponding positive and negative ends in each phase loop are identified according to the position change, so as to determine the line sequence definition of the four pulse ports, and the drive control of the stepper motor can be directly performed according to the line sequence definition subsequently, so as to avoid the problem of poor user experience. After the driver is connected to the stepper motor, the driver automatically identifies and matches the line sequence definition of the four pulse ports according to the wiring of the stepper motor, and the user does not need to manually distinguish the line sequence of the wires of the stepper motor, so that the driver can directly drive the stepper motor to operate normally based on the line sequence definition, which greatly improves the work efficiency of the wiring of the stepper motor, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a structural schematic diagram of a stepper motor driver provided in an embodiment of the present application;
[0061] Figure 2 is a flow chart of a stepper motor drive line sequence identification method provided in an embodiment of the present application;
[0062] Figure 3 It is a structural schematic diagram of a stepper motor drive line sequence recognition system provided in an embodiment of the present application;
[0063] Figure 4 It is a structural schematic diagram of another stepper motor drive line sequence recognition system provided in an embodiment of the present application;
[0064] Figure 5 It is a structural schematic diagram of another stepper motor drive line sequence identification system provided in an embodiment of the present application;
[0065] Figure 6 It is a structural schematic diagram of a stepper motor drive line sequence identification device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0067] The stepper motor needs to be driven by a driver to run. When connecting the stepper motor to the driver, it is necessary to connect the A+, A-, B+ and B- lines of the stepper motor to the A+, A-, B+ and B- ports of the driver in accordance with the line sequence of the stepper motor so that the stepper motor can work normally. Otherwise, the stepper motor may run in the opposite direction of the expected direction or may not run at all, which may damage the stepper motor and the driver. In order to avoid damage to the stepper motor and the driver due to wiring errors, in the prior art, the four wires A+, A-, B+ and B- of the stepper motor are usually marked with different colors for distinction, such as red, blue, black and green. However, since the colors of the logos of different merchants may be different, the line sequence may not be the same. Therefore, users may make mistakes when connecting the wires, and there is also a risk of damaging the stepper motor and the driver, resulting in a poor user experience.
[0068] Based on this, a stepper motor drive line sequence identification method, system and driver provided in this embodiment are proposed. By sending pulse signals and detecting current, the first phase loop formed by the first pulse port and the second pulse port and the second phase loop formed by the third pulse port and the fourth pulse port are determined, so as to avoid the motor being damaged by rashly starting the motor after the loops of different phases are cross-connected, thereby ensuring that the motor can rotate normally; on this basis, the motor is driven by a current signal with a preset timing to generate a position change, and the corresponding positive and negative ends in each phase loop are identified according to the position change, so as to determine the line sequence definition of the four pulse ports, and the drive control of the stepper motor can be directly performed according to the line sequence definition in the future, so as to avoid the problem of poor user experience. Compared with the existing method that requires manual identification by the user, in this embodiment, after the driver and the stepper motor are connected, the driver automatically identifies and matches the line sequence definition of the four pulse ports according to the wiring of the stepper motor, and the user does not need to manually distinguish the line sequence of the wires of the stepper motor, so that the driver can directly drive the stepper motor to operate normally based on the line sequence definition in the future, which greatly improves the work efficiency of the wiring of the stepper motor, thereby improving the user experience.
[0069] Figure 1 is a schematic diagram of a stepper motor driver provided in an embodiment of the present application, with reference to Figure 1 The driver 1 provided in this embodiment specifically includes a control chip 11, a drive module 12, a current sampling module 13 and an encoder 14. The control chip 11 is connected to the drive module 12, the current sampling module 13 and the encoder 14. The drive module 12 is provided with four pulse ports, at least three of which are connected to the current sampling module 13. The four pulse ports are used to connect to the wires of the stepper motor 2. Based on the wire connection with the stepper motor 2, the subsequent driver 1 can send a current signal (pulse signal) through the wire to drive the stepper motor 2 to run. It should be noted that the four pulse ports can drive the motor by sending current signals in sequence according to the preset timing, and the driving direction includes forward and reverse directions.
[0070] The control chip 11 includes a plurality of pins, including a limit pin, an enable pin, a direction pin, a pulse pin, a CAN pin and a UART pin, wherein the limit pin, the enable pin, the direction pin and the pulse pin are 1×IO, and the CAN pin and the UART pin are 2×IO.
[0071] The driving module 12 includes a pre-stage driving unit 121 and a switch unit 122. The control chip 11 is connected to a first end of the pre-stage driving unit 121; a second end of the pre-stage driving unit 121 is connected to a first end of the switch unit 122; a second end of the switch unit 122 is connected to the current sampling module 13, and a third end of the switch unit 122 is provided with four pulse ports, at least three of which are connected to the current sampling module 13 through the interior of the switch unit 122.
[0072] In one embodiment, each pulse port is correspondingly connected to a current sampling module 13 .
[0073] In one embodiment, the control chip 11 is connected to the pre-stage driving unit 121 through multiple pulse width modulation signals (i.e., PWM signals). For example, the control chip 11 is connected to the pre-stage driving unit 121 through 8 PWM signals. The control chip 11 can control the switching of the control channel of the switch unit 122 through the 8 PWM signals. The switch unit 122 includes a plurality of MOS tubes. For example, the switch unit 122 is composed of 8 MOS tubes. The line sequence definition (including the first line sequence definition and the real line sequence definition) corresponding to each pulse port can be changed according to the 8 PWM signals. For example, the line sequence definitions of the four pulse ports corresponding to the 8 PWM signals are the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port, and the second negative phase pulse port. When it is necessary to redefine, the on and off of the corresponding MOS tube can be controlled by the 8 PWM signals to realize the exchange processing of the control channel of the pulse port. For example, after the control channel exchange processing is performed, that is, after the line sequence definitions of the four pulse ports are rearranged, they are the first negative phase pulse port, the first positive phase pulse port, the second positive phase pulse port, and the second negative phase pulse port.
[0074] In one embodiment, the specific configuration structure of the MOS tube in the switch unit 122 can be set according to actual conditions and is not limited in this embodiment.
[0075] In one embodiment, the driver 1 further includes a reminder module (not shown in the figure), the reminder module is connected to the control chip 11, and the reminder module is used to receive a first reminder signal or a second reminder signal. When the reminder module receives the first reminder signal, the first reminder processing is performed to prompt that the wiring is correct; when the reminder module receives the second reminder signal, the second reminder processing is performed to prompt that the wiring is incorrect. Exemplarily, the reminder module is an LED light, the first reminder processing is bright green, and the second reminder processing is bright red. The color prompt of the LED is used to indicate whether the wiring is correct or not, so that the user can determine the wiring situation according to the LED color, avoid the need to drive the stepper motor 2 to run to know whether the wiring is incorrect, avoid driving the motor when the wiring is incorrect and cause damage to the stepper motor 2 or the driver 1, play a role in protecting the stepper motor 2 and the driver 1, thereby improving the wiring reliability, and the wiring situation can be known according to the color corresponding to the simple LED light, which improves the user experience. In addition, after automatically identifying the line sequence definition of the four pulse ports, the user is informed through the first reminder signal that the subsequent driving work can be carried out, further improving the user experience.
[0076] In one embodiment, the driver 1 further includes a voltage divider module 15 , a first end of the voltage divider module 15 is connected to the control chip 11 , and a second end of the voltage divider module 15 is used to connect to a motor bus.
[0077] As described above, by controlling the four pulse ports corresponding to the driving module through the control chip in the stepper motor driver to output corresponding pulse signals, and adjusting and exchanging the corresponding control channels in the driving module through the control chip, and cooperating with the current sampling module to collect the corresponding current values, the control chip can determine the first phase loop and the second phase loop based on the collected current values. For example, the first phase loop includes a first positive phase pulse port and a first negative phase pulse port, and the second phase loop includes a second positive phase pulse port and a second negative phase pulse port. After determining the first phase loop and the second phase loop, the four pulse ports are controlled according to the preset timing to send current signals to the stepper motor in sequence, and the position change of the stepper motor based on the current signal is collected through the encoder, and the corresponding positive and negative current terminals in each phase loop are further identified according to the position change to determine the true line sequence definition of the four pulse ports. Compared with the existing driver that directly drives the stepper motor after wiring to confirm whether the wiring is correct, and manually rewiring is required when the wiring cannot be driven, the driver provided in this embodiment provides line sequence recognition and automatic pairing functions, so that the user does not need to identify the line sequence of the wires in advance, and the driver can automatically identify and automatically pair. After the identification and pairing are completed, the driver can directly drive the stepper motor, thereby greatly improving the wiring work efficiency, and thus greatly improving the user experience.
[0078] Figure 2A flow chart of a stepper motor drive line sequence identification method provided in an embodiment of the present application is given. The stepper motor drive line sequence identification method provided in this embodiment can be executed by a stepper motor drive device, which can be implemented by software and / or hardware. The stepper motor drive device can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the stepper motor drive device can be a driver of a stepper motor.
[0079] The following description is made by taking the driver of a stepper motor as the subject of the stepper motor drive line sequence identification method. Figure 2 The stepper motor drive line sequence identification method is used for the stepper motor driver, and the following steps can be performed by the control chip in the driver. The driver also includes four pulse ports, which are used to connect to the wires of the stepper motor, and at least three pulse ports are connected to the current sampling module. The stepper motor drive line sequence identification method specifically includes:
[0080] S101, receiving a power-on signal, and in response to the power-on signal, controlling a first pulse port to send a first pulse signal.
[0081] A stepper motor is a device that converts an electrical pulse signal into an angular displacement or a linear displacement. When the stepper motor is connected to the driver, the driver is powered on, that is, the stepper motor can be driven to work by the electrical pulse signal sent by the driver. Before driving the stepper motor, it is necessary to verify whether the wiring is correct. If the wiring is incorrect, the stepper motor may have a running direction opposite to the expected running direction or cannot run at all, which may damage the stepper motor and the driver. Therefore, when the stepper motor is connected to the driver and the driver is powered on, the driver receives the power-on signal, responds to the power-on signal, and controls the first pulse port to send the first pulse port. Wherein the first pulse port is a predefined first line sequence defined as a forward pulse port, which can be a first positive phase pulse port, such as A+, or a second positive phase pulse port B+, which can be set according to actual conditions. In this embodiment, the first pulse port is defined as a predefined first line sequence defined as a first positive phase pulse port as an example for explanation. By controlling the first pulse port to send the first pulse signal, on the basis of normal wiring connection, the second pulse port corresponding to the first pulse port will inevitably be able to receive the first pulse signal. Based on the corresponding connection of at least three pulse ports to the current sampling module, there will inevitably be a current sampling module that can collect a current value (i.e., the first current value). Subsequently, it can be directly determined that the pulse port that collects the current value corresponding to the first pulse signal is the second pulse port corresponding to the first pulse port, that is, the first phase loop is determined, avoiding the situation where the motor cannot be started or the motor is damaged due to cross-connection of different phase loops, thereby improving the starting safety of the stepper motor after wiring, and then extending the overall service life of the stepper motor.
[0082] It should be noted that the second pulse port corresponding to the first pulse port can be understood as two pulse ports whose line sequence is defined as the same phase. For example, the line sequence of the first pulse port is defined as the first positive phase pulse port (ie A+), and the line sequence of the second pulse port is defined as the first negative phase pulse port (ie A-).
[0083] Figure 3 is a schematic diagram of a stepper motor drive line sequence recognition system provided in an embodiment of the present application, referring to Figure 3 The stepper motor drive line sequence recognition system includes a driver 1 and a stepper motor 2. Assume that the driver 1 and the stepper motor 2 are connected as follows Figure 3 As shown, assuming that the first pulse port is the first pulse port, assuming that its line sequence is defined as the first positive phase pulse port, namely A+, when the first pulse port (ie A+) sends the first pulse signal through the wire (such as a+) of the stepper motor 2 and inputs the stepper motor 2, the first pulse signal is transmitted via the coil connected to the wire (such as a+), and is output and fed back to the driver 1 through the corresponding wire (such as a-), as shown in FIG. Figure 3 As shown, the third pulse port (i.e., A-) of the driver 1 receives the first pulse signal, that is, the current value that can be sampled by the sampling module 131 corresponding to the second pulse port (i.e., A-) is greater than zero. The first pulse port (i.e., A+) and the second pulse port (i.e., A-) of the driver are two pulse ports in the same phase loop. Similarly, assuming that the first pulse port is the third pulse port, and assuming that its line sequence is defined as the second positive phase pulse port, i.e., B+, when the first pulse port (i.e., B+) sends the first pulse signal through the wire (e.g., b+) of the stepper motor 2 and inputs it into the stepper motor 2, the first pulse signal is transmitted via the coil connected to the wire (e.g., b+), and is output and fed back to the driver 1 through the corresponding wire (e.g., b-), as shown in FIG. Figure 3 As shown, the fourth pulse port (i.e., B-) of the driver 1 receives the first pulse signal, i.e., the current value sampled by the sampling module 132 corresponding to the fourth pulse port (i.e., B-) is greater than zero. The third pulse port (i.e., B+) and the fourth pulse port (i.e., B-) of the driver are two pulse ports in the same phase loop.
[0084] It should be noted that the first pulse port does not specifically refer to the first pulse port, but refers to any one of the four pulse ports, that is, the pulse port that sends the first pulse signal is determined as the first pulse port. For example, the aforementioned first pulse port or the third pulse port can both be used as the first pulse port.
[0085] As described above, by controlling the first pulse port to send the first pulse signal after the driver is powered on, another pulse port in the same phase loop corresponding to the first pulse port can be determined based on the first pulse signal, thereby avoiding the problem of drive damage caused by staggered connection of different phases in the prior art, thereby improving the safety of the stepper motor drive and effectively extending the overall service life of the stepper motor.
[0086] S102: Collect a first current value through a current sampling module.
[0087] After the first pulse port is controlled to send the first pulse signal, the first current value corresponding to the first pulse signal is collected through the current sampling module. Exemplarily, the center point time of the first pulse signal can be predetermined, and the current sampling module can collect current at the corresponding center point time of the first pulse signal to obtain the first current value corresponding to the first pulse signal.
[0088] Reference Figure 3 , based on at least three current sampling modules being connected to corresponding pulse ports, this embodiment is explained by taking the three current sampling modules being set to be connected to the second pulse port, the third pulse port and the fourth pulse port respectively as an example. Assume that among the four pulse ports, the first pulse port is the first pulse port of this embodiment, and its line sequence is defined as the first positive phase pulse port, that is, A+. It should be noted that in this embodiment, the line sequence definition of the first pulse port is determined as the first positive phase pulse port, that is, A+, for illustration only. In actual execution, the line sequence definition of the first pulse port can be arbitrary, that is, it can be any one of the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port and the second negative phase pulse port. The first pulse port (i.e., the first pulse port, the line sequence is defined as the first positive phase pulse port, A+) is controlled to send the first pulse signal, the first pulse signal enters through the wire (e.g., a+) of the stepper motor 2, and after being transmitted through the coil, it is output to the third pulse port of the driver 1 through the wire (e.g., a-) of the stepper motor 2, then the current sampling module 130 connected to the second pulse port collects the corresponding first current value as a positive value, that is, the first current value is greater than zero. It should be noted that the other two current sampling modules (i.e., the current sampling module 131 and the current sampling module 132) also collect the first current value, but the collected first current value is zero.
[0089] As described above, after the first pulse port is controlled to send the first pulse signal, the first current value is collected through the current sampling module, and then the second pulse port corresponding to the first pulse port can be determined according to the collection result, so as to determine the corresponding two pulse ports in the same phase loop, thereby avoiding the problem of drive damage caused by staggered connection of different phases in the prior art, thereby improving the safety of the stepper motor drive, and further effectively extending the overall service life of the stepper motor.
[0090] S103, determining a pulse port whose first current value is greater than zero as a second pulse port corresponding to the first pulse port.
[0091] After the first pulse port sends the first pulse signal, only the pulse port that forms the same-phase loop with the first pulse port can receive the first pulse signal. Therefore, after the first current value is collected by the current sampling module, the pulse port with the first current value greater than zero is determined as the second pulse port corresponding to the first pulse port. For example, the first pulse port and the second pulse port are two pulse ports corresponding to the A-phase loop (i.e., A+ and A-); or the first pulse port and the second pulse port are two pulse ports corresponding to the B-phase loop (i.e., B+ and B-). As described above, by sending the first pulse signal and collecting the first current value, the two pulse ports corresponding to the same-phase loop can be determined, avoiding the problem of drive damage caused by staggered connection of different phases in the prior art, thereby improving the safety of the stepper motor drive, and further effectively extending the overall service life of the stepper motor.
[0092] like Figure 3As shown, it is assumed that among the four pulse ports, the first pulse port is the first pulse port of this embodiment, and its line sequence is defined as the first positive phase pulse port, that is, A+. It should be noted that in this embodiment, the line sequence definition of the first pulse port is determined as the first positive phase pulse port, that is, A+, which is only for example. In actual execution, the line sequence definition of the first pulse port can be arbitrary, that is, it can be any one of the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port, and the second negative phase pulse port. Control the first pulse port (that is, the first pulse port, the line sequence is defined as the first positive phase pulse port, A+) to send a first pulse signal, the first pulse signal enters through the wire (for example, a+) of the stepper motor 2, and after being transmitted by the coil, it is output to the third pulse port of the driver 1 through the wire (for example, a-) of the stepper motor 2, then the current sampling module 130 connected to the second pulse port collects the corresponding first current value as a positive value, that is, the first current value is greater than zero. It should be noted that the other two current sampling modules (i.e., current sampling module 131 and current sampling module 132) also collect the first current value, but the collected first current value is zero. It is determined that the second pulse port corresponding to the current sampling module 130 that collects the first current value greater than zero is the second pulse port, that is, the line sequence of the second pulse port is defined as the first negative phase pulse port, i.e., A-. Therefore, the other two pulse ports (i.e., the third pulse port and the fourth pulse port in this embodiment) are determined as the third pulse port and the fourth pulse port of another group of in-phase loops.
[0093] It should be noted that, in actual execution, the line sequence of the first pulse port may be defined as the first negative phase pulse port, and the second pulse port may be defined as the first positive phase pulse port. Therefore, this embodiment can only determine that the first pulse port and the second pulse port are two pulse ports in the same phase loop, and which of the two pulse ports is the positive phase and which is the negative phase needs to be further confirmed later.
[0094] like Figure 3As shown, it is assumed that among the four pulse ports, the third pulse port is the first pulse port of this embodiment, and its line sequence is defined as the second positive phase pulse port, that is, B+. It should be noted that in this embodiment, the line sequence definition of the first pulse port is determined as the second positive phase pulse port, that is, B+, which is only for example. In actual execution, the line sequence definition of the first pulse port can be arbitrary, that is, it can be any one of the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port, and the second negative phase pulse port. Control the first pulse port (that is, the third pulse port, the line sequence is defined as the second positive phase pulse port, B+) to send a first pulse signal, the first pulse signal enters through the wire (for example, b+) of the stepper motor 2, and after being transmitted by the coil, it is output to the fourth pulse port of the driver 1 through the wire (for example, b-) of the stepper motor 2, then the current sampling module 132 connected to the fourth pulse port collects the corresponding first current value as a positive value, that is, the first current value is greater than zero. It should be noted that the other two current sampling modules (i.e., current sampling module 130 and current sampling module 131) also collect the first current value, but the collected first current value is zero. It is determined that the fourth pulse port corresponding to the current sampling module 132 that collects the first current value greater than zero is the second pulse port, that is, the line sequence of the fourth pulse port is defined as the second negative phase pulse port, i.e., B-. Therefore, the other two pulse ports (i.e., the first pulse port and the third pulse port in this embodiment) are determined as the third pulse port and the fourth pulse port of another group of in-phase loops.
[0095] It should be noted that, in actual execution, the line sequence of the first pulse port may be defined as the second negative phase pulse port, and the second pulse port may be defined as the second positive phase pulse port. Therefore, this embodiment can only determine that the first pulse port and the second pulse port are two pulse ports in the same phase loop, and which of the two pulse ports is positive phase and which is negative phase needs to be further confirmed later.
[0096] S104, controlling the third pulse port to send a second pulse signal, and collecting a second current value through a current sampling module.
[0097] Among the four pulse ports, after the first pulse port and the second pulse port are determined as above, one of the remaining two pulse ports is selected as the third pulse port, and the third pulse port is controlled to send the second pulse signal. On the basis of normal wiring connection, the corresponding remaining pulse port must be able to receive the second pulse signal, that is, the corresponding current sampling module must be able to collect a current value (that is, the second current value). Subsequently, it can be directly determined that the pulse port that collects the current value corresponding to the second pulse signal is the fourth pulse port corresponding to the third pulse port, that is, the second phase loop is determined. As mentioned above, by controlling the third pulse port to send the second pulse signal, it can be determined whether the third pulse port and the corresponding fourth pulse port are wired normally based on the collection of the second current value corresponding to the second pulse signal, thereby improving the reliability of line sequence identification, avoiding abnormal wiring (such as disconnected wiring) that causes the motor to be unable to start normally later and affects the user experience, thereby improving the user experience.
[0098] Exemplarily, after the third pulse port is controlled to send the second pulse signal, the second current value corresponding to the second pulse signal is collected by the current sampling module. For example, the center point time of the second pulse signal can be predetermined, and the current sampling module can be used to collect current at the center point time corresponding to the second pulse signal, so that the second current value corresponding to the second pulse signal can be obtained.
[0099] S105. Determine a pulse port whose second current value is greater than zero as a fourth pulse port corresponding to the third pulse port.
[0100] After the third pulse port sends the second pulse signal, only the pulse port that forms the same-phase loop with the third pulse port can receive the second pulse signal. Therefore, after the second current value is collected by the current sampling module, the pulse port whose second current value is greater than zero is determined as the fourth pulse port corresponding to the third pulse port. For example, when the first pulse port and the second pulse port are obtained as the two pulse ports corresponding to the A-phase loop (i.e., A+ and A-), the third pulse port and the fourth pulse port obtained at this time are the two pulse ports corresponding to the B-phase loop. When the first pulse port and the second pulse port obtained as the two pulse ports corresponding to the B-phase loop (i.e., B+ and B-), the third pulse port and the fourth pulse port obtained at this time are the two pulse ports corresponding to the A-phase loop. In the above, through the sending of the second pulse signal and the collection of the second current value, the two pulse ports corresponding to the same-phase loop can be determined, avoiding the problem of damaged drive caused by interlaced connection of different phases in the prior art, thereby improving the safety of the stepper motor drive, and then effectively extending the overall service life of the stepper motor. In addition, by sending the second pulse signal and collecting the second current value, when a second current value greater than zero is collected, it means that there is no abnormal wiring at this time, thereby ensuring the normal driving of the subsequent stepper motor and improving the user's adaptation experience.
[0101] like Figure 3As shown, assuming that the first pulse port obtained by the above embodiment is the first pulse port, and its corresponding second pulse port is the second pulse port, then one of the third pulse port and the fourth pulse port is selected as the third pulse port to send the second pulse signal. Assuming that the third pulse port is selected as the third pulse port, its line sequence is defined as the second positive phase pulse port, that is, B+. It should be noted that the line sequence definition of the third pulse port in this embodiment is determined as the second positive phase pulse port, that is, B+, only for example. In actual execution, the line sequence definition of the third pulse port can be arbitrary, that is, it can be any one of the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port, and the second negative phase pulse port. For example, assuming that the first pulse port and the second pulse port are determined to be the first positive phase pulse port and the first negative phase pulse port, the third pulse port is the second positive phase pulse port or the second negative phase pulse port. The third pulse port (i.e., the third pulse port, the line sequence is defined as the second positive phase pulse port, B+) is controlled to send a second pulse signal, the second pulse signal enters through the wire of the stepper motor 2 (e.g., b+), and after being transmitted through the coil, it is output to the fourth pulse port of the driver 1 through the wire of the stepper motor 2 (e.g., b-), then the current sampling module 132 connected to the fourth pulse port collects the corresponding second current value as a positive value, that is, the second current value is greater than zero. It should be noted that the other two current sampling modules (i.e., the current sampling module 130 and the current sampling module 131) also collect the second current value, but the collected second current value is zero. It is determined that the fourth pulse port corresponding to the current sampling module 132 that collects the second current value greater than zero is the fourth pulse port, that is, the line sequence of the fourth pulse port is defined as the second negative phase pulse port, i.e., B-.
[0102] It should be noted that, in actual implementation, the line sequence of the third pulse port may be defined as the second negative phase pulse port, and the fourth pulse port may be defined as the second positive phase pulse port. Therefore, this embodiment can only determine that the third pulse port and the fourth pulse port are two pulse ports in the same phase loop, and which of the two pulse ports is the positive phase and which is the negative phase needs to be further confirmed later.
[0103] like Figure 3As shown, through the aforementioned embodiment, assuming that the first pulse port obtained by the aforementioned embodiment is the third pulse port, and its corresponding second pulse port is the fourth pulse port, then one of the first pulse port and the second pulse port is selected as the third pulse port to send the second pulse signal. Assuming that the first pulse port is selected as the third pulse port, its line sequence is defined as the first positive phase pulse port, that is, A+. It should be noted that in this embodiment, the line sequence definition of the third pulse port is determined as the first positive phase pulse port, that is, A+, only for example. In actual execution, the line sequence definition of the third pulse port can be arbitrary, that is, it can be any one of the first positive phase pulse port, the first negative phase pulse port, the second positive phase pulse port, and the second negative phase pulse port. For example, assuming that the first pulse port and the second pulse port are determined to be the second positive phase pulse port and the second negative phase pulse port, the third pulse port is the first positive phase pulse port or the first negative phase pulse port. The third pulse port (i.e., the first pulse port, the line sequence is defined as the first positive phase pulse port, A+) is controlled to send a second pulse signal, the second pulse signal enters through the wire of the stepper motor 2 (e.g., a+), is transmitted through the coil, and is output to the third pulse port of the driver 1 through the wire of the stepper motor 2 (e.g., a-), then the current sampling module 130 connected to the second pulse port collects the corresponding second current value as a positive value, that is, the second current value is greater than zero. It should be noted that the other two current sampling modules (i.e., the current sampling module 131 and the current sampling module 132) also collect the second current value, but the collected second current value is zero. It is determined that the second pulse port corresponding to the current sampling module 130 that collects the second current value greater than zero is the fourth pulse port, that is, the line sequence of the second pulse port is defined as the first negative phase pulse port, i.e., A-.
[0104] It should be noted that, in actual implementation, the line sequence of the third pulse port may be defined as the first negative phase pulse port, and the fourth pulse port may be defined as the first positive phase pulse port. Therefore, this embodiment can only determine that the third pulse port and the fourth pulse port are two pulse ports in the same phase loop, and which of the two pulse ports is the positive phase and which is the negative phase needs to be further confirmed later.
[0105] S106, controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing.
[0106] On the basis of the above-mentioned embodiment, the first pulse port and its corresponding second pulse port, the third pulse port and its corresponding fourth pulse port can be determined, that is, the two pulse ports corresponding to the two groups of in-phase loops are determined. In order to verify whether the line sequence of the determined pulse port can drive the stepper motor normally, the first pulse port, the second pulse port, the third pulse port and the fourth pulse port can be controlled to send current signals in sequence according to the preset timing, so that the stepper motor is driven forward or reversely for one step. It should be noted that the preset timing can be a preset forward drive timing or a preset reverse drive timing. In the above, by controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to the preset timing, it can be determined whether the correct drive is performed according to the position change of the corresponding stepper motor, thereby determining the final true definition of the four pulse ports, and then executing the corresponding stepper motor drive strategy according to the final true definition, so that the stepper motor performs the driving work according to the corresponding drive strategy, avoiding the reversal caused by the reverse connection of the two pulse ports of one phase, thereby ensuring the operation reliability of the stepper motor, and thus improving the user experience.
[0107] For example, Figure 3 As shown, it is assumed that among the four pulse ports, the first pulse port is determined to be the first pulse port, the second pulse port is the second pulse port, the third pulse port is the third pulse port, and the fourth pulse port is the fourth pulse port. The first line sequence of the first pulse port and the second pulse port is predefined as the first positive phase pulse port and the first negative phase pulse port; the first line sequence of the third pulse port and the fourth pulse port is predefined as the second positive phase pulse port and the second negative phase pulse port. Assume that the first pulse port and the second pulse port correspond to the two pulse ports of the A phase loop, and the third pulse port and the fourth pulse port are the two pulse ports of the B phase loop. For example, the first line sequence of the first pulse port (i.e., the first pulse port) is defined as A+, the first line sequence of the second pulse port (i.e., the second pulse port) is defined as A-, the first line sequence of the third pulse port (i.e., the third pulse port) is defined as B+, and the first line sequence of the fourth pulse port (i.e., the fourth pulse port) is defined as B-. When the preset timing is the forward drive timing, the corresponding order of sending current signals is A+, A+B+, B+, B+A-, A-, AB-, B-. When the preset timing is the reverse driving timing, the corresponding order of sending the current signal is B+, B+A+, A+, A+B-, B-, BA-, A-. It should be noted that the forward driving timing and the reverse driving timing provided in this embodiment are only for illustration. In actual operation, the corresponding forward driving timing and the reverse driving timing have various timing arrangements of the embodiment, which are not listed one by one in this embodiment.
[0108] It should be noted that the first line sequence definitions of the four pulse ports need to be predefined before the current signal can be sent according to the preset timing based on the first line sequence definitions.
[0109] S107, collecting the position change of the stepper motor based on the current signal through the encoder.
[0110] After controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing, the stepper motor rotates based on the drive of the current signal. Therefore, the position information of the stepper motor before and after sending the current signal can be collected by the encoder. Based on the position information, the position change amount of the stepper motor based on the current signal can be determined. Subsequently, the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port can be determined based on the position change amount. Subsequently, the corresponding drive control can be performed based on the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port. Exemplarily, the position change amount includes forward and reverse.
[0111] S108. Determine the line sequence definition of the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port according to the position change amount.
[0112] First, the first line sequence definition of the four pulse ports is predefined, and the current signal is sent according to the preset timing based on the first line sequence definition, and the position change of the stepper motor based on the current signal is collected through the encoder. Among them, the preset timing includes a forward drive timing and a reverse drive timing. When the preset timing is a forward drive timing, if the position change of the stepper motor based on the current signal is collected as a forward direction, it means that the first line sequence definition is correct, and the first line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is directly determined as a real line sequence definition. When the preset timing is a forward drive timing, if the position change of the stepper motor based on the current signal is collected as a reverse direction, it means that the first line sequence definition corresponding to one of the corresponding groups of pulse ports in phase is opposite to the real line sequence definition, that is, one of the groups of pulse ports in phase has a reverse connection, so it is necessary to exchange the internal control channels of two pulse ports in phase in one group, so that the corresponding line sequence definition is also processed interactively. For example, the control channels of the first pulse port and the second pulse port are exchanged, or the control channels of the third pulse port and the fourth pulse port are exchanged. According to the first line sequence definition, the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port after the control channel exchange process is completed is determined. For example, the first line sequence definitions of the two pulse ports after the control channel exchange process are exchanged to obtain the real line sequence definitions of the two pulse ports, and the first line sequence definitions of the two pulse ports that have not undergone the control channel exchange process are determined as the real line sequence definitions of the two pulse ports.
[0113] Similarly, when the preset timing is a reverse drive timing, if the position change amount of the stepper motor based on the current signal is collected as reverse, it means that the first line sequence definition is correct, and the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is directly determined as the first line sequence definition. When the preset timing is a reverse drive timing, if the position change amount of the stepper motor based on the current signal is collected as positive, it means that the first line sequence definition corresponding to one of the corresponding groups of pulse ports in phase is opposite to the real line sequence definition, that is, one of the groups of pulse ports in phase is reversely connected, and therefore it is necessary to exchange the internal control channels of two pulse ports in phase in one group, so that the corresponding line sequence definitions are also interactively processed accordingly. For example, the control channels of the first pulse port and the second pulse port are exchanged, or the control channels of the third pulse port and the fourth pulse port are exchanged. According to the first line sequence definition, the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port after the control channel exchange process is completed is determined. For example, the first line sequence definitions of the two pulse ports after the control channel exchange process are exchanged to obtain the real line sequence definitions of the two pulse ports, and the first line sequence definitions of the two pulse ports that have not undergone the control channel exchange process are determined as the real line sequence definitions of the two pulse ports.
[0114] Depend on Figure 1 It can be seen that the control chip 11 in the driver 1 provided in this embodiment controls the on-off combination of the eight MOS tubes in the switch unit 122 through eight PWM signals, thereby realizing the exchange adjustment of the control channels corresponding to the four pulse ports.
[0115] In one embodiment, if Figure 3As shown, the first line sequence definitions of the predefined first pulse port, the second pulse port, the third pulse port and the fourth pulse port are the first positive phase pulse port (i.e., A+), the first negative phase pulse port (i.e., A-), the second positive phase pulse port (i.e., B+) and the second negative phase pulse port (i.e., B-). The first pulse port, the second pulse port, the third pulse port and the fourth pulse port are controlled to send current signals in sequence according to the forward driving timing, and the order of sending current signals corresponding to the forward driving timing is the first positive phase pulse port (i.e., A+), the second positive phase pulse port (i.e., B+), the first negative phase pulse port (i.e., A-) and the second negative phase pulse port (i.e., B-) corresponding to the first line sequence definition. Exemplarily, the forward drive timing is to first send a current signal through the first positive phase pulse port (i.e., A+); then, on the basis of maintaining the first positive phase pulse port (i.e., A+) sending a current signal, send a current signal through the second positive phase pulse port (i.e., B+); then, stop the first positive phase pulse port (i.e., A+) sending a current signal, and maintain the second positive phase pulse port (i.e., B+) sending a current signal; then, on the basis of maintaining the second positive phase pulse port (i.e., B+) sending a current signal, send a current signal through the first negative phase pulse port (i.e., A-); then, stop the second positive phase pulse port (i.e., B+) sending a current signal, and maintain the first negative phase pulse port (i.e., A-) sending a current signal; then, on the basis of maintaining the first negative phase pulse port (i.e., A-) sending a current signal, send a current signal through the second negative phase pulse port (i.e., B-); then, stop the first negative phase pulse port (i.e., A-) sending a current signal, and maintain the second negative phase pulse port (i.e., B-) sending a current signal; then end this forward drive timing control. That is, the transmission of the current signal is expressed as: A+, A+B+, B+, B+A-, A-, AB-, B-. The position change generated by the current signal corresponding to the forward drive timing of the stepper motor is collected by the encoder. When the position change is positive, the first line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is determined as the real line sequence definition, that is, the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is the first positive phase pulse port (ie A+), the first negative phase pulse port (ie A-), the second positive phase pulse port (ie B+) and the second negative phase pulse port (ie B-). When the position change is reverse, the control channels of the first pulse port (ie A+) and the second pulse port (ie A-) are exchanged. Based on the exchange of the control channels, the line sequence of the first pulse port and the second pulse port is also exchanged. Therefore, the real line sequence of the first pulse port is the first negative phase pulse port (ie A-), and the real line sequence of the second pulse port is the first positive phase pulse port (ie A+). The third pulse port and the fourth pulse port are not adjusted based on the control channel, so the first line sequence definition of the third pulse port and the fourth pulse port is a real line sequence definition.Therefore, the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are finally determined as the first negative phase pulse port (i.e. A-), the first positive phase pulse port (i.e. A+), the second positive phase pulse port (i.e. B+) and the second negative phase pulse port (i.e. B-), for example. Figure 4 shown.
[0116] In one embodiment, when the position change amount collected after the aforementioned forward driving timing is in the reverse direction, the third pulse port and the fourth pulse port are subjected to control channel exchange processing. Based on the exchange of the control channel, the line sequence of the third pulse port and the fourth pulse port is also exchanged, so the real line sequence of the third pulse port is the second negative phase pulse port (i.e., B-), and the real line sequence of the fourth pulse port is the second positive phase pulse port (i.e., B+). The first pulse port and the second pulse port are not adjusted based on the control channel, so the first line sequence definition of the first pulse port and the second pulse port is the real line sequence definition. Therefore, it is finally determined that the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are the first positive phase pulse port (i.e., A+), the first negative phase pulse port (i.e., A-), the second negative phase pulse port (i.e., B-) and the second positive phase pulse port (i.e., B+), for example Figure 5 shown.
[0117] It should be noted that the first pulse port does not specifically refer to the first pulse port, but refers to any one of the four pulse ports, that is, the pulse port that sends the first pulse signal is determined as the first pulse port. The second pulse port does not specifically refer to the second pulse port, but refers to the pulse port among the four pulse ports that is combined with the aforementioned first pulse port to form a co-phase loop. The third pulse port is not the third characteristic pulse port, but refers to any one of the remaining two pulse ports among the four pulse ports except the aforementioned first pulse port and the second pulse port, that is, the pulse port that sends the second pulse signal is determined as the third pulse port. The fourth pulse port does not specifically refer to the fourth pulse port, but refers to the pulse port among the four pulse ports that is combined with the aforementioned third pulse port to form a co-phase loop.
[0118] It should be noted that the forward and reverse directions are relative, and can be represented by clockwise and counterclockwise. For example, when driven in the forward direction, the rotor of the stepper motor rotates clockwise, and when driven in the reverse direction, the rotor of the stepper motor rotates counterclockwise.
[0119] In one embodiment, after determining two groups of pulse ports of the same phase through the above-mentioned embodiments, it is assumed that the four predefined pulse ports are defined as the first positive phase pulse port (i.e. A+), the first negative phase pulse port (i.e. A-), the second positive phase pulse port (i.e. B+) and the second negative phase pulse port (i.e. B-) according to the first line sequence definition from the first pulse port to the fourth pulse port. It should be noted that in this embodiment, the first pulse port is the first pulse port, and the corresponding first line sequence is defined as the first positive phase pulse port (i.e. A+); the second pulse port is the second pulse port, and the corresponding first line sequence is defined as the first negative phase pulse port (i.e. A-); the third pulse port is the third pulse port, and the corresponding first line sequence is defined as the second positive phase pulse port (i.e. B+); the fourth pulse port is the fourth pulse port, and the corresponding first line sequence is defined as the second negative phase pulse port (i.e. B-). After the first line sequence definition of the four pulse ports is predefined, when driving is performed based on the preset timing (forward drive timing or reverse drive timing) according to the first line sequence definition, the corresponding driving result (i.e. position change) is shown in Table 1:
[0120]
[0121] Table 1
[0122] In Table 1, the result is normal, which means that the timing control direction is the same as the actual rotation direction. For example, when the preset timing is the forward drive timing, when the current signal is sent based on the forward drive timing, when the position change generated by the current signal corresponding to the forward drive timing of the stepper motor collected by the encoder is positive, the corresponding result is normal; if the position change generated by the current signal corresponding to the forward drive timing of the stepper motor collected by the encoder is reverse, the corresponding result is reverse. It should be noted that the forward and reverse directions are relative, and the forward and reverse directions can be represented by clockwise and counterclockwise. Assuming that the rotor of the stepper motor rotates clockwise during forward drive, the stepper motor is driven to rotate by the forward drive timing. If the rotor of the stepper motor rotates clockwise, the position change collected by the encoder is positive, and the corresponding result is normal; if the rotor of the stepper motor rotates counterclockwise, the position change collected by the encoder is reverse, and the corresponding result is reverse.
[0123] Similarly, for example, when the preset timing is a reverse drive timing, when the current signal is sent based on the reverse drive timing, if the position change generated by the current signal corresponding to the forward drive timing of the stepper motor collected by the encoder is reverse, the corresponding result is normal; if the position change generated by the current signal corresponding to the reverse drive timing of the stepper motor collected by the encoder is forward, the corresponding result is reverse. It should be noted that forward and reverse are relative, and forward and reverse directions can be represented by clockwise and counterclockwise. Assuming that the rotor of the stepper motor rotates counterclockwise during reverse drive, and the stepper motor is driven to rotate by the reverse drive timing, if the rotor of the stepper motor rotates counterclockwise, the position change collected by the encoder is reverse, and the corresponding result is normal; if the rotor of the stepper motor rotates clockwise, the position change collected by the encoder is forward, and the corresponding result is reverse.
[0124] It can be seen from Table 1 that when the result is normal, it means that the driving is performed through the preset first line sequence definition, and the timing control direction is the same as the actual rotation direction, then the first line sequence definition can be directly determined as the real definition of the four pulse ports. When the result is reversed, it means that the driving is performed through the preset first line sequence definition, and the timing control direction is opposite to the actual rotation direction, then the line sequence needs to be adjusted so that when the driving is performed through the adjusted line sequence, the timing control direction can be the same as the actual rotation direction. The control channels of two pulse ports of the same phase in one group in the first line sequence definition can be exchanged, and the first line sequence definitions corresponding to the two pulse ports are also exchanged, so as to determine the real line sequence definitions of the two pulse ports after the control channels are exchanged. The specific exchange process is the same as that in the aforementioned embodiment, and will not be repeated here.
[0125] In one embodiment, after the real line sequence definitions of the four pulse ports are determined by the aforementioned implementation, a first reminder signal is generated and transmitted to the reminder module to prompt that the wiring is correct. For example, the reminder module is an LED light. When the LED light receives the first reminder signal, it lights up green to prompt that the wiring is correct. When the LED lights up green, the stepper motor can be driven normally at any time, avoiding the need to drive the stepper motor to determine whether the wiring is incorrect, which greatly improves the user experience.
[0126] In one embodiment, after the first pulse port is controlled to send the first pulse signal, when the first current value is collected by the current sampling module, if the first current values collected by all current sampling modules are zero, there may be an insurmountable wiring problem, such as a problem that the wire is disconnected and requires manual confirmation, then a second reminder signal is generated, and the second reminder signal is sent to the reminder module to remind that the wiring is incorrect. For example, the reminder module is an LED lamp, and when the LED lamp receives the second reminder signal, it lights up red to indicate that the wiring is incorrect. When the first current values corresponding to the first pulse signal collected by all current sampling modules are zero, the user is reminded to pay attention by lighting a red LED to avoid damage to the motor or driver caused by rashly driving the motor, thereby protecting the stepper motor and the driver, thereby improving the wiring reliability. The wiring status can be known according to the color corresponding to the simple LED lamp, which improves the user experience.
[0127] In one embodiment, after the third pulse port is controlled to send the second pulse signal, when the second current value is collected by the current sampling module, if the second current values collected by all current sampling modules are zero, there may be an insurmountable wiring problem, such as a problem that the wire is disconnected and requires manual confirmation, then a second reminder signal is generated, and the second reminder signal is sent to the reminder module to remind that the wiring is incorrect. For example, the reminder module is an LED lamp, and when the LED lamp receives the second reminder signal, it lights up red to indicate that the wiring is incorrect. When the second current values corresponding to the second pulse signals collected by all current sampling modules are zero, the user is reminded to pay attention by lighting a red LED to avoid damage to the motor or driver caused by rashly driving the motor, thereby protecting the stepper motor and the driver, thereby improving the wiring reliability. The wiring status can be known according to the color corresponding to the simple LED lamp, which improves the user experience.
[0128] As described above, after the stepper motor and the driver are connected and powered on, the driver receives the power-on signal, and in response to the power-on signal, controls the first pulse port to send the first pulse signal, collects the first current value through the current sampling module, and determines the pulse port with the first current value greater than zero as the second pulse port corresponding to the first pulse port; controls the third pulse port to send the second pulse signal, collects the second current value through the current sampling module, and determines the pulse port with the second current value greater than zero as the fourth pulse port corresponding to the third pulse port; controls the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing, collects the position change of the stepper motor based on the current signal through the encoder, and determines the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change. By adopting the above-mentioned technical means, the first phase loop formed by the first pulse port and the second pulse port and the second phase loop formed by the third pulse port and the fourth pulse port can be determined through the sending of pulse signals and current detection, so as to avoid the damage to the motor caused by rashly starting the motor after the loops of different phases are cross-connected, thereby ensuring that the motor can rotate normally; on this basis, the motor is driven by the current signal with a preset timing to produce a position change, and the corresponding positive and negative ends in each phase loop are identified according to the position change, so as to determine the line sequence definition of the four pulse ports, and the drive control of the stepper motor can be directly performed according to the line sequence definition subsequently, so as to avoid the problem of poor user experience. After the driver is connected to the stepper motor, the driver automatically identifies and matches the line sequence definition of the four pulse ports according to the wiring of the stepper motor, and the user does not need to manually distinguish the line sequence of the wires of the stepper motor, so that the driver can directly drive the stepper motor to operate normally based on the line sequence definition, which greatly improves the work efficiency of the wiring of the stepper motor, thereby improving the user experience.
[0129] Based on the above implementation, the embodiment of the present application further provides a stepper motor drive line sequence recognition system, comprising a stepper motor and the driver provided by the above embodiment. The stepper motor is connected to four pulse ports of the driver through wiring.
[0130] The present application embodiment provides a stepper motor drive line sequence recognition device, referring to Figure 6 The stepper motor drive line sequence recognition device includes: a processor 31, a memory 32, a communication module 33, an input device 34 and an output device 35. The number of processors in the stepper motor drive line sequence recognition device can be one or more, and the number of memories in the stepper motor drive line sequence recognition device can be one or more. The processor, memory, communication module, input device and output device of the stepper motor drive line sequence recognition device can be connected through a bus or other methods.
[0131] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the stepper motor drive line sequence identification method described in any embodiment of the present application (for example, the control chip in the driver). The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device or other non-volatile solid-state storage device. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0132] The communication module 33 is used for data transmission.
[0133] The processor 31 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory, that is, realizes the above-mentioned stepper motor drive line sequence identification method.
[0134] The input device 34 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 35 may include a display device such as a display screen.
[0135] The stepper motor drive line sequence identification device provided above can be used to execute the stepper motor drive line sequence identification method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0136] The embodiment of the present application also provides a storage medium storing computer executable instructions, which are used to execute a stepper motor drive line sequence identification method when executed by a computer processor. The stepper motor drive line sequence identification method includes: receiving a power-on signal, and in response to the power-on signal, controlling the first pulse port to send a first pulse signal; collecting a first current value through a current sampling module; determining a pulse port with a first current value greater than zero as a second pulse port corresponding to the first pulse port; controlling the third pulse port to send a second pulse signal, and collecting the second current value through a current sampling module; determining a pulse port with a second current value greater than zero as a fourth pulse port corresponding to the third pulse port; controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing; collecting the position change of the stepper motor based on the current signal through an encoder; and determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change.
[0137] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.
[0138] Of course, the computer executable instructions of a storage medium storing computer executable instructions provided in an embodiment of the present application are not limited to the stepper motor drive line sequence identification method described above, and can also execute related operations in the stepper motor drive line sequence identification method provided in any embodiment of the present application.
[0139] The stepper motor drive line sequence identification device, storage medium and stepper motor drive line sequence identification equipment provided in the above embodiments can execute the stepper motor drive line sequence identification method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the stepper motor drive line sequence identification method provided in any embodiment of the present application.
[0140] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A stepper motor drive line sequence identification method, It is characterized in that A driver for a stepper motor, the driver comprising four pulse ports, the pulse ports being used to connect to the wiring of the stepper motor, at least three pulse ports correspondingly connected to a current sampling module, the method comprising: receiving a power-on signal, and in response to the power-on signal, controlling the first pulse port to send a first pulse signal; Collecting a first current value by the current sampling module; Determine a pulse port whose first current value is greater than zero as a second pulse port corresponding to the first pulse port; Controlling the third pulse port to send a second pulse signal, and collecting a second current value through the current sampling module; Determine the pulse port whose second current value is greater than zero as a fourth pulse port corresponding to the third pulse port; Controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing; Acquiring a position change of the stepper motor based on the current signal by an encoder; The line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is determined according to the position change.
2. The method according to claim 1, It is characterized in that The preset timing includes a forward driving timing; The controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to sequentially send current signals according to a preset timing sequence comprises: Controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to the forward driving timing sequence; The determining of the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change amount includes: When the position change is in a positive direction, determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port; When the position change is in the reverse direction, the control channels of the first pulse port and the second pulse port are exchanged, or the control channels of the third pulse port and the fourth pulse port are exchanged; Determine the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port after the control channel exchange process is completed.
3. The method according to claim 2, It is characterized in that The controlling the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to sequentially send current signals according to the forward driving timing sequence comprises: The first line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are predefined as a first positive phase pulse port, a first negative phase pulse port, a second positive phase pulse port and a second negative phase pulse port in sequence; Control the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to the forward driving timing, wherein the order of sending current signals corresponding to the forward driving timing is the first positive phase pulse port, the second positive phase pulse port, the first negative phase pulse port and the second negative phase pulse port corresponding to the first line sequence definition; When the position change is in a positive direction, determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port includes: When the position change is in a positive direction, determining that the real line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port is the first line sequence definition; The determining of the line sequence definition of the first pulse port, the second pulse port, the third pulse port, and the fourth pulse port after the control channel exchange process is completed includes: When the control channels of the first pulse port and the second pulse port are exchanged, it is determined that the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are the first negative phase pulse port, the first positive phase pulse port, the second positive phase pulse port and the second negative phase pulse port in sequence; When the third pulse port and the fourth pulse port are subjected to control channel exchange processing, the real line sequence definitions of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port are determined to be the first positive phase pulse port, the first negative phase pulse port, the second negative phase pulse port and the second positive phase pulse port respectively.
4. The method according to claim 1, It is characterized in that After determining the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change, the method includes: A first reminder signal is generated and transmitted to the reminder module to prompt that the wiring is correct.
5. The method according to claim 1, It is characterized in that After the first current value is collected by the current sampling module, the method includes: When the first current value is zero, a second reminder signal is generated; The second reminder signal is transmitted to the reminder module to prompt that the wiring is incorrect. The controlling the third pulse port to send the second pulse signal, after collecting the second current value through the current sampling module, comprises: When the second current value is zero, a second reminder signal is generated; The second reminder signal is transmitted to the reminder module to prompt that the wiring is incorrect.
6. A driver, It is characterized in that Including control chip, drive module, current sampling module and encoder; The control chip is connected to the driving module, the current sampling module and the encoder; The driving module is provided with four pulse ports, at least three of which are connected to the current sampling module; The control chip is used to receive a power-on signal, and in response to the power-on signal, control the first pulse port to send a first pulse signal; Collecting a first current value by the current sampling module; Determine a pulse port whose first current value is greater than zero as a second pulse port corresponding to the first pulse port; Controlling the third pulse port to send a second pulse signal, and collecting a second current value through the current sampling module; Determine the pulse port whose second current value is greater than zero as the fourth pulse port corresponding to the third pulse port; control the first pulse port, the second pulse port, the third pulse port and the fourth pulse port to send current signals in sequence according to a preset timing; The encoder is used to collect the position change of the stepper motor based on the current signal through the encoder; The control chip is also used to determine the line sequence definition of the first pulse port, the second pulse port, the third pulse port and the fourth pulse port according to the position change.
7. The driver according to claim 6, It is characterized in that The driving module includes a front-stage driving unit and a switch unit; The control chip is connected to the first end of the front-stage driving unit; The second end of the front-stage driving unit is connected to the first end of the switch unit; The second end of the switch unit is connected to the sampling module, and the third end of the switch unit is provided with four pulse ports, wherein at least three pulse ports are connected to the current sampling module through the interior of the switch unit.
8. The driver according to claim 6, It is characterized in that Also includes reminder module; The reminder module is connected to the control chip, and is used to receive a first reminder signal or a second reminder signal, and to make a corresponding reminder based on the received first reminder signal or the received second reminder signal.
9. The driver according to any one of claims 6 to 8, It is characterized in that Also includes a voltage divider module; The first end of the voltage divider module is connected to the control chip, and the second end of the voltage divider module is used to connect to the motor bus.
10. A stepper motor drive line sequence recognition system, It is characterized in that Comprising a stepping motor and a driver as described in any one of claims 6 to 9; The stepper motor is connected to the four pulse ports of the driver through wiring.
