The easiest way to get started is to use the AFMotor library, which provides an abstraction layer for the shield.
The L293D chip is very forgiving. It has built-in thermal shutdown to prevent it from burning out if it gets too hot and internal diodes to protect the circuit from voltage spikes created by the motors when they stop or reverse. This "bulletproof" design is a safety net for beginners.
The shield is built around two L293D motor driver ICs and a to save Arduino pins.
The HW-130 is built around two chips and a 74HC595 shift register to minimize the number of Arduino pins used. Specification Motor Driver Chip 2 x L293D Operating Voltage 4.5V to 25V DC (Motor Supply) Output Current 0.6A per channel (1.2A Peak) DC Motor Support Up to 4 bi-directional motors Stepper Support Up to 2 stepper motors (Unipolar or Bipolar) Servo Support 2 dedicated 5V hobby servo headers Protection Thermal shutdown and internal kickback diodes Understanding the Pinout & Layout hw 130 motor control shield for arduino datasheet better
#include // Create motor objects for motor ports M1, M2, M3, M4 AF_DCMotor motor1(1); AF_DCMotor motor2(2); void setup() // Set speed to 200/255 (0-255 range) motor1.setSpeed(200); motor2.setSpeed(200); void loop() motor1.run(FORWARD); // Motor 1 runs forward motor2.run(BACKWARD); // Motor 2 runs backward delay(2000); motor1.run(RELEASE); // Motor 1 stops motor2.run(RELEASE); // Motor 2 stops delay(1000); Use code with caution.
600mA continuous per channel (1.2A peak) with thermal shutdown protection. Speed Control: 8-bit speed selection (approx. 0.5% resolution). 5.imimg.com Pinout & Connectivity
| Feature | Specification | | :--- | :--- | | | L293D (Dual H-Bridge) | | Motor Channels | 4x DC motors or 2x stepper motors | | Servo Ports | 2x dedicated servo control ports | | Max Motor Current | 600mA continuous (per channel), 1.2A peak | | Motor Voltage (VMS) | 4.5V to 36V (via EXT_PWR terminal) | | Logic Voltage (VCC) | 5V (from the Arduino board) | | Arduino PWM Pins Used | 5, 6, 3, 11 | | Arduino Digital Pins Used | 4, 7, 8, 12 | | Free Arduino Pins | A0-A5 (Analog), D2, D13 | | Approx. Cost | $5 - $10 (USD) | | Typical Library | Adafruit Motor Shield Library ( AFMotor.h ) | The easiest way to get started is to
| Parameter | Value | |-----------|-------| | Driver IC | L293D (x1) | | Logic voltage | 5V (from Arduino) | | Motor supply voltage (VS) | 4.5V – 12V (external) | | Max continuous current per channel | 600 mA | | Peak current | 1.2 A (per channel) | | PWM frequency | ~490 Hz (Arduino default) | | Onboard flyback diodes | Yes (internal to L293D) |
: Operates with motor supply voltages from 4.5V to 25V (some versions support up to 36V).
For the open-source purists and those who prioritize extreme power efficiency, the is an excellent modern choice. It is designed to be a pin-compatible replacement for the original Arduino Motor Shield but uses a VNH2SP30 driver, offering significantly improved electrical performance for driving higher loads with lower power dissipation. It is the recommended shield by the DCC-EX model train control community for its reliability and power-handling capabilities. This "bulletproof" design is a safety net for beginners
// Set default motor speed (0-255) motor1.setSpeed(200); motor2.setSpeed(200);
A: This is almost always a power issue. First, ensure you are using an external power supply for the motors via EXT_PWR . Second, verify that the 5V-EN jumper has been removed. Finally, check that all ground (GND) connections are common between the Arduino, the shield, and the external supply.