The L293D Motor Driver Shield is an expansion board designed to drive inductive loads such as relays, solenoids, DC, and stepper motors. It lets you drive two DC motors with your Arduino board, controlling the speed and direction of each one independently. The shield is based on the L293D motor driver IC which provides bidirectional drive currents of up to 600mA at voltages from 4.5V to 36V. It is compatible with a wide range of Arduino boards and can be stacked with other shields.
Pin Number | Function | Description |
---|---|---|
1-2 | Motor A | Connects to the terminals of the first DC motor. |
3-4 | Motor B | Connects to the terminals of the second DC motor. |
5-6 | Power Supply (V+) | External power supply for motors (4.5V to 36V). |
7 | Ground (GND) | Common ground for logic and motor power. |
8-9 | Direction Control | Controls the direction of the motors. |
10-11 | Speed Control | Controls the speed of the motors (PWM). |
12 | Enable Motor A | Enables or disables Motor A. |
13 | Enable Motor B | Enables or disables Motor B. |
Connecting Motors:
Power Supply:
Control Connections:
#include <AFMotor.h>
AF_DCMotor motor(4); // Create motor #4
void setup() {
motor.setSpeed(200); // Set the speed to 200/255
}
void loop() {
motor.run(FORWARD); // Turn the motor forward
delay(1000); // Run for 1 second
motor.run(BACKWARD); // Turn the motor backward
delay(1000); // Run for 1 second
motor.run(RELEASE); // Stop the motor
delay(1000); // Wait for 1 second
}
Q: Can I control a stepper motor with this shield? A: Yes, the L293D shield can be used to control a bipolar stepper motor.
Q: What is the maximum current the L293D shield can handle? A: The shield can handle up to 600mA per channel continuously, with peak currents of 1.2A.
Q: Can I stack other shields on top of the L293D shield? A: Yes, the shield is designed to be stackable with other Arduino shields.
Q: Do I need an external power supply? A: An external power supply is necessary if the motor requires more voltage or current than the Arduino board can provide.
Q: How do I control the speed of the motors? A: You can control the speed by applying PWM signals to the Speed Control pins.