Share this

Stepper motor speed control and motion planning

2026-04-06 05:09:47 · · #1
The most significant difference between stepper motors and other motors used for control applications is their ability to accept digital control signals (electrical pulse signals) and convert them into corresponding angular or linear displacements, thus making them themselves actuators that perform digital-to-analog conversion. Furthermore, they can perform open-loop position control, obtaining a specified position increment with a single pulse signal input. Compared to traditional DC servo systems, this incremental position control system significantly reduces costs and requires almost no system adjustments. Therefore, stepper motors are widely used in CNC machine tools, robotics, remote control, aerospace, and other fields. The development of microcomputers and microelectronics technology has further broadened their applications. Stepper Motor Speed ​​Characteristics The speed of a stepper motor depends on the pulse frequency, the number of rotor teeth, and the number of steps. Its angular velocity is directly proportional to the pulse frequency and synchronized with the pulse in time. Therefore, with a fixed number of rotor teeth and steps, the desired speed can be obtained by controlling the pulse frequency. Since stepper motors start using their synchronous torque, the starting frequency is relatively low to prevent step loss. Especially with the increase in power, the rotor diameter increases, the inertia increases, and the starting frequency and the maximum operating frequency may differ by as much as 10 times. In order to fully utilize the high-speed performance of the motor, the motor is usually started at a frequency lower than the starting frequency, and then the pulse frequency is gradually increased until the desired speed is reached. The selected rate of change must ensure that the motor does not lose steps and the starting acceleration time should be shortened as much as possible. In order to ensure the positioning accuracy of the motor, the pulse rate must be gradually reduced from the maximum speed to the speed at which it can stop (equal to or slightly greater than the starting speed) before stopping. Therefore, when a stepper motor drives a load to move a certain distance at high speed and accurately positions it, it should generally include five stages: "start-acceleration-high-speed operation (uniform speed)-deceleration-stop". The speed characteristic is usually trapezoidal. If the distance moved is very short, it is triangular speed characteristic, as shown in Figure 1. [align=center] Figure 1 Speed ​​curve of a stepper motor[/align] Stepper motor control system structure The PC initializes the 8253 counter 0 on the hardware control circuit at appropriate times and sets the frequency change (i.e., speed and acceleration change) of the acceleration and deceleration process to prevent loss of steps. For example, in point-to-point control, a speed curve is set so that during startup and acceleration, the stepper motor generates sufficient torque to drive the load and keep up with the specified speed and acceleration; during deceleration, the descent characteristic prevents the load from overshooting and stops at the specified position. The 8253 on the hardware control circuit board generates a pulse square wave as an interrupt signal source, activating the firmware in the microstepping drive circuit to generate pulses of a certain frequency, which, after power amplification, drive the stepper motor. Changes in the stepper motor's direction of motion, as well as its startup and shutdown, are all implemented by the computer-controlled hardware control circuit. [align=center]Figure 2 Stepper Motor Control System[/align] The combination of software and hardware for control offers advantages such as simple circuitry and convenient control. In this control method, the microcomputer software occupies less storage space, and program development is not limited by timing constraints. As long as external interrupts are allowed, the microcomputer can freely execute other tasks between each step of the motor to achieve motion control of multiple stepper motors. Determining the Initial Value of the Timer Real-time control of the stepper motor utilizes a PC. The generation of the pulse square wave is achieved using an 8253 timer. Counter 0 operates in mode 0 to generate the pulse square wave, while counter 1 operates in mode 1 for counting. The clock frequency of counter 0 is provided by a 2MHz crystal oscillator. Assuming the computer assigns an initial value of D1 to counter 0, the frequency of the generated pulse square wave is f1 = f0/D1, and the period is T1 = 1/f1 = D1/f0, where D1 = f0T1 = f0/f1. Here, f1 is the starting frequency, and f0 is the crystal oscillator frequency. Stepper Motor Acceleration and Deceleration Mathematical Model To prevent the stepper motor from losing steps during operation, its maximum operating frequency should generally be less than (or equal to) the step response frequency fs. At this frequency, the stepper motor can start, stop, or reverse arbitrarily without losing steps. There are two driving methods for stepper motor acceleration and deceleration: delta and trapezoidal driving methods (see Figure 1). The delta driving method is a special case of the trapezoidal driving method, so we will only study the trapezoidal method. Motor acceleration and deceleration are achieved by continuously modifying the initial value of a timer using a computer. During the acceleration phase, starting from the instant of startup, for each pulse generated, the initial value of the timer decreases by a certain value, resulting in a decrease in the corresponding pulse period (i.e., an increase in the pulse frequency). During the deceleration phase, the initial value of the timer continuously increases, resulting in an increase in the corresponding pulse period (i.e., a decrease in the pulse frequency), corresponding to the deceleration phase of the trapezoidal pulse frequency characteristics. The key to this design is determining the pulse timing tn, the pulse time interval (i.e., the pulse period Tn), and the pulse frequency fn. Assuming the number of pulses is calculated from the instant of startup, the number of pulses in the acceleration phase is n, and the instant of startup is set as the starting point, the initial value of the timer is D1, and the decrease in the initial value of the timer is Δ. From the physical process of the acceleration phase, we know that the first pulse period, i.e., the pulse period at startup, is T1 = D1/f0, and t1 = 0. Due to the modification of the initial value of the timer, the second pulse period T2 = (D1-△)/f0 = T1-△/f0, the pulse timing t2 = T1, then the period of the nth pulse is: (1) The pulse timing is: The pulse frequency is: The above formulas show the relationship between the number of pulses n, the pulse frequency fn, and the time tn. Let △/f0 = δ, that is, the reduction of the two adjacent pulse periods in the acceleration phase, then the above formula is simplified to: (5) Combining (4) and (5), and simplifying the relationship between fn and tn, the mathematical model of the acceleration phase is: Where, is a constant, its 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: From equations (6) and (7), it can be seen that in the acceleration phase, the pulse frequency continuously increases, and the acceleration increases as a quadratic function. This acceleration method is very beneficial to the operation of the stepper motor, because the acceleration is gentle at the start, and once the stepper motor has a certain speed, the acceleration increases rapidly. This allows for a smooth acceleration transition, which is beneficial for improving the machine's positioning accuracy. Furthermore, it shortens the acceleration process and improves rapid acceleration performance. For the deceleration phase, following a similar analysis method, the pulse frequency characteristic can be expressed as: Where A = -δ, B = (2T1 - δ)², C = 8δ, T1 is the pulse period at the start of deceleration, and δ is the increment between two adjacent pulse periods during the deceleration phase. Since T1 >> δ, then B = 4T1². From equations (8) and (9), it can be seen that the pulse frequency continuously decreases during the deceleration phase, and the acceleration is negative, with the absolute value decreasing as a quadratic function. This deceleration performance is also beneficial to the stepper motor, enabling it to stop smoothly without impact during deceleration, thus improving the machine's positioning accuracy. In summary, the pulse frequency characteristic of this design can be derived (see Figure 3). [align=center]Figure 3 Pulse Frequency Characteristics[/align] Experiment and Summary This method has been successfully applied to the intelligent motion control unit I designed. By developing control software under a Windows environment and using VC++ to design a well-designed control interface, the selection of motion mode, speed, acceleration/deceleration, and position control were easily realized, demonstrating a certain degree of intelligence. This control unit reduces the time the PC is occupied, allowing other tasks to be completed while the motors are running, thus realizing the acceleration/deceleration, speed, and position control of three stepper motors. Furthermore, the use of microstepping drive power supplies improves stepping accuracy and positioning accuracy.
Read next

CATDOLL Ava Hybrid Silicone Head

The hybrid silicone head is crafted using a soft silicone base combined with a reinforced scalp section, allowing durab...

Articles 2026-02-22