Stufin
Home Quick Cart Profile

L293D Motor Driver Board

Buy Now on Stufin

VIN

Input voltage pin (5V to 36V)

GND

Ground pin

ENA1 and ENA2Enable pins for Motor 1 and Motor 2, respectively
IN1 and IN2Input pins for direction and speed control of Motor 1
IN3 and IN4Input pins for direction and speed control of Motor 2
OUT1 and OUT2Output pins for Motor 1
OUT3 and OUT4Output pins for Motor 2

Applications

The L293D Motor Driver Board is suitable for a wide range of applications, including

Robotics and robotic arms

Automated guided vehicles (AGVs)

Industrial automation

IoT projects

DIY electronics projects

Conclusion

The L293D Motor Driver Board is a versatile and reliable component for controlling DC motors in various applications. Its compact design, high current capability, and bidirectional control make it an ideal choice for robotics, automation, and IoT projects. With its ease of use and straightforward connections, the L293D Motor Driver Board is a popular choice among hobbyists and professionals alike.

Pin Configuration

  • L293D Motor Driver Board Documentation
  • Pin Description:
  • The L293D Motor Driver Board is a dual H-bridge motor driver designed to drive two DC motors or one stepper motor. It has 16 pins, which are described below:
  • Pin 1: Enable 1 (EN1)
  • Function: Enables or disables the motor driver for Motor 1
  • Logic:
  • + High (H): Enables the motor driver
  • + Low (L): Disables the motor driver
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 2: Input 1 (IN1)
  • Function: Sets the direction of Motor 1
  • Logic:
  • + High (H): Motor 1 rotates clockwise
  • + Low (L): Motor 1 rotates counterclockwise
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 3: Input 2 (IN2)
  • Function: Sets the direction of Motor 1
  • Logic:
  • + High (H): Motor 1 rotates counterclockwise
  • + Low (L): Motor 1 rotates clockwise
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 4: Output 1 (OUT1)
  • Function: Output pin for Motor 1
  • Connection: Connected to one terminal of Motor 1
  • Pin 5: Output 2 (OUT2)
  • Function: Output pin for Motor 1
  • Connection: Connected to the other terminal of Motor 1
  • Pin 6: Ground (GND)
  • Function: Ground pin
  • Connection: Connected to the ground of the power supply and microcontroller
  • Pin 7: VCC
  • Function: Power supply pin
  • Connection: Connected to a voltage source (e.g., 5V or 12V) that matches the motor's operating voltage
  • Pin 8: Sense (SENSE)
  • Function: Input pin for sensing the motor current (optional)
  • Connection: Typically connected to a current sense resistor or a voltage divider to monitor the motor current
  • Pin 9: Enable 2 (EN2)
  • Function: Enables or disables the motor driver for Motor 2
  • Logic:
  • + High (H): Enables the motor driver
  • + Low (L): Disables the motor driver
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 10: Input 3 (IN3)
  • Function: Sets the direction of Motor 2
  • Logic:
  • + High (H): Motor 2 rotates clockwise
  • + Low (L): Motor 2 rotates counterclockwise
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 11: Input 4 (IN4)
  • Function: Sets the direction of Motor 2
  • Logic:
  • + High (H): Motor 2 rotates counterclockwise
  • + Low (L): Motor 2 rotates clockwise
  • Connection: Typically connected to a digital output of a microcontroller (e.g., Arduino)
  • Pin 12: Output 3 (OUT3)
  • Function: Output pin for Motor 2
  • Connection: Connected to one terminal of Motor 2
  • Pin 13: Output 4 (OUT4)
  • Function: Output pin for Motor 2
  • Connection: Connected to the other terminal of Motor 2
  • Pin 14: VCC
  • Function: Power supply pin ( duplicate of Pin 7)
  • Connection: Connected to a voltage source (e.g., 5V or 12V) that matches the motor's operating voltage
  • Pin 15: Ground (GND)
  • Function: Ground pin (duplicate of Pin 6)
  • Connection: Connected to the ground of the power supply and microcontroller
  • Pin 16: Heat Sink
  • Function: Heat sink pin for dissipating heat generated by the motor driver
  • Connection: Typically connected to a heat sink or left unconnected
  • Connection Structure:
  • Here's a general connection structure for using the L293D Motor Driver Board:
  • Connect the VCC pins (7 and 14) to a voltage source that matches the motor's operating voltage.
  • Connect the GND pins (6 and 15) to the ground of the power supply and microcontroller.
  • Connect the EN1 and EN2 pins to digital outputs of a microcontroller to control the motor drivers.
  • Connect the IN1, IN2, IN3, and IN4 pins to digital outputs of a microcontroller to control the direction of the motors.
  • Connect the OUT1 and OUT2 pins to the terminals of Motor 1.
  • Connect the OUT3 and OUT4 pins to the terminals of Motor 2.
  • If using a current sense resistor or voltage divider, connect the SENSE pin to the output of the sensing circuit.
  • Remember to check the datasheet and application notes for specific requirements and recommendations for your project.

Code Examples

L293D Motor Driver Board Documentation
Overview
The L293D Motor Driver Board is a popular and widely used motor driver IC for controlling DC motors and stepper motors in IoT projects. It is a dual H-bridge motor driver IC that can handle two DC motors or one stepper motor. The L293D provides an efficient and reliable way to drive motors with a maximum current rating of 1A per channel.
Pinout and Pin Functions
The L293D Motor Driver Board has a total of 16 pins, which are:
| Pin No. | Pin Name | Function |
| --- | --- | --- |
| 1-4 | VCC, GND, VCC, GND | Power supply and ground |
| 5-6 | IN1, IN2 | Input pins for motor A |
| 7-8 | OUT1, OUT2 | Output pins for motor A |
| 9-10 | IN3, IN4 | Input pins for motor B |
| 11-12 | OUT3, OUT4 | Output pins for motor B |
| 13-16 | ENA, GND, ENB, GND | Enable pins and ground |
Code Examples
Here are a few code examples to demonstrate how to use the L293D Motor Driver Board in various contexts:
Example 1: Controlling a Single DC Motor using Arduino
In this example, we will use the L293D Motor Driver Board to control a single DC motor using an Arduino board.
```c
const int motorIn1 = 2;  // Pin 2 connected to IN1 of L293D
const int motorIn2 = 3;  // Pin 3 connected to IN2 of L293D
const int enableA = 9;  // Pin 9 connected to ENA of L293D
void setup() {
  pinMode(motorIn1, OUTPUT);
  pinMode(motorIn2, OUTPUT);
  pinMode(enableA, OUTPUT);
}
void loop() {
  // Set motor direction and speed
  digitalWrite(motorIn1, HIGH);
  digitalWrite(motorIn2, LOW);
  analogWrite(enableA, 128); // 50% duty cycle
delay(2000);
// Change motor direction and speed
  digitalWrite(motorIn1, LOW);
  digitalWrite(motorIn2, HIGH);
  analogWrite(enableA, 255); // 100% duty cycle
delay(2000);
}
```
In this example, we use the Arduino's digital pins to control the input pins of the L293D Motor Driver Board, and the analogWrite function to set the motor speed using PWM.
Example 2: Controlling Two DC Motors using Raspberry Pi
In this example, we will use the L293D Motor Driver Board to control two DC motors using a Raspberry Pi.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define motor pins
motorA_in1 = 17
motorA_in2 = 23
motorA_enable = 24
motorB_in1 = 20
motorB_in2 = 21
motorB_enable = 25
# Set up motor pins as outputs
GPIO.setup(motorA_in1, GPIO.OUT)
GPIO.setup(motorA_in2, GPIO.OUT)
GPIO.setup(motorA_enable, GPIO.OUT)
GPIO.setup(motorB_in1, GPIO.OUT)
GPIO.setup(motorB_in2, GPIO.OUT)
GPIO.setup(motorB_enable, GPIO.OUT)
while True:
  # Set motor directions and speeds
  GPIO.output(motorA_in1, GPIO.HIGH)
  GPIO.output(motorA_in2, GPIO.LOW)
  GPIO.output(motorA_enable, GPIO.HIGH)
GPIO.output(motorB_in1, GPIO.LOW)
  GPIO.output(motorB_in2, GPIO.HIGH)
  GPIO.output(motorB_enable, GPIO.HIGH)
time.sleep(2)
# Change motor directions and speeds
  GPIO.output(motorA_in1, GPIO.LOW)
  GPIO.output(motorA_in2, GPIO.HIGH)
  GPIO.output(motorA_enable, GPIO.HIGH)
GPIO.output(motorB_in1, GPIO.HIGH)
  GPIO.output(motorB_in2, GPIO.LOW)
  GPIO.output(motorB_enable, GPIO.HIGH)
time.sleep(2)
```
In this example, we use the RPi.GPIO library to control the GPIO pins of the Raspberry Pi, which are connected to the input pins of the L293D Motor Driver Board. We set the motor directions and speeds using the output functions of the GPIO library.