Вы находитесь на странице: 1из 5

# Eng.

Mohammad Aqel

## Faculty of Engineering & Information Technology

Al-AZHAR UNIVERSITY-GAZA

## Embedded System Design Lab

ITSE 4316
(Experiment 3)
Controlling of Unipolar Stepper Motor

Objective
To investigate how the stepper motor can be interfaced to PIC16F84A microcontroller. In this
experiment the speed and the direction of motor rotation will be controlled.

Background
Stepping motors are found in diverse equipment, as printers, disk drives, plotters and so on. The
rotator is driven by a magnetic force, which is controlled by a digital signal of suitable power
levels. This makes them ideally suited to a microprocessor based control system, which can
generate such signals very easily.

There are several types of stepper motor available but it is possible to explain the general nature
of operation by reference to a simple model of a permanent magnet motor. This motor is a
digital one because it moved in discrete steps as it traverses through 360°, a common stepper
motor is geared to move perhaps 15° per step in an inexpensive stepper motor to 1° per step .

## Figure 3.1: The symbol of stepper motor.

In Figure (2), A, B, C and D are electromagnets, which are fixed. A magnetized iron rotor is free
to rotate between them. It is attached to the motor shaft.

1
Figure 3.2: The parts of stepper motor.

The magnetic device is controlled by a current signal. And by passing current in the correct
direction, through A and C it is possible to make A a North Pole and C a south pole in the
vicinity of the rotor.

This causes the rotor to line up vertically in the position shown because ’unlike’ magnetic poles
attract each other. The rotor is thus held in a certain position.

If we now switch off A and C and perform a similar operation with B and D then the rotor is
encouraged to move round to a horizontal position. If D is a North Pole and B a south pole, the
rotation is counter clockwise.

Reversing the magnetic polarity of B and D would have produced a clockwise rotation. By
continuing with appropriate energization of A, B, C and D rotation can be produced, in either
direction, as a series of 90 STEPS.

## Although this is a much-simplified illustration in relation to real motor construction it does

highlight two important factors:

1) The rotor position depends on a combination of signals applied to the motor windings
called phases.
2) The rotor can be moved a fixed amount by changing the combination of signals and the
SPEED OF ROTATION will depend on how quickly the combinations are changed
(assuming the motor is able to follow the required stepping rate).

2
Suitable interface circuits are included to allow it to be driven directly from microcontroller
I/O lines and the design of this particular motor gives a step angle of 7.5 rather than 90.

Every signal sent out by special program will propel the motor a step or half step ahead. The
direction of rotation is determined by the order the signals are sent.

To propel the motor in one-step or half steps, the logic inputs A, B, C and D must be exited
in the sequences of Table (1.1).

D C B A D C B A
1 0 0 0 0 0 0 1
0 1 0 0 0 0 1 0
0 0 1 0 0 1 0 0
0 0 0 1 1 0 0 0

REPEAT REPEAT
ONE-STEP .

## COUNTER CLOCKWISE CLOCKWISE ROTATION

ROTATION

D C B A D C B A
1 0 0 0 0 0 0 1
1 1 0 0 0 0 1 1
0 1 0 0 0 0 1 0
0 1 1 0 0 1 1 0
0 0 1 0 0 1 0 0
0 0 1 1 1 1 0 0
0 0 0 1 1 0 0 0

REPEAT REPEAT

HALF-STEP
Table 3.1: The direction of rotation and propelling the motor by one step or Half step.

To propel the stepper motor, PIC16F84A microcontroller is used. The schematic diagram of the
experiment is shown in Figure 3-3.

3
Figure 3.3: The Schematic Diagram.

With the connection shown in the above figure will have to send output values in the sequence
01, 02, 04, 08 to great the condition in table (1.1) that give clockwise rotation. To write the
program, which is propelling the step motor in clockwise rotation we must be written by
sequence as shown in the flowchart in Figure 3.4.

Figure 3.4: Flowchart of the sequence required to write the program to propel the stepper motor.

4
Lab Work

(Part I)
Design a circuit to interface a stepper motor to the PIC16F84A as shown in Figure 3.3. Show all
connections in detail.

(Part II)
For the circuit you have designed, write a PICBasic program which runs the motor in multiple
different modes ( Fast left, Fast right, Slow left, Slow right, Stop ) according to the input signal
from two switches connected to PORTA.

In the experiment ULN2003is used to control the Unipolar stepper motor. ULN2003 is a Seven
Darlington Arrays. It’s high voltage,high current darlington arrays each containing seven open
collector darlington pairs with common emitters. Each channel rated at 500mAand can
withstand peak currents of 600mA.Suppressiondiodesare included for inductive load driving and
the inputs are pinned opposite the outputs to simplify board layout. Figure 3.5 show the pin
description of ULN2003.