This model shows how to use the Stepper Motor Driver and 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 Stepper Controller block, select Variant->Override using-> controller_choice==2 (Speed Controller).
The stepper has a full step size of 1.8 degrees. In position control model, 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. This model reverse engineers such a module at a system-level.
The alternative of implementing the algorithm on a microprocessor (such as a PIC or xPC) 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.