L293D Motor Driver IC
L293D Motor Driver IC
The L293D is a dual H-bridge motor driver integrated circuit (IC) designed to drive inductive loads such as DC motors, relays, and solenoids. It is a popular and widely used component in robotics, automation, and IoT projects that require bidirectional motor control.
The L293D motor driver IC is capable of driving two DC motors independently, allowing for simultaneous forward and reverse rotation, as well as braking. The IC provides a high-current output stage that can handle high-voltage and high-current loads, making it suitable for driving a wide range of DC motors.
| The pinout for the L293D motor driver IC is as follows |
| Pin Number | Pin Name | Function |
| --- | --- | --- |
| 1 | EN1 | Enable Input for H-Bridge 1 |
| 2 | IN1 | Direction Input for Motor 1 |
| 3 | IN2 | Direction Input for Motor 1 |
| 4 | VCC1 | Power Supply for H-Bridge 1 |
| 5 | OUT1 | Output Pin for Motor 1 |
| 6 | OUT2 | Output Pin for Motor 1 |
| 7 | GND | Ground |
| 8 | VCC2 | Power Supply for H-Bridge 2 |
| 9 | OUT3 | Output Pin for Motor 2 |
| 10 | OUT4 | Output Pin for Motor 2 |
| 11 | IN3 | Direction Input for Motor 2 |
| 12 | IN4 | Direction Input for Motor 2 |
| 13 | EN2 | Enable Input for H-Bridge 2 |
| 14-16 | NC | No Connection |
| The L293D motor driver IC is commonly used in |
Robotics and robotic arms
CNC machines and 3D printers
Automation systems
IoT projects requiring motor control
Hobby projects such as remote-controlled cars and drones
The L293D motor driver IC is a versatile and reliable component for driving DC motors in a wide range of applications. Its dual H-bridge configuration, high-current output, and internal protection features make it an ideal choice for designers and engineers requiring bidirectional motor control.
L293D Motor Driver IC DocumentationOverviewThe L293D is a dual H-bridge motor driver integrated circuit (IC) that allows bidirectional control of two DC motors or a single stepper motor. It is commonly used in robotics, automation, and IoT projects to control motor speed and direction.Pinout and DescriptionThe L293D IC has a 16-pin package with the following pinout:| Pin # | Pin Name | Description |
| --- | --- | --- |
| 1 | Enable 1 (EN1) | Enables/Disables Motor 1 |
| 2 | Input 1 (IN1) | Input for Motor 1 direction control |
| 3 | Input 2 (IN2) | Input for Motor 1 direction control |
| 4 | Output 1 (OUT1) | Output for Motor 1 |
| 5 | Output 2 (OUT2) | Output for Motor 1 |
| 6 | GND | Ground connection |
| 7 | VCC | Power supply (5V or 12V) |
| 8 | Output 3 (OUT3) | Output for Motor 2 |
| 9 | Output 4 (OUT4) | Output for Motor 2 |
| 10 | Input 3 (IN3) | Input for Motor 2 direction control |
| 11 | Input 4 (IN4) | Input for Motor 2 direction control |
| 12 | Enable 2 (EN2) | Enables/Disables Motor 2 |
| 13 | SENSE | Sense pin for motor current monitoring (optional) |
| 14 | VCC1 | Power supply for internal circuitry (5V) |
| 15 | GND1 | Ground connection for internal circuitry |
| 16 | VCC2 | Power supply for internal circuitry (5V) |Example 1: Controlling a DC Motor with an ArduinoIn this example, we'll use an Arduino Uno to control the speed and direction of a DC motor using the L293D motor driver IC.Hardware Connections:L293D IC: VCC to Arduino's 5V, GND to Arduino's GND, EN1 to Arduino's Digital Pin 2, IN1 to Arduino's Digital Pin 3, IN2 to Arduino's Digital Pin 4, OUT1 and OUT2 to DC motor
Arduino Uno: Digital Pins 2, 3, and 4 to L293D ICCode:
```c++
const int enPin = 2; // Enable pin for motor 1
const int in1Pin = 3; // Input pin for motor 1 direction control
const int in2Pin = 4; // Input pin for motor 1 direction controlvoid setup() {
pinMode(enPin, OUTPUT);
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
}void loop() {
// Set motor direction (clockwise)
digitalWrite(in1Pin, HIGH);
digitalWrite(in2Pin, LOW);// Set motor speed (50% duty cycle)
analogWrite(enPin, 128);delay(2000);// Set motor direction (counterclockwise)
digitalWrite(in1Pin, LOW);
digitalWrite(in2Pin, HIGH);// Set motor speed (50% duty cycle)
analogWrite(enPin, 128);delay(2000);
}
```
Example 2: Controlling a Stepper Motor with a Raspberry PiIn this example, we'll use a Raspberry Pi to control the direction and step rate of a stepper motor using the L293D motor driver IC.Hardware Connections:L293D IC: VCC to Raspberry Pi's 5V, GND to Raspberry Pi's GND, EN1 to Raspberry Pi's GPIO Pin 17, IN1 to Raspberry Pi's GPIO Pin 23, IN2 to Raspberry Pi's GPIO Pin 24, OUT1 and OUT2 to Stepper motor
Raspberry Pi: GPIO Pins 17, 23, and 24 to L293D ICCode (Python):
```python
import RPi.GPIO as GPIO
import timeGPIO.setmode(GPIO.BCM)enPin = 17 # Enable pin for motor 1
in1Pin = 23 # Input pin for motor 1 direction control
in2Pin = 24 # Input pin for motor 1 direction controlGPIO.setup(enPin, GPIO.OUT)
GPIO.setup(in1Pin, GPIO.OUT)
GPIO.setup(in2Pin, GPIO.OUT)while True:
# Set motor direction (clockwise)
GPIO.output(in1Pin, GPIO.HIGH)
GPIO.output(in2Pin, GPIO.LOW)# Set motor step rate (500 steps per second)
GPIO.output(enPin, GPIO.HIGH)
time.sleep(0.002)
GPIO.output(enPin, GPIO.LOW)
time.sleep(0.002)# Set motor direction (counterclockwise)
GPIO.output(in1Pin, GPIO.LOW)
GPIO.output(in2Pin, GPIO.HIGH)# Set motor step rate (500 steps per second)
GPIO.output(enPin, GPIO.HIGH)
time.sleep(0.002)
GPIO.output(enPin, GPIO.LOW)
time.sleep(0.002)
```
Note: These examples are for illustration purposes only and may require modifications for specific use cases. Ensure proper voltage and current ratings for the motor driver IC and connected components.