LAB #8: CPLD-CONTROLLED STEPPER MOTOR

---

 

OBJECTIVE

To introduce students to the control of a stepper motor using a CPLD.

 

MATERIALS

 

INTRODUCTION

Stepper motors are used in many applications for precise positioning. Example applications include disk drives, printers, and robots. They are called steppers because they rotate in steps of a few degrees for each pulse of voltage applied to one or more of their terminals. The motor used in this experiment is a 3.6°/step, 4 phase unipolar motor. It has four leads that can be used to energize the internal coils in sequence to produce step rotations of the shaft. Students are referred to the web site "Jones on stepping motors" at http://www.cs.uiowa.edu/~jones/step/ for a short tutorial on stepper motors and further references.

 

Stepper motors are controlled by a sequence of pulses applied to their terminals and therefore lend themselves to easy interfacing with digital circuits including microprocessors that can generate such pulses but require more complex circuitry (such as a digital to analog converter) to generate variable voltages necessary to control other types of motors.

 

MOTOR DRIVER CIRCUIT

Motors typically require large currents to energize their windings to a level sufficient to cause rotor motion. CPLDs are not designed to supply such large currents therefore a motor driver circuit and an external power supply are necessary to provide the required power. Figure 1 shows the 4-phase motor driver circuit that must be used to interface the motor to the digital control circuit.

 

Figure 2 shows the pulse sequences on terminals A, B, A', B', required to generate motion of the shaft in one direction. Reversing the sequences will cause motion in the opposite direction. The motor used in this experiment is rated at 3.6°/step. We would like to connect a gear assembly (using Lego gears) to achieve a precision equal or better than 1°/step.

 

PRELAB

1)      Design a digital control system to control a stepper motor. The desired system responds to three inputs: mode (1 bit), level (4 bits), and direction (1 bit). The direction bit (Dir) indicates the direction of rotation of the motor shaft: 0 for clockwise (CW), 1 for counter clockwise (CCW). The Mode bit indicates on of two control modes: speed (Mode = 0) or position (Mode = 1). When in speed control mode, the digital system controls the motor to turn at one of 4 speeds specified by the two least significant bits of Level (the two most significant bits of Level are ignored in this mode). When in position control mode, the motor shaft moves by an angle of rotation indicated by the 4-bit number Level in the direction chosen by Dir. The shaft should move to any of sixteen equally spaced angles around the whole 360°.

2)      Write a complete VHDL program to implement the stepper motor controller on the Altera Max CPLD.

3)      Run simulations to verify the proper operation of your controller prior to lab time.

4)      Build and test the driver circuit shown on Figure 1.

5)      Build a pointer attached to the output shaft that trips a micro-switch at its 0° direction. The signal from the micro-switch will be used to indicate to the controller that the pointer is in its reference direction. Make sure that the switch can be activated by the pointer in both directions (CW and CCW).

6)      Build the complete circuit according to the design specs.

 

LAB PROCEDURE

1)      Demonstrate the complete circuit working according to the design specs.

 

QUESTIONS

1)      How is the motor speed related to the clock frequency in your design?

2)      At what clock frequency can you run this system for maximum speed?

 

Figure 1. Stepper-motor driver circuit connections

Figure 2. Timing for motor coil energizing

 

Figure 3. Stepper-motor control system