SECTION 17.2: STEPPER MOTOR INTERFACING
This section begins with an overview of the basic operation of stepper motors. Then we describe how to interface a stepper motor to the 8051. Finally, we use Assembly language programs to demonstrate control of the angle and direction of stepper motor rotation.
A stepper motor is a widely used device that translates electrical pulses into mechanical movement. In applications such as disk drives, dot matrix printers, and robotics, the stepper motor is used for position control. Stepper motors commonly have a permanent magnet rotor (also called the shaft) surrounded by a stator (see Figure 17-7). There are also steppers called variable reluctance stepper motors that do not have a PM rotor. The most common stepper motors have four stator windings that are paired with a center-tapped common as shown in Figure 17-8. This type of stepper motor is commonly referred to as a. four-phase or unipolar stepper motor. The center tap allows a change of current direction in each of
two coils when a winding is grounded, thereby resulting in a polarity change of the stator. Notice that while a conventional motor shaft runs freely, the stepper motor shaft moves in a fixed repeat-able increment, which allows one to move it to a precise position. This repeatable fixed movement is possible as a result of basic magnetic theory
where poles of the same polarity repel Figure 17-8. Stator Windings
and opposite poles attract. The direction Configuration
of the rotation is dictated by the stator
poles. The stator poles are determined by the current sent through the wire coils.
As the direction of the current is changed, the polarity is also changed causing the
reverse motion of the rotor. The stepper motor discussed here has a total of 6
leads: 4 leads representing the four stator windings and 2 commons for the
center-tapped leads. As the sequence of power is applied to each stator winding,
the rotor will rotate. There are several widely used sequences where each has a
different degree of precision. Table 17-3 shows a 2-phase, 4-step stepping
Table 17-3; Normal 4-Step Sequence
It must be noted that although we can start with any of the sequences in Table 17-3, once we start we must continue in the proper order. For example, if we start with step 3 (0110), we must continue in the sequence of steps 4, 1,2, etc.
How much movement is associated with a single step? This depends on the internal construction of the motor, in particular the number of teeth on the stator and the rotor. The step angle is the minimum degree of rotation associated with a single step. Various motors have different step angles. Table 17-4 shows some step angles for various motors. In Table 17-4, notice the term steps per revolution. This is the total number of steps needed to rotate one complete rotation or 360 degrees (e.g., 180 steps x 2 degrees = 360).
It must be noted that perhaps contrary to one’s initial impression, a stepper motor does not need more ter-
minal leads for the stator to achieve smaller steps. All the stepper motors discussed in this section have 4 leads for the stator winding and 2 COM wires for the center tap. Although some manufacturers set aside only one lead for the common signal instead of two, they always have 4 leads for the stators. Next we discuss some associated terminology in order to understand the stepper motor further.
Describe the 8051 connection to the stepper motor of Figure 17-9 and code a program to rotate it continuously.
The following steps show the 8051 connection to the stepper motor and its programming.
Use an ohmmeter to measure the resistance of the leads. This should identify which
COM leads are connected to which winding leads.
The common wire(s) are connected to the positive side of the motor’s power supply.
In many motors, +5 V is sufficient.
The four leads of the stator winding are controlled by four bits of the 8051 port (Pl.O
- P1.3). However, since the 8051 lacks sufficient current to drive the stepper motor
windings, we must use a driver such as the ULN2003 to energize the stator. Instead
of the ULN2003, we could have used transistors as drivers, as shown in Figure 17-9.
However, notice that if transistors are used as drivers, we must also use diodes to
take care of inductive current generated when the coil is turned off. One reason that
using the ULN2003 is preferable to the use of transistors as drivers is that the
ULN2003 has an internal diode to take care of back EMF.
Change the value of DELAY to set the speed of rotation.
We can use the single-bit instructions SETB and CLR instead of RR A to create the
Figure 17-9. 8051 Connection to Stepper Motor
Steps per second and rpm relation
The relation between rpm (revolutions per minute), steps per revolution, and steps per second is as follows.
The four-step sequence and number of teeth on rotor
The switching sequence shown earlier in Table 17-3 is called the 4-step switching sequence since after four steps the same two windings will be “ON” How much movement is associated with these four steps? After completing every four steps, the rotor moves only one tooth pitch. Therefore, in a stepper motor with 200 steps per revolution, the rotor has 50 teeth since 4×50 = 200 steps are needed to complete one revolution. This leads to the conclusion that the minimum step angle is always a function of the number of teeth on the rotor. In other words, the smaller the step angle, the more teeth the rotor passes. See Example 17-2.
Give the number of times the four-step sequence in Table 17-3 must be applied to a stepper motor to make an 80-degree move if the motor has a 2-degree step angle.
A motor with a 2-degree step angle has the following characteristics:
Step angle: 2 degrees Steps per revolution: 180
Number of rotor teeth: 45 Movement per 4-step sequence: 8 degrees
To move the rotor 80 degrees, we need to send 10 consecutive four-step sequences, since 10×4 steps x 2 degrees = 80 degrees.
Looking at Example 17-2, one might wonder what happens if we want to move 45 degrees, since the steps are 2 degrees each. To allow for finer resolutions, all stepper motors allow what is called an 8-step switching sequence. The 8-step sequence is also called half-stepping, since in the 8-step sequence each step is half of the normal step angle. For example, a motor with a 2-degree step angle can be used as a 1-degree step angle if the sequence of Table 17-5 is applied.
Table 17-5: Half-Step 8-Step Sequence
The motor speed, measured in steps per second (steps/s), is a function of the switching rate. Notice in Example 17-1 that by changing the length of the time delay loop, we can achieve various rotation speeds.
The following is a definition of holding torque: “With the motor shaft at standstill or zero rpm condition, the amount of torque, from an external source, required to break away the shaft from its holding position. This is measured with rated voltage and current applied to the motor.” The unit of torque is ounce-inch (or kg-cm).
Wave drive 4-step sequence
In addition to the 8-step and the 4-step sequences discussed earlier, there is another sequence called the wave drive 4-step sequence. It is shown in Table 17-6. Notice that the 8-step sequence of Table 17-5 is simply the combination of the wave drive 4-step and normal 4-step normal sequences shown in Tables 17-6 and 17-3, respectively. Experimenting with the wave drive 4-step is left to the reader.
Table 17-6: Wave Drive 4-Step Sequence
Table 17-7: Selected Stepper Motors Characteristics (www.Jameco.com)
Unipolar versus bipolar stepper motor interface
There are three common types of stepper motor interfacing: universal, unipolar, and bipolar. They can be identified by the number of connections to the motor. A universal stepper motor has eight, while the unipolar has six and the bipolar has four. The universal stepper motor can be configured for all three modes, while the unipolar can be either unipolar or bipolar. Obviously the bipolar cannot be configured for universal nor unipolar mode. Table 17-7 shows selected stepper motor characteristics. Figure 17-10 shows the basic internal connections of all three type of configurations.
Unipolar stepper motors can be controlled using the basic interfacing shown in Figure 17-11, whereas the bipolar stepper requires H-Bridge circuitry. Bipolar stepper motors require a higher operational current than the unipolar; the advantage of this is a higher holding torque.
Figure 17-10. Common Stepper Motor Types
Using transistors as drivers
Figure 17-11 shows an interface to a unipolar stepper motor using transistors. Diodes are used to reduce the back EMF spike created when the coils are energized and de-energized, similar to the electromechanical relays discussed earlier. TIP transistors can be used to supply higher current to the motor. Table 17-8 shows the common industrial Darlington transistors. These transistors can accommodate higher voltages and currents.
Figure 17-11. Using Transistors for Stepper Motor Driver
Table 17-8: Darlington Transistor Listing
Controlling stepper motor via optoisolator
In the first section of this chapter we examined the optoisolator and its use. Optoisolators are widely used to isolate the stepper motor’s EMF voltage and keep it from damaging the digital/microcontroller system. This is shown in Figure 17-12.
Figure 17-12. Controlling Stepper Motor via Optoisolator
A switch is connected to pin P2.7. Write a program to monitor the status of SW and perform the following:
If SW = 0, the stepper motor moves clockwise.
If SW = 1, the stepper motor moves counterclockwise.
Stepper motor control with 8051 C
The 8051 C version of the stepper motor control is given below. In this program we could have used « (shift left) and » (shift right) as was shown in Chapter 7.
A switch is connected to pin P2.7. Write a C program to monitor the status of SW and perform the following:
If SW = 0, the stepper motor moves clockwise.
If SW = 1, the stepper motor moves counterclockwise.