Sunteți pe pagina 1din 15

Experiment No.

PROBLEM DEFINITION: Interface the stepper motor


to 8051 Microcontroller to rotate the motor in
clockwise/anticlockwise direction by N steps with
suitable delay between successive steps.

1
Objectives of the Experiment:

1. To demonstrate the interfacing of stepper motor


with 8051 Microcontroller.

2. To develop an 8051 ‘C’ code to rotate the


stepper motor in clockwise/anticlockwise
direction.

2
Stepper Motor Interfacing

 Stepper motor is a device that translates


electrical pulses into mechanical
movement.
 In applications like disk drives, dot
matrix printers, and robotics, stepper
motor is used for position control.
 Stepper motor commonly have a
permanent magnet rotor surrounded by
a stator.
3
Stepper Motor Interfacing

 Most common stepper motors have


four stator windings that are paired
with a center tapped common as
shown in fig. below

4
Stepper Motor interfacing

 This type of stepper motor is


commonly referred to as a four
phase or unipolar stepper motor.
 The center tap allows a change of
current direction in each of two coils
when a winding is grounded,
resulting in a polarity change of the
stator.
5
Stepper Motor Interfacing

 Stepper motor shaft moves in a fixed


repeatable increment, which allows one
move into a precise position.
 The direction of rotation is dictated by the
stator poles.
 Stator poles are determined by the current
sent through the wire coils.
 As the direction of the current is changed,
the polarity is also changed causing the
reverse motion of the rotor. 6
Stepper Motor Interfacing

 The stepper motor has total 6 leads: 4


leads representing the four stator windings
and 2 commons for the center-tapped
leads.
 As the sequence of power is applied to
each stator winding the rotor will rotate.
 There are several widely used sequences
where each has a different degree of
precision.
7
Stepper Motor Interfacing

 Table shows wave drive stepping sequence i.e. only one electromagnet is
energized at a time.
STEP A B C D

1 1 0 0 0

2 0 1 0 0

3 0 0 1 0

4 0 0 0 1
Department of Computer Science and Engineering, GIT 03/25/20 8
20
Step angle

 How much movement is associated


with a single step? (7.2degrees)
 Depends on number of teeth on the
stator and the rotor.
 Thestep angle is minimum degree of
rotation associated with a single
step.

9
Stepper motor interfacing
diagram

10
Algorithm for the experiment
STEP 1 : INCLUDE THE HEADER FILE ‘’at89c51ed2.h’’
STEP 2 : DECLARE THE DELAY SUBROUTINE
STEP 3 : BEGIN MAIN
STEP 4 : DECLARE VARIABLES.
STEP 5 : USE FOR LOOP TO SPECIFY THE NUMBER OF STEPS.
STEP 6 : INTIALIZE THE VALUE TO INDICATE THE NUMBER OF WINDINGS
ENERGIZED AT A TIME. (STEP SEQUENCE)
STEP 7: USE FOR LOOP TO SEND THE VALUE TO PORT 0 FOLLOWING THE
PROPER 4 STEP SEQUENCE
STEP 8: VALUE (0x01)IS SHIFTED LEFT 4 TIMES (CLOCKWISE ROTATION) OR
VALUE (0x08) IS SHIFTED RIGHT 4 TIMES (ANTICLOCKWISE ROTATION)
STEP 9: CALL DELAY SUBROUTINE TO INCLUDE DELAY BETWEEN EACH STEP..
STEP 10:TERMINATE PROGRAM AFTER THE SPECIFIED NUMBER OF
ROTATIONS. 11
8051 ‘C’ code to rotate stepper motor in clockwise direction by ‘N’ steps.

#include "at89c51ed2.h"

void delay(unsigned int);


main()
{
unsigned char Val,i,j;

for(j=0;j<50;j++)
{
Val = 0x01;
for(i=0;i<4;i++)
{
P0 = Val;
Val = Val << 1;
delay(10000);

}
}

}
12
DELAY SUBROUTINE

void delay(unsigned int n)


{
unsigned int m;
for(m=0;m<n;m++);
}

13
Connection Details

• Port 0 to CN12 of Microcontroller


Evaluation Board

14
Learning Outcomes of the Experiment

At the end of the session, students should be able to :

•Interface Stepper Motor to 8051 Microcontroller


•Write ‘C’ code to rotate steeper motor in clockwise/anticlockwise
direction.
•Understand the applications of stepper motor in position control
(Robotics)

S-ar putea să vă placă și