Objectives: Experiment No. 2 Driving Stepper Motor
Objectives: Experiment No. 2 Driving Stepper Motor
Objectives: Experiment No. 2 Driving Stepper Motor
EXPERIMENT No. 2
DRIVING STEPPER MOTOR
1. Objectives
2. Apparatus
4.Introduction
In a simple LED package, each LED is typically connected with one terminal to its own
pin on the outside of the package and the other LED terminal connected in common with all
other LEDs in the device and brought out to a shared pin. This shared pin will then make up all
1
Exp.2: Stepper Motor Mechatronics System Design Lab
of the cathodes (negative terminals) OR all of the anodes (positive terminals) of the LEDs in the
device; and so will be either a "Common Cathode" or "Common Anode" device depending how
it is constructed. Hence a 7 segment plus DP package will only require nine pins to be present
and connected.
Numbers to 7-segment-code:
A single byte can encode the full state of a 7-segment-display. The most popular bit encodings
are gfedcba and abcdefg - both usually assume 0 is off and 1 is on.
Stepper motor
The stepper motor is synchronous motor, driven by a DC power supply. This motor can rotate a
specific number of degrees for every electric pulse received by its control unit, so it can be used to control
systems such as CNC machines where the position of the machine can be controlled precisely by the
stepper motor. Moreover, it does not need any form of feedback.
There are four types of stepper motors: Unipolar, Bipolar, Bifilar, and multiphase. The first two
are discussed here in more detail:
2
Exp.2: Stepper Motor Mechatronics System Design Lab
There are 6 terminal wires available from the motor. Two of them are usually connected to the
supply voltage (sometimes they are combined into just one wire and hence in that case only 5 terminal
will be available rather than 6). The other 4 wires are the terminal of the four electromagnets.
2- Bipolar stepper motor: In a bipolar motor the current can be passed in each coil in two directions and
hence the name. The bipolar motor is more powerful than the unipolar because it is possible to reverse the
magnetization in each of the electromagnets. We can use an H-bridge (e.g., constructed of 4 transistors) to
enable the current to flow in both directions in each coil.
5. Procedure
3
Exp.2: Stepper Motor Mechatronics System Design Lab
Using PIC16F877A, 7-egment, and any other components needed build a 7-segment driving
circuit, and write an assembly code to drive it to count from 1-9.
1) Try to rotate the motor’s shaft by your hand. What do you notice?
3) Using the multi-meter measure the resistance between the wires and identify the coil wires from the
supply wires, and sketch the internal diagram for this stepper motor.
Using Pic16F877A, ULN2003, and any other components needed build a stepper motor driving circuit,
and write an assembly code to drive the stepper motor with fixed speed and fixed direction.
Edit the program you have written in part II to change the direction of rotation
4
Exp.2: Stepper Motor Mechatronics System Design Lab
Part IV: Controlling the speed & direction of the stepper motor:
Edit the program you have written in part III to control the speed and direction, it’s required to have
minimum three speeds (use push buttons to change the speed) and display the speed(1,2,3) on the 7-
segment.
1) Find the resolution of the stepper motor (deg/step) by counting the steps needed to rotate the motor 360
degrees.
[Hint: connect LED to one of the phases and count the pulses].
2) Write an assembly code to rotate the motor to reach 90 degrees. (You can use push buttons).
5
Exp.2: Stepper Motor Mechatronics System Design Lab