Share this

Design and implementation of speed increase/decrease in stepper motor control

2026-04-06 06:38:37 · · #1

Abstract: This paper introduces a speed control scheme for stepper motors. Based on the analysis of the dynamic characteristics of stepper motors, the ideal acceleration and deceleration control curve of the stepper motor is derived, and exponential acceleration and deceleration control is realized. The acceleration and deceleration process of the stepper motor is processed using a discrete method, and the discrete control of the stepper motor acceleration and deceleration by a microcontroller is implemented using C language programming, giving the system good dynamic characteristics. 0 Introduction Stepper motor control is an important part of the development of economical CNC systems, among which acceleration and deceleration control during the stepper motor's motion is the focus. In practical stepper motor applications, especially in control systems requiring fast response, the key issue is how to ensure that the stepper motor does not stall or lose steps during high-speed operation with frequent starts and stops and sudden frequency changes. Moreover, the occurrence of stalling and loss of steps is related to the speed change characteristics of the stepper motor, that is, the law of change of the stepper motor's running speed. The purpose of stepper motor acceleration and deceleration control is to prevent the motor from "losing steps" during sudden speed changes and to ensure smooth operation. There are many methods to achieve acceleration and deceleration control. Theoretical derivation shows that an exponential acceleration/deceleration curve better adapts the changes in the angular acceleration of the stepper motor rotor to the changes in its output torque. Experiments have shown that this can greatly increase the maximum operating frequency of the stepper motor under microcomputer control and significantly shorten the acceleration time. 1. Dynamic Characteristics Analysis of Stepper Motor Since the output torque of the stepper motor decreases with the increase of the stepping frequency, according to the dynamic characteristics of the stepper motor, it can be described by its dynamic model (second-order differential): Where: J—total moment of inertia of the system θ—rotor angle β—damping coefficient k—proportioning factor that has a certain functional relationship with θ Tz—sum of frictional resistance torque and other resistance torques independent of β Td—electromagnetic drive torque generated by the stepper motor Where, —inertial torque —angular acceleration Obviously, the inertial torque should be less than the maximum electromagnetic torque Td. During the acceleration phase, the larger the angular acceleration, the better, so that the time to reach uniform speed is shorter. However, during the acceleration phase, in order to reduce the impact on the system, it should not change abruptly. The above formula actually reflects the torque-frequency characteristics, that is, the higher the pulse frequency, the smaller the torque. Therefore, under the premise of not losing steps, the frequency f should be proportional to the derivative of time during the acceleration phase. Therefore, it can be expressed as: Where A and B are two specific time constants. Assuming that the starting frequency during the acceleration phase is f, then the Laplace transform of equation (3) yields: The Laplace transform of equation (4) yields: The inverse Laplace transform of equation (5) yields: In equation (6), f is a time constant, reflecting the speed of acceleration. In equation (7), f is a time constant. Let the starting frequency of the stepper motor during the acceleration process be f, and the highest operating frequency be f. After running for a sufficient time (denoted by f), we have: According to equation (7), we get: The Laplace transform of equation (8) yields: And since f is much greater than f, we get: Substituting equation (9) into equation (7) yields: In equation (10), f is a time constant. This equation is the mathematical model of ordinary exponential acceleration and deceleration. 2. The acceleration and deceleration curve of the stepper motor. According to the theoretical derivation of the dynamic characteristics of the stepper motor, the acceleration and deceleration curve of the stepper motor is more able to adapt the change of the angular acceleration of the stepper motor rotor to the change of its output torque. The exponential curve can more fully reflect the speed characteristics of the stepper motor. Therefore, the exponential curve is used to analyze the acceleration and deceleration of the stepper motor. The acceleration and deceleration curve of the motor is drawn by the exponential curve equation as shown in Figure 1: As shown in Figure 1, the vertical axis is the frequency, and the unit is steps/second, which actually reflects the speed. The horizontal axis is the time, and the number of steps taken in each time interval is represented by N. The number of steps actually reflects the travel. The ideal acceleration curve and the actual acceleration curve are marked in the figure. 3. Discrete processing of the acceleration process. According to the acceleration algorithm, if the running speed is when the program is running, the acceleration time can be calculated as: Since continuous control cannot be realized on the computer, the rise time must be discretized. If the acceleration segment is evenly divided into n segments, the rise time can be obtained from equation (11), and the time interval between two adjacent speed changes is. Where: n is the number of steps. The frequency of each speed range is calculated using the above formula, which gives the timer's setpoint. The number of pulses (or steps) Ni in each frequency band is then calculated. The total number of steps for acceleration is: During program execution, the number of steps required for each speed range is calculated and checked incrementally. When it reaches zero, it indicates that the required steps for that speed range have been completed, and the program moves to the next speed range. Simultaneously, the total number of steps for the acceleration process is decremented until the acceleration process is complete. This is the process for accelerating; the process for decelerating is handled in the same way. The stepper motor selected in this paper is a 42BYG4501 two-phase hybrid stepper motor. The maximum no-load starting frequency of this motor is 1200 steps/s. The allowable jump frequency can be obtained from the maximum no-load starting frequency, generally taken as 1/2 to 3 of it. Considering the specific requirements for acceleration and deceleration in this system, this paper specifies a starting frequency of 500Hz and a maximum operating frequency of 15000Hz, requiring acceleration to 10000Hz within 120 steps. The pulse time interval of the stepper motor's acceleration process is calculated. First, the rise time and time constant are calculated: Using MATLAB, the following is calculated: Therefore, the acceleration curve can be represented as:

4. Stepper Motor Speed ​​Control Using a Microcontroller This paper uses a C8051F040 microcontroller to control the speed of a stepper motor. The microcontroller uses a timer interrupt method to control the stepper motor speed. Speed ​​control essentially involves continuously changing the initial load value of the timer. To minimize CPU resource consumption and improve response speed, the timer load values ​​required for each discrete speed point are stored in the microcontroller's ROM. During system operation, a lookup table is used to find the required load values. In speed-up control, the number of microsteps and corresponding time constants for each step are looked up. In deceleration control, no adjustments are needed; the time division is the same as the acceleration segment. The final speed is the starting speed of the acceleration segment. After the system enters acceleration/deceleration mode, it first calculates the number of steps and timer time constants required for the acceleration/deceleration process, as well as the timer time constant for the constant speed segment, based on the set operating speed and fills the table. The acceleration/deceleration program flowchart is shown in Figure 2, which illustrates the process of looking up tables to execute each acceleration level, constant speed segment, and deceleration level. Assuming the acceleration and deceleration segments are symmetrically subdivided into 255 segments, forming a sawtooth-shaped curve that gradually approximates an exponential curve for acceleration and deceleration. Each segment has a timing period of 20μs. Different frequencies correspond to different speeds, and the reciprocal of the frequency corresponds to the period of the control pulse driving the stepper motor. By setting the timing period of the microcontroller, the acceleration and deceleration of the stepper motor are controlled. The flowchart of the acceleration process is shown in Figure 3 below. 5 Conclusion This paper uses an exponential acceleration and deceleration method to realize the speed control of the stepper motor by the microcontroller. Discretization processing is used to realize the speed adjustment of the stepper motor. The frequency of each ascending and descending step is calculated according to the exponential law function. The acceleration and deceleration control of the stepper motor is realized by looking up tables and using timer interrupt technology. Experimental results show that the program written using the acceleration and deceleration control flowchart described above makes the motor run smoothly in practical applications and can reliably run along the designed exponential curve. This method is simple, practical, and effective.

References:
[1] Li Haibo, He Xuetao. Discrete control of stepper motor acceleration and deceleration [J]. Journal of Beijing University of Chemical Technology, 2003, (1): 92-94.
[2] Xu Yuming, Research and Implementation of Stepper Motor Speed ​​Control - Industrial Automation 2007
[3] Chen Aiguo, Huang Wenling. Research on the acceleration and deceleration curve of stepper motor. Conference paper, 2002.
[4] Liu Yadong, Li Congxin. Precise control of stepper motor speed [J]. Journal of Shanghai Jiaotong University, 2004(10).
[5] Fang Yufu, Research and Application of Automatic Speed-Up and Down System for Stepper Motors, Conference Paper, 2005

Read next

CATDOLL 136CM Ya

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22