Stall detection method, apparatus, device, and computer-readable storage medium
By acquiring the current input and feedback of the two-phase stepper motor and calculating the stall detection state, the problem of stall detection of stepper motors without encoders is solved, and low-cost and reliable stall judgment is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN YAKO AUTOMATION TECH CO LTD
- Filing Date
- 2022-07-26
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technology cannot detect whether a stepper motor is stalled without additional equipment such as an encoder, which can lead to abnormal operation of the motor system.
By acquiring the first and second phase current inputs and feedback of the two-phase stepper motor, the stall detection status quantity is calculated, and the motor stall status is determined based on this status quantity.
It effectively determines whether a two-phase stepper motor is stalled, is low-cost, adaptable, requires no additional equipment, and is safe and reliable.
Smart Images

Figure CN115242138B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial control, and in particular to a stall detection method, device, equipment and computer readable storage medium. BACKGROUND
[0002] The stepping motor system includes a stepping motor and a stepping driver. The stepping motor may output torque when the rotation speed is 0, which is generally mechanical or artificial. When the stepping motor stalls, if the stepping driver cannot correctly detect the stall information and take corresponding measures, the operation of the motor system will be abnormal; or if the stepping driver cannot identify the stall information of the stepping motor, it will also cause the motor system to work abnormally.
[0003] The prior art generally detects stall through an external encoder or a photoelectric switch detection device. However, without an external device such as an encoder that can directly reflect the rotation position of the stepping motor, it is impossible to detect whether there is a stall problem. SUMMARY
[0004] The main purpose of the present application is to provide a stall detection method, device, equipment and computer readable storage medium, which aims to solve the problem that the prior art cannot detect stall when there is no other additional device that can directly reflect the rotation position of the stepping motor.
[0005] To achieve the above purpose, the present application provides a stall detection method, which comprises the following steps:
[0006] Obtaining the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback of a two-phase stepping motor;
[0007] Based on the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback, the stall detection state quantity within a preset number of external input pulses is calculated;
[0008] Based on the stall detection state quantity, it is judged whether the two-phase stepping motor stalls.
[0009] Optionally, before the step of obtaining the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback of the two-phase stepping motor in real time, the method further comprises:
[0010] Obtaining the given current, the subdivision, the given rotation speed of the external input pulse of the corresponding driver of the two-phase stepping motor;
[0011] Judging whether the given current, the subdivision, the given rotation speed of the external input pulse change respectively;
[0012] When the given current, the subdivision, and the given rotation speed are all unchanged, the step of obtaining the first phase current given, the first phase current feedback, the second phase current given, and the second phase current feedback of the two-phase stepping motor is performed.
[0013] The given rotation speed of the external input pulse is calculated by a first method, and the step of judging whether the given rotation speed of the external input pulse changes includes:
[0014] The pulse period and the pulse number of the external input pulse are obtained.
[0015] According to the pulse period and the pulse number, the modified pulse speed of the given rotation speed of the external input pulse after a filtering algorithm is calculated by a second method.
[0016] The historical modified pulse speed and the historical given rotation speed of the last pulse period are obtained, and within a preset speed error range, based on the historical modified pulse speed, the historical given rotation speed, and the modified pulse speed, it is judged whether the given rotation speed changes.
[0017] Optionally, the step of judging whether the two-phase stepping motor stalls based on the stall detection state quantity includes:
[0018] The stall detection state quantity in the given number of external input pulses is obtained.
[0019] It is judged whether the stall detection state quantity is within a preset normal range of stall detection state quantity.
[0020] If yes, it is determined that the two-phase stepping motor does not stall.
[0021] Optionally, before the step of judging whether the stall detection state quantity is within the preset normal range of stall detection state quantity, the method further includes:
[0022] In the constant speed state, within a preset number of external input pulses in the first period, the reference maximum value and the reference minimum value of the stall detection state quantity are obtained.
[0023] Based on a preset detection sensitivity requirement, the reference maximum value, and the reference minimum value, the preset normal range of stall detection state quantity is obtained.
[0024] Optionally, after the step of judging whether the two-phase stepping motor stalls based on the stall detection state quantity, the method further includes:
[0025] When it is determined that the two-phase stepping motor stalls, a stop driving signal is sent to the two-phase stepping motor to stop the two-phase stepping motor.
[0026] Furthermore, to achieve the above object, the application also provides a stall detection device, which comprises:
[0027] an acquisition module, configured to acquire a first-phase current given value, a first-phase current feedback value, a second-phase current given value and a second-phase current feedback value of a two-phase stepping motor;
[0028] a calculation module, configured to calculate a stall detection state quantity within a given number of external input pulses based on the first-phase current given value, the first-phase current feedback value, the second-phase current given value and the second-phase current feedback value;
[0029] a judgment module, configured to judge whether the two-phase stepping motor stalls based on the stall detection state quantity.
[0030] Optionally, the acquisition module comprises:
[0031] an acquisition unit, configured to acquire a given current, a subdivision, a given rotating speed of an external input pulse of a corresponding driver of a two-phase stepping motor;
[0032] a judgment unit, configured to respectively judge whether the given current, the subdivision and the given rotating speed of the external input pulse change;
[0033] an execution unit, configured to execute the step of acquiring the first-phase current given value, the first-phase current feedback value, the second-phase current given value and the second-phase current feedback value of the two-phase stepping motor when the given current, the subdivision and the given rotating speed of the external input pulse do not change.
[0034] Optionally, the judgment unit is further configured to:
[0035] acquire a pulse period and a pulse number of the external input pulse;
[0036] calculate a modified pulse speed of the given rotating speed of the external input pulse after a filtering algorithm by using a second method according to the pulse period and the pulse number;
[0037] acquire a historical modified pulse speed and a historical given rotating speed of a previous pulse period, and judge whether the given rotating speed changes based on the historical modified pulse speed, the historical given rotating speed and the modified pulse speed within a preset speed error range.
[0038] Optionally, the judgment module is further configured to:
[0039] acquire the stall detection state quantity within the given number of external input pulses;
[0040] judge whether the stall detection state quantity is within a preset normal range of stall detection state quantity;
[0041] If yes, it is determined that the two-phase stepping motor does not stall.
[0042] Optionally, the determining module is further configured to:
[0043] In the constant speed state, a reference maximum value and a reference minimum value of the stall detection state quantity are obtained within a preset number of external input pulses in the first period.
[0044] Based on the preset detection sensitivity requirement, the reference maximum value and the reference minimum value, the preset normal range of the stall detection state quantity is obtained.
[0045] Optionally, the determining module is further configured to:
[0046] When it is determined that the two-phase stepping motor stalls, a stop driving signal is sent to the two-phase stepping motor to stop the two-phase stepping motor.
[0047] In addition, to achieve the above-mentioned purpose, the application further provides a stall detection device, which comprises a memory, a processor and a stall detection program stored in the memory and executable on the processor, and the stall detection program is configured to implement the steps of the stall detection method.
[0048] In addition, to achieve the above-mentioned purpose, the application further provides a computer readable storage medium, which stores a stall detection program, and the stall detection program implements the steps of the stall detection method when executed by a processor.
[0049] The stall detection method, device, system and computer readable storage medium provided by the application can effectively determine whether the two-phase stepping motor stalls without other additional modules or devices, have low cost, make up for the deficiency of the prior art, have high practicability and high safety and reliability. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 is a structure diagram of a stall detection device of a hardware running environment related to the embodiment scheme of the application;
[0051] Figure 2 is a flowchart of the first embodiment of the stall detection method of the application;
[0052] Figure 3The detailed flowchart of step S30 in the stalling detection method of the embodiment of the present application is shown in the figure;
[0053] Figure 4 The judgment flowchart before step S10 in the stalling detection method of the embodiment of the present application is shown in the figure;
[0054] Figure 5 The implementation flowchart of the stalling detection method of the embodiment of the present application is shown in the figure;
[0055] Figure 6 The function module diagram of the stalling detection device of the embodiment of the present application is shown in the figure.
[0056] The implementation, function features and advantages of the present application will be further explained with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0057] It should be understood that the specific embodiments described herein merely serve to explain the present application and do not limit the present application.
[0058] Reference Figure 1 , Figure 1 The stalling detection device structure diagram of the hardware running environment involved in the embodiment scheme of the present application is shown in the figure.
[0059] As Figure 1 shown, the stalling detection device can include a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 can include a display screen, an input unit such as a keyboard, and an optional user interface 1003 can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 can be a high-speed random access memory (RAM) memory, or a stable non-volatile memory (NVM), such as a magnetic disk memory. The memory 1005 can also be an independent storage device from the aforementioned processor 1001.
[0060] Those skilled in the art can understand that Figure 1 the structure shown in the figure does not constitute a limitation on the stalling detection device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.
[0061] As Figure 1 shown, the memory 1005 as a computer readable storage medium can include an operating system, a data storage module, a network communication module, a user interface module and a stall detection program.
[0062] In Figure 1 the stall detection device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the stall detection device of the application can be arranged in the stall detection device, the stall detection device calls the stall detection program stored in the memory 1005 through the processor 1001, and executes the stall detection method provided by the embodiment of the application.
[0063] The embodiment of the application provides a stall detection method, referring to Figure 2 , Figure 2 the flowchart of the first embodiment of the stall detection method of the application.
[0064] In this embodiment, the stall detection method comprises the following steps:
[0065] Step S10, acquiring the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback of the two-phase stepping motor;
[0066] Step S20, calculating the stall detection state quantity in the given external input pulse number based on the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback;
[0067] Step S30, judging whether the two-phase stepping motor stalls based on the stall detection state quantity.
[0068] In this embodiment, a stall detection method is provided for stall detection of a two-phase stepping motor. The stepping motor driver is an actuator that converts electrical pulses into angular displacement. When the stepping driver receives a pulse signal, it drives the stepping motor to rotate in the set direction by a fixed angle (called "step angle"). Its rotation is step by step with a fixed angle. The number of pulses can be controlled to control the amount of angular displacement, so as to achieve the purpose of accurate positioning; at the same time, the pulse frequency can be controlled to control the speed and acceleration of the motor rotation, so as to achieve the purpose of speed regulation and positioning.
[0069] Generally, the motor matched with the two-phase digital stepper driver is without encoder, and the control of the motor running current of the digital stepper driver only has current loop closed loop control without speed loop closed loop control. Therefore, the present application detects the feedback current of the stepper motor, compares with the standard given current, calculates and judges whether the motor is stalled in real time, that is, when the stepper motor cannot normally rotate or stops rotating due to mechanism interference, the stepper driver can determine the state.
[0070] The following will be described in detail:
[0071] Step S10, obtaining the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback of the two-phase stepper motor;
[0072] In an embodiment, the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback of the two-phase stepper motor are obtained. Among them, the current given is the input current set by the driver; the current feedback is obtained by sampling through the sampling circuit and converting through the amplification circuit, and the feedback signal is proportional to the output current, and the current feedback is the actual running current of the motor. The input current and the current feedback are composed of current size and current phase. When the current closed loop control is performed, there is a fixed difference between the given phase and the feedback phase, that is, the effective amplitude and waveform of the feedback current are very close to the given current and the feedback current at a constant speed, if the difference between the given current phase and the feedback phase changes, or the amplitude or waveform of the feedback current changes, then the stall can be judged. In addition, because the detection object of the present application is a two-phase stepper motor, that is, the stepper motor is driven by two-phase sinusoidal current with a phase difference of 90°, so both two-phase currents need to be detected, and therefore the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback are obtained.
[0073] Step S20, based on the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback, calculating the stall detection state quantity in the given external input pulse number;
[0074] In an embodiment, the first phase current given, the first phase current feedback, the second phase current given and the second phase current feedback are input into a preset calculation formula, and the stall detection state quantity is calculated, and the formula can be referred to: A=f(IA_Ref, IB_Ref, IA_Fdb, IB_Fdb);
[0075] Among them, IA_Ref is the A phase current given; is I_Ref*cos(a);
[0076] IA_Fdb is the A phase current feedback of the two-phase stepper motor; I_Fdb*cos(b);
[0077] IB_Ref — Phase B current reference; is I_Ref*sin(a);
[0078] IB_Fdb—Current feedback of phase B of a two-phase stepper motor; I_Fdb*sin(b);
[0079] This is understandable, because the current has a sinusoidal waveform. Therefore, if a stall occurs, the waveform, phase, and amplitude of the current sinusoidal wave will all change. Specifically, the waveform refers to the image of the alternating current; the amplitude is the maximum absolute value of the alternating current within one cycle, which is also a sinusoidal wave, half the distance from the crest to the trough; and the phase describes the change in the signal waveform, usually measured in degrees (angles), also called the phase angle. Since both the given current and the output current include waveform, phase, and amplitude information, the difference between the given current and the feedback current is calculated using formulas to obtain the stall detection status quantities, thus reflecting the phase difference, waveform difference, and amplitude difference of the current, and thereby determining whether the stall is detected.
[0080] Step S30: Determine whether the two-phase stepper motor is stalled based on the stall detection status quantity.
[0081] In one embodiment, the stall detection status is used to determine whether a two-phase stepper motor is stalled. This is understandable because the calculated stall detection status can provide feedback on phase difference, waveform difference, and amplitude difference; therefore, it is possible to determine whether a two-phase stepper motor is stalled based on the stall detection status. For example, the maximum and minimum values of the stall detection status can be obtained at a constant speed. Subsequently, by checking whether the stall detection status falls within the range of the obtained maximum and minimum values, it can be determined whether a stall has occurred. If the stall detection status is outside the range of the obtained maximum and minimum values, it indicates that the motor operation has encountered a certain fault, thus confirming that a stall has occurred.
[0082] This embodiment acquires the first-phase current input, first-phase current feedback, second-phase current input, and second-phase current feedback of a two-phase stepper motor in real time. Based on these data, it calculates the stall detection status in real time and determines whether the two-phase stepper motor is stalled. This method effectively determines whether a two-phase stepper motor is stalled without requiring additional modules or equipment, resulting in low cost. Furthermore, because the stall detection status is calculated in real time, it does not require adjustments based on different stepper motors, offering good adaptability.
[0083] Furthermore, based on the first embodiment of the stall detection method of the present invention, a second embodiment of the stall detection method of the present invention is proposed.
[0084] Referring to Figure 3 , Figure 3 Figure 2 is a flowchart illustrating a refinement of step S30 in the method for detecting stalling of the two-phase stepping motor according to the first embodiment of the present application. In the second embodiment, the step of determining whether the two-phase stepping motor stalls based on the stalling detection state quantity comprises the steps of:
[0085] In step S31, the stalling detection state quantity within the given number of external input pulses is obtained.
[0086] In step S32, it is determined whether the stalling detection state quantity is within a preset normal range of the stalling detection state quantity.
[0087] In step S33, if yes, it is determined that the two-phase stepping motor does not stall.
[0088] In this embodiment, the stalling detection state quantity is obtained, and it is subsequently determined whether the stalling detection state quantity is within the obtained normal range of the stalling detection state quantity, so as to obtain the stalling determination result of the motor.
[0089] The steps will be described in detail as follows:
[0090] In step S31, the stalling detection state quantity within the given number of external input pulses is obtained.
[0091] In an embodiment, the stalling detection state quantity within the given number of external input pulses is obtained, and the stalling is determined according to the stalling detection state quantity. It can be understood that the stalling detection state quantity fluctuates within a certain boundary after constant speed, and this fluctuation boundary can be used to determine whether the stalling detection state quantity is abnormal. To calculate the boundary of the stalling detection state quantity, i.e., to determine the maximum and minimum values, a certain sample quantity is required. Since the driver rotates the stepping motor by a fixed angle (referred to as "step angle") in the set direction, the rotation is step by step at a fixed angle, therefore, the sample quantity is obtained by rotating the stepping motor for a certain time. Within the preset number of external input pulses, the program calculates the stalling detection state quantity in real time, and determines the actual maximum value and the actual minimum value in real time.
[0092] In step S32, it is determined whether the stalling detection state quantity is within a preset normal range of the stalling detection state quantity.
[0093] In an embodiment, it is determined whether the stalling detection state quantity is within a preset normal range of the stalling detection state quantity. It can be understood that if the stalling detection state quantity is below the obtained maximum value of the stalling detection state quantity, and the stalling detection state quantity is above the obtained minimum value of the stalling detection state quantity, i.e., the stalling detection state quantity is within the normal range, it indicates that the two-phase stepping motor does not have a fault.
[0094] Step S33, if yes, it is determined that the two-phase stepping motor does not stall.
[0095] In an embodiment, when the motor stalls, the current waveform and amplitude will change slightly, and the stall detection state quantity calculated according to the formula can feedback the slight changes of the current waveform and the current amplitude. Once the motor stalls, the phase difference between the given current and the feedback current, and the amplitude difference between the given current amplitude and the feedback current amplitude will change, and then the stall detection state quantity calculated will exceed the boundary of the maximum value and the minimum value calculated in the normal state. Therefore, when the stall detection state quantity is within the range of the maximum value and the minimum value obtained, i.e. within the normal range, it is determined that the two-phase stepping motor does not stall. Correspondingly, if it exceeds the maximum value and the minimum value obtained, it is determined that the two-phase stepping motor stalls.
[0096] Further, in an embodiment, before the step of determining whether the stall detection state quantity is within the preset normal range of the stall detection state quantity, the method further comprises:
[0097] Step S321, in a constant speed state, a reference maximum value and a reference minimum value of the stall detection state quantity are obtained within a preset number of external input pulses in a first period.
[0098] In an embodiment, in a constant speed state, the reference maximum value and the reference minimum value are obtained according to the preset number of external input pulses. It can be understood that in a constant speed state and when the motor does not stall, the maximum value and the minimum value of the stall detection state quantity calculated within the preset number of external input pulses of the motor operation are usually a constant value, that is, if the actual working motor appears a value other than the maximum value / minimum value obtained by the preset number of external input pulses, it means that the motor stalls. Therefore, first, the reference maximum value and the reference minimum value are obtained within the preset number of external input pulses in a first period when the motor operates normally and in a constant speed state. It should be noted that the reference values calculated for different motors, different given currents, different speeds, etc. are different.
[0099] Step S322, based on the preset detection sensitivity requirement, the reference maximum value and the reference minimum value, the preset normal range of the stall detection state quantity is obtained.
[0100] In an embodiment, according to a preset detection sensitivity requirement, the normal range is set according to the reference maximum value and the reference minimum value. After the reference maximum value and the reference minimum value in the normal operation are obtained, if it is directly judged whether the stall detection state quantity is consistent with the reference maximum value and the reference minimum value, the system may be reported as an error when there is a little error, which is not conducive to the normal operation of the motor and is not in line with the actual situation. Specifically, according to a preset detection sensitivity requirement, the normal floating range of the maximum value and the minimum value is adjusted, for example: the reference minimum value of the stall detection state quantity in the normal state is 5, the reference maximum value is 15, the minimum value is set to 3, and the maximum value is set to 17, so that when the stall detection state quantity is detected as 3, it is considered that it exceeds the minimum value, and the two-phase stepping motor is stalled. The range size can be changed according to the user's sensitivity requirement, for example, the user wants to make the detection more sensitive, so the error between the minimum value and the reference minimum value is 1, and the error between the maximum value and the reference maximum value is 1, so that when the stall detection state quantity is detected as 4, it exceeds the minimum value range, and the two-phase stepping motor is stalled. That is, the higher the detection sensitivity requirement, the smaller the error between the minimum value and the reference minimum value and the error between the maximum value and the reference maximum value.
[0101] In the embodiment, the stall detection state quantity in the preset external input pulse number is obtained, and then it is judged whether the stall detection state quantity is in the obtained normal range of the stall detection state. If the stall detection state quantity is in the obtained normal range of the stall detection state, that is, in the reference maximum value and the reference minimum value range, it is determined that the two-phase stepping motor does not stall, which realizes judging whether the two-phase stepping motor stalls according to the stall detection state quantity, and the detection sensitivity can be adjusted according to the need to further adjust the normal range of the stall detection state quantity, so as to meet the individualized and different detection requirements of the user.
[0102] Further, based on the first and second embodiments of the stall detection method, the third embodiment of the stall detection method is provided.
[0103] Reference Figure 4 , Figure 4 It is a judgment flowchart of the given current, subdivision, and given speed of the external input pulse before step S10 in the first embodiment of the stall detection method of the application. In the third embodiment, before the steps of obtaining the first-phase current given, the first-phase current feedback, the second-phase current given, and the second-phase current feedback of the target two-phase motor, the method further comprises:
[0104] Step S11, obtaining the given speed of the given current, subdivision, and external input pulse of the corresponding driver of the two-phase stepping motor;
[0105] Step S12, respectively, determine whether the given current, the subdivision, the given speed of the external input pulse change;
[0106] Step S13, when the given current, the subdivision, the given speed of the external input pulse change, execute the step of obtaining the first phase current of the two-phase stepping motor, the first phase current feedback, the second phase current given and the second phase current feedback.
[0107] In this embodiment, before detection, first of all, the given current, the subdivision, the speed are judged, only when the given current, the subdivision, the given speed of the external input pulse do not change, the subsequent step is carried out. Because the motor is in the acceleration and deceleration state, not constant speed, the calculated stall detection state quantity will change. In addition, because the subdivision changes, the current changes will change the stall detection state quantity in the subsequent calculation of the stall detection state quantity, then the patent does not judge the stall in this case. The given current, the subdivision will not change, the feedback current will change when the stall is usually set.
[0108] The following will be described in detail:
[0109] Step S11, obtaining the given current, the subdivision, the given speed of the external input pulse of the corresponding driver of the two-phase stepping motor;
[0110] In an embodiment, the given current, the subdivision, the given speed of the external input pulse of the corresponding driver of the two-phase stepping motor are obtained. Specifically, the speed can be obtained by detecting the period of the external input pulse and detecting the output pulse frequency. Specifically, the time difference of the external input pulse is captured by writing code, thereby obtaining the period of the input pulse. The number of output pulses is obtained, the number of output pulses per unit time is calculated, and the output pulse frequency is calculated. Because the speed of the stepping motor can be controlled by frequency, the running frequency of the stepping motor is proportional to the speed, according to the period detection of the external input pulse and the output pulse frequency detection, the given speed of the external input pulse of the stepping motor is calculated by the calculation formula. In addition, the given current and the subdivision are preset, and the given current and the subdivision are usually set and will not change. It can be understood that the current and the load of the stepping motor are related, and the size of the current determines the size of the torque. If the load torque is too large, the motor cannot drive the load, and serious step loss occurs, then the speed of the motor and the load are related, of course, this is not the normal working state of the stepping motor; in the normal working state of the motor, as long as the pulse frequency is constant, it can be considered that the stepping motor is constant speed output.
[0111] Step S12, respectively, determine whether the given current, the subdivision, the given speed of the external input pulse change;
[0112] In an embodiment, it is determined whether the given current, the subdivision, and the given rotation speed of the external input pulse are changed, respectively. The given current and the subdivision are set on the driver at the start of the operation, i.e., a fixed value, and generally, these values do not change during the operation, but the user can change the current or the subdivision during the actual operation of the driver. Since the subdivision affects the rotation speed and the change of the current changes the stall detection state quantity, it is necessary to detect whether the current and the subdivision are changed. In addition, the rotation speed affects the current output, i.e., the calculated value is changed in the case of the current feedback that is not constant speed.
[0113] In step S13, when the given current, the subdivision, and the given rotation speed are not changed, a step of acquiring the first phase current given, the first phase current feedback, the second phase current given, and the second phase current feedback of the two-phase stepping motor is performed.
[0114] In an embodiment, when the given current, the subdivision, and the rotation speed are not changed, a step of acquiring the first phase current given, the first phase current feedback, the second phase current given, and the second phase current feedback of the two-phase stepping motor is performed. It can be understood that when the rotation speed is changed, the maximum value and the minimum value are changed in the subsequent calculation of the stall detection state quantity. Similarly, when the subdivision is changed, the rotation speed is changed sharply, and the calculated stall detection state quantity is changed. Therefore, only when the given current, the subdivision, and the rotation speed are not changed, the subsequent detection can be performed, and a predetermined number of external input pulses are run to obtain the maximum value / minimum value of the stall detection state quantity. It can be understood that only one moment of the stall detection state quantity cannot determine whether the stall occurs, and generally, a certain sample quantity is required, and generally, in a few periods of a sine wave, sufficient sample quantity can be obtained.
[0115] Further, in an embodiment, the driver is controlled to drive the two-phase stepping motor to rotate based on the given number of external input pulses.
[0116] In an embodiment, it can be understood that the rotation speed of the motor is constant, because the driver drives the stepping motor to rotate in a set direction by a fixed angle, each step corresponds to an angle, and therefore the movement of the stepping motor can be reflected by the angle, so that the predetermined number of external input pulses is used as a period for judgment. Since the stall detection state quantity is acquired in real time, the value range of the stall detection state quantity in a period does not differ much, and when the stall detection state quantity that exceeds the normal value range is detected in a period, it can be considered that the stall occurs.
[0117] Further, in an embodiment, the given speed of the external input pulse is calculated by a first method, and the step of judging whether the given speed of the external input pulse changes includes:
[0118] In step S121, the pulse period and the pulse number of the external input pulse are obtained.
[0119] In step S122, the modified pulse speed of the external input pulse after filtering algorithm is calculated by a second method according to the pulse period and the pulse number.
[0120] In step S123, the historical modified pulse speed and the historical given speed of the last pulse period are obtained, and within a preset speed error range, the historical modified pulse speed, the historical given speed and the modified pulse speed are used to judge whether the given speed changes.
[0121] In an embodiment, the given speed is compared with the historical given speed of the last period to judge whether the given speed changes. It can be understood that the given speed is constant within the same pulse period, and therefore, specifically, within a preset speed error range, the modified pulse speed and the given speed of the external input pulse of the current period are compared with the historical modified pulse speed and the historical given speed of the external input pulse of the last period to judge whether the given speed of the external input pulse changes.
[0122] Further, it is also necessary to compare the speeds calculated by the first method and the second method to judge whether the given speed of the external input pulse changes. The second method is to calculate the given speed according to the number of pulses in a period, and the first method is to calculate the modified pulse speed according to the interval between each pulse. The given speed of the external input pulse is obtained by the first method, that is, the pulse period and the pulse number of the external input pulse are obtained, and it is assumed that the input pulse is 10001, 1 represents a pulse, and 0 represents an interval time. After modification, that is, after micro-division and filtering, it is assumed that it will become 33344 under normal circumstances, and it may become 33444 if a small speed change occurs in the filtering modification conversion process, which indicates that the given speed changes. Therefore, in this embodiment, the first method is used to calculate the external input pulse speed, and the second method is used to calculate the equivalent pulse of the external input pulse after filtering algorithm, that is, the modified pulse speed, to judge whether the input given speed changes.
[0123] Further, in an embodiment, after the step of judging whether the two-phase stepping motor stalls based on the stall detection state quantity, the method further includes:
[0124] Step S34, when determining that the two-phase stepping motor is stalled, sending a stop driving signal to the two-phase stepping motor to stop the two-phase stepping motor.
[0125] In an embodiment, when determining that the two-phase stepping motor is stalled, sending a stop driving signal to stop the two-phase stepping motor, thereby protecting the motor from damage. Further, when no stall of the motor is detected, it indicates that the motor is not stalled, and the driving signal is continued to be sent to keep the motor running.
[0126] Referring to Figure 5 , Figure 5 The flowchart of the implementation of an embodiment of the stall detection method of the present application is shown, and the stall detection method of the present application is described. The stall detection state quantity is calculated in real time, wherein the stall detection state quantity is calculated according to the mathematical model: A = f(IA_Ref, IB_Ref, IA_Fdb, IB_Fdb).
[0127] IA_Ref - A-phase current given; I_Ref*cos(a);
[0128] IA_Fdb - two-phase stepping motor A-phase current feedback; I_Fdb*cos(b);
[0129] IB_Ref - B-phase current given; I_Ref*sin(a);
[0130] IB_Fdb - two-phase stepping motor B-phase current feedback; I_Fdb*sin(b);
[0131] Then, it is determined whether the given current, subdivision, and given speed of the external input pulse of the two-phase stepping driver change. If they change, the detection is not performed, and the step of determining whether the given current, subdivision, and given speed of the external input pulse of the two-phase stepping driver change is returned. When it is determined that the given current, subdivision, and given speed of the external input pulse of the two-phase stepping driver do not change, the stall detection function enables the control driver to output a certain current angle Num. If the output fails, the step is returned until the output current angle, i.e., the preset angle (i.e., the preset number of external input pulses) in the embodiment. Then, the maximum value C_Max and the minimum value C_min of the stall detection state quantity under the current constant speed state are calculated, and it is further determined whether A is within the preset C_min and C_max range. If yes, the motor is not stalled. If no, the motor is stalled.
[0132] The embodiment obtains the given current, the subdivision, the given rotating speed of the external input pulse of the driver corresponding to the two-phase stepping motor, and judges whether the given current, the subdivision, the given rotating speed of the external input pulse change, and only when the given current, the subdivision, the given rotating speed of the external input pulse do not change, the locked-rotor detection is performed, thereby avoiding the misjudgment of the locked-rotor caused by the change of the given current, the subdivision, the given rotating speed of the external input pulse of the system itself. And in the case that the given current, the subdivision, the given rotating speed of the external input pulse do not change, the locked-rotor is judged in the preset external input pulse number as a period, the locked-rotor detection state quantity is calculated in the periodic external input pulse number, and the locked-rotor is judged according to the locked-rotor detection state quantity, and an effective locked-rotor judgment result can be obtained.
[0133] Reference Figure 6 , Figure 6 The embodiment of the locked-rotor detection device is a function module schematic diagram, and the application further provides a locked-rotor detection device. The locked-rotor detection device comprises:
[0134] The acquisition module 10 is used to acquire the first-phase current given, the first-phase current feedback, the second-phase current given and the second-phase current feedback of the two-phase stepping motor.
[0135] The calculation module 20 is used to calculate the locked-rotor detection state quantity in the given external input pulse number based on the first-phase current given, the first-phase current feedback, the second-phase current given and the second-phase current feedback.
[0136] The judgment module 30 is used to judge whether the two-phase stepping motor is locked-rotor based on the locked-rotor detection state quantity.
[0137] Optionally, the acquisition module comprises:
[0138] The acquisition unit is used to acquire the given current, the subdivision, the given rotating speed of the external input pulse of the driver corresponding to the two-phase stepping motor.
[0139] The judgment unit is used to respectively judge whether the given current, the subdivision, the given rotating speed of the external input pulse change.
[0140] The execution unit is used to execute the step of acquiring the first-phase current given, the first-phase current feedback, the second-phase current given and the second-phase current feedback of the two-phase stepping motor when the given current, the subdivision and the given rotating speed do not change.
[0141] Optionally, the judgment unit is further used to:
[0142] Acquire the pulse period and the pulse number of the external input pulse.
[0143] According to the pulse period and the pulse number, a modified pulse speed of the external input pulse after filtering a given rotating speed is calculated by a second method;
[0144] A history modified pulse speed and a history given rotating speed of a last pulse period are obtained, and within a preset speed error range, whether the given rotating speed changes is judged based on the history modified pulse speed, the history given rotating speed and the modified pulse speed.
[0145] Optionally, the judging module is further configured to:
[0146] The stall detection state quantity within the given external input pulse number is obtained.
[0147] Whether the stall detection state quantity is within a preset stall detection state quantity normal range is judged.
[0148] If yes, it is determined that the two-phase stepping motor does not stall.
[0149] Optionally, the judging module is further configured to:
[0150] In a constant speed state, within a preset external input pulse number of a first period, a reference maximum value and a reference minimum value of the stall detection state quantity are obtained.
[0151] Based on a preset detection sensitivity requirement, the reference maximum value and the reference minimum value, the preset stall detection state quantity normal range is obtained.
[0152] Optionally, the judging module is further configured to:
[0153] When it is determined that the two-phase stepping motor stalls, a stop driving signal is sent to the two-phase stepping motor to stop the two-phase stepping motor.
[0154] In addition, an embodiment of the present application further provides a computer readable storage medium. A stall detection program is stored on the computer readable storage medium, and the stall detection program is executed by a processor to implement steps of the stall detection method.
[0155] The method implemented by the stall detection program executed by the processor running on the computer readable storage medium can refer to the embodiments of the stall detection method of the present application, and will not be described here.
[0156] It should be noted that, in this document, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or system that comprises the recited element.
[0157] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0158] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and the necessary general hardware platform, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a computer readable storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) as described above, and includes a number of instructions for making a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) execute the methods described in the various embodiments of the present application.
[0159] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A stall detection method, characterized by, The stall detection method comprises the following steps: obtaining a first phase current given value, a first phase current feedback value, a second phase current given value and a second phase current feedback value of a two-phase stepping motor; calculating a stall detection state quantity within a given number of external input pulses based on the first phase current given value, the first phase current feedback value, the second phase current given value and the second phase current feedback value; judging whether the two-phase stepping motor stalls based on the stall detection state quantity; Before the step of obtaining the first phase current given value, the first phase current feedback value, the second phase current given value and the second phase current feedback value of the two-phase stepping motor, the method further comprises: obtaining a given current, a subdivision, a given speed of an external input pulse of a driver corresponding to the two-phase stepping motor; judging whether the given current, the subdivision and the given speed of the external input pulse change respectively; when the given current, the subdivision and the given speed do not change, executing the step of obtaining the first phase current given value, the first phase current feedback value, the second phase current given value and the second phase current feedback value of the two-phase stepping motor; The given speed of the external input pulse is calculated by a first method, and the step of judging whether the given speed of the external input pulse changes comprises: obtaining a pulse period and a pulse number of the external input pulse; calculating a modified pulse speed of the given speed of the external input pulse after a filtering algorithm by a second method according to the pulse period and the pulse number; obtaining a historical modified pulse speed and a historical given speed of a last pulse period; judging whether the given speed changes based on the historical modified pulse speed, the historical given speed and the modified pulse speed within a preset speed error range.
2. The stall detection method of claim 1, wherein, The step of judging whether the two-phase stepping motor stalls based on the stall detection state quantity comprises: obtaining the stall detection state quantity within the given number of external input pulses; judging whether the stall detection state quantity is within a preset normal range of stall detection state quantity; if yes, determining that the two-phase stepping motor does not stall.
3. The stall detection method of claim 2, wherein, Before the step of judging whether the stall detection state quantity is within the preset normal range of stall detection state quantity, the method further comprises: obtaining a reference maximum value and a reference minimum value of the stall detection state quantity within a preset number of external input pulses in a constant speed state in a first period; obtaining the preset normal range of stall detection state quantity based on a preset detection sensitivity requirement, the reference maximum value and the reference minimum value.
4. The stall detection method of claim 1, wherein, After the step of judging whether the two-phase stepping motor stalls based on the stall detection state quantity, the method further comprises: when it is determined that the two-phase stepping motor stalls, sending a stop driving signal to the two-phase stepping motor to stop the two-phase stepping motor.
5. A stall detection device, characterized by The device comprises: an obtaining module for obtaining a first phase current given value, a first phase current feedback value, a second phase current given value and a second phase current feedback value of a two-phase stepping motor; The computing module is configured to calculate a stall detection state quantity within a given number of external input pulses based on the first phase current given value, the first phase current feedback value, the second phase current given value, and the second phase current feedback value. The judging module is configured to judge whether the two-phase stepping motor stalls based on the stall detection state quantity. The obtaining module is further configured to obtain a given current, a subdivision, and a given speed of an external input pulse of a driver corresponding to the two-phase stepping motor, and judge whether the given current, the subdivision, and the given speed of the external input pulse change. The step of judging whether the given speed of the external input pulse changes includes: The obtaining module is further configured to obtain a pulse period and a pulse number of the external input pulse, calculate a modified pulse speed of the given speed of the external input pulse after filtering algorithm by using a second method according to the pulse period and the pulse number, and obtain a historical modified pulse speed and a historical given speed of a previous pulse period.
6. The stall detection device of claim 5, wherein, The obtaining module further includes: The obtaining unit is configured to obtain a given current, a subdivision, and a given speed of an external input pulse of a driver corresponding to the two-phase stepping motor. The judging unit is configured to judge whether the given current, the subdivision, and the given speed of the external input pulse change. The executing unit is configured to execute the step of obtaining the first phase current given value, the first phase current feedback value, the second phase current given value, and the second phase current feedback value of the two-phase stepping motor when the given current, the subdivision, and the given speed of the external input pulse do not change.
7. A stall detection device characterized by, The device includes a memory, a processor, and a stall detection program stored on the memory and executable on the processor, and the stall detection program is configured to implement the steps of the stall detection method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a stall detection program, and the stall detection program is executed by the processor to implement the steps of the stall detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Locked-rotor detection method for direct-current brush motor based on FFT technology and controller
CN112595971A
Delay optimization method for motor locked-rotor protection and control system thereof
CN114094912A
Electric wrench
CN203282416U
Stepping motor closed-loop control system
CN208836041U