This model shows how to use the Unipolar Stepper Motor Driver and Unipolar Stepper Motor blocks together to implement a controlled permanent magnet stepper motor. The model provides two controller options: one to control position and one to control speed. To change the controller type, right-click on the Controller block, select Variant->Override using-> and select Position or Speed.
The stepper has a full step size of 1.8 degrees. In position control mode, the input Ref is the desired number of steps. In speed control mode, the input Ref is the desired number of steps per second.
This model is a system-level model suitable for studying the dynamics of the stepper and whether step angle will slip when driving a given load. It can also be used to tune the stepper controller to improve stepping performance. Often the controller is either partly or fully implemented on an off-the-shelf stepper controller module.
The alternative of implementing the algorithm on a microprocessor (such as a PIC) gives greater flexibility, and the microprocessor may also be used to control other parts of the overall system. In this case parts of the Stepper Motor Driver block may also be implemented in on the microprocessor, leaving only the power amplifier stage in analog electronics.
Position Control Test
The motor shaft angle as compared to the demand signal. A position control algorithm accepts a position command as a number of steps and converts it to a pulse train that controls the stepper motor driver. The spikes on the angular velocity plot occur as the shaft settles into its commanded position.
Speed Control Test
The plots below show the motor shaft angle as compared to the demand signal. A speed control algorithm accepts a speed command as a number of steps per second and converts it to a pulse train that controls the stepper motor driver. The spikes on the angular velocity plot occur as the shaft settles into the current step.
The plot below shows how the states of the pins on the unipolar stepper driver affect the motion of the unipolar stepper motor. The driver initiates a step each time the ENA signal rises above the Enable threshold voltage. The driver sets the common connections A0 and B0 to always be high, and grounds the A+, A-, B+ and B- as required.