Stepper Motor interfacing with 8051

Stepper Motor

Stepper Motor
Stepper Motor

 

The Stepper motor is a brushless DC motor that divides the full rotation angle of 360° into a number of equal steps.

The motor is rotated by applying a certain sequence of control signals. The speed of rotation can be changed by changing the rate at which the control signals are applied.

Various stepper motors with different step angles and torque ratings are available in the market.

A microcontroller can be used to apply different control signals to the motor to make it rotate according to the need of the application.

For more information about Stepper Motor and how to use it, refer to the topic Stepper Motor in the sensors and modules section.

 

Stepper Motor Driver connection with 8051

Stepper Motor Interface with 8051 using ULN2003 Driver
Stepper Motor Connection with 8051 using ULN2003
  • Here we are going to interface 6 wires Unipolar Stepper Motor with an 8051 controller.
  • Only four wires are required to control the stepper motor.
  • Two common wires of the stepper motor are connected to the 5V supply.
  • ULN2003 driver is used to driving the stepper motor.
  • Note that to know the winding coil and their center tap leads measure resistance in between leads. From center leads, we will get half the resistance value of that winding.

 

Example

Let’s program At89S52 to rotate the stepper motor 360° clockwise by half-step sequence and 360° anticlockwise by full-step sequence.

8051 Stepper Motor Code

#include <reg52.h>

#define Stepper_Port P2			/* Define Stepper Motor Port */

/* Function to provide delay of 1ms at 11.0592 MHz */
void delay(unsigned int count)
{
    int i,j;
    for(i=0; i<count; i++)
			for(j=0; j<112; j++);
}

int main(void)
{
	int i,period;
	period = 100;	/* Set period in between two steps of Stepper Motor */
	while (1)
	{
		/* Rotate Stepper Motor clockwise with Half step sequence */
		for(i=0; i<12; i++)
		{
			Stepper_Port = 0x09;
			delay(period);
			Stepper_Port = 0x08;
			delay(period);
			Stepper_Port = 0x0C;
			delay(period);
			Stepper_Port = 0x04;
			delay(period);
			Stepper_Port = 0x06;
			delay(period);
			Stepper_Port = 0x02;
			delay(period);
			Stepper_Port = 0x03;
			delay(period);
			Stepper_Port = 0x01;
			delay(period);
		}
		/* last one step to acquire initial position */ 
		Stepper_Port = 0x09;
		delay(period);
		delay(1000);
		/* Rotate Stepper Motor Anticlockwise with Full step sequence */
		for(i=0; i<12; i++)
		{
			Stepper_Port = 0x09;
			delay(period);
			Stepper_Port = 0x03;
			delay(period);
			Stepper_Port = 0x06;
			delay(period);
			Stepper_Port = 0x0C;
			delay(period);
		}
		Stepper_Port = 0x09;
		delay(period);
		delay(1000);
	}
}

 

Video Stepper motor Driving using 8051

 


Components Used

ULN2003 Motor Driver
ULN2003A is a high-voltage, high-current Darlington transistor array.
1
8051 AT89c51
8051 AT89c51
1

Downloads

8051_Stepper_Motor_Keil_Project Download
8051_Stepper_Control_Proteus_Simulation Download
Ad