Control method and device of stepping motor

文档序号:515406 发布日期:2021-05-28 浏览:27次 中文

阅读说明:本技术 一种步进电机的控制方法及装置 (Control method and device of stepping motor ) 是由 叶国洪 胡胜发 于 2021-03-12 设计创作,主要内容包括:本发明涉及电机控制技术领域,公开了一种步进电机的控制方法和装置,所述方法包括:接收步进电机的第一控制命令和状态信息,确定所述步进电机的目标位置;判断所述第一转动方向是否和所述状态信息中的当前转向相同,然后控制步进电机通过加速模式、减速模式和匀速模式到达目标位置。所述装置包括:接收模块、计算模块、第一判断模块和控制模块。本发明的有益效果:用户可以根据需要随时输入新的控制命令,步进电机可以实时响应用户的操作,不用等待上次转动执行完毕后才执行下个指令,大大提升用户体验。同时由于采用了依次变速的减速模式和加速模式,可以在步进电机启动、停止或变向过程中避免力矩的快速变化造成步进电机丢步。(The invention relates to the technical field of motor control, and discloses a control method and a control device of a stepping motor, wherein the method comprises the following steps: receiving a first control command and state information of a stepping motor, and determining a target position of the stepping motor; and judging whether the first rotating direction is the same as the current rotating direction in the state information or not, and then controlling the stepping motor to reach the target position through an acceleration mode, a deceleration mode and a constant speed mode. The device comprises: the device comprises a receiving module, a calculating module, a first judging module and a control module. The invention has the beneficial effects that: the user can input new control command as required at any time, and step motor can respond to user's operation in real time, need not wait to rotate last time and just carry out next instruction after the execution finishes, promotes user experience greatly. Meanwhile, the speed reduction mode and the acceleration mode which change speed in sequence are adopted, so that the step loss of the stepping motor caused by the rapid change of the moment can be avoided in the starting, stopping or turning process of the stepping motor.)

1. A control method of a stepping motor, comprising:

receiving a first control command and state information of a stepping motor, wherein the first control command comprises a first distance and a first rotating direction; the state information of the stepping motor comprises a current position, a current steering and a current speed;

determining a target position of the stepping motor according to a current position and a first distance and a first rotating direction between a current steering direction and the first control command in the state information of the stepping motor;

judging whether the first rotating direction is the same as the current rotating direction in the state information, if so, controlling the stepping motor to rotate to the target position and then stop; if the difference is not the same, controlling the stepping motor to immediately enter a deceleration mode until the deceleration is zero, and rotating to the target position in the first rotating direction and then stopping;

the deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

2. The stepping motor control method according to claim 1,

the step motor is controlled to immediately enter a deceleration mode until the deceleration is zero, and the method specifically comprises the following steps:

judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

when the stepping motor is in a constant speed mode or an acceleration mode, controlling the stepping motor to enter a deceleration mode until the current speed is reduced to zero;

when the stepper motor is in the deceleration mode, the deceleration mode is maintained until the current speed is reduced to zero.

3. The stepping motor control method according to claim 2, wherein the rotation in the first rotational direction to the target position is stopped, specifically:

controlling the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, and stopping the stepping motor after the stepping motor rotates to the target position;

wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

4. The stepping motor control method according to claim 1, wherein the step motor is controlled to stop after rotating to the target position, specifically:

judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

when the stepping motor is in the constant speed mode, the constant speed mode is kept, and then the stepping motor enters the deceleration mode to rotate to the target position and then stops;

when the stepping motor is in an acceleration mode, the acceleration mode is kept, then the stepping motor enters a constant speed mode and a deceleration mode, and the stepping motor is stopped after rotating to the target position;

when the stepping motor is in the deceleration mode, the stepping motor is controlled to enter the acceleration mode, then enter the uniform speed mode and the deceleration mode, and the stepping motor is stopped after rotating to the target position.

5. The stepping motor control method according to claim 1, further comprising: and the stepping motor immediately enters a deceleration mode when receiving a second control command, wherein the second control command is a stop command.

6. The stepping motor control method according to any one of claims 1 to 5, wherein the speed of the stepping motor in the constant speed mode is the second speed, and the first speed is one third of the second speed.

7. A stepping motor control apparatus, comprising: the device comprises a receiving module, a calculating module, a first judging module, a first control module and a second control module;

the receiving module is used for receiving a first control command and state information of the stepping motor; wherein the first control command comprises a first distance and a first direction of rotation; the state information of the stepping motor comprises a current position, a current steering and a current speed;

the calculation module is used for determining a target position of the stepping motor according to a current position in the state information of the stepping motor, a first distance between a current steering direction and the first control command and a first rotating direction;

the first judging module is used for judging whether the first rotating direction is the same as the current rotating direction in the state information;

the first control module is used for controlling the stepping motor to rotate to the target position and then stop when the first judging module determines that the first rotating direction is the same as the current rotating direction;

the second control module is used for controlling the stepping motor to immediately enter a deceleration mode until the deceleration is zero when the first judging module determines that the first rotating direction is different from the current rotating direction, and the stepping motor stops after rotating to the target position in the first rotating direction;

the deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

8. The stepping motor control device according to claim 7, wherein the first control module comprises a first judging unit, a first control unit, a second control unit and a third control unit;

the first judging unit is used for judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

the first control unit is used for keeping the constant speed mode when the stepping motor is in the constant speed mode, and then entering the speed reduction mode to enable the stepping motor to stop after rotating to the target position;

the second control unit is used for keeping the acceleration mode when the stepping motor is in the acceleration mode, then entering the constant speed mode and the deceleration mode, and stopping the stepping motor after the stepping motor rotates to the target position;

and the third control unit is used for controlling the stepping motor to enter an acceleration mode when the stepping motor is in a deceleration mode, and then enter a constant speed mode and a deceleration mode to enable the stepping motor to stop after rotating to the target position.

9. The stepping motor control device according to claim 7, wherein the second control module comprises: a second judging unit, a fourth control unit and a fifth control unit;

the second judging unit is used for judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

the fourth control unit is used for controlling the stepping motor to enter a deceleration mode until the current speed is reduced to zero when the stepping motor is in a constant speed mode or an acceleration mode;

the fifth control unit is configured to maintain the deceleration mode until the current speed is reduced to zero when the stepping motor is in the deceleration mode.

10. The stepping motor control device according to claim 9, wherein the second control module is configured to stop after rotating to the target position in the first rotation direction, and specifically:

the second control module controls the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, so that the stepping motor stops after rotating to the target position;

wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

Technical Field

The invention relates to the technical field of motor control, in particular to a control method and a control device of a stepping motor.

Background

The step loss phenomenon often occurs in the operation process of the stepping motor, so that the control precision and the control performance of the stepping motor are reduced.

In order to improve the performance of the stepping motor, a closed-loop control link, such as an encoder, is often added to the stepping motor in the prior art, and although the occurrence of a step loss phenomenon can be effectively reduced, the cost expenditure can be greatly increased. Therefore, the ordinary stepping motor has no closed-loop control, so that steps are easy to lose but the program cannot be known.

Meanwhile, if a new control command is received in the running process of the stepping motor, the new control command cannot be executed immediately, and the new control command needs to be executed after the last control command is executed, so that the user experience is poor.

Therefore, a new control method for a stepping motor is needed, which improves the control accuracy and control performance of the stepping motor, reduces the occurrence of step loss, and improves the user experience under the condition of low cost increase.

Disclosure of Invention

The purpose of the invention is: the control method and the control device for the stepping motor improve the control precision and the control performance of the stepping motor, reduce the step loss phenomenon and improve the user experience.

In order to achieve the above object, the present invention provides a method for controlling a stepping motor, which comprises:

receiving a first control command and state information of a stepping motor, wherein the first control command comprises a first distance and a first rotating direction; the state information of the stepping motor includes a current position, a current steering direction, and a current speed.

And determining the target position of the stepping motor according to the current position and the current steering in the state information of the stepping motor and the first distance and the first rotating direction in the first control command.

Judging whether the first rotating direction is the same as the current rotating direction in the state information, if so, controlling the stepping motor to rotate to the target position and then stop; and if the difference is not the same, controlling the stepping motor to immediately enter a deceleration mode until the deceleration is zero, and rotating to the target position in the first rotating direction and then stopping.

The deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

In the above method, the controlling the stepping motor to immediately enter the deceleration mode until the deceleration is zero specifically includes: judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode; when the stepping motor is in a constant speed mode or an acceleration mode, controlling the stepping motor to enter a deceleration mode until the current speed is reduced to zero; when the stepper motor is in the deceleration mode, the deceleration mode is maintained until the current speed is reduced to zero.

Further, the rotation in the first rotation direction to the target position is stopped, specifically: controlling the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, and stopping the stepping motor after the stepping motor rotates to the target position; wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

In the above method, the controlling the stepping motor to rotate to the target position and then stop includes: judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode; when the stepping motor is in the constant speed mode, the constant speed mode is kept, and then the stepping motor enters the deceleration mode to rotate to the target position and then stops; when the stepping motor is in an acceleration mode, the acceleration mode is kept, then the stepping motor enters a constant speed mode and a deceleration mode, and the stepping motor is stopped after rotating to the target position; when the stepping motor is in the deceleration mode, the stepping motor is controlled to enter the acceleration mode, then enter the uniform speed mode and the deceleration mode, and the stepping motor is stopped after rotating to the target position.

Further, the control method of the stepping motor of the present invention further includes: and the stepping motor immediately enters a deceleration mode when receiving a second control command, wherein the second control command is a stop command.

Further, the speed of the stepping motor in the constant speed mode is a second speed, and the first speed is one third of the second speed.

The invention also discloses a stepping motor control device, comprising: the device comprises a receiving module, a calculating module, a first judging module, a first control module and a second control module.

The receiving module is used for receiving a first control command and state information of the stepping motor; wherein the first control command comprises a first distance and a first direction of rotation; the state information of the stepping motor comprises a current position, a current steering and a current speed; the calculation module is used for determining a target position of the stepping motor according to a current position in the state information of the stepping motor, a first distance between a current steering direction and the first control command and a first rotating direction; the first judging module is used for judging whether the first rotating direction is the same as the current rotating direction in the state information; the first control module is used for controlling the stepping motor to rotate to the target position and then stop when the first judging module determines that the first rotating direction is the same as the current rotating direction; the second control module is used for controlling the stepping motor to immediately enter a deceleration mode until the deceleration is zero when the first judging module determines that the first rotating direction is different from the current rotating direction, and the stepping motor stops after rotating to the target position in the first rotating direction; the deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

Further, the first control module comprises a first judging unit, a first control unit, a second control unit and a third control unit; the first judging unit is used for judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode; the first control unit is used for keeping the constant speed mode when the stepping motor is in the constant speed mode, and then entering the speed reduction mode to enable the stepping motor to stop after rotating to the target position; the second control unit is used for keeping the acceleration mode when the stepping motor is in the acceleration mode, then entering the constant speed mode and the deceleration mode, and stopping the stepping motor after the stepping motor rotates to the target position; and the third control unit is used for controlling the stepping motor to enter an acceleration mode when the stepping motor is in a deceleration mode, and then enter a constant speed mode and a deceleration mode to enable the stepping motor to stop after rotating to the target position.

Further, the second control module includes: a second judging unit, a fourth control unit and a fifth control unit; the second judging unit is used for judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode; the fourth control unit is used for controlling the stepping motor to enter a deceleration mode until the current speed is reduced to zero when the stepping motor is in a constant speed mode or an acceleration mode; the fifth control unit is configured to maintain the deceleration mode until the current speed is reduced to zero when the stepping motor is in the deceleration mode.

Further, the second control module is configured to stop after rotating to the target position in the first rotation direction, and specifically includes: the second control module controls the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, so that the stepping motor stops after rotating to the target position; wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

Compared with the prior art, the invention discloses a control method and a control device of a stepping motor, which have the beneficial effects that: the user can input new control command as required at any time, and step motor can respond to user's operation in real time, need not wait to rotate last time and just carry out next instruction after the execution finishes, promotes user experience greatly. Meanwhile, due to the adoption of a speed reduction mode and an acceleration mode which change speed in sequence, the step motor can be prevented from losing steps due to the rapid change of torque in the starting, stopping or turning process of the step motor, and the control precision of the step motor is improved.

Drawings

FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a method for controlling a stepper motor provided in the present invention;

FIG. 2 is a schematic diagram illustrating an operation mode of a stepping motor in the control method of the stepping motor according to the present invention;

FIG. 3 is a schematic structural diagram of an embodiment of a stepping motor control apparatus provided in the present invention;

FIG. 4 is a schematic structural diagram of an embodiment of a first control module provided by the present invention;

fig. 5 is a schematic structural diagram of an embodiment of a second control module provided in the present invention.

Detailed Description

The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.

Example 1:

referring to fig. 1, fig. 1 is a schematic flowchart of an embodiment of a control method of a stepping motor according to the present invention. As shown in fig. 1, the present invention discloses a control method of a stepping motor, which specifically comprises:

step 101: receiving a first control command and state information of a stepping motor, wherein the first control command comprises a first distance and a first rotating direction; the state information of the stepping motor includes a current position, a current steering direction, and a current speed.

Step 102: and determining the target position of the stepping motor according to the current position and the current steering in the state information of the stepping motor and the first distance and the first rotating direction in the first control command.

Step 103: judging whether the first rotating direction is the same as the current rotating direction in the state information, if so, executing a step 104; if not, go to step 105.

Step 104: and controlling the stepping motor to rotate to the target position and then stop.

Step 105: and controlling the stepping motor to immediately enter a deceleration mode until the deceleration is zero, and stopping after rotating to the target position in the first rotating direction.

The deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

In the present embodiment, the first rotation direction and the first distance in the first control command are integral, i.e. the first control command is rotated by the first distance in the specified first rotation direction; the first distance may also be replaced by a first angle, a first number of steps, etc. according to a mathematical formula. The current position of the stepping motor can be determined according to the selected zero position of the stepping motor, and the current steering and the current speed of the stepping motor can be obtained according to the pulse signal.

The method for determining the position of the target is as follows: setting the current position as X, the current steering as positive and the first distance as Y, and if the first control command is positive rotation Y, setting the target position as X + Y; if the first control command is reverse rotation Y, the target position is X-Y; when the current steering is reverse, if the first control command is positive rotation Y, the target position is X + Y; if the first control command is reverse rotation Y, the target position is X-Y.

In this embodiment, step 104 specifically includes:

judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode.

And when the stepping motor is in the constant speed mode, the constant speed mode is kept, and then the stepping motor enters the deceleration mode to rotate to the target position and then stops. The method specifically comprises the following steps: when the stepping motor is in the uniform speed mode, the stepping motor is controlled to run for a second distance at a uniform speed and then enter the deceleration mode, and the stepping motor runs for a third distance in the deceleration mode, wherein the sum of the second distance and the third distance is the first distance.

When the stepping motor is in the acceleration mode, the acceleration mode is kept, then the constant speed mode and the deceleration mode are entered, and the stepping motor is stopped after rotating to the target position. The method specifically comprises the following steps: when the stepping motor is in the acceleration mode, the stepping motor is controlled to keep the acceleration mode, the stepping motor enters the uniform speed mode after the fourth distance, the stepping motor enters the deceleration mode after the stepping motor runs for the fifth distance in the uniform speed mode, the stepping motor runs for the sixth distance in the deceleration mode, and the sum of the fourth distance, the fifth distance and the sixth distance is the first distance.

When the stepping motor is in the deceleration mode, the stepping motor is controlled to enter the acceleration mode, then enter the uniform speed mode and the deceleration mode, and the stepping motor is stopped after rotating to the target position. The method specifically comprises the following steps: when the stepping motor is in the deceleration mode, the stepping motor is controlled to immediately enter the acceleration mode, enter the uniform speed mode after a seventh distance, enter the deceleration mode after the eighth distance is operated in the uniform speed mode, operate the ninth distance in the deceleration mode, and the sum of the seventh distance, the eighth distance and the ninth distance is the first distance.

In this embodiment, step 105 specifically includes:

judging the current running mode of the stepping motor, wherein: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

and when the stepping motor is in a constant speed mode or an acceleration mode, controlling the stepping motor to enter a deceleration mode until the current speed is reduced to zero.

When the stepper motor is in the deceleration mode, the deceleration mode is maintained until the current speed is reduced to zero.

No matter what operation mode the stepping motor is in, the deceleration mode is immediately entered, and the distance traveled during the deceleration to zero is recorded as the tenth distance.

When the speed of the stepping motor is reduced to zero, the stepping motor rotates to the target position in the first rotating direction and then stops, and the method specifically comprises the following steps:

and controlling the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, so that the stepping motor stops after rotating to the target position. The method specifically comprises the following steps: when the stepping motor rotates reversely, firstly, the stepping motor enters an acceleration mode, enters a constant speed mode after running for the eleventh distance, enters a deceleration mode after running for the twelfth distance in the constant speed mode, and reaches a target position after running for the thirteenth distance in the deceleration mode; the sum of the eleventh distance, the twelfth distance, and the thirteenth distance is equal to the sum of the first distance and the tenth distance.

Wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

The stepping motor can receive a stop command issued by a user at any time in the using process, and immediately enters a deceleration mode when receiving a second control command, wherein the second control command is the stop command.

The speed of the stepping motor in the constant speed mode is a second speed, and the first speed is one third of the second speed.

When the stepping motor is started, stopped or changes the steering, the stepping motor has larger torque, and is easy to lose steps under the condition of larger torque. The trapezoidal curve control algorithm is simple, but when the stepping motor is started and stopped, the acceleration of starting and stopping is large, and the probability of motor step loss is increased. The S curve control algorithm can ensure that the speed and the acceleration of the stepping motor do not change suddenly in the movement process due to the acceleration and the continuity of the speed curve, but the method is complex in control, has high requirements on equipment and is not suitable for the control of a common stepping motor. The technical scheme disclosed by the invention provides the control method of the acceleration mode and the deceleration mode of the stepping motor, the motor can run stably, the step loss risk is reduced, the control method is simple, the control method is suitable for most stepping motors, the reaction is quicker, the control method can be quickly executed after a user gives an instruction, and the user experience is improved.

The acceleration mode, the uniform speed mode and the deceleration mode are described with reference to fig. 2 in the specification. As shown in fig. 2, the segment a is accelerated by the third acceleration, the segment B is accelerated by the fourth acceleration, the segment C is at a constant speed, the segment D is decelerated by the first acceleration, and the segment E is decelerated by the second acceleration. All above are linear accelerations. It can be known that the segment A and the segment B correspond to an acceleration mode, the segment C corresponds to a constant speed mode, and the segment D and the segment E correspond to a deceleration mode.

Acceleration relationships for the segments in FIG. 2:

1) aA ≦ aB, i.e., from a stationary state, the rotation is performed at a small acceleration and then at a large acceleration. The torque is reduced during starting to avoid step loss, and the stepping motor rotates at a higher acceleration after starting, so that a uniform speed mode can be quickly achieved, and the reaction speed of the stepping motor is increased.

2) The speed of the stepping motor is reduced to zero at a higher acceleration, and the acceleration is smaller when the stepping motor stops, so that the stepping motor cannot shake when the stepping motor stops, and step loss is avoided.

3) aA ═ aE, i.e., a and E segment accelerations are in a symmetric relationship. I.e. the absolute values of the third acceleration and the second acceleration are equal.

4) and aB is-aD, namely the acceleration of the sections B and D is in a symmetrical relation. I.e. the absolute values of the fourth acceleration and the first acceleration are equal.

After the acceleration of the section A, the speed of the stepping motor is one third of the speed in the constant speed mode, namely the first speed is one third of the second speed, the speed in the constant speed mode can be preset, and the speed of the stepping motor reaches the second speed after the acceleration of the section B; entering a constant speed mode after reaching the second speed; when the stepping motor decelerates, namely enters a deceleration mode, the deceleration of the section D is firstly carried out, then the deceleration of the section E is carried out, namely, the deceleration is carried out at a larger acceleration, the deceleration is carried out to one third of the second speed, and then the deceleration is carried out at a smaller acceleration.

Because a user may send a new control instruction at any time, the stepping motor may be in an acceleration mode, a deceleration mode or a uniform speed mode, and at this time, a corresponding user command needs to be quickly sent, and the running precision of the stepping motor needs to be ensured to avoid the step loss phenomenon, so that after the control command is received, the stepping motor needs to be selected to be switched to the running mode according to a judgment result, the speed of the stepping motor is adjusted according to the speed and acceleration relation in the running mode, the stepping motor sequentially enters different running modes, and finally reaches a target position.

By adopting the control method of the stepping motor, a user can input a new control command at any time according to needs, the stepping motor can respond to the operation of the user in real time, and the next instruction is executed without waiting for the completion of the last rotation execution, so that the user experience is greatly improved. Meanwhile, due to the adoption of a speed reduction mode and an acceleration mode which change speed in sequence, the step motor can be prevented from losing steps due to the rapid change of torque in the starting, stopping or turning process of the step motor, and the control precision of the step motor is improved.

Example 2:

referring to fig. 3, fig. 3 is a schematic flow chart of an embodiment of a control device of a stepping motor provided in the present invention. As shown in fig. 3, the present invention discloses a control method of a stepping motor, which specifically comprises: the device comprises a receiving module 201, a calculating module 202, a first judging module 203, a first control module 204 and a second control module 205.

The receiving module 201 is configured to receive a first control command and status information of the stepping motor; wherein the first control command comprises a first distance and a first direction of rotation; the state information of the stepping motor includes a current position, a current steering direction, and a current speed.

The calculating module 202 is configured to determine a target position of the stepping motor according to a current position in the state information of the stepping motor, a first distance between a current steering direction and the first control command, and a first rotating direction.

The first determining module 203 is configured to determine whether the first rotating direction is the same as the current rotating direction in the status information.

The first control module 204 is configured to control the stepping motor to rotate to the target position and then stop when the first determining module determines that the first rotation direction is the same as the current rotation direction.

The second control module 205 is configured to, when the first determining module determines that the first rotation direction is different from the current rotation direction, control the stepping motor to immediately enter a deceleration mode until the deceleration is zero, and stop after rotating to the target position in the first rotation direction.

The deceleration mode includes: if the current speed is lower than the first speed, decelerating at a second acceleration, and if the current speed is higher than the first speed, sequentially decelerating according to the first acceleration and the second acceleration; wherein the first acceleration is greater than the second acceleration.

The first control module 204 is configured to: the first control module 204 includes a first determining unit 301, a first control unit 302, a second control unit 303, and a third control unit 304.

The first judging unit 301 is configured to judge a current operation mode of the stepping motor, where: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode.

The first control unit 302 is configured to maintain the constant speed mode when the stepping motor is in the constant speed mode, and then enter the deceleration mode to stop the stepping motor after the stepping motor rotates to the target position.

The second control unit 303 is configured to maintain the acceleration mode when the stepping motor is in the acceleration mode, and then enter the uniform speed mode and the deceleration mode to stop the stepping motor after the stepping motor rotates to the target position.

The third control unit 304 is configured to, when the stepping motor is in the deceleration mode, control the stepping motor to enter the acceleration mode, and then enter the constant speed mode and the deceleration mode, so that the stepping motor stops after rotating to the target position.

The second control module 205 is configured to: the second control module includes: a second determination unit 401, a fourth control unit 402, and a fifth control unit 403;

the second judging unit 401 is configured to judge a current operation mode of the stepping motor, where: the operation modes comprise a constant speed mode, an acceleration mode and a deceleration mode;

the fourth control unit 402 is configured to, when the stepping motor is in the constant speed mode or the acceleration mode, control the stepping motor to enter the deceleration mode until the current speed is reduced to zero;

the fifth control unit 403 is adapted to, when the stepping motor is in the deceleration mode, maintaining the deceleration mode until the current speed is reduced to zero.

The second control module is used for stopping after rotating to the target position in the first rotating direction, and specifically comprises:

the second control module controls the stepping motor to sequentially enter an acceleration mode, a constant speed mode and a deceleration mode, so that the stepping motor stops after rotating to the target position; wherein the acceleration mode comprises: if the current speed is lower than the first speed, accelerating according to a third acceleration and a fourth acceleration in sequence until the current speed reaches the second speed, and if the current speed is higher than the first speed, accelerating according to the fourth acceleration until the current speed reaches the second speed; the third acceleration is less than the fourth acceleration.

The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and substitutions can be made without departing from the technical principle of the present invention, and these modifications and substitutions should also be regarded as the protection scope of the present invention.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于ANN自适应滤波的风剪切3倍频纹波抑制方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!