Skip to main content

How to interface bi-polar stepper motor with AT89C51 ( 45 & 90 degree angular rotation )

hi, how are you today



Let's learn how to interface a Stepper motor with our baby (8051uC)

Description 

This article helps you to understand the concept behind the interfacing of bipolar stepper.The name bi-polar means that we have no common pin to apply voltage , all 4 pins are used to control the angular motion of motor. Stepper motor is a motor that runs covers angular movement and most commonly used at toll plazas.
Here I tried to teach you how stepper motor works, it can be run in any direction by simple programming. Mechanism is same as of dc motor but in place of single coil, it has 2 coils and that helps to provide angular movement of 90 and 45 degrees.

If we generate magnetic field in one coil than it will attain an angular movement of 90 degrees and if we generate magnetic field in 2 sequence coils than we can attain an angular movement of 45 degree.
Bipolar stepper motor is having 4 wires and all 4 wires are used to control the motion of motor by using L293D IC 

Here we connect 4 pins of port 3 to L293D input terminal and their resp.output is connected to all four wires of stepper motor that are used to provide angular motion(45 or 90 degree) to steper motor.

Programming


90 degree angle step
1:  #include<reg51.h>      // header file  
2:  void delay(int time)    // function to generate delay  
3:     {  
4:     int i,j;  
5:     for(i=0;i<=time;i++) // i will run from 0 to user defined value  
6:     for(j=0;j<=1275;j++); // j will run from 0 to 1275 "time" times  
7:     }  
8:  sbit m1=P3^0;  
9:  sbit m2=P3^1;  
10:  sbit m3=P3^2;  
11:  sbit m4=P3^3;  
12:                   /*90 degree phase shift*/  
13:  void main()         // main function  
14:     {  
15:      while(1)       // while(1)used to provide continuous loop  
16:       {  
17:        m1=1; m2=m3=m4=0;  
18:        delay(500);  
19:        m2=1; m1=m3=m4=0;  
20:        delay(500);  
21:        m3=1; m1=m2=m4=0;  
22:        delay(500);  
23:        m4=1; m1=m2=m3=0;  
24:        delay(500);     
25:       }  
26:     }  

45 degree angle step
1:  #include<reg51.h>      // header file  
2:  void delay(int time)    // function to generate delay  
3:     {  
4:     int i,j;  
5:     for(i=0;i<=time;i++) // i will run from 0 to user defined value  
6:     for(j=0;j<=1275;j++); // j will run from 0 to 1275 "time" times  
7:     }  
8:  sbit m1=P3^0;  
9:  sbit m2=P3^1;  
10:  sbit m3=P3^2;  
11:  sbit m4=P3^3;  
12:  void main()          // main function  
13:     {   
14:      while(1)        // while(1)used to provide continuous loop  
15:       {  
16:        m4=m1=1; m2=m3=0; // here motor will stuck between 4th and 1st  
17:        delay(500);  
18:        m1=1; m2=m3=m4=0; // here motor will stuck at 1st pin  
19:        delay(500);  
20:        m1=m2=1; m3=m4=0; // here motor will stuck between 1st and 2nd  
21:        delay(500);  
22:        m2=1; m1=m3=m4=0; // here motor will stuck at 2nd pin  
23:        delay(500);  
24:        m2=m3=1; m1=m4=0; // here motor will stuck between 2nd and 3rd  
25:        delay(500);  
26:        m3=1; m1=m2=m4=0; // here motor will stuck at 3rd pin  
27:        delay(500);  
28:        m3=m4=1; m1=m2=0; // here motor will stuck between 3rd and 4th  
29:        delay(500);  
30:        m4=1; m1=m2=m3=0; // here motor will stuck at 4th pin  
31:        delay(500);    
32:       }  
33:     }  

For enhance concept just visit www.salahtutorials.com

Hope you all like this post and I wish this must be useful for you.
Thanks :)

Comments

Translate to your language

Popular posts from this blog

Different Stages of I2C communication

Different Stages Of I2C

How to import Pygame in pycharm

hi, how are you today

Working demonstration of UART communication using 2 8051 uController on Proteus with Embedded C code.

Here we are going to use 2 at89c51 uControllers just to understand UART communication in 8051.