Skip to content
Home > Components > Actuators > Motor Driver (L293D)

Motor Driver (L293D)

A dual H-bridge motor driver IC capable of driving two DC motors bidirectionally or one bipolar stepper motor.

Component Preview

L293D Motor DriverL293D IC

The L293D is an integrated circuit motor driver that can be used for simultaneous, bidirectional control of two DC motors. It contains two built-in H-bridges and internal flyback diodes to protect your microcontroller.

ActuatorsDriverIC

Overview

Microcontrollers like the Arduino cannot output enough current to drive motors directly. The L293D acts as an amplifier: it takes low-current control signals from the Arduino and uses them to switch a higher-current power supply dedicated to the motors.

Pin Reference

(Note: Pin numbering starts top-left at the notch and goes down, then up the right side).

PinTypeDescription
EN1,2digitalEnable pin for Motor 1. High = ON, Low = OFF. (PWM for speed control).
IN1digitalInput 1 for Motor 1 direction control.
OUT1digitalOutput 1. Connect to motor 1 terminal A.
GND1/2powerGround. Connect to Arduino GND and battery GND.
OUT2digitalOutput 2. Connect to motor 1 terminal B.
IN2digitalInput 2 for Motor 1 direction control.
VCC2powerMotor Power (Vs). Connect to battery positive (up to 36V).
VCC1powerLogic Power (Vss). Connect to Arduino 5V.
IN4digitalInput 4 for Motor 2 direction control.
OUT4digitalOutput 4. Connect to motor 2 terminal B.
GND3/4powerGround. Connect to Arduino GND and battery GND.
OUT3digitalOutput 3. Connect to motor 2 terminal A.
IN3digitalInput 3 for Motor 2 direction control.
EN3,4digitalEnable pin for Motor 2. (PWM for speed control).

Configurable Attributes

This component has no standard configurable attributes.

Working Principle (H-Bridge)

An H-Bridge allows voltage to be applied across a load in either direction.

  • If IN1 is HIGH and IN2 is LOW, the motor spins Forward.
  • If IN1 is LOW and IN2 is HIGH, the motor spins Backward.
  • If both are LOW, the motor stops.
  • Applying a PWM signal to EN1,2 pulses the power rapidly, changing the motor's average speed.

Wiring Diagram (Single Motor)

This diagram shows how to wire a single DC motor to the L293D.

Wiring Diagram

Example Arduino Code

This code drives a single motor forward, then backward, then stops.

cpp
const int enA = 9;
const int in1 = 8;
const int in2 = 7;

void setup() {
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
}

void loop() {
  // Full speed forward
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 255); 
  delay(2000);
  
  // Full speed backward
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  analogWrite(enA, 255);
  delay(2000);
  
  // Stop
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(2000);
}

Simulation Notes

  • The L293D perfectly simulates H-bridge logic. If you wire the VCC2 pin incorrectly, the motors will not spin.
  • The motors in the simulation will display their RPM, allowing you to visually verify speed control via PWM.

Released under the MIT License.