Speed Control of Stepper Motor

The biggest feature of stepper motor that is different from other control motors is that it can accept digital control signals (electrical pulse signals) and convert them into corresponding angular displacement or linear displacement, so it is an executive element that completes digital-to-analog conversion. . And it can carry out open-loop position control, input a pulse signal to get a specified position increment. Compared with the traditional DC servo system, such an incremental position control system has a significantly lower cost, and almost no system adjustment is required. Therefore, stepper motors are widely used in CNC machine tools, robots, remote control, aerospace and other fields, especially the development of microcomputer and microelectronics technology, so that stepper motors can be widely used.

Speed characteristics of stepper motors

The speed of the stepper motor depends on the pulse frequency, the number of rotor teeth and the number of beats. Its angular velocity is proportional to the pulse frequency and is time-synchronized with the pulse. Therefore, when the number of rotor teeth and the number of running beats are constant, the required speed can be obtained as long as the pulse frequency is controlled. Since the stepping motor is started with its synchronous torque, the starting frequency is not high in order not to lose step. Especially as the power increases, the diameter of the rotor increases, the inertia increases, and the difference between the starting frequency and the maximum operating frequency may be as much as 10 times.

In order to give full play to the fast performance of the motor, usually start the motor at a lower frequency than the starting frequency, and then gradually increase the pulse frequency until the desired speed. In order to ensure the positioning accuracy of the motor, the motor must gradually reduce the pulse rate from the highest speed to the speed that can be stopped (equal to or slightly greater than the starting speed) before stopping. Therefore, when the stepper motor drags the load to move a certain distance at high speed and accurately position it, generally speaking, it should include five stages of “start-acceleration-high-speed operation (uniform speed)-deceleration-stop”, and the speed characteristic is usually trapezoidal. If the distance is very short, it is a triangle velocity characteristic, as shown in Figure 1.

Speed curve of stepper motor
Figure 1: Speed curve of stepper motor

The PC machine sets the frequency change (ie speed, acceleration change) of the acceleration and deceleration process by assigning the initial value to the 8253 counter 0 on the hardware control circuit at the appropriate time to prevent out-of-step. For example, set the speed curve in the point control, so that the stepper motor can generate enough torque to drive the load when starting and accelerating, and keep up with the specified speed and acceleration; when decelerating, the descending characteristic makes the load not generated. Overshoot, stop at the specified position. The 8253 on the hardware control circuit board generates a pulse square wave as an interrupt signal source, starts the solidification program in the subdivision drive circuit to generate a pulse of a certain frequency, and drives the stepper motor to move after power amplification. The change of the movement direction of the stepping motor and the start and stop are all realized by the computer-controlled hardware control circuit.

Figure 2: Stepper motor control system

The software and hardware are combined for control, which has the advantages of simple circuit and convenient control. In this control, the microcomputer software occupies less storage units, and the program development is not limited by timing. As long as the external interrupt is allowed, the microcomputer is free to perform other tasks between each step of the motor to realize the motion control of multiple stepper motors.

Determination of the initial value of the timer

The real-time control of the stepping motor uses a PC. The generation of the pulse square wave adopts the 8253 timer. The counter 0 works in the mode 0 to generate the pulse square wave, and the counter 1 works in the mode 1 to count the number. Provided by a 2MHz crystal. Suppose the computer assigns the initial value of 8253 counter 0 to D1, then the frequency of the generated pulse square wave is f1 = f0 / D1, the period is T1 = 1/ f1 = D1 / f0, D1 = f0T1 = f0 / f1. Among them, f1 is the starting frequency, and f0 is the crystal frequency.

Mathematical model of stepper motor acceleration and deceleration

In order to prevent the stepper motor from falling out of step during operation, it is generally required that its maximum operating frequency should be less than (or equal to) the step response frequency fs. At this frequency, the stepper motor can be started, stopped or reversed at will without losing step. There are two drive modes for stepping motor speed up and down, namely triangle and trapezoid drive mode (see Figure 1), and triangle drive mode is a special case of trapezoid drive, so we only need to study trapezoid mode. The acceleration and deceleration of the motor are realized by the computer constantly modifying the initial value of the timer. In the motor acceleration stage, starting from the moment of startup, every time a pulse is generated, the initial value of the timer decreases by a certain value, and the corresponding pulse period decreases, that is, the pulse frequency increases; in the deceleration stage, the initial value of the timer increases continuously, then The corresponding pulse period increases and the pulse frequency decreases, corresponding to the deceleration stage of the trapezoidal pulse frequency characteristic. The key to this design is to determine the pulse timing tn, the pulse time interval, that is, the pulse period Tn and the pulse frequency fn. Assuming that the number of pulses is counted from the instant of start, the number of pulses in the acceleration phase is n, and the instant of start is set as the starting point of timing, the initial value of the timer is D1, and the decrement of the initial value of the timer is △. From the physical process of the acceleration stage, it can be known that the first pulse period, that is, the pulse period T1 = D1 / f0, t1 = 0 when starting. Due to the modification of the initial value of the timer, the second pulse period T2 = (D1-△) / f0 = T1 – △ / f0, and the pulse timing t2 = T1, the period of the nth pulse is:

Tn = T1 – (n-1) △ / f0 (1)

The pulse timing is:

tn = T1 + …… + Tn-1 = (n – 1) T1 – (n – 1) (n -2) / 2 * △ / f0 (2)

The pulse frequency is:

1 / fn = Tn = T1 – (n-1) △ / f0 (3)

The above formula shows the relationship between the number of pulses n and the pulse frequency fn and time tn, respectively. Let △ / f0 = δ, that is, the decrement of two adjacent pulse periods in the acceleration stage, the above formula is simplified to:

tn = (n-1) T1 – (n-2) (n-1) δ / 2 (4)

1 / fn = T1 – (n-1) δ (5)

Combining (4) and (5), and simplifying the relationship between fn and tn, the mathematical model of the acceleration stage is obtained as:

f = 2 / A + √B – Ct2 B – Ct2 > δ2 (6)

Among them, is a constant whose value is related to the initial value of the timer and the change of the timer, A = -δ, B = (2T1 + δ)2, C = 8δ.

The change of the pulse frequency in the acceleration phase is:

df / dt = 4Ct / (A + √B – Ct2 )2 * √B – Ct2 (7)

From equations (6) and (7), it can be seen that in the acceleration stage, the pulse frequency increases continuously, and the acceleration increases with a quadratic function. This acceleration method is very beneficial to the operation of the stepper motor, because when starting, the acceleration is gentle, and once the stepper motor has a certain speed, the acceleration increases rapidly. In this way, on the one hand, the acceleration transitions smoothly, which is conducive to improving the positioning accuracy of the machine, and on the other hand, the acceleration process can be shortened and the fast performance can be improved.

For the deceleration stage, according to the analysis method similar to the above, the expression of the pulse frequency characteristic can be obtained as:

f = 2 / A + √B – Ct2 (8)

df / dt = -4Ct / (A + √B – Ct2 )2 * √B – Ct2 (9)

Among them, A = -δ, B = (2T1 – δ)2, C = 8δ, T1 is the pulse period at the beginning of deceleration, and δ is the increment of two adjacent pulse periods in the deceleration stage. Since T1 >> δ, B = 4T12, it can be seen from equations (8) and (9) that the pulse frequency decreases continuously in the deceleration stage, and the acceleration is negative, and the absolute value decreases with a quadratic function. This deceleration performance is also beneficial to the stepper motor, which enables the stepper motor to stop smoothly without shock during deceleration, which improves the positioning accuracy of the machine.

In summary, the pulse frequency characteristics of this design can be derived (see Figure 3).

Pulse frequency characteristic
Figure 3: Pulse frequency characteristic

This method has been successfully applied to the intelligent motion control unit designed by me. By developing the control software under Windows environment and using VC++ to design a good control interface interface, the selection of motion mode, speed, acceleration and deceleration and position control are conveniently realized. possess a certain degree of intelligence. The control unit reduces the occupied time of the PC, so that other tasks can be completed while the motor is running, thereby realizing the acceleration and deceleration, speed and position control of the three stepper motors. And the use of subdivided drive power to improve the stepping accuracy and positioning accuracy.

Leave a Comment

Your email address will not be published. Required fields are marked *