Interfacing DC Motor With Arduino UNO | Embedded System | New Topic [2023]

In this article, Poly Notes Hub shares knowledge on how to interfacing dc motor with Arduino UNO. In this article, we will know about the circuit diagram, working principle, and the Code also.

Author Name: Arun Paul.

How to interfacing DC Motor With Arduino UNO ?

Required Components
  1. Arduino UNO
  2. Motor Driver IC L293D
  3. Two Motor
  4. Power Supply
Circuit Diagram
  1. Arduino D12, D11, D10, and D9 connected to the L293D’s PIN 2, PIN 7, PIN 10, and PIN 15 respectively.
  2. +5V and +12V supply provided to the IC’s PIN 16 and PIN 8.
  3. Motor 1 is connected to the PIN 3 and PIN 6 of the IC.
  4. Motor 2 is connected to the PIN 11 and PIN 14 of the IC.
  5. IC’s all ground pin should be connected to the negative terminal of the power supply.
interfacing dc motor with arduino uno
Arduino Code

Upload this code to the Arduino

void setup() {
  pinMode(12, OUTPUT); // l293d pin2 connected with D12 of Arduino
  pinMode(11, OUTPUT); // l293d pin7 connected with D11 of Arduino
  pinMode(10, OUTPUT); // l293d pin10 connected with D10 of Arduino
  pinMode(9, OUTPUT); // l293d pin15 connected with D9 of Arduino


}

void loop() {

  digitalWrite(12, HIGH); // For Motor 1 and Motor 2 Clockwise Direction
  digitalWrite(11, LOW);
  digitalWrite(10, HIGH); 
  digitalWrite(9, LOW);
  delay(3000); // Rotating Clockwise for 3 sec

  digitalWrite(12, LOW); // For Motor 1 and Motor 2 Break
  digitalWrite(11, LOW);
  digitalWrite(10, LOW); 
  digitalWrite(9, LOW);
  delay(2000); // Stop for 2 Sec

  digitalWrite(12, LOW); // For Motor 1 and Motor 2 Anti-Clockwise Direction
  digitalWrite(11, HIGH);
  digitalWrite(10, LOW); 
  digitalWrite(9, HIGH);
  delay(3000); // Rotating Clockwise for 3 sec

  digitalWrite(12, LOW); // For Motor 1 and Motor 2 Break
  digitalWrite(11, LOW);
  digitalWrite(10, LOW); 
  digitalWrite(9, LOW);
  delay(2000); // Stop for 2 Sec

}
Video for Reference ( Interfacing DC Motor with Arduino UNO )
Share To:

Leave a Reply

Your email address will not be published. Required fields are marked *