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

MOTOR STEPPER

TEORI DASAR MOTOR STEPPER


RANGKAIAN DRIVER MOTOR
STEPPER
PEMOGRAMAN MOTOR STEPPER

Gambar motor Stepper

TEORI DASAR MOTOR STEPPER


Stepper Motor interfacing with Microcontrollers: Introduction
Introduction
This section of tutorial will explain you everything that you need to know
about stepper motors. Stepper motors can be used in various areas of your
microcontroller projects such as making robots, robotic arm, automatic door
lock system etc. This tutorial will explain you construction of stepper motors
(unipolar and bipolar stepper motors ), basic pricipal, different controlling
types (Half step and Full step), Interfacing Techniques (using L293D or
ULN2003) and programming your microcontroller in C and assembly to
control
stepper
motor.
Unipolar stepper motor
The unipolar stepper motor has five or six wires and four coils (actually two
coils divided by center connections on each coil). The center connections of
the coils are tied together and used as the power connection. They are called
unipolar steppers because power always comes in on this one pole.
Bipolar stepper motor
The bipolar stepper motor usually has four wires coming out of it. Unlike
unipolar steppers, bipolar steppers have no common center connection. They
have two independent sets of coils instead. You can distinguish them from
unipolar steppers by measuring the resistance between the wires. You should
find two pairs of wires with equal resistance. If you've got the leads of your
meter connected to two wires that are not connected (i.e. not attached to the
same coil), you should see infinite resistance (or no continuity).

As already said, we will talk mostly on "Unipolar stepper motors" which is

most common type of stepper motor available in the market.A simple


example of 6 lead step motor is given below and in 5 lead step motor wire 5
and 6 are joined together to make 1 wire as common.

Working of Stepper Motor


Now lets discuss the operation pricipal of a stepper motor. When we energize
a coil of stepper motor, The shaft of stepper motor (which is actually a
permanent magnet) align itself according to poles of energized coil. So when
motor coils are energized in a particular sequence, motor shaft tend to align
itself according to pole of coils and hence rotates. A small example of
energizing operation is given below.

You can see in the example, when coil "A" is energized, A north-south polarity
is generated at "A+A\" as shown in the figure above and magnetic shaft
automatically align itself according to the poles generated. When the next
coil is energized the shaft again align itself and take a step. Hence the
working pricipal.

We have seen that to make the stepper motor work, we need to energize coil
in a sqeuence. The explaination and generation of the sequence is explaind
in the next section of the tutorial.

Connecting Unipolar Stepper Motor


There are actually many ways you can interface a stepper motor to your
controller,
out
of
them
the
most
used
interfaces
are:
1. Interface using L293D - H-Bridge Motor Driver
2. Interface using ULN2003/2004 - Darlington Arrays
We will dicuss both connection techniques one by one. The above mentioned
methods need 4 controller pins for interface.
Connecting Unipolar stepper using L293D

[lightbox=l293d-stepper-big.gif|Stepper
stepper
motor

motor

interfacing

using L293D|
connections]

[/lightbox]
Please click on the image to enlarge it
As you see in the circuit above the four pins "Controller pin 1",2,3 and 4 will
control the motion and direction of the stepper motor according to the step
sequece
programmed
in
the
controller.

Connecting Unipolar stepper using ULN2003/2004


[lightbox=uln2003-stepper-big.gif|Stepper motor interfacing using ULN2003|
stepper motor

connections]
[/lightbox]
Please click on the image to enlarge it
As already discussed in case of L293D, Here in this circuit too the four pins
"Controller pin 1",2,3 and 4 will control the motion and direction of the
stepper motor according to the step sequece sent by the controller.
2-wire connection for Unipolar Stepper Motor

We have seen the generally used 4-wire connection method for interfacing
unipolar stepper motor, but we can simplify the design to make controller
use less pins with the help of 2-wire connection method. The circuit for 2-wire
connection is shown below.
Unipolar Stepper Motor connection|stepper motor connections

Connecting Bipolar Stepper Motor

As we have studied that, Bi-polar stepper motors has 2 different coils. The
step sequence for Bipolar stepper motor is same as that of unipolar stepper
motors. The driving circuit for this require an H-Bridge as it allows the
polarity of the power applied to be controlled independently. This can be
done as shown in the figure below:
Bipolar Stepper Motor connection

Now we have seen the methods for connecting stepper motors with your
microcontroller. So keeping these circuits in mind,we will now look at the
programming of microcontroller to control stepper motors. This is discussed
in the next section of the tutorial

PEMROGRAMAN MOTOR STEPPER


Programming Full step Sequence
CODE:

org 0H
stepper equ P1
main:
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
sjmp main

#0CH
#06H
#03H
#09H

delay:
mov r7,#4
wait2:
mov r6,#0FFH
wait1:
mov r5,#0FFH
wait:
djnz r5,wait
djnz r6,wait1
djnz r7,wait2
ret
end
The working of the above code can be seen in the demo animation below.

Programming Half step Sequence


Assembly Programming
Here also the main routine changes rest everything remains same.
CODE:
main:
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
sjmp main

#08H
#0CH
#04H
#06H
#02H
#03H
#01H
#09H

The working of the above code can be seen in the demo animation below.

Programming for 2-wire connection of Unipolar Stepper Motor


Assembly Programming
CODE:
main:
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
mov stepper,
acall delay
sjmp main

#03H
#01H
#00H
#02H

The working of the above code can be seen in the demo animation below.

Programming for Bipolar Stepper Motor


Assembly Programming
CODE:
main:
mov stepper, #08H
acall delay
mov stepper, #02H
acall delay
mov stepper, #04H
acall delay
mov stepper, #01H
acall delay
sjmp main

The UCN 5804 Stepper Motor IC


By using an external stepper motor controller, such as the UCN 5804, you can simplify your
programs and control as many motors as you have outputs via an array of UCN 5804's. Not only
does it allow for the control of more motors, but more importantly, it simplifies the process. You
now only have to output the pulse of your desired speed. Additionally, you can switch between

full and half stepping in real time via a switch on the UCN 5804 (or you may have the PIC
control it), as well as reverse direction. A pinout for the UCN804 is shown in Figure 8.

Figure 8
The schematic we will build to use this chip is shown in Figure 9. Since we are using a 5V
stepper motor, we will be powering the UCN 5804 with a 9V wall transformer. You cannot use
6V, due to the draw of the motor. The UCN 5804 can support voltages up to 35V.

Figure 9
Notice in the schematic that two resistors, rx and ry, do not have an assigned value. This is
because our motor draws only 100 mA, well under the chip's supported 1,250 mA. However, if
you were to use a motor that draws the maximum or above, then you would need to use rx and ry
to get the amperage under 1,250 mA. For example, a 24V motor with a phase resistance of 15
ohms would draw 1,600 mA (24/15 = 1.6). In this case, you should use _at least_ a 5 ohm
resistor for both rx and ry, which would bring the current down to 1.2 A.
Since the input of the UCN 5804 is CMOS and TTL compatible, we can connect the outputs
from the PIC directly into the UCN 5804. Two outputs are needed; one to control the step input
(pin 11), and one to control the output enable (pin 15) which enables the stepper motor while
high and disables the stepper motor while low.
Pins 9 and 10 control the stepping method (half or full steps). Pin 14 controls the step direction.
Both of these controls can be manipulated by the PIC, but it is easier to control them directly
through the use of jumpers acting as switches.
All the program has to do, is output a pulse and set the output enable low. This can be
accomplished with a very simple program such as the following:
Listing 3

' Stepper motor control with a UCN 5804


Symbol delay = B0
low 1
delay = 10
delay = delay * 1000
loop: pulsout 0,delay
goto loop
' make a delay variable
' set the output enable low
' set a pulsewidth of 10 ms
' turn delay into microseconds
' send pulsewidth of delay to UCN5804
' repeat forever

End Listing 3
Notice that I added an extra step; taking the defined "delay" value and multiplying it by 1,000.
This is necessary because the pulsout command requires a pulsewidth in micro-seconds, not
milli-seconds. You can make the code even smaller by removing lines 1, 3, and 4 and replacing
"delay" in line 5 with a set number in microseconds. However, I prefer to the method shown in
the listing, because it makes it easier to change the delay parameter in the more familiar
milliseconds without having to convert it to microseconds.

Вам также может понравиться