A stepper motor (pulse motor) is an actuator that converts electrical pulses into angular displacement. It is a type of digital control actuator that controls the motor's speed and acceleration by controlling the pulse frequency, thus achieving speed regulation. Stepper motors have advantages such as high torque, low inertia, and high response frequency, giving them superior characteristics of instantaneous start and rapid stop. The biggest advantage of stepper motors in various applications is that they can be controlled in an open-loop manner without feedback to control position and speed. However, precisely because there is no feedback from the load position to the control circuit, the stepper motor must correctly respond to each change in excitation. If the excitation frequency is not selected properly, the motor may not be able to move to the new position, resulting in a permanent error between the actual load position and the position expected by the controller, i.e., loss of steps or overshoot. Therefore, in the open-loop control system of a stepper motor, preventing loss of steps and overshoot is crucial for the normal operation of the open-loop control system.
This design uses the SPMC75F2413A as the controller for this system. The SPMC75F2413A is a new member of the μ'nSPTM series and a newly launched 16-bit microcontroller from Sunplus Technology. In this design, the SPMC75F2413 generates pulse signals, and the drive circuit uses the Allergo SLA7042M two-phase stepper motor driver to construct the stepper motor drive circuit. The actuator is a two-phase hybrid stepper motor.
1. Stepper motor acceleration and deceleration control principle
The S-curve acceleration/deceleration transforms the traditional 3-segment acceleration/deceleration process into a 7-segment process, forming an S-shape, as shown in Figure 1. The acceleration segment consists of an acceleration segment (T1), a uniform acceleration segment (T2), and a deceleration segment (T3); the deceleration segment consists of an acceleration/deceleration segment (T5), a uniform deceleration segment (T6), and a deceleration/deceleration segment (T7); and the uniform velocity segment is (T4).
In a stepper motor control system, a single electrical pulse signal causes the stepper motor to rotate by an angle or move forward one step. If the input is the number of pulses N, its frequency within a specified time T is f. The frequency f of the drive pulse varies with time t as follows:
In the formula, fm is the highest continuous frequency of the stepper motor, and τ is the time constant that determines the speed of acceleration. In actual work, it can be determined by experiments, given the speed at which the system reaches uniform speed and the time it takes for the system to reach its maximum speed.
This system uses a microcontroller timer interrupt to control the speed of the stepper motor. During speed control, the loading value of the timer is continuously changed.
The acceleration process is discretized, and the acceleration time is fixed as T = T1 + T2 + T3 in the design. For ease of explanation, T2 = 0. At this time, the acceleration segment changes from 3 to 2, namely the acceleration-deceleration segment and the deceleration-deceleration segment. T is divided into 40 equal time intervals, that is, the acceleration-deceleration time T1 is divided into 20 equal parts, and the acceleration-deceleration time T3 is divided into 20 equal parts. Then the interval between two speed changes is Δt = T / 40. The frequency of each gear can be calculated by equation (1), and the number of steps executed by the stepper motor at each gear frequency can also be calculated.
2. System Hardware Design
Figure 2 is a block diagram of the system hardware design structure.
In Figure 2, the SPMC75F2413A is a 16-bit microcontroller from a series of products. It operates at a speed of 0-24 MHz within a 4.5-5.5 V operating voltage range, and features 2 K words of SRAM and 32 K words of Flash ROM; four groups of 64-bit programmable I/O ports (IOA-IOD4); and five general-purpose 16-bit timers/counters. This system uses IOB0-IOB3 bits of the SPMC75F2413A's IOB ports as output ports for control signals, and IOB4 bit as the input port for the photoelectric sensor.
Stepper motors are easy to interface with digital circuits, but the signal energy of typical digital circuits is far from sufficient to drive the motor. Therefore, a matching driver is necessary to drive the stepper motor. The driver tells the motor how many microsteps to take by providing a specific excitation current to the motor windings. Stepper motors operate in full-step mode because this perfectly matches the motor's mechanical design characteristics. At this time, the stator and rotor teeth are perfectly aligned, the current flowing through the windings is at its maximum, and the step angle is also at its maximum. As the microstepping increases, the step angle decreases accordingly.