Introduction: L293d With Linkit One

Picture of L293d With Linkit One

Hi,

In this tutorial I am going to tell about controlling dc motors using linkit one with L293d Ic.L293D is a typical Motor driver or Motor Driver integrated circuit which is used to drive direct current on either direction. It is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motor with a single L293D IC. Dual H-bridge Motor Driver integrated circuit (IC).The l293d can drive small and quite big motors as well.Source wikipedia.

Step 1: Why L293d??

Picture of Why L293d??

It is capable of handling PWM as easy to use rather than making switch circuit using transistors and diodes.To prevent harm to our device we use this as dc motors provide reverse voltage.

Step 2: Things Required

Picture of Things Required

We need :-

  • L293d
  • Linkit one
  • USB cable or battery
  • Breadboard
  • Jumper wires
  • Battery

Step 3: Circuit

Picture of Circuit

Arrange everything as shown in picture.Leave some wires for motors and battery.It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to be flown in either direction. As you know voltage need to change its direction for being able to rotate the motor in clockwise or anticlockwise direction, Hence H-bridge IC are ideal for driving a DC motor.

In a single l293d chip there two h-Bridge circuit inside the IC which can rotate two dc motor independently. Due its size it is very much used in robotic application for controlling DC motors. Given below is the pin diagram of a L293D motor controller. There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor, the pin 1 and 9 need to be high. For driving the motor with left H-bridge you need to enable pin 1 to high. And for right H-Bridge you need to make the pin 9 to high. If anyone of the either pin1 or pin9 goes low then the motor in the corresponding section will suspend working. It’s like a switch.Source rakesmondal.info

Step 4: Done!!

Picture of Done!!

/ Use this code to test your motor with the linkit one board:// if you need PWM, just use the PWM outputs on the Arduino// and instead of digitalWrite, you should use the analogWrite command// --------------------------------------------------------------------------- Motorsint motor_left[] = {2, 3};int motor_right[] = {7, 8};// --------------------------------------------------------------------------- Setupvoid setup() {Serial.begin(9600);// Setup motorsint i;for(i = 0; i < 2; i++){pinMode(motor_left[i], OUTPUT);pinMode(motor_right[i], OUTPUT);}}// --------------------------------------------------------------------------- Loopvoid loop() { drive_forward();delay(1000);motor_stop();Serial.println("1");drive_backward();delay(1000);motor_stop();Serial.println("2");turn_left();delay(1000);motor_stop();Serial.println("3");turn_right();delay(1000);motor_stop();Serial.println("4"); motor_stop();delay(1000);motor_stop();Serial.println("5");}// --------------------------------------------------------------------------- Drivevoid motor_stop(){digitalWrite(motor_left[0], LOW); digitalWrite(motor_left[1], LOW); digitalWrite(motor_right[0], LOW); digitalWrite(motor_right[1], LOW);delay(25);}void drive_forward(){digitalWrite(motor_left[0], HIGH); digitalWrite(motor_left[1], LOW); digitalWrite(motor_right[0], HIGH); digitalWrite(motor_right[1], LOW); }void drive_backward(){digitalWrite(motor_left[0], LOW); digitalWrite(motor_left[1], HIGH); digitalWrite(motor_right[0], LOW); digitalWrite(motor_right[1], HIGH); }void turn_left(){digitalWrite(motor_left[0], LOW); digitalWrite(motor_left[1], HIGH); digitalWrite(motor_right[0], HIGH); digitalWrite(motor_right[1], LOW);}void turn_right(){digitalWrite(motor_left[0], HIGH); digitalWrite(motor_left[1], LOW); digitalWrite(motor_right[0], LOW); digitalWrite(motor_right[1], HIGH); }

Hope you liked it.

Thank you!!

Comments

About This Instructable

886views

4favorites

License:

Bio: Thank you instructables!!
More by Gursimran Singh 425:Plant BoxDIY CNC For 60$ (Large Work Area)Advanced Mosquito Repeller and Swatter
Add instructable to: