Micro c lab5(stepper-motor)

17
Microcontrollers Lab 5 DRIVING STEPPER MOTOR USING 8051

Transcript of Micro c lab5(stepper-motor)

Page 1: Micro c lab5(stepper-motor)

MicrocontrollersLab 5

DRIVING STEPPER MOTOR USING 8051

Page 2: Micro c lab5(stepper-motor)

Objectives of the LabThe Applications of Stepper Motor

Learning how to find the wiring combination of stepper motor

Learning how to run stepper motor CW or CCW

About ULN2003 chip

Interfacing stepper motor with 8051

Page 3: Micro c lab5(stepper-motor)

Deciding Pins or Ports to use

Use withcaution

If EA high*Only 4 pins of controller are required. As this is an output process we may use any port. We will use P2.

Page 4: Micro c lab5(stepper-motor)

Applications of Stepper Motor Motors are majorly used for

driving mechanical assemblies using electronic signals.

Due to the working mechanism of stepper motor, it has many applications utilizing position control, angle control, precise movement and open loop control.

It is used in robotic limbs, conveyer belts, hard disk drives e.t.c.

Page 5: Micro c lab5(stepper-motor)

Theory of Operation This is best explained using figures.

Page 6: Micro c lab5(stepper-motor)

Wiring of Stepper Motor We can find stepper motor configuration

by first finding the common pins.

See the entities where R is there, the pin that is common will be ‘common’.

Now, we give 12V to the common pins, and give one by one ground on other pins.

12 13 14 15 16 23 24 25 26

R 2R OL OL OL R OL OL OL

34 35 36 45 46 56

OL OL OL R 2R R

Page 7: Micro c lab5(stepper-motor)

Wiring of Stepper Motor (contd.) When we give ground on one-pin, the

stepper motor makes a step to either CW or CCW.

We need to give ground one-by-one to the pins and adjust them in the sequence such as when ground one-by-one is given to the pins, the motor should move CW or CCW.

Remember this combination and mark the pins as ABCD.

Now, we see that when we give ABCD 0111, 1011, 1101 & 1110, the motor moves CW or CCW.

Page 8: Micro c lab5(stepper-motor)

Stepper Motor combinationsA B C D

0 1 1 1

1 0 1 1

1 1 0 1

1 1 1 0

Alternate Combination

1 1 0 0

0 1 1 0

0 0 1 1

1 0 0 1

If motor is running in CW using above combination just reverse the combination to run in CCW.

Page 9: Micro c lab5(stepper-motor)

Need of ULN2003A The ‘current’ requirement for stepper

motor can not be provided by µC pins. Thus a current amplifier is required. One problem arises, i.e. we need ‘0’ to

turn on the coil without current amplifier. But when we insert an amplifier, we need

to give ‘1’ to turn on coil. Thus the combination given on previous

slide will be reversed. i.e. ‘0’ to ‘1’ and ‘1’ to ‘0’.

Page 10: Micro c lab5(stepper-motor)

ULN2003A configurationFree-wheeling diodes

Page 11: Micro c lab5(stepper-motor)

Step angle and speed of motor Step angle when in control can give

position and precision control in applications.

For a 360 degree, the steps that motor takes are mentioned on the motor.

e.g. If a stepper motor takes 200 steps for 360 degree, then 1 step will move 360/200=1.8 degrees. Thus to move let’s say 30 degrees we need 30/1.8=16.67 steps.

Speed of motor is controlled by the delay given between the change of combination.

Page 12: Micro c lab5(stepper-motor)

Phase(Coil) Current WaveformsLess Torque than full step drive

1 step angle=360/200

1/2 step angle=360/(2*200)

Page 13: Micro c lab5(stepper-motor)

Full Step with ULN2003AA B C D

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

Alternate Combination

0 0 1 1

1 0 0 1

1 1 0 0

0 1 1 0

If motor is running in CW using above combination just reverse the combination to run in CCW.

Page 14: Micro c lab5(stepper-motor)

Half Step with ULN2003AA B C D

0 0 0 1

1 0 0 1

1 0 0 0

1 1 0 0

0 1 0 0

0 1 1 0

0 0 1 0

0 0 1 1

If motor is running in CW using above combination just reverse the combination to run in CCW.

Page 15: Micro c lab5(stepper-motor)

Algorithm for Full StepStart

Send seq to output

Store in A

Next Sequence

Call Delay

mov a,#66h;01100110b

mov p2,a

rr a

call delay

Page 16: Micro c lab5(stepper-motor)

Proteus Devices needed in this Lab1. AT89c51

2. ULN2003A

3. Stepper Motor

Page 17: Micro c lab5(stepper-motor)

Lab TasksRun Stepper Motor using 8051.