Spread the love

stepper motor interfacing with 8051_________________________________________________________________________________________________

  • What is motor? – A motor is an electric machine that converts electrical energy into mechanical energy. Motor has following parts:

dc_motor_diagram (1)

  1. Rotor –In an electric motor the moving part is the rotor which turns the shaft to deliver the mechanical power. The rotor usually has conductors laid into it which carry currents that interact with the magnetic field of the stator to generate the forces that turn the shaft. However, some rotors carry permanent magnets, and the stator holds the conductors.
  2. Stator –The stationary part is the stator, usually has either windings or permanent magnets. The stator is the stationary part of the motor’s electromagnetic circuit. The stator core is made up of many thin metal sheets, called laminations. Laminations are used to reduce energy loses that would result if a solid core were used.
  3. Windings-Windings are wires that are laid in coils, usually wrapped around a laminated soft iron magnetic core so as to form magnetic poles when energized with current.
  4. Commutator –commutator is a mechanism used to switch the input of certain AC and DC machines consisting of slip ring segments insulated from each other and from the electric motor’s shaft. The motor’s armature current is supplied through the stationary brushes in contact with the revolving commutator, which causes required current reversal and applies power to the machine in an optimal manner as the rotor rotates from pole to pole.

stepper motor interfacing with 8051

  • Types of motor –There are many confusion arises when motors categorized, but mainly two types that is AC & DC. Here we only interface simple DC motor, geared DC motor and stepper motor as you can see on above pics.
  • Operation – we can’t direct interface any motors with microcontroller because

 

  1. Low voltage compatibility – microcontroller pin produced very low voltage about 5V and at this voltage motor not drive properly. To operate motor, at least 9V required.
  2. Low current compatibility – microcontroller pin produced very low current about 1.3mA(AT89c51)  and at this current rating motor not drive. To operate motor, at least 300mA current required.
  3. Back EMF- motor produced back current due to induced EMF which is harmful for microcontroller and cause of this microcontroller pin may be damaged.

 

Solution is L293D Dual H-Bridge IC for simple DC motor and ULN2803 or ULN2003 for stepper motor, this IC produce 600mA to 700mA current with voltage range of 9V to 48V which is enough to drive small electronics motors. The circuit diagram of how to interface motor using this IC is shown in side TAB(circuit diagram).

73451_SN_6100_Light_2013

  • Applications – Different motors are used according to its characteristics and required parameters and its application as diverse as industrial fans, blowers and pumps, machine tools, household appliances, power tools, and disk drives.

Click Here : Interfacing of simple DC & geared DC motor

Click Here : stepper motor interfacing with 8051 and program point of view understanding

1. Circuit Diagram Of GEAR MOTOR interfacing with 8051

gear motor interfacing with 8051   ____________________________________________________________________________________________________

2. Circuit Diagram Of STEPPER MOTOR interfacing with 8051

stepper motor interfacing with 8051

1. Program of GEAR MOTOR Controlled By Switches With 8051

/******************************************************
IDE :- Keil
DEVELOPED BY:- FIRMWARE DEVELOPER (www.firmcodes.com)
WHAT PROGRAM DO:- CONTROLLING GEAR MOTOR BY SWITCH
******************************************************/
#include<reg51.h>

sbit m11=P2^4;  // 1st pin of 1st motor 
sbit m12=P2^5;  // 1st pin of 2nd motor 
sbit m21=P2^6;  // 2nd pin of 1st motor 
sbit m22=P2^7;  // 2nd pin of 2nd motor 
sbit forward=P1^0;   // forward button
sbit backward=P1^1;  // backward button
sbit left=P1^2;      // left button
sbit right=P1^3;     // right button

 void main()
    {
	forward=backward=left=right=0;  // make all button as zero
        while(1)
	  {		
	       if(forward==1)   // check forward button if pressed then enter in loop
	        {
	           m11=1;     
	           m12=0;
	           m21=1;
	           m22=0;
                }
	      else if(right==1)  // check backward button if pressed then enter in loop
	        {
		    m11=1;
	            m12=0;
	            m21=0;
	            m22=0;			 
                }
	      else if(left==1)  // check left button if pressed then enter in loop
	        {
		    m11=0;
	            m12=0;
	            m21=1;
	            m22=0;
                }
	   
              else if(backward==1)  // check right button if pressed then enter in loop
	        {
		   m11=0;
		   m12=1;
		   m21=0;
		   m22=1;
                }
	      else
	        {
		   m11=0;
	           m12=0;
	           m21=0;
	           m22=0;
                }
	   }
    }	 

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)

_______________________________________________________________________________________________________

2. Program of STEPPER MOTOR Controlled By Switches With 8051

/******************************************************
IDE :- Keil
DEVELOPED BY:- FIRMWARE DEVELOPER (www.firmcodes.com)
WHAT PROGRAM DO:- CONTROLLING STEPPER MOTOR BY SWITCH USING 8051
******************************************************/
#include<reg51.h>

sbit a1=P2^4;  // 1 pin of gear motor is attached with this pin
sbit a2=P2^5;  // 2 pin of gear motor is attached with this pin
sbit a3=P2^6;  // 3 pin of gear motor is attached with this pin
sbit a4=P2^7;  // 4 pin of gear motor is attached with this pin
sbit one=P1^0;  
sbit two=P1^1;  
sbit three=P1^2;    
sbit four=P1^3;  

void main()
  {
	one=two=three=four=0;
	a1=a2=a3=a4=0;
	while(1)
	  {
		// rotate gear motor step by step pressing button
		if(one==1)
		  {
		     a2=a3=a4=0;
		     a1=1;
                  }
		else if(two==1)
		  {
			a1=a2=a4=0;
	                a3=1;
                   }
		else if(three==1)
		  {
			a1=a2=a3=0;
	                a4=1;
                   }
		else if(four==1)
		  {
		        a1=a3=a4=0;
	                a2=1;
                  }	  
          }
    }

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)

_________________________________________________________________________________________________

Content for the tab VIDEO