L293D Motor Driver IC with a Raspberry Pi Pico
A 16-pin DIP with two H-bridges and built-in clamp diodes that drives two DC motors forward and reverse at 600 mA each.

The Raspberry Pi Pico drives the L293D's six control pins on GP0 to GP5: EN1 on GP0 and EN2 on GP3 take PWM for speed, the IN pins set direction. The chip's logic supply VCC1 comes from VBUS, because it needs 4.5 V to 7 V, while its inputs read 3.3 V as high.
Wiring the L293D Motor Driver IC to the Raspberry Pi Pico
Pin by pin.
| L293D Motor Driver IC | Raspberry Pi Pico |
|---|---|
| EN1 | GP0 |
| IN1 | GP1 |
| IN2 | GP2 |
| EN2 | GP3 |
| IN3 | GP4 |
| IN4 | GP5 |
| VCC1 | VBUS |
| GND | GND |
- VCC1 is on VBUS, which gives about 5 V only while the board is powered from USB.
What to know on the Raspberry Pi Pico
- The inputs read high from 2.3 V, so the Pico's 3.3 V outputs drive IN and EN directly; only VCC1 needs 5 V.TI L293D datasheet SLRS008D, p. 4
- VBUS gives 5 V only while USB powers the Pico, and 0 V otherwise. On battery, feed VCC1 from a 5 V source of its own.Raspberry Pi Pico datasheet, release 21, p. 8
- The motors run from VCC2, 4.5 V to 36 V and never below VCC1, on their own supply; only the grounds join the Pico's.TI L293D datasheet SLRS008D, pp. 1, 4
- analogWrite() on GP0 and GP3 uses the RP2040's PWM; it has 16 PWM channels, so speed control needs no special pins.Raspberry Pi Pico datasheet, release 21, p. 4
L293D Motor Driver IC code for the Raspberry Pi Pico
Compiled for rp2040:rp2040:rpipico on 2026-10-29.
// L293D Motor Driver IC on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/l293d-motor-driver/raspberry-pi-pico
const int EN1 = 0, IN1 = 1, IN2 = 2; // channel 1 (motor A)
const int EN2 = 3, IN3 = 4, IN4 = 5; // channel 2 (motor B)
void setup() {
const int pins[] = {EN1, IN1, IN2, EN2, IN3, IN4}; // an array: AVR has no <initializer_list>
for (int p : pins) pinMode(p, OUTPUT);
}
// speed: -255..255, its sign the direction
void drive(int en, int inA, int inB, int speed) {
digitalWrite(inA, speed > 0);
digitalWrite(inB, speed < 0);
analogWrite(en, abs(speed));
}
void loop() {
drive(EN1, IN1, IN2, 200); drive(EN2, IN3, IN4, 200); delay(2000); // both forward
drive(EN1, IN1, IN2, 0); drive(EN2, IN3, IN4, 0); delay(1000); // stop
drive(EN1, IN1, IN2, -200); drive(EN2, IN3, IN4, 200); delay(2000); // spin in place
drive(EN1, IN1, IN2, 0); drive(EN2, IN3, IN4, 0); delay(1000);
}
L293D Motor Driver IC on the Raspberry Pi Pico: questions
Can a 3.3 V Pico control an L293D?
Yes. Its inputs read high from 2.3 V (TI datasheet SLRS008D, p. 4). Only VCC1 needs 4.5 V to 7 V, taken from VBUS on USB.
Can I power the motors from the Pico's VBUS?
No: VBUS is the USB 5 V and powers the logic here. Give VCC2 its own motor supply and join its ground to the Pico's.
Why do my motors not turn with the Pico?
Check VCC1 has 5 V (VBUS is 0 V without USB, Pico datasheet p. 8), VCC2 has the motor supply, the grounds are joined, and EN1/EN2 on GP0/GP3 get a non-zero PWM.
Keep going
This guide as plain Markdown. /components/l293d-motor-driver/raspberry-pi-pico.md