100% found this document useful (1 vote)
84 views

Stepper Motor: Free !

The document discusses controlling a stepper motor using an 8051 microcontroller. It explains that stepper motors move in discrete steps by energizing coils in a specific sequence. The 8051 can drive the coils through a transistor array like the ULN2003 since it cannot source enough current directly. Example assembly and C code is provided to continuously rotate the motor forward by issuing the step sequence to the motor coils through ports P1.0-P1.3. Reversing the sequence reverses motor direction.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
84 views

Stepper Motor: Free !

The document discusses controlling a stepper motor using an 8051 microcontroller. It explains that stepper motors move in discrete steps by energizing coils in a specific sequence. The 8051 can drive the coils through a transistor array like the ULN2003 since it cannot source enough current directly. Example assembly and C code is provided to continuously rotate the motor forward by issuing the step sequence to the motor coils through ports P1.0-P1.3. Reversing the sequence reverses motor direction.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

8051 microcontroller hardware interfacing tutorials - stepper motor Pgina 1 de 2

Home 8051 Interfacings 8051 Downloads About Me Contact Me

8051 INTERFACING
Online FREE !

Stepper Motor

BASICS OF STEPPER MOTOR

Of all motors, step motor is the easiest to control. It's handling simplicity is really hard to deny - all there is to do is to bring the sequence of rectangle impulses
to one input of step controller and direction information to another input. Direction information is very simple and comes down to "left" for logical one on that pin
and "right" for logical zero. Motor control is also very simple - every impulse makes the motor operating for one step and if there is no impulse the motor won't
start. Pause between impulses can be shorter or longer and it defines revolution rate. This rate cannot be infinite because the motor won't be able to "catch up"
with all the impulses (documentation on specific motor should contain such information). The picture below represents the scheme for connecting the step motor
to microcontroller and appropriate program code follows.

The key to driving a stepper is realizing how the motor is constructed. A diagram shows the representation of a 4 coil motor, so named because 4 coils are used
to cause the revolution of the drive shaft. Each coil must be energized in the correct order for the motor to spin.

In Figure 3.3, as in Figure 3.1, boxes are used to represent switches; a control unit, not shown, is
responsible for providing the control signals to open and close the switches at the appropriate times in
order to spin the motors. The control unit is commonly a computer or programmable interface
controller, with software directly generating the outputs needed to control the switches.

As with drive circuitry for variable reluctance motors, we must deal with the inductive kick produced
when each of these switches is turned off. Again, we may shunt the inductive kick using diodes, but
now, 4 diodes are required, as shown in Figure 3.4:

Step angle

It is angle through which motor shaft rotates in one step. step angle is different for different motor . selection of motor according to step angle depends on the
application , simply if you require small increments in rottion choose motor having smaller step angle.

No of steps require to rotate one complete rotation = 360 deg. / step angle in deg.

Steps/second

The relation between RPM and steps per sec. is given by ,


steps or impulses /sec. =(RPM X Steps /revolution ) /60

Pause between impulses can be shorter or longer and it defines revolution rate. This rate cannot be infinite because the motor won't be able to "catch up" with all
the impulses (documentation on specific motor should contain such information). So referring to RPM value in datasheet you can calculate steps/sec and from it
delay or pause between impulses

INTERFACING TO 8051.

To cause the stepper to rotate, we have to send a pulse to each coil in turn. The 8051 does not have sufficient drive capability on its output to drive each coil, so
there are a number of ways to drive a stepper,

Stepper motors are usually controlled by transistor or driver IC like ULN2003.

Driving current for each coil is then needed about 60mA at +5V supply. A Darlington transistor array, ULN2003 is used to increase driving capacity of the 2051
chip. Four 4.7k resistors help the 2051 to provide more sourcing current from the +5V supply.

Coil A Coil B Coil C Coil D Step

0 1 1 0 1

0 0 1 1 2

1 0 0 1 3

1 1 0 0 4

http://www.freewebs.com/maheshwankhede/stepper.html 10/02/2010
8051 microcontroller hardware interfacing tutorials - stepper motor Pgina 2 de 2

CODE EXAMPLE

To move motor in forward direction continuously

Connection -P1.0 -P1.3 connected to Coils A -D.

ASSEMBLY LANGUAGE C LANGUAGE (SPJ)

mov a,#66h ;Load step sequence void main ()


{
AGAIN TMOD = 0x20 ;
mov p2,a ;issue sequence to motor TCON = 0x40 ;
rr a ;rotate step sequence right clockwise=Next sequence TH1 = 0xf9 ;
acall DELAY ;~ 20 msec. TL1 = 0xf9 ;
sjmp AGAIN ;Repete again PCON = 0x80 ;
SCON = 0x50 ;
while (1) /*continues loop */
{
printf("a"); /* transmit a along with CR & LF.
}

CONTROLLING STEPPER MOTOR WITH TWO PORT PINS ONLY

For Forward
D0 D0 Coil energized

0 0 AB

0 1 BC

1 0 CD

1 1 DA

To reverse the motor just reverse the above sequence viz.


11,10,01,00.

Site Developed and maintained by Mahesh Wankhede

http://www.freewebs.com/maheshwankhede/stepper.html 10/02/2010

You might also like