Skip to main content

Featured Post

Kerala's First 3D Printed Building

Created as a showcase project, AMAZE-28, the single-room summer house, was successfully constructed within 28 days on the grounds of the Kerala State Nirmithi Kendra. The 3D-printed building at the Kerala State Nirmithi Kendra in Thiruvananthapuram. (Photo: Shekunj)  The inauguration of Kerala's inaugural 3D-printed structure, a 380-square-foot single-room summer house, is scheduled to take place on October 10 at the Kerala State Nirmithi Kendra (Kesnik) campus located in PTP Nagar, Thiruvananthapuram.  Conceived as a showcase initiative, the summer house named AMAZE-28 was successfully finished within a mere 28 days. This impressive project was executed by Tvasta, a construction technology startup based in Chennai, founded by alumni of IIT-Madras, who have entered into a memorandum of understanding (MoU) with Kesnik.  AMAZE-28 is perched upon a concrete foundation atop a gentle elevation within the Kesnik campus. Febi Varghese, the Director and Chief Executive Officer of...

Speed Control of DC Motor using Arduino and L293D Motor Driver

 

L293D is a dual H-bridge motor driver integrated circuit that allows you to control the direction and speed of two DC motors simultaneously. In this tutorial, we will go over how to use the L293D motor driver with Arduino to control the movement of DC motors. Whether you are a beginner or an experienced engineer, you will find this guide helpful.

L293D Motor Driver and Arduino

Introduction to L293D Motor Driver

LThe L293D is a dual H-bridge motor driver integrated circuit that allows you to control the direction and speed of two DC motors simultaneously. This versatile IC is a popular choice for controlling motors in a wide range of applications, from small robots to automation systems.

The L293D is a 16-pin integrated circuit that is designed to drive DC motors. It works by applying a voltage to the inputs, which then outputs a controlled current to the motors. This current is what drives the motors and changes their direction and speed. The L 293D is capable of driving motors up to 600mA, making it ideal for small to medium-sized motors.

Pin Diagram of the L293D Motor Driver

The L293D IC has 16 pins, which are numbered as shown in the following pin diagram:


Components Required

  • Arduino Uno
  • L293D motor driver
  • DC Motors
  • 9V battery
  • Breadboard
  • Jumper wires
  • Power supply unit

Connecting the L293D Motor Driver to the Arduino

  1. Start by connecting the L293D motor driver to the breadboard.
  2. Connect the power supply unit to the breadboard, providing power to the L293D and the motors.
  3. Connect the DC motors to the L293D. Connect Motor 1 to Output 1 and 2; Motor 2 to Output 3 and 4.
  4. Connect the L293D to the Arduino. Connect pin 1, 9, and 16 of L293D to the 5V pin on the Arduino and pin 4, 5, 12, and 13 to the ground. Connect the inputs (pins 2, 7, 10, and 15) to the digital pins 2, 3, 4, and 5 on the Arduino.
  5. Finally, connect the battery to the pin 8 on L293D to provide power to the motors.
  6. Refer the figure given below for the circuit connection.

L293D Motor Driver to the Arduino
L293D Motor Driver to the Arduino

Direction Control of DC Motor using L293D and Arduino

  1. Start by opening the Arduino IDE and creating a new sketch
  2. In the setup function, set the digital pins connected to the inputs of the L293D as outputs.
  3. In the loop function, use the digitalWrite function to change the state of the inputs and control the direction and speed of the motors.
int motor1Pin1 = 2;
int motor1Pin2 = 3;
int motor2Pin1 = 4;
int motor2Pin2 = 5;

void setup() {
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(motor2Pin1, OUTPUT);
  pinMode(motor2Pin2, OUTPUT);
}

void loop() {
  digitalWrite(motor1Pin1, HIGH);
  digitalWrite(motor1Pin2, LOW);
  digitalWrite(motor2Pin1, HIGH);
  digitalWrite(motor2Pin2, LOW);
  delay(1000);
  digitalWrite(motor1Pin1, LOW);
  digitalWrite(motor1Pin2, HIGH);
  digitalWrite(motor2Pin1, LOW);
  digitalWrite(motor2Pin2, HIGH);
  delay(1000);
}

Also Read: Controlling an LED using Arduino and Python GUI: Arduino Projects

Speed control of DC Motor using L293Motor Driver

Controlling the speed of a DC motor using an L293D motor driver and an Arduino is a simple process. The L 293D has two inputs for each motor, allowing you to control the direction of the motor and the speed. By pulsing the inputs with different duty cycles, you can control the speed of the motor.

Here's how you can control the speed of a motor using the L293D and an Arduino:

Control the speed of a motor using the L293D
  1. Connect the L 293D to a breadboard and power supply unit. Connect the positive and negative terminals of the motor to the L293D's output pins.
  2. Connect the L293D to the Arduino. Connect the inputs pins 2 to the digital pin 9 (PWM) on the Arduino and pin 7 of L293D to the Ground. Connect pins 1, 9, and 16 to the 5V pin on the Arduino and pin 8 of L293D to the power supply as shown in the figure above.
  3. Write a program in the Arduino IDE to control the speed of the motor. Use the analogWrite() function to pulse the input pins with a duty cycle that corresponds to the desired speed. For example, a duty cycle of 128 will result in half-speed, while a duty cycle of 255 will result in full-speed.
int enablePin = 9;

void setup() {
  pinMode(enablePin, OUTPUT);
}

void loop() {
  // Full speed
  analogWrite(enablePin, 255);
  delay(1000);
  
  // Half speed
  analogWrite(enablePin, 128);
  delay(1000);
}
  1. Upload the program to the Arduino and test the motor. You should be able to control the speed of the motor by changing the duty cycle of the input pins.

It's that simple! By using the L293D motor driver and an Arduino, you can control the speed of a DC motor with ease. You can also experiment with different duty cycles to find the ideal speed for your project.

Control DC Motor Speed using Potentiometer + L293D + Arduino

Controlling the speed of a DC motor using an L293D motor driver, an Arduino, and a 10K potentiometer is a simple and effective way to adjust the motor speed in real time. The potentiometer acts as a variable resistor, allowing you to control the duty cycle of the PWM signal that drives the motor.

Here's how you can control the speed of a DC motor using an L293D motor driver, an Arduino, and a 10K potentiometer:

Speed control using Potentiometer and L293D
Speed control using Potentiometer and L293D

  1. Upload the program to the Arduino and test the motor. You should be able to control the speed of the motor by turning the potentiometer.

By using the L 293D motor driver, an Arduino, and a 10K potentiometer, you can easily control the speed of a DC motor with high precision. This method is ideal for applications where real-time control of the motor speed is required, such as in robotics and Lautomation projects.

Conclusion

In this tutorial, we went over the steps to use the L 293D motor driver with an Arduino to control the movement of DC motors. We covered the basic components and wiring needed, as well as a simple example program to control the motors.

The L 293D motor driver is a versatile and easy-to-use IC for controlling DC motors. By following this tutorial, you should have a good understanding of how to use the L 293D with an Arduino and be able to create your own projects that involve motor control.

In addition to the L 293D, there are many other motor drivers and motor driver shields available that you can use with an Arduino. The L 293D motor driver shield is a popular option that provides a convenient way to connect the L 293D to an Arduino without having to wire everything together yourself.

In any case, the important thing is to understand the basic principles of motor control and how to use motor drivers like the L 293D to achieve it. With a little bit of practice and experimentation, you will be able to create your own projects that involve motor control and bring your ideas to life.




Comments

Popular posts from this blog

Controlling LEDs over WiFi using NodeMCU and Blynk App.

This article is the base on the Internet of things ( IoT ) . IoT describes the network of physical objects—“things” or objects—that are embedded with sensors, software, and other technologies for the purpose of connecting and exchanging data with other devices and systems over the Internet. In this article 3 LEDs will be controlled by an android application (made using Blynk) over a wifi connection. How to use NodeMCU with Blynk  If you want to start learn the Internet of Things (IoT) concept, then controlling a LED over the  internet is the " Hello World!" of the IoT journey. Performing the " Hello World" task will be easy using NodeMCU micro-controller as the first client and Blynk as the 'broker' or server and Blynk android application as the second client. Now communication between two clients will happen through broker over the internet. Now lets, make this happen.  Components Required For this activity we will need following components: Nod...

How to Know the NodeMCU IP Address for Your Next IoT Project

  NodeMCU IP Address: The NodeMCU is a popular development board for IoT projects. It’s small, affordable, and comes with built-in Wi-Fi connectivity, making it the perfect choice for creating connected devices. But before you can start building your NodeMCU projects, you need to know the IP address of your device. This IP address is essential for communicating with the NodeMCU from another device, such as a computer or smartphone. In this article, we’ll show you how to find the NodeMCU IP address, so you can get started with your next IoT project. Method 1: To Know the NodeMCU IP Address One of the easiest ways to find the NodeMCU IP address is by using the serial monitor in the Arduino IDE. First, connect your NodeMCU board to your computer using a micro-USB cable. Then, upload the following code to the NodeMCU: #include <ESP8266WiFi.h> void setup() { Serial.begin(115200); Serial.println(); Serial.print("Connecting to "); Serial.println(...

Blinking of LED Using Arduino UNO

Hi !!!! Here we are going to learn very very simple use of Arduino, that is blinking of a LED. Here we will do simplest project using Arduino. So, here we go.... COMPONENTS REQUIRED - Bread Board Arduino UNO Jumper Wires Power Source (5V) / Battery Resistor (1K) CIRCUIT PREPA RATION - Take bread board and Arduino. Connect the +5V from Arduino to the +Ve line on Bread Board and GROUND from Arduino to -Ve line on bread board. Red Wire     : +5 V Black Wire  : GROUND     Now put a LED on bread board. Connect the Anode (+ / Longer terminal) of led to the pin 13 of Arduino. Connect Cathode (- / Shorter terminal)  to 1K ohm resistor and connect another terminal of resistor to the GND on breadboard.   Now our circuit is ready to work.  Our next aim is to build the code. Let's make our code. CODE -     To download the complete code -  CLICK HERE -----------------------------...