Stepper motor working principle
When current flows through the stator windings, the stator windings generate a vector magnetic field. This magnetic field causes the rotor to rotate by an angle, aligning the direction of the rotor's magnetic field with that of the stator's magnetic field. When the stator's vector magnetic field rotates by an angle, the rotor also rotates by the same angle. With each input electrical pulse, the motor rotates one angle and moves one step forward. Its output angular displacement is proportional to the number of input pulses, and its rotational speed is proportional to the pulse frequency. Changing the energizing sequence of the windings reverses the motor's direction. Therefore, the rotation of a stepper motor can be controlled by adjusting the number and frequency of pulses and the energizing sequence of each phase winding.
Most motors contain an iron core and winding coils. The windings have resistance, and when current flows through them, losses occur. The magnitude of these losses is proportional to the resistance and the square of the current; this is what we commonly call copper loss. If the current is not standard DC or a sine wave, harmonic losses will also occur. The iron core has hysteresis and eddy current effects, which also generate losses in an alternating magnetic field. The magnitude of these losses depends on the material, current, frequency, and voltage; this is called iron loss.
Both copper and iron losses manifest as heat, thus affecting motor efficiency. Stepper motors generally prioritize positioning accuracy and torque output, resulting in relatively low efficiency, high current consumption, and high harmonic content. The frequency of current alternation also varies with speed. Consequently, stepper motors commonly experience heat generation, and the situation is more severe than with general AC motors.
Three stepper motor circuit diagrams
Circuit Diagram 1:
In Figure 3, RL1 to RL4 represent the internal resistance of the winding, and the 50Ω resistor is an external resistor that limits the current and also improves the circuit time constant. D1 to D4 are freewheeling diodes, which attenuate the back electromotive force generated by the motor winding through the freewheeling diodes (D1 to D4), thereby protecting the power transistor TIP122 from damage.
Connecting a 200μF capacitor in parallel with a 50Ω external resistor can improve the leading edge of the current pulse injected into the stepper motor windings, thereby enhancing the high-frequency performance of the stepper motor. The 200Ω resistor connected in series with the freewheeling diode reduces the discharge time constant of the circuit, making the trailing edge of the current pulse in the windings steeper and the current fall time shorter, also contributing to improved high-frequency performance.
Circuit Diagram 2:
The drive circuit for a bipolar stepper motor, as shown in the figure, uses eight transistors to drive two sets of phases. Bipolar drive circuits can drive both four-wire and six-wire stepper motors simultaneously. While four-wire motors can only use bipolar drive circuits, this significantly reduces costs for mass production applications. The number of transistors in a bipolar stepper motor drive circuit is twice that of a unipolar drive circuit. The four lower transistors are typically driven directly by a microcontroller, while the upper transistors require a more expensive upper-level drive circuit. Since the transistors in a bipolar drive circuit only need to withstand the motor voltage, it does not require clamping circuits like unipolar drive circuits.
Stepper motors cannot be directly connected to an AC or DC power supply; instead, a dedicated stepper motor driver must be used, as shown in Figure 2. This driver consists of a pulse generation and control unit, a power drive unit, and a protection unit. The two units enclosed by the dotted line in the figure can be implemented using microcomputer control. The drive unit is directly coupled to the stepper motor and can also be understood as the power interface of the stepper motor's microcomputer controller.
Circuit Diagram 3:
Figure 8 shows a stepper motor drive system with constant current chopping function, constructed using L297 (a dedicated chip for ring distributors) and L298.
Does a stepper motor have an encoder?
Stepper motors do not have encoders. If you want to add an encoder to a stepper motor, you can use a dual-shaft stepper motor and add the encoder to the rear shaft.
A stepper motor is the actuator, while the encoder is part of the feedback system. The encoder works in conjunction with the stepper motor, and its operation is controlled by a PLC. In principle, the PLC sends pulse commands to the stepper driver, which then provides the corresponding current to the stepper motor to make it run. When the encoder detects that the stepper motor has reached the required position, it sends a feedback signal to the PLC. The PLC then receives the feedback signal and stops sending pulse signals to the stepper driver. When the stepper motor no longer receives current from its motor, it will immediately stop running. (A servo motor uses this type of device.) In reality, the encoder continuously feeds back the current position to the PLC. The PLC compares the feedback value with the target value and adjusts the rotor's rotation angle accordingly.
Whether it will stop smoothly and whether it will reach the desired position after stopping depends on whether the motor has a braking device. Of course, at low speeds, the feed accuracy is generally sufficient.
Another method involves pre-calculating the number of pulses required for the stepper motor's feed, then programming the PLC to execute that many pulses, at which point the stepper motor stops, and the encoder provides feedback on the motor's position, forming a semi-closed-loop control. For high-speed positioning, the PLC program can be set to decelerate the motor when it's close to the desired position, ensuring sufficient positioning accuracy.
How to add an encoder to a stepper motor
Adding encoders to stepper motors is somewhat redundant and a waste of resources; because stepper motors cannot respond in real time, there must be an acceleration and deceleration process.
Example: Using an Oriental stepper motor with a harmonic reducer, a reduction ratio of 100:1, and a step angle of 0.0072°, if you want to add an encoder to prevent missed steps, etc., the following method is provided:
A: In principle, it's possible to install a motor at one end of the leadscrew and an encoder at the other. However, this will be affected by the accuracy of the reducer, potentially leading to misjudgments of missed steps. It's best to use a dual-shaft motor with the encoder added to the rear end; this is how servo motors are typically installed, unless you have special applications or limitations (no dual-shaft motors). Generally, 2500 lines are sufficient; higher line counts are wasteful.
Additionally, the encoder resolution should be roughly the same as the stepper motor's resolution. If the driver has a high microstepping level, and you only need to detect missed steps, the encoder resolution only needs to be the same as or slightly higher than the resolution before microstepping.
The significance of adding an encoder to a stepper motor
While stepper motors are precisely controllable devices, they are open-loop and require an encoder to achieve closed-loop feedback control. This allows for the measurement of stepper motor step loss and rotational or traversal speeds for dynamic speed control. Regarding this argument, the first point—that open-loop control requires an encoder for closed-loop feedback—is somewhat understandable, as I myself have occasionally experienced stepper motor malfunctions due to poor wiring connections. As for the second point—speed control of stepper motors—I don't think it's necessary. Speed adjustment can be achieved by controlling the stepper motor's pulse frequency; I really don't see the need for external feedback.