INTERFACE OF ARDUINO AND DC MOTOR USING DRIVER IC L293D

In the previous sections, you learned about motor rotations and L293D IC to protect our circuitry and for high voltage motors. Then interfacing of the motor with L293D IC. Now in this section, we added Arduino and you see how to interface of Arduino and DC motor using driver L293D IC.

REQUIRED MATERIAL

S.N. COMPONENT QUANTITY
1. Arduino UNO 1
2. L293D IC 1
3. Motor 5V 1
4. Button and Resistor
(Logic-state is HIGH & LOW signal)
2
5. Connecting Wires approx 20

CIRCUIT DIAGRAM

INTERFACE OF ARDUINO AND DC MOTOR USING DRIVER IC L293D
Click to Zoom

CODE INTERFACING OF ARDUINO AND DC MOTOR USING DRIVER IC L293D

int bt1 = 2, bt2 = 3;
int bs1 = 0, bs2 = 0;
int o1 = 12, o2 = 13;
int del = 10;
void setup() {
  pinMode(bt1, INPUT);
  pinMode(bt2, INPUT);
  pinMode(o1, OUTPUT);
  pinMode(o2, OUTPUT);
}

void loop() {
  bs1 = digitalRead(bt1); delay(del);
  bs2 = digitalRead(bt2); delay(del);

  if (bs1 == HIGH) {
    digitalWrite(o1, HIGH);
  }
  else if (bs1 == LOW) {
    digitalWrite(o1, LOW);
  }

  if (bs2 == HIGH) {
    digitalWrite(o2, HIGH);
  }
  else if (bs2 == LOW) {
    digitalWrite(o2, LOW);
  }
}

OUTPUT

If you give logic 1 to the pin 2 then it turns output pin 12 as HIGH and motor will start rotating clockwise

And if you give logic 1 to pin 3 then it turns output pin 13 as HIGH and the motor will start rotating anti-clockwise.

Arduino Motor Interfacing using L293D
Click to Zoom

READ NEXT
SERVO MOTOR WITH ARDUINO


 

Total Visits: 1922
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x