Você está na página 1de 7

SPEED CONTROL OF STEPPER MOTOR USING 8051 MICROCONTROLLER

Submitted By Hussain K. Saifee

Guided By Prof P. S. Chaudhari

DEPARTMENT OF POST GRADUATION STUDIES, PROF RAM MEGHE COLLEGE OF ENGINEERING AND MANAGEMENT, BADNERA.

INTRODUCTION: In this mini project I have used 8051 microcontroller which is one of the most popular microcontroller. This project presents speed control of stepper motor in both the direction i.e. clockwise and anti-clockwise. The stepper motor used here is a six wire unipolar stepper motor. Pulses given to stepper motor in proper sequence List of components: 1) 2) 3) 4) 5) 6) 7) 8) 9) Microcontroller from Atmel AT89C51, 40 pin DIP IC socket, Stepper motor driver IC ULN2003A, Small Push Button switch 7 Nos. , Single strand connecting wires, Vegakits general purpose 8051 PCB, 16 pin DIP IC socket, 9V six wire unipolar stepper motor, 9V Battery.

INTRODUCTION: In this mini project I have used 8051 microcontroller which is one of the most popular microcontroller. This project presents speed control of stepper motor in both the direction i.e. clockwise and anti-clockwise. The stepper motor used here is a six wire unipolar stepper motor. Pulses given to stepper motor in proper sequence List of components: 1) 2) 3) 4) 5) Microcontroller from Atmel AT89C51, 40 pin DIP IC socket, Stepper motor driver IC ULN2003A, Small Push Button switch 7 Nos. , Single strand connecting wires,

6) 7) 8) 9)

Vegakits general purpose 8051 PCB, 16 pin DIP IC socket, 9V six wire unipolar stepper motor, 9V Battery.

SPEED CONTROL OF STEPPER MOTOR IN BOTH THE DIRECTION

SUBMITTED BY: Hussain K. Saifee Roll No: 07 First Year M.E, Electrical and Electronics Engineering, Prof Ram Meghe College of Engineering and Management, Badnera.

Program:
#include <reg51.h> #include <absacc.h> sbit p10=P1^0; //Declare 1.0 of port 1 as an input port and it is used to run motor in clockwise direction sbit p11=P1^1; //Declare 1.1 of port 1 as an input port and it is used to run motor in anticlockwise direction sbit p12=P1^2; //Declare 1.2 of port 1 as an input port and it is used to stop the motor sbit p13=P1^3; //Declare 1.3 of port 1 as input port to control the speed sbit p14=P1^4; //Declare 1.4 of port 1 as input port to control the speed sbit p15=P1^5; //Declare 1.5 of port 1 as input port to control the speed sbit p16=P1^6; //Declare 1.6 of port 1 as input port to control the speed #define UP 20 #define DOWN 30 #define STOP 40 void delay()//Delay process { unsigned char i,j,k; if(p14==0) { for(i=0;i<=0xed;i++) for(j=0;j<=0x1d;j++) for(k=0;k<=0x11;k++); } if(p13==0) // motor runs slow { for(i=0;i<=0xdd;i++) for(j=0;j<=0x1c;j++) for(k=0;k<=0x4e;k++); } if(p15==0) { for(i=0;i<=0xcc;i++) for(j=0;j<=0x1b;j++) for(k=0;k<=0x1c;k++); } if(p16==0) // motor runs fast { for(i=0;i<=0xbb;i++) for(j=0;j<=0x09;j++) for(k=0;k<=0x02;k++);

} }

main() { unsigned char temp; while(1) { if(p10==0) { temp=UP;//Control is transferred P2=0X00; delay(); } if(p11==0) { temp=DOWN;//Inversion of control P2=0X00; delay(); }

if(p12==0) { temp=STOP;//Control stop } switch(temp) { case DOWN : P2=0X02;//Inversion of control //0011 delay(); delay(); P2=0X08;//0110 delay(); delay(); P2=0X04;//1100 delay(); delay(); P2=0X01;//1001 delay();

delay(); break; case UP : P2=0X01;//Control is transferred delay(); delay(); P2=0X04; delay(); delay(); P2=0X08; delay(); delay(); P2=0X02; delay(); delay(); break; case STOP : //Control stop P2=0X00; delay(); delay(); break; } } } Circuit diagram drawn in Proteus:

VCC

U2 U1
19 XTAL1 P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD 39 38 37 36 35 34 33 32 21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 1B 2B 3B 4B 5B 6B 7B COM 1C 2C 3C 4C 5C 6C 7C 9 16 15 14 13 12 11 10

18

XTAL2

+88.8

SW1
SW-SPST-MOM

RST

ULN2003A

SW2
SW-SPST-MOM

SW3
SW-SPST-MOM

29 30 31

PSEN ALE EA

SW4
SW-SPST

SW5
SW-SPST

1 2 3 4 5 6 7 8

P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 AT89C51

SW6
SW-SPST

SW7
SW-SPST

Você também pode gostar