Interfacing Stepper Motor with 8051Microcontroller

 Interfacing Stepper Motor with 8051Microcontroller




A stepper motor, also known as a step motor or stepping motor, is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at one of these steps without any position sensor for feedback (an open-loop controller), as long as the motor is carefully sized to the application in respect to torque and speed.


Interfacing Stepper Motor with 8051 Microcontroller

We are using Port P0 of 8051 for connecting the stepper motor. HereULN2003 is used. This is basically a high voltage, high current Darlington transistor array. Each ULN2003 has seven NPN Darlington pairs. It can provide high voltage output with common-cathode clamp diodes for switching inductive loads.
Wave Drive Mode − In this mode, one coil is energized at a time. So all four coils are energized one after another. This mode produces less torque than the full-step drive mode.
The following table is showing the sequence of input states in different windings.



Full Drive Mode − In this mode, two coils are energized at the same time. This mode produces more torque. Here the power consumption is also high.
The following table is showing the sequence of input states in different windings.



The circuit diagram is like below: 

Source code: 
    For the wave drive mode-

#include<reg51.h>
#define stepper_motor P0
 
void msdelay(unsigned int time)  // Function for creating delay in milliseconds.
{
    unsigned i,j ;
    for(i=0;i<time;i++)    
    for(j=0;j<1275;j++);
}
 
void main()
{
while (1) {
stepper_motor = 0x08;
msdelay(20);
stepper_motor = 0x04;
msdelay(20);
stepper_motor = 0x02;
msdelay(20);
stepper_motor = 0x01;
msdelay(20);
}
}

Source code: 
    For the Full drive mode-
#include<reg51.h>
#define stepper_motor P0
 
void msdelay(unsigned int time)  // Function for creating delay in milliseconds.
{
    unsigned i,j ;
    for(i=0;i<time;i++)    
    for(j=0;j<1275;j++);
}
 
void main()
{
while (1) {
stepper_motor = 0x0C;
msdelay(20);
stepper_motor = 0x06;
msdelay(20);
stepper_motor = 0x03;
msdelay(20);
stepper_motor = 0x09;
msdelay(20);
}
}



Comments

Popular posts from this blog

LCD Interfacing with 8051 Microcontroller

Serial Interrupt Programming in 8051 Microcontroller

Interfacing LED with 8051 Microcontroller in Assembly