Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use L293D: Examples, Pinouts, and Specs

Image of L293DDesign with L293D in Cirkit Designer

Introduction

The L293D is a quadruple high-current half-H driver designed to control the direction and speed of DC motors and stepper motors. It is a versatile motor driver IC that can drive two motors simultaneously, making it ideal for robotics and automation projects. The L293D can handle up to 600 mA of continuous current per channel, with a peak current of 1.2 A. Additionally, it features built-in diodes for back EMF protection, ensuring safe operation when driving inductive loads like motors.

Explore Projects Built with L293D

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO Controlled Obstacle Avoiding Robot with L293D Motor Driver and Ultrasonic Sensor: A project utilizing L293D in a practical application
Arduino UNO Controlled Obstacle Avoiding Robot with L293D Motor Driver and Ultrasonic Sensor

This circuit is designed to control a robot with four DC motors for movement, an ultrasonic sensor for distance measurement, and a servo motor to direct the sensor. The L293D driver shield interfaces with the motors, while the Arduino UNO microcontroller runs the embedded code to process sensor data and control motor speeds and directions. An LCD display is included for output, and power is supplied by a 4 x AAA battery mount.

Open Project in Cirkit Designer
Image of Arduino-Controlled Dual DC Motor Driver with Hall Effect Sensors and Indicator LEDs: A project utilizing L293D in a practical application
Arduino-Controlled Dual DC Motor Driver with Hall Effect Sensors and Indicator LEDs

This circuit controls two DC motors using an L293D motor driver, with an Arduino UNO as the microcontroller. The Arduino reads inputs from three Hall sensors and controls the motors' direction based on the sensors' states, while also indicating the sensors' status through three LEDs. Each LED and Hall sensor is connected to the Arduino with a current-limiting resistor, and the motors' operation is dependent on the Hall sensors' signals.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

The L293D is a 16-pin IC. Below is the pin configuration:

Pin Number Pin Name Description
1 Enable 1,2 Enables and disables the first motor (High = Enabled, Low = Disabled)
2 Input 1 Logic input to control the direction of Motor 1
3 Output 1 Output connected to one terminal of Motor 1
4 GND Ground (common ground for logic and motor power supply)
5 GND Ground (common ground for logic and motor power supply)
6 Output 2 Output connected to the other terminal of Motor 1
7 Input 2 Logic input to control the direction of Motor 1
8 Vcc2 (Motor) Motor power supply (4.5 V to 36 V)
9 Enable 3,4 Enables and disables the second motor (High = Enabled, Low = Disabled)
10 Input 3 Logic input to control the direction of Motor 2
11 Output 3 Output connected to one terminal of Motor 2
12 GND Ground (common ground for logic and motor power supply)
13 GND Ground (common ground for logic and motor power supply)
14 Output 4 Output connected to the other terminal of Motor 2
15 Input 4 Logic input to control the direction of Motor 2
16 Vcc1 (Logic) Logic power supply (5 V)

Usage Instructions

How to Use the L293D in a Circuit

  1. Power Supply: Connect the motor power supply to Vcc2 (Pin 8) and the logic power supply to Vcc1 (Pin 16). Ensure that the ground pins (Pins 4, 5, 12, and 13) are connected to the common ground.
  2. Motor Connections: Connect the motor terminals to the output pins (Output 1 and Output 2 for Motor 1, Output 3 and Output 4 for Motor 2).
  3. Control Inputs: Use the input pins (Input 1, Input 2, Input 3, and Input 4) to control the direction of the motors. A HIGH signal on one input and a LOW signal on the other will determine the motor's rotation direction.
  4. Enable Pins: Set the enable pins (Enable 1,2 and Enable 3,4) HIGH to activate the corresponding motor channels.

Important Considerations and Best Practices

Example: Using L293D with Arduino UNO

Below is an example of controlling a DC motor using the L293D and Arduino UNO:

// Define motor control pins
const int enablePin = 9;  // Enable pin for Motor 1
const int input1 = 2;     // Input 1 for Motor 1
const int input2 = 3;     // Input 2 for Motor 1

void setup() {
  // Set motor control pins as outputs
  pinMode(enablePin, OUTPUT);
  pinMode(input1, OUTPUT);
  pinMode(input2, OUTPUT);

  // Initialize motor in stopped state
  digitalWrite(enablePin, LOW);  // Disable motor
  digitalWrite(input1, LOW);     // Set Input 1 to LOW
  digitalWrite(input2, LOW);     // Set Input 2 to LOW
}

void loop() {
  // Rotate motor clockwise
  digitalWrite(enablePin, HIGH); // Enable motor
  digitalWrite(input1, HIGH);    // Set Input 1 to HIGH
  digitalWrite(input2, LOW);     // Set Input 2 to LOW
  delay(2000);                   // Run motor for 2 seconds

  // Stop motor
  digitalWrite(enablePin, LOW);  // Disable motor
  delay(1000);                   // Wait for 1 second

  // Rotate motor counterclockwise
  digitalWrite(enablePin, HIGH); // Enable motor
  digitalWrite(input1, LOW);     // Set Input 1 to LOW
  digitalWrite(input2, HIGH);    // Set Input 2 to HIGH
  delay(2000);                   // Run motor for 2 seconds

  // Stop motor
  digitalWrite(enablePin, LOW);  // Disable motor
  delay(1000);                   // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motor Not Running:

    • Ensure the enable pin is set HIGH.
    • Verify the power supply connections to Vcc1 and Vcc2.
    • Check the input pin logic levels.
  2. Motor Running in the Wrong Direction:

    • Swap the HIGH and LOW signals on the input pins for the motor.
  3. Overheating:

    • Reduce the motor load or add a heat sink to the L293D.
    • Ensure the motor's current does not exceed the IC's maximum ratings.
  4. Noisy Operation:

    • Add decoupling capacitors near the power supply pins.
    • Check for loose connections in the circuit.

FAQs

Q: Can the L293D drive stepper motors?
A: Yes, the L293D can drive stepper motors by controlling the sequence of inputs to the motor coils.

Q: Can I use the L293D with a 3.3 V microcontroller?
A: The L293D requires a minimum logic voltage of 4.5 V. Use a level shifter or a 5 V microcontroller for compatibility.

Q: How many motors can the L293D control?
A: The L293D can control up to two DC motors or one stepper motor.

Q: Do I need external diodes for back EMF protection?
A: No, the L293D has built-in diodes for back EMF protection.