Stepping motor control method, device, equipment and storage medium

By using sensors to determine the initial position obstruction, and by combining the reverse and forward movements of the stepper motor with linear acceleration and deceleration modes, the positioning uncertainty during stepper motor startup is resolved, enabling precise control of the stepper motor, ensuring that the medium accurately reaches the target position, and improving the accuracy of stepper motor control.

CN113258839BActive Publication Date: 2025-12-05SHENZHEN YIHUA COMP +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010363014.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-30
Publication Date
2025-12-05
Estimated Expiration
2040-04-30

AI Technical Summary

Technical Problem

When a stepper motor starts, the stator teeth and rotor are in random positions, which may lead to reverse motion, resulting in media transmission errors and affecting precise control.

Method used

The sensor determines whether there is an obstruction at the starting position. If there is an obstruction, the movement is reversed; if there is no obstruction, the movement is forward for a predetermined distance until the target position is reached. Linear acceleration/deceleration or constant speed mode control is used.

Benefits of technology

This improves the precision of stepper motor control, ensuring that the medium accurately reaches the target position.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113258839B_ABST
    Figure CN113258839B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a kind of step motor control methods, the method includes: whether the starting position of pre-set is judged by sensor being arranged on transmission channel existence shielding;In the case where starting position exists shielding, by step motor drive target medium to the opposite direction of target transmission direction movement;By sensor detection starting position is not exist shielding, in the case where starting position is not exist shielding, by step motor drive target medium to the opposite direction of target transmission direction movement pre-set first distance;By step motor drive target medium to target transmission direction movement to pre-set target position.The step motor control method of the present application, the starting position of target medium is adjusted, accurately control target medium accurately transport to target position, improve the accuracy of step motor control.In addition, a kind of step motor control device, equipment and storage medium are also proposed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control technology, and in particular to a stepper motor control method, device, equipment, and storage medium. Background Technology

[0002] Currently, stepper motors are widely used in mechanical automation equipment. Stepper motors can be used to transmit media. The medium being transmitted is placed on the transmission channel of the stepper motor-driven equipment, and the stepper motor drives the transmission channel to rotate, thereby realizing the transmission of the medium.

[0003] When a stepper motor starts, there is a process of aligning the stator teeth with the rotor. However, when the motor was powered off during the previous operation, the relative positions of the stator teeth and rotor were random. Therefore, during the tooth alignment process, the stepper motor may first rotate in the opposite direction to the target direction and then rotate back to the target direction. Since the stepper motor does not calculate the number of steps to move in the opposite direction, it may complete the predetermined number of steps but fail to reach the target position. In other words, when the stepper motor moves in the opposite direction to the target direction first, it introduces errors in media transmission. For applications requiring precise control of media transmission to a specific location, this situation of the stepper motor rotating in the opposite direction to the target direction before rotating back to the target direction introduces uncertainty into the position control of media transmission, leading to certain control errors.

[0004] Therefore, there is an urgent need for a solution to improve the control accuracy of stepper motors. Summary of the Invention

[0005] Therefore, it is necessary to propose a stepper motor control method, device, computer equipment, and storage medium to address the above problems.

[0006] A stepper motor control method, wherein the stepper motor is used to control a target medium to be transmitted in a transmission channel according to a target transmission direction; the method includes:

[0007] The sensor installed on the transmission channel determines whether there is an obstruction at the preset starting position;

[0008] If there is an obstruction at the starting position, the target medium is driven by a stepper motor to move in the opposite direction to the target transmission direction;

[0009] The sensor detects whether there is no obstruction at the starting position. If no obstruction is detected at the starting position, the target medium is driven by a stepper motor to move a preset first distance in the opposite direction of the target transmission direction.

[0010] The target medium is driven by a stepper motor to move in the target transmission direction to the preset target position.

[0011] In one embodiment, after determining whether there is an obstruction at the preset starting position by using a sensor installed on the transmission channel, the method further includes: if there is no obstruction at the starting position, performing the stepper motor to drive the target medium to move in the target transmission direction to the preset target position.

[0012] In one embodiment, the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor further includes: driving the target medium to move in the target transport direction via a stepper motor according to a preset driving mode and a preset target position, wherein the driving mode includes at least one of a linear acceleration / deceleration mode and / or a constant speed mode; and controlling the stepper motor to be locked after the target medium reaches the target position so that the target medium stops moving at the target position.

[0013] In one embodiment, before the step of driving the target medium to move in the target transport direction by a stepper motor, the method further includes: driving the target medium to move in the target transport direction by a stepper motor, detecting whether there is an obstruction at the starting position by a sensor; and if an obstruction is detected at the starting position, controlling the stepper motor to be locked so that the target medium stops moving at the starting position.

[0014] In one embodiment, after the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor, the method further includes: detecting whether a driving command is received, the driving command including a second target position; if a driving command is received, then according to the preset driving mode and the second target position, driving the target medium to move in the target transmission direction or the opposite direction of the target transmission direction via a stepper motor; after the target medium reaches the second target position, controlling the stepper motor to be in a locked state so that the target medium stops moving at the second target position.

[0015] In one embodiment, the method further includes: obtaining the current state of the stepper motor, the current state including one of an idle state, a driving state, and a locked state; if the stepper motor is in an idle state, then performing the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel.

[0016] A stepper motor control device, wherein the stepper motor is used to control the target medium to be transmitted in a transmission channel according to the target transmission direction; the device includes:

[0017] The judgment module is used to determine whether there is an obstruction at the preset starting position by using sensors installed on the transmission channel;

[0018] The first adjustment module is used to drive the target medium to move in the opposite direction of the target transmission direction by a stepper motor when there is an obstruction at the starting position.

[0019] The detection module is used to detect whether there is no obstruction at the starting position through the sensor. If no obstruction is detected at the starting position, the target medium is driven by a stepper motor to move a preset first distance in the opposite direction of the target transmission direction.

[0020] The drive module is used to drive the target medium to move in the target transmission direction to the preset target position via a stepper motor.

[0021] In one embodiment, the device further includes a second adjustment module, configured to perform the step of driving the target medium to move in the target transmission direction to a preset target position by means of a stepper motor when there is no obstruction at the starting position.

[0022] In one embodiment, the driving module further includes: a driving unit, configured to drive the target medium to move in the target transport direction via a stepper motor according to a preset driving mode and a preset target position, wherein the driving mode includes at least one of a linear acceleration / deceleration mode and / or a constant speed mode; and a locking unit, configured to control the stepper motor to be locked after the target medium reaches the target position, so that the target medium stops moving at the target position.

[0023] In one embodiment, the driving unit further includes: a detection subunit, configured to drive the target medium to move in the target transport direction via a stepper motor, and detect whether there is an obstruction at the starting position via a sensor; and a locking subunit, configured to control the stepper motor to be locked in a locked state when an obstruction is detected at the starting position, so that the target medium stops moving at the starting position.

[0024] In one embodiment, the device further includes: a detection module for detecting whether a driving command is received, the driving command including a second target position; a command driving module for, if a driving command is detected, driving the target medium to move in the target transmission direction or the opposite direction of the target transmission direction according to the preset driving mode and the second target position; and a locking module for controlling the stepper motor to be locked after the target medium reaches the second target position, so that the target medium stops moving at the second target position.

[0025] In one embodiment, the device further includes: a status acquisition module, used to acquire the current status of the stepper motor, the current status including an idle state, a driving state, and a locked state; if the stepper motor is in an idle state, then the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel is executed.

[0026] A computer device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:

[0027] The sensor installed on the transmission channel determines whether there is an obstruction at the preset starting position;

[0028] If there is an obstruction at the starting position, the target medium is driven by a stepper motor to move in the opposite direction to the target transmission direction;

[0029] The sensor detects whether there is no obstruction at the starting position. If no obstruction is detected at the starting position, the target medium is driven by a stepper motor to move a preset first distance in the opposite direction of the target transmission direction.

[0030] The target medium is driven by a stepper motor to move in the target transmission direction to the preset target position.

[0031] A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:

[0032] The sensor installed on the transmission channel determines whether there is an obstruction at the preset starting position;

[0033] If there is an obstruction at the starting position, the target medium is driven by a stepper motor to move in the opposite direction to the target transmission direction;

[0034] The sensor detects whether there is no obstruction at the starting position. If no obstruction is detected at the starting position, the target medium is driven by a stepper motor to move a preset first distance in the opposite direction of the target transmission direction.

[0035] The target medium is driven by a stepper motor to move in the target transmission direction to the preset target position.

[0036] The stepper motor control method, apparatus, device, and storage medium of this invention determine whether there is an obstruction at a preset starting position using sensors installed on the transmission channel, thereby determining whether the medium has reached the starting position. If an obstruction exists at the starting position, the target medium is driven by a stepper motor to move in the opposite direction to the target transmission direction. This continues until no obstruction is detected at the starting position, at which point the target medium is driven by a stepper motor to move a certain distance in the opposite direction to the target transmission direction. Finally, the target medium is driven by a stepper motor to move in the target transmission direction to the preset target position. This stepper motor control method, apparatus, device, and storage medium of the present invention, by continuously controlling the transmission of the target medium in both forward and reverse directions, adjusts the starting position of the target medium and then accurately controls the transport of the target medium to the target position, thus improving the accuracy of stepper motor control. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] in:

[0039] Figure 1 This is a flowchart of a stepper motor control method in one embodiment;

[0040] Figure 2 This is a structural block diagram of a stepper motor control device in one embodiment;

[0041] Figure 3 This is a structural block diagram of a stepper motor control device in one embodiment;

[0042] Figure 4 This is a structural block diagram of the driver module in one embodiment;

[0043] Figure 5 This is a structural block diagram of the driving unit in one embodiment;

[0044] Figure 6 This is a structural block diagram of a stepper motor control device in one embodiment;

[0045] Figure 7 This is a structural block diagram of a stepper motor control device in one embodiment;

[0046] Figure 8 This is a structural block diagram of a computer device that runs the aforementioned stepper motor control method in one embodiment. Detailed Implementation

[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0048] In this embodiment, a stepper motor control method is provided, which adjusts the starting position of target medium transmission and then transmits the target medium to the target position. The method is applied to the control of a stepper motor, and its execution is based on a control device for the stepper motor with a transmission channel.

[0049] like Figure 1 As shown, in one embodiment, a stepper motor control method is provided. This stepper motor control method specifically includes the following steps S102-S110:

[0050] Step S102: Determine whether there is an obstruction at the preset starting position using a sensor installed on the transmission channel; if yes, proceed to step S104: drive the target medium to move in the opposite direction of the target transmission direction using a stepper motor; if no, proceed to step S110: drive the target medium to move in the target transmission direction to the preset target position using a stepper motor.

[0051] Specifically, the transmission channel can be a conveyor belt, and the target medium is the object to be transmitted, such as a ticket or similar object. The transmission channel is used to transmit the target medium. A sensor installed on the transmission channel is used to detect whether the target medium exists at the starting position; this sensor can be an infrared reflective sensor. A stepper motor transmits the target medium through the transmission channel; the stepper motor can be driven by a belt or gears. The target transmission direction is from the starting position to the target position.

[0052] Throughout the entire process of the stepper motor control method, it is necessary to determine the current state of the stepper motor, especially before executing step S102.

[0053] In one embodiment, the current state of the stepper motor is determined and the current state of the stepper motor is obtained. The current state includes one of the following: idle state, driving state, and locked state. If the stepper motor is in the idle state, the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel is executed.

[0054] Specifically, the idle state is the state of the stepper motor when a small current flows through its circuitry, but this current is insufficient to control the stepper motor's rotation frequency. The drive state is the state of the stepper motor when it drives the target medium to move in the direction of target transport or in the opposite direction. The locked state is the state of the stepper motor when it stops rotating and remains stationary. When the stepper motor is in the idle state, it is easy for it to switch to the drive state at any time, preventing the stepper motor from generating excessive heat and burning out due to maintaining a constant rotation speed for an extended period.

[0055] In step S102, a sensor installed on the transmission channel determines whether there is an obstruction at the preset starting position. If there is an obstruction at the starting position, it means that all or part of the target medium to be transmitted is located at the starting position. If there is no obstruction at the starting position, it means that the target medium to be transmitted is not located at the starting position.

[0056] If the starting position is obstructed, step S104 is executed, causing the stepper motor to drive the target medium to move in the opposite direction of the target transmission direction, thereby completely removing the target medium from the starting position. The situation where the target medium just leaves the starting position, versus the situation where the target medium, initially not in the starting position, is adjusted to the starting position, will result in sensor detection errors when the target medium reaches the starting position. Completely removing the target medium from the starting position will avoid these errors.

[0057] In one embodiment, if there is no obstruction at the starting position, the step of driving the target medium to move in the target transmission direction to the preset target position by a stepper motor is performed, namely step S110.

[0058] Specifically, when the target medium is not in the starting position, the stepper motor is controlled to drive the target medium to move towards the target position, so that the target medium is in the preset target position.

[0059] Step S106: Detect whether there is no obstruction at the starting position using the sensor; if yes, proceed to step S108: drive the target medium to move a preset first distance in the opposite direction of the target transmission direction using a stepper motor; if no, continue to proceed to step S104: drive the target medium to move in the opposite direction of the target transmission direction using a stepper motor.

[0060] Specifically, detecting the absence of obstruction at the starting position by the sensor can be achieved by detecting a falling edge, where the falling edge is the instantaneous change in sensor voltage from high to low. At the instant the target medium detaches from the starting position, the sensor detects the falling edge, and the sensor voltage decreases.

[0061] When the starting position is obstructed, the target medium is driven by a stepper motor to move continuously in the opposite direction of the target transmission direction, causing the target medium to leave the starting position. When no obstruction is detected at the starting position, the target medium is driven by a stepper motor to continue moving a certain distance in the opposite direction of the target transmission area, causing the target medium to completely leave the starting position.

[0062] Step S110: Drive the target medium to move in the target transmission direction to the preset target position by a stepper motor.

[0063] Specifically, the stepper motor controls the transmission of the target medium to the target position. The target position is the final location to which the stepper motor needs to transmit the target medium. The target medium, which has moved from its starting position, can be directly transmitted to the target position using a preset drive mode.

[0064] In one embodiment, according to a preset driving mode and a preset target position, a stepper motor drives the target medium to move in the target transportation direction. The driving mode includes at least one of a linear acceleration / deceleration mode and / or a constant speed mode. After the target medium reaches the target position, the stepper motor is controlled to be locked so that the target medium stops moving at the target position.

[0065] Specifically, the constant speed mode involves the stepper motor driving the target medium at a constant speed. According to the preset driving pattern, the target medium, which has moved from its starting position, is transferred to its target position. The linear acceleration / deceleration mode involves the stepper motor first accelerating and then decelerating the target medium. The acceleration time, acceleration, and / or deceleration time in the linear acceleration / deceleration mode can be determined within a specific range based on the stepper motor's operating frequency and the distance between the starting and target positions.

[0066] The frequency F of the stepper motor running at a constant speed m The calculation method is as follows:

[0067]

[0068] Among them, v m α is the speed of the stepper motor; α is the number of steps the stepper motor takes to complete one revolution.

[0069] The frequency F of the stepper motor's acceleration or deceleration operation ω The calculation method is as follows:

[0070]

[0071] Where ω is the acceleration or deceleration of the stepper motor during operation.

[0072] When a stepper motor accelerates or decelerates, an incremental frequency is added to the frequency of the stepper motor running at a constant speed. This incremental frequency F is the frequency calculated after acceleration or deceleration. inc The calculation formula is as follows:

[0073]

[0074] The frequency F of the stepper motor after acceleration or deceleration calculation cur The calculation formula is as follows:

[0075] F m ±f inc =f cur

[0076] The frequency of the stepper motor after acceleration calculation is "+", and the frequency of the stepper motor after deceleration calculation is "-".

[0077] Finally, the loading value of the stepper motor is calculated, and the counting function is implemented through the system clock to output the stepper motor running clock waveform. The calculation method is as follows:

[0078]

[0079] Among them, f c / k This is the frequency of the system clock.

[0080] The linear acceleration / deceleration mode of the stepper motor can be effectively controlled based on the clock waveform of the stepper motor's operation. The linear acceleration / deceleration mode allows the target medium to be transported to its destination in the shortest possible time without affecting equipment performance.

[0081] In step S110, the target medium, which is detached from the starting position, can be transferred to the starting position first, and then transferred from the starting position to the target position. In this case, the distance between the starting position and the target position is known. It is only necessary to determine the number of steps of the stepper motor based on the distance. Through linear acceleration and deceleration mode and / or constant speed mode, the stepper motor drives a specific number of steps to accurately deliver the target medium to the target position, thereby achieving the precision of the stepper motor's control over the target medium.

[0082] In one embodiment, a stepper motor drives the target medium to move in the target transport direction. A sensor detects whether there is an obstruction at the starting position. If an obstruction is detected at the starting position, the stepper motor is locked to stop the target medium at the starting position.

[0083] Specifically, detecting obstruction at the starting position using a sensor can be achieved by detecting a rising edge. The rising edge is the instantaneous change in sensor voltage from low to high. When the target medium reaches the starting position, the sensor detects this rising edge, and the sensor voltage increases accordingly. By readjusting all or part of the target medium at the starting position, as well as any target medium that has moved away from its initial position, back to the starting position, the stepper motor only needs to use the same drive mode to handle target media initially in different positions, ensuring that the target medium is ultimately and accurately transmitted to the target location.

[0084] In one embodiment, it is detected whether a drive command is received, the drive command including a second target position; if a drive command is received, then according to the preset drive mode and the second target position, the stepper motor drives the target medium to move in the target transmission direction or the opposite direction of the target transmission direction; after the target medium reaches the second target position, the stepper motor is controlled to be locked so that the target medium stops moving at the second target position.

[0085] Specifically, the drive command may also include drive direction and / or drive distance, etc. The stepper motor transports the target medium located at the target position directly from the target position to the second target position according to a preset drive mode. If no drive command is received, the stepper motor is controlled to be in an idle state. The stepper motor can drive the target medium to different target positions multiple times, not just transporting it to one target position, thus achieving comprehensive stepper motor control.

[0086] like Figure 2 As shown, in one embodiment, a stepper motor control device is provided, the stepper motor being used to control the target medium to be transmitted in a transmission channel according to a target transmission direction; the device includes:

[0087] The judgment module 202 is used to determine whether there is an obstruction at the preset starting position by using a sensor installed on the transmission channel;

[0088] The first adjustment module 204 is used to drive the target medium to move in the opposite direction of the target transmission direction by a stepper motor when there is an obstruction at the starting position.

[0089] The detection module 206 is used to detect whether there is no obstruction at the starting position through the sensor. If no obstruction is detected at the starting position, the target medium is driven by a stepper motor to move a preset first distance in the opposite direction of the target transmission direction.

[0090] The drive module 208 is used to drive the target medium to move in the target transmission direction to the preset target position via a stepper motor.

[0091] like Figure 3 As shown, in one embodiment, the device further includes a second adjustment module 205, used to perform the step of driving the target medium to move to a preset target position by a stepper motor in the target transmission direction when there is no obstruction at the starting position.

[0092] like Figure 4 As shown, in one embodiment, the driving module 208 further includes: a driving unit, used to drive the target medium to move in the target transportation direction by means of a stepper motor according to a preset driving mode and a preset target position, the driving mode including at least one of a linear acceleration / deceleration mode and / or a constant speed mode; and a locking unit, used to control the stepper motor to be locked after the target medium reaches the target position, so that the target medium stops moving at the target position.

[0093] like Figure 5 As shown, in one embodiment, the driving unit further includes: a detection subunit, used to drive the target medium to move in the target transport direction via a stepper motor, and to detect whether there is an obstruction at the starting position via a sensor; and a locking subunit, used to control the stepper motor to be locked in a locked state when an obstruction is detected at the starting position, so that the target medium stops moving at the starting position.

[0094] like Figure 6 As shown, in one embodiment, the device further includes: a detection module 209, used to detect whether a driving command is received, the driving command including a second target position; a command driving module 211, used to, if a driving command is detected, drive the target medium to move in the target transmission direction or the opposite direction of the target transmission direction according to the preset driving mode and the second target position; and a locking module 213, used to control the stepper motor to be locked after the target medium reaches the second target position, so that the target medium stops moving at the second target position.

[0095] like Figure 7 As shown, in one embodiment, the device further includes: a status acquisition module 201, used to acquire the current status of the stepper motor, the current status including an idle state, a driving state, and a locked state; if the stepper motor is in an idle state, then the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel is executed.

[0096] Figure 8 An internal structural diagram of a computer device in one embodiment is shown. This computer device can specifically be a terminal or a server. Figure 8As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a stepper motor control method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to implement the stepper motor control method. Those skilled in the art will understand that… Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0097] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the following steps: determining whether there is an obstruction at a preset starting position using a sensor disposed on the transmission channel; if there is an obstruction at the starting position, driving a target medium to move in the opposite direction of the target transmission direction using a stepper motor; detecting whether there is no obstruction at the starting position using the sensor; if no obstruction is detected at the starting position, driving the target medium to move a preset first distance in the opposite direction of the target transmission direction using a stepper motor; and driving the target medium to move in the target transmission direction to a preset target position using a stepper motor.

[0098] In one embodiment, after determining whether there is an obstruction at the preset starting position by using a sensor installed on the transmission channel, the method further includes: if there is no obstruction at the starting position, performing the stepper motor to drive the target medium to move in the target transmission direction to the preset target position.

[0099] In one embodiment, the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor further includes: driving the target medium to move in the target transport direction via a stepper motor according to a preset driving mode and a preset target position, wherein the driving mode includes at least one of a linear acceleration / deceleration mode and / or a constant speed mode; and controlling the stepper motor to be locked after the target medium reaches the target position so that the target medium stops moving at the target position.

[0100] In one embodiment, before the step of driving the target medium to move in the target transport direction by a stepper motor, the method further includes: driving the target medium to move in the target transport direction by a stepper motor, detecting whether there is an obstruction at the starting position by a sensor; and if an obstruction is detected at the starting position, controlling the stepper motor to be locked so that the target medium stops moving at the starting position.

[0101] In one embodiment, after the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor, the method further includes: detecting whether a driving command is received, the driving command including a second target position; if a driving command is received, then according to the preset driving mode and the second target position, driving the target medium to move in the target transmission direction or the opposite direction of the target transmission direction via a stepper motor; after the target medium reaches the second target position, controlling the stepper motor to be in a locked state so that the target medium stops moving at the second target position.

[0102] In one embodiment, the method further includes: obtaining the current state of the stepper motor, the current state including one of an idle state, a driving state, and a locked state; if the stepper motor is in an idle state, then performing the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel.

[0103] In one embodiment, a computer-readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the following steps: determining whether there is an obstruction at a preset starting position using a sensor disposed on the transmission channel; if there is an obstruction at the starting position, driving the target medium to move in the opposite direction of the target transmission direction using a stepper motor; detecting whether there is no obstruction at the starting position using the sensor; if no obstruction is detected at the starting position, driving the target medium to move a preset first distance in the opposite direction of the target transmission direction using a stepper motor; and driving the target medium to move in the target transmission direction to a preset target position using a stepper motor.

[0104] In one embodiment, after determining whether there is an obstruction at the preset starting position by using a sensor installed on the transmission channel, the method further includes: if there is no obstruction at the starting position, performing the stepper motor to drive the target medium to move in the target transmission direction to the preset target position.

[0105] In one embodiment, the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor further includes: driving the target medium to move in the target transport direction via a stepper motor according to a preset driving mode and a preset target position, wherein the driving mode includes at least one of a linear acceleration / deceleration mode and / or a constant speed mode; and controlling the stepper motor to be locked after the target medium reaches the target position so that the target medium stops moving at the target position.

[0106] In one embodiment, before the step of driving the target medium to move in the target transport direction by a stepper motor, the method further includes: driving the target medium to move in the target transport direction by a stepper motor, detecting whether there is an obstruction at the starting position by a sensor; and if an obstruction is detected at the starting position, controlling the stepper motor to be locked so that the target medium stops moving at the starting position.

[0107] In one embodiment, after the step of driving the target medium to move in the target transmission direction to a preset target position via a stepper motor, the method further includes: detecting whether a driving command is received, the driving command including a second target position; if a driving command is received, then according to the preset driving mode and the second target position, driving the target medium to move in the target transmission direction or the opposite direction of the target transmission direction via a stepper motor; after the target medium reaches the second target position, controlling the stepper motor to be in a locked state so that the target medium stops moving at the second target position.

[0108] In one embodiment, the method further includes: obtaining the current state of the stepper motor, the current state including one of an idle state, a driving state, and a locked state; if the stepper motor is in an idle state, then performing the step of determining whether there is an obstruction at the preset starting position by using a sensor set on the transmission channel.

[0109] The stepper motor control method, apparatus, device, and storage medium of this invention determine whether there is an obstruction at a preset starting position using sensors installed on the transmission channel, thereby determining whether the medium has reached the starting position. If an obstruction exists at the starting position, the target medium is driven by a stepper motor to move in the opposite direction to the target transmission direction. This continues until no obstruction is detected at the starting position, at which point the target medium is driven by a stepper motor to move a certain distance in the opposite direction to the target transmission direction. Finally, the target medium is driven by a stepper motor to move in the target transmission direction to the preset target position. This stepper motor control method, apparatus, device, and storage medium of the present invention, by continuously controlling the transmission of the target medium in both forward and reverse directions, adjusts the starting position of the target medium and then accurately controls the transport of the target medium to the target position, thus improving the accuracy of stepper motor control.

[0110] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0111] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0112] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims. Please enter the specific implementation details.

Claims

1. A method of controlling a stepper motor, characterized by, The step motor is used to control the target medium to be transmitted on the transmission channel in the target transmission direction; The method comprises: judging whether the preset starting position is blocked by a sensor arranged on the transmission channel; in the case that the starting position is blocked, driving the target medium to move in the opposite direction of the target transmission direction by the step motor; detecting whether the starting position is unblocked by the sensor, and in the case that the starting position is unblocked, driving the target medium to move in the opposite direction of the target transmission direction by the step motor for a preset first distance; driving the target medium to move in the target transmission direction to a preset target position by the step motor; wherein the step of driving the target medium to move in the target transmission direction to the preset target position by the step motor further comprises: driving the target medium to move in the target transmission direction by the step motor according to a preset driving mode and the preset target position, the driving mode comprising at least one of a linear acceleration and deceleration mode and / or a uniform speed mode; after the target medium reaches the target position, controlling the step motor to be in a locked state so as to stop the movement of the target medium at the target position; wherein the step of driving the target medium to move in the target transmission direction by the step motor further comprises: driving the target medium to move in the target transmission direction by the step motor, and detecting whether the starting position is blocked by the sensor; in the case that the starting position is blocked, controlling the step motor to be in a locked state so as to stop the movement of the target medium at the starting position.

2. The method of claim 1, wherein, after the step of judging whether the preset starting position is blocked by the sensor arranged on the transmission channel, the method further comprises: in the case that the starting position is unblocked, performing the step of driving the target medium to move in the target transmission direction to the preset target position by the step motor.

3. The method of claim 1, wherein, after the step of driving the target medium to move in the target transmission direction to the preset target position by the step motor, the method further comprises: detecting whether a driving instruction is received, the driving instruction comprising a second target position; if the driving instruction is detected, driving the target medium to move in the target transmission direction or in the opposite direction of the target transmission direction by the step motor according to the preset driving mode and the second target position; after the target medium reaches the second target position, controlling the step motor to be in a locked state so as to stop the movement of the target medium at the second target position.

4. The method of claim 1, wherein, The method further comprises: obtaining a current state of the step motor, the current state comprising one of an idle state, a driving state and a locked state; if the step motor is in the idle state, performing the step of judging whether the preset starting position is blocked by the sensor arranged on the transmission channel.

5. A stepping motor control device characterized by comprising: The step motor control method according to any one of claims 1-4 is applied to the step motor control device, the step motor being used to control the target medium to be transmitted on the transmission channel in the target transmission direction; The device comprises: a judging module configured to judge whether a preset starting position is blocked by a sensor arranged on the transmission channel; The first adjusting module is configured to drive the target medium to move in the opposite direction of the target transmission direction by the stepper motor when the start position is blocked. The detecting module is configured to detect whether the start position is blocked by the sensor, and drive the target medium to move in the opposite direction of the target transmission direction by the stepper motor for a preset first distance when it is detected that the start position is not blocked. The driving module is configured to drive the target medium to move in the target transmission direction to a preset target position by the stepper motor.

6. The apparatus of claim 5, wherein, The device further comprises: The second adjusting module is configured to execute the step of driving the target medium to move in the target transmission direction to the preset target position by the stepper motor when the start position is not blocked. 7.A computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to make the processor perform the steps of the method according to any one of claims 1 to 4. 8.A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to make the processor perform the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Stepping motor control device, component mounter provided therewith, and stepping motor control method

    CN106063117A

  • Cash box tongue piece positioning control method and device

    CN107038796A