Saturday, September 26, 2015

BIDIRECTIONAL MOTOR CONTROL USING L293D AND ARDUINO IN PROTEUS

INTRODUCTION

if you dont know how to simulate Arduino in Proteus Simulator click here to know or visit my previous post about using arduino in proteus. 

Arduino is an open source development board which is very good research and learning platform for technical and non technical person. It is very easy and comfortable to use in most of the situation from school project to the professional job. So it gives us knowledge about electronics and help develop idea of all age students. Learning arduino is awesome with enough hardware but sometimes we can not have all the component and arduino to research and design a project due to money and many thing so there is a solution of this problem.. We can design and code and test the system even if we dont have enough hardware. Yes we can solve it with computer having arduino IDE and proteus simulator. 
So i tried here to present an idea about the same thing that how can we use arduino in proteus to design and code system.


The following tutorial helps you to use a motor with motor driver IC L293D to control motor bidirectionally i.e. we can rotate motor in both direction using arduino . The tutorial also helps you to simulate it in proteus simulator. Here arduino is used as master controller of the motor. The motor driver is used to change the direction of the motor rotation according to the input from arduino. In this tutorial the program is coded so as to rotate 2 motor in 4 ways which can be used in ROBOTICS to control motion of robots by modifying the program. 

L293D MOTOR DRIVER CONTROLLER

if you dont know how to simulate Arduino in Proteus Simulator click here to know or visit my previous post about using arduino in proteus. 

This is the motor driver ic and it can control maximum of 4 motors in unidirectional and 2 motors in bidirectional motion. No external H-bridge configuration is necessary. It has 16 pins. 


 ==> There are two Vcc's and 4 gnd. Connect Vcc's to positive terminal of power supply and gnd to  
          negative terminal of the power supply.
==>  Enable 1,2 and enable 3,4 are the pin used to control speed of the motor  by sending pwm 
         signal from arduino but we here just deal about bidirectional motor control so we connect them          together to positive terminal of the power supply so that motor rotates with its full speed.
==>  input 1 and input 2 are connected to the 13 and 12 digital i/o pin of arduino respectively
==>  input 3 and input 4 are connected to the 4 and 3 digital i/p pin of arduino respectively.
==>  output 1 and output 2 are connected to first motor and output 3 and output 4 are connected to              second motor

WORKING OF MOTOR DRIVER

Inside motor driver there are H bridge configuration. The output of the motor is completely dependent on the input bit supplied on it. 

inputs                         outputs

in1=0  and in2=0   ========> motor stops
in1=0  and in2=1   ========> motor revolves clockwise(or anti-clock wise)
in1=1  and in2=0   ========> motor revolves anticlockwise (or clockwise)
in1=1  and in2=1   ========> motor stops but this is not suitable and for mosfet driver it will burn                                                       mosfet so dont make it happen

CIRCUIT DIAGRAM 

if you dont know how to simulate Arduino in Proteus Simulator click here to know or visit my previous post about using arduino in proteus. 

open your proteus and assemble the component and connect them as show in the diagram below. 

CODE OR PROGRAM

if you dont know how to simulate Arduino in Proteus Simulator click here to know or visit my previous post about using arduino in proteus. 

==>  open your arduino ide and write the following program . 
 int l1=12;
 int l2=13;
 int r1=3;
 int r2=4;
 void setup() {
  // put your setup code here, to run once:
  pinMode(l1,OUTPUT);
  pinMode(l2,OUTPUT);
  pinMode(r1,OUTPUT);
  pinMode(r2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  {
      digitalWrite(l1,HIGH);
      digitalWrite(l2,LOW);
      digitalWrite(r1,HIGH);
      digitalWrite(r2,LOW);
  } 
  delay(5000); 
    {
      digitalWrite(l1,LOW);
      digitalWrite(l2,HIGH);
      digitalWrite(r1,LOW);
      digitalWrite(r2,HIGH);
  }
  delay(5000); 
    {
      digitalWrite(l1,HIGH);
      digitalWrite(l2,LOW);
      digitalWrite(r1,LOW);
      digitalWrite(r2,HIGH);
  }
  delay(5000); 
    {
      digitalWrite(l1,LOW);
      digitalWrite(l2,HIGH);
      digitalWrite(r1,HIGH);
      digitalWrite(r2,LOW);
  }
  delay(5000); 
}
==>  compile the code
==>  copy the hex file shown in the compile window
==>  go to proteus
==>  click the arduino to make it red color
==>  again click it and a new window opens
==>  paste the copied file on the program file section of the new window
==>  click ok


if you dont know how to simulate Arduino in Proteus Simulator click here to know or visit my previous post about using arduino in proteus. 


then the motor starts running and as already said the motor will run in 4 different ways and it remains running one way for 5 seconds

 learning is exploring so try to modify circuit as well as the program to develop new idea and if you have idea please share with me.. also share your output with me..................................................

  for more updates please follow me .. 


help all others to reach this tutorial so that beginners feel easy.   

No comments:

Post a Comment