L293D Motor Driver and Arduino: DC Motor Speed Controlling Project
Introduction:
L293D Motor Driver and Arduino: Motor Speed Controlling Project- In this article, we will see how to control the speed of a DC motor using L293D motor driver with Arduino. The L293D is a popular motor driver chip that allows you to easily control the direction and speed of a DC motor. By connecting L293D to Arduino, you can make various projects related to motor control
By connecting L293D to Arduino, we can control the speed of two DC motors. When we connect a DC motor to Arduino, it receives voltage up to 5V. However, by using a potentiometer in our project, we will adjust it and send it to the DC motor. Below is the list of items required for this system, then assemble them to create the circuit, and then program it. You can use this project to create a DC motor fan or even control the speed of a remote control car. Let’s get started!
Speed Control Using Arduino
Materials Needed:
Arduino Nano USB-C Type (Recommended)
*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
About L293D Motor Driver:
L293D is one of the most popular drivers in the market. There are several reasons that make L293D the preferred choice for users, such as its low cost (compared to other drivers), suitable shape and size, easy controllability, no need for protection circuits and diodes, no need for heat sinks, good resistance to temperature variations, and high-speed changes. This IC can be set to voltages from 5V to 36V, with a motor current of up to 600 mA. However, it can withstand currents of up to 1200 mA for up to 100 microseconds without repetition. The frequency of this IC is 5 kHz. If your motor meets these specifications, do not hesitate to use L293D.
L293D Features and Specifications
The L293 and L293D devices are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional drive currents of up to 1A at voltages from 4.5V to 36V, while the L293D is designed to provide bidirectional drive currents of up to 600mA at voltages from 4.5V to 36V. Both devices are designed for driving inductive loads such as relays, solenoids, DC and bipolar stepping motors, and other high-current/high-voltage loads in positive-supply applications.
Each output is a complete totem pole drive circuit with a Darlington transistor receiver and a pseudo-Darlington source. The drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. The L293 and L293D can operate from 0°C to 70°C.
Other important features of L293D include:
- Wide supply voltage range: 4.5V to 36V.
- Independent input logic supply.
- Internal ESD protection.
- High noise immunity inputs.
- Output current per channel: 1A (600mA for L293D).
- Peak output current per channel: 2A (1.2A for L293D).
- Output clamp diodes for inductive transient suppression (L293D).
L293D Motor Driver Pinout
Enable Pins (1, 9): Pins 1 and 9 are enable pins for the first and second set of motor drivers. These pins need to be HIGH to enable the respective motor drivers.
Input Pins (2, 7, 10, 15): These pins (2, 7 for Motor 1; 10, 15 for Motor 2) are the input pins for controlling the direction of the motors. When specific input pins are set HIGH or LOW, the corresponding motor will rotate in the desired direction.
Output Pins (3, 6, 11, 14): These pins (3, 6 for Motor 1; 11, 14 for Motor 2) are connected to the motors. The output voltage and current from these pins drive the motors.
Ground Pins (4, 5, 12, 13): These pins are connected to ground (GND) and provide the reference voltage for the IC.
VCC Pins (8, 16): These pins are connected to the positive power supply (VCC) for the IC. They typically receive a voltage between 5V and 36V.
Free-Wheeling Diodes (16, 8): Each output (pins 3, 6, 11, 14) has a diode connected to the positive power supply. These diodes help in protecting the IC from back EMF generated by the motors during their operation.
DC Motor Speed Control with L293D and Arduino Circuit
The DC Motor Speed Controller Circuit Image is provided. You can create it. It uses the L293D Dual DC Motor Driver. Currently, we will control one DC motor with it. I have used an external power source to provide power, which allows you to use up to 12V. You can use a potentiometer with it. I have created this circuit in Fritzing.
L293D Motor Driver Arduino Coding
Copy this program and launch the Arduino IDE software. Paste this program into Arduino Uno and upload it. Then you will be able to control the speed of the DC motor, and your project will be ready.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
int potPin = A0; int potValue = 0; //Motor A const int motorPin1 = 5; const int motorPin2 = 6; void setup(){ pinMode(potPin,INPUT); Serial.begin(9600); pinMode(motorPin1, OUTPUT); pinMode(motorPin2, OUTPUT); } void loop(){ sensorValue = analogRead(potPin); analogWrite(motorPin1,potValue/4); analogWrite(motorPin2,0); Serial.print(potValue/4); } |
After uploading the sketch, your project will work correctly to control the speed of DC motors. When you rotate the potentiometer, the speed of the DC motor will increase or decrease.
Conclusion
Congratulations! You have successfully learned how to control the speed of a DC motor using L293D motor driver with Arduino. With this knowledge, you can now create various projects related to robotics, automation, and other equipment control. Have fun experiencing and exploring the possibilities!