Skip to main content

The future of AI in business and its potential to transform industries

What is stepper motor? | How to interface stepper motor with AT89C51?

 What is a stepper motor? | How to interface stepper motor with AT89C51?

banner for what is stepper motor

Stepper motor

  • Stepper motors are DC motor which moves on discrete steps.
  • Stepper motor converts electrical pulses into mechanical movements.
  • Most common stepper motors have 4 stator winding which is paired with a centre tapped common.
  • Two coils should be on in order to rotate a stepper motor.
  • Another important factor is the step angle, it is the minimum degree of rotation with a single step. 

Movement of stepper motor

showing how stepper motor rotates

For the movement of the stepper motor, in a clockwise direction, we need to give a signal to the coil A and B and then B and C then C and D and so on.

the hexadecimal value for the movement is given below.


truth table regarding stepper motor

For the movement in an antilock wise direction you need to give 1 to A and D, then D and C, then C and B and so on. In other words, the sequence of the hexadecimal will change like 0x09, 0x0C, 0x06 and then 0x03.

Interfacing of  stepper motor with AT89C51

In this section, we will see how to interface stepper motor with AT89C51 microcontroller and also rotate the motor in the clockwise direction with 90-degree step angle.

The software for the simulation we are using is proteus professional 8 and for generating the hex file we are using Keil Microvision 5.


The hardware for the simulation required are :
  • AT89C51 microcontroller
  • ULN2003A IC
  • Stepper motor

Make hardware connections on the proteus simulation

interfacing of stepper motor with AT89C51

Please make sure all the connections are connected to the right port, In this simulation, I am using the Port 3 of the for connection. 
I am also using a ULN2003A IC which is a high current high voltage Darlington pair transistor array for stepper motor driving and safety purpose.

Write the program for your microcontroller

Write the below-given code to the Keil Microvision IDE and generate the hex file after executing it.

code

#include <reg51.h>

int i,j;

void delay()
{
  TMOD=0x02;
for(i=0;i<3600;i++)
{
  TH0=0;
TR0=1;
while(TF0==0);
TF0=0;
}
}

void main()
{
  int arr[]={3,6,0xC,9};
while(1)
{
  for(j=0;j<sizeof arr;j++)
{
  P3=arr[j];
delay();
}
}
}


Upload the Hex file to the microcontroller

uploading hex file to proteus simulation

On double-clicking to the microcontroller, you can upload the hex file to the microcontroller.

While uploading the Hex file don't forget to change the clock frequency of the microcontroller to 11.0592 MHz.

If you don't know how to generate a Hex file you can click here.

And that's it you can simulate your project, by clicking the play button on the bottom left corner.

Video 




Popular posts from this blog

What is machine learning and it's types?

 What is machine learning(ML)? Machine learning is a subset of artificial intelligence. Machine learning enables computers or machines to make data-driven decisions rather than being explicitly programmed for a certain task. These programs or algorithms are designed in a way that they learn and improve over time when are exposed to new data. Examples:- 1. Product recommendations   While checking for a product did you noticed when it recommends a product similar to what you are looking for? or did you noticed "the person bought this product also bought this" combination of products? How are they doing this recommendation? This is machine learning. 2. Email spam and malware filtering  There are a number of spam filtering approaches that email clients use.  To ascertain that these spam filters are continuously updated they are powered by machine learning. 3. Online customer support A number of websites nowadays offer the option to chat with customer support representati...

PIC18 Timer programming in C

The PIC18 timer is divided into 4 types Timer 0 Timer 1 Timer 2 Timer 3 PIC18 timers can be used to generate a time delay or as a counter to count external event happening outside the microcontroller. In this article, we will see how to generate a time delay by programming the PIC18 timer. Timer 0 The timer 0 module has the following features Software is scalable as an 8 bit or 16-bit timer/counter. Readable and writable Dedicated 8 bit software programmable Prescaler Clock source selectable to be internal or external Edge select for external clock Register required for Timer 0 Control register Each timer has a control register called TCON to set the various timer operation modes. T0CON is an 8-bit register used for control of timer 0. TOCON TMR0ON (Timer0 on/off control bit)                                       1 = Enable timer 0                ...

Top 7 domains to expertise after learning python

Top 7 domains to expertise after learning python Python is one of the most popular programming languages. It is an object-oriented, dynamic semantics and high-level programming language. It's high-level built-in data structure combined with dynamic binding and dynamic typing makes it attractive for rapid application development. Often programmers fall in love with python because of the increased productivity it provides. Python is one of the most readable languages in the world right now. This language is very popular among developers and is widely used by many programmers to create application and programs. The implementation of this programming language is simple and at the same time, the language has a very clean structure as compared to other languages.  So if you mastered your python concepts and skills, you can dominate these 7 domains. Machine learning / Artificial intelligence Desktop GUI Data analytics and data visualization  Web development Game development Mobile ap...