Sie sind auf Seite 1von 6

Exp.

2: Stepper Motor Mechatronics System Design Lab

EXPERIMENT No. 2
DRIVING STEPPER MOTOR

1. Objectives

The student is expected to achieve the following objectives:

 Understand how to deal with a PIC microcontroller.


 Write a simple code to drive a seven segment.
 Knowing the different kind of stepper motors.
 To be familiar with stepper motor and test it.
 Controlling the direction, speed, and the position of stepper motor.

2. Apparatus

 Seven segment display SC52-11EWA.


 PIC16F877A.
 Stepper motor kit.
 Multimeter.
 DC power supply.

Figure 1:Stepper motor kit


3. Prelab

 Read the PIC16F877A data sheets.


 Read about the working principle of the stepper motor.
 Read the ULN2003 data sheets.

4.Introduction

Seven Segment Display:

LED displays are nothing more than sets of Light Emitting


Diodes. The difference is that they have different shapes in order to
display specific information. So driving LED displays is the same as
regular LED. Seven-segment displays may use liquid crystal display
(LCD), arrays of light-emitting diodes (LEDs), and other light-generating
or controlling techniques such as cold cathode gas discharge, vacuum
fluorescent, incandescent filaments, and others.

Figure 2: 7-segment display

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.

Table1: the hexadecimal encodings for displaying the digits 0 to 9:


Digit gfedcba abcdefg a b c d e f g
0 0x3F 0x7E on on on on on on off
1 0x06 0x30 off on on off off off off
2 0x5B 0x6D on on off on on off on
3 0x4F 0x79 on on on on off off on
4 0x66 0x33 off on on off off on on
5 0x6D 0x5B on off on on off on on
6 0x7D 0x5F on off on on on on on
7 0x07 0x70 on on on off off off off
8 0x7F 0x7F on on on on on on on
9 0x6F 0x7B on on on on off on 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:

1- Unipolar stepper motor: It consists of four separate electromagnets.


To run the motor current has to be passed in each coil in a certain sequence. The current is passed in each
coil in only one direction and thus it is called ‘Unipolar’.

2
Exp.2: Stepper Motor Mechatronics System Design Lab

Figure 3: Circuit symbol for unipolar stepper motor

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.

Figure 4: Circuit symbol for bnipolar stepper motor

Full stepping, half stepping and micro-stepping


By applying full voltage to one phase of the motor, full stepping is achieved. The motor will
advance by the stepping angle. By applying equal voltage to adjacent phases, half stepping can be
achieved. By applying fractions of voltage to adjacent phases, micro-stepping is achieved. Micro-stepping
can be applied in very small steps down to around 125th of the full step.

5. Procedure

Part I: Drive of a 7-segment display:

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.

Part III: Identification of the stepper motor:

1) Try to rotate the motor’s shaft by your hand. What do you notice?

What is the difference between it and other motors?

2) Depending on the wires number, what’s the type of this motor?

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.

Part II: Driving the 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.

Figure 4: Driving the stepper motor

Part III: Controlling the direction of the stepper motor:

Edit the program you have written in part II to change the direction of rotation

(cw & ccw) using one or two push buttons.

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.

Part V: Controlling the position of the stepper motor:

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

Das könnte Ihnen auch gefallen