Reverse a DC motor with the L293D
Drive one DC motor through the L293D. Enable on D9 controls PWM; D7 and D8 select direction. Stop before changing direction.
Drive one DC motor through the L293D. Enable on D9 controls PWM; D7 and D8 select direction. Stop before changing direction.
Use the Uno R3 Learning Kit. Build with power disconnected, check the labelled connections, then upload the supplied sketch. Drag or zoom the 3D model to inspect it from any angle.
Also needed
An additional regulated, current-limited motor supply is required. The illustrated 5V is appropriate only if your motor is rated for the resulting voltage; confirm before powering.
Step 1 — Watch the complete build
Press Play for the narrated build. You can rotate and zoom the model while it plays, or follow the individual steps below.
Loading assembly…
Keep U S B disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around. Connect the Arduino’s five volt output to the positive rail. Connect Arduino ground to the ground rail. Add the L293D dual H-bridge. Its 1 · EN1,2 lead goes into column 8 row D; the highlights show the remaining holes. Add the direct current motor with leads. Keep its terminals accessible for the connections that follow. Add the 100 nanofarads ceramic capacitor. Its 0 lead goes into column 3 row H; the highlights show the remaining holes. Add the 100 microfarads electrolytic capacitor · 50 volts. Its - lead goes into column 24 row H; the highlights show the remaining holes. Add the Regulated motor supply · 5 volts. Keep its terminals accessible for the connections that follow. Connect the Regulated motor supply · 5 volts’s positive 5 volts pin to the separate motor supply rail. Connect the Regulated motor supply · 5 volts’s ground pin to the lower ground rail. Connect the ground rail to the lower ground rail. Connect the driver’s supply pin to the positive rail. Connect the driver’s ground pin to the ground rail. Connect the driver’s ground pin to the ground rail. Connect the driver’s ground pin to the ground rail. Connect the driver’s ground pin to the ground rail. Connect the driver’s EN3,4 pin to the ground rail. Connect the driver’s VM pin to the separate motor supply rail. Connect the capacitor’s 0 pin to the driver’s supply pin. Connect the capacitor’s 1 pin to the ground rail. Connect the capacitor’s + pin to the separate motor supply rail. Connect the capacitor’s - pin to the lower ground rail. Connect the driver’s OUT1 pin to the direct current motor with leads’s pin 1 pin. Connect the driver’s OUT2 pin to the direct current motor with leads’s pin 2 pin. Connect Arduino digital pin 9 to the driver’s EN1,2 pin. Connect Arduino digital pin 7 to the driver’s IN1 pin. Connect Arduino digital pin 8 to the driver’s IN2 pin. Connect the driver’s IN3 pin to the ground rail. Connect the driver’s IN4 pin to the ground rail. Check all wiring. Connect the square U S B-B plug to the Uno and the U S B-A plug to your computer. Use Verify and Upload in the code editor below.
Step 2 — Understand the breadboard
Keep USB disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around.
Loading assembly…
Keep U S B disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around.
Step 3 — Connect Uno 5V → T+ rail 3
Connect the Arduino’s five volt output to the positive rail.
| Connect | To |
|---|---|
| Uno 5V | T+ rail 3 |
Loading assembly…
Connect the Arduino’s five volt output to the positive rail.
Step 4 — Connect Uno GND → T- rail 1
Connect Arduino ground to the ground rail.
| Connect | To |
|---|---|
| Uno GND | T- rail 1 |
Loading assembly…
Connect Arduino ground to the ground rail.
Step 5 — Place L293D dual H-bridge
Add the L293D dual H-bridge. Its 1 · EN1,2 lead goes into column 8 row D; the highlights show the remaining holes.
Exact breadboard holes
- driver · 1 · EN1,2 → column 8 row D
- driver · 2 · IN1 → column 9 row D
- driver · 3 · OUT1 → column 10 row D
- driver · 4 · GND → column 11 row D
- driver · 5 · GND → column 12 row D
- driver · 6 · OUT2 → column 13 row D
- driver · 7 · IN2 → column 14 row D
- driver · 8 · VM → column 15 row D
- driver · 9 · EN3,4 → column 15 row F
- driver · 10 · IN3 → column 14 row F
- driver · 11 · OUT3 → column 13 row F
- driver · 12 · GND → column 12 row F
- driver · 13 · GND → column 11 row F
- driver · 14 · OUT4 → column 10 row F
- driver · 15 · IN4 → column 9 row F
- driver · 16 · VCC → column 8 row F
Loading assembly…
Add the L293D dual H-bridge. Its 1 · EN1,2 lead goes into column 8 row D; the highlights show the remaining holes.
Step 6 — Place DC motor with leads
Add the DC motor with leads. Keep its terminals accessible for the connections that follow.
Loading assembly…
Add the direct current motor with leads. Keep its terminals accessible for the connections that follow.
Step 7 — Place 100 nF ceramic capacitor
Add the 100 nF ceramic capacitor. Its 0 lead goes into column 3 row H; the highlights show the remaining holes.
Exact breadboard holes
- bypass · 0 → column 3 row H
- bypass · 1 → column 4 row H
Loading assembly…
Add the 100 nanofarads ceramic capacitor. Its 0 lead goes into column 3 row H; the highlights show the remaining holes.
Step 8 — Place 100 µF electrolytic capacitor · 50 V
Add the 100 µF electrolytic capacitor · 50 V. Its - lead goes into column 24 row H; the highlights show the remaining holes.
Exact breadboard holes
- bulk · - → column 24 row H
- bulk · + → column 25 row H
Loading assembly…
Add the 100 microfarads electrolytic capacitor · 50 volts. Its - lead goes into column 24 row H; the highlights show the remaining holes.
Step 9 — Place Regulated motor supply · 5 V
Add the Regulated motor supply · 5 V. Keep its terminals accessible for the connections that follow.
Loading assembly…
Add the Regulated motor supply · 5 volts. Keep its terminals accessible for the connections that follow.
Step 10 — Connect Regulated motor supply · 5 V +5V → B+ rail 29
Connect the Regulated motor supply · 5 V’s +5V pin to the separate motor supply rail.
| Connect | To |
|---|---|
| Regulated motor supply · 5 V +5V | B+ rail 29 |
Loading assembly…
Connect the Regulated motor supply · 5 volts’s positive 5 volts pin to the separate motor supply rail.
Step 11 — Connect Regulated motor supply · 5 V GND → B- rail 29
Connect the Regulated motor supply · 5 V’s ground pin to the lower ground rail.
| Connect | To |
|---|---|
| Regulated motor supply · 5 V GND | B- rail 29 |
Loading assembly…
Connect the Regulated motor supply · 5 volts’s ground pin to the lower ground rail.
Step 12 — Connect T- rail 2 → B- rail 2
Connect the ground rail to the lower ground rail.
| Connect | To |
|---|---|
| T- rail 2 | B- rail 2 |
Loading assembly…
Connect the ground rail to the lower ground rail.
Step 13 — Connect column 8 row J → T+ rail 8
Connect the driver’s supply pin to the positive rail.
| Connect | To |
|---|---|
| column 8 row J | T+ rail 8 |
Loading assembly…
Connect the driver’s supply pin to the positive rail.
Step 14 — Connect column 11 row A → T- rail 11
Connect the driver’s ground pin to the ground rail.
| Connect | To |
|---|---|
| column 11 row A | T- rail 11 |
Loading assembly…
Connect the driver’s ground pin to the ground rail.
Step 15 — Connect column 12 row A → T- rail 13
Connect the driver’s ground pin to the ground rail.
| Connect | To |
|---|---|
| column 12 row A | T- rail 13 |
Loading assembly…
Connect the driver’s ground pin to the ground rail.
Step 16 — Connect column 12 row J → T- rail 14
Connect the driver’s ground pin to the ground rail.
| Connect | To |
|---|---|
| column 12 row J | T- rail 14 |
Loading assembly…
Connect the driver’s ground pin to the ground rail.
Step 17 — Connect column 11 row J → T- rail 10
Connect the driver’s ground pin to the ground rail.
| Connect | To |
|---|---|
| column 11 row J | T- rail 10 |
Loading assembly…
Connect the driver’s ground pin to the ground rail.
Step 18 — Connect column 15 row J → T- rail 15
Connect the driver’s EN3,4 pin to the ground rail.
| Connect | To |
|---|---|
| column 15 row J | T- rail 15 |
Loading assembly…
Connect the driver’s EN3,4 pin to the ground rail.
Step 19 — Connect column 15 row A → B+ rail 15
Connect the driver’s VM pin to the separate motor supply rail.
| Connect | To |
|---|---|
| column 15 row A | B+ rail 15 |
Loading assembly…
Connect the driver’s VM pin to the separate motor supply rail.
Step 20 — Connect column 3 row J → column 8 row I
Connect the capacitor’s 0 pin to the driver’s supply pin.
| Connect | To |
|---|---|
| column 3 row J | column 8 row I |
Loading assembly…
Connect the capacitor’s 0 pin to the driver’s supply pin.
Step 21 — Connect column 4 row J → T- rail 4
Connect the capacitor’s 1 pin to the ground rail.
| Connect | To |
|---|---|
| column 4 row J | T- rail 4 |
Loading assembly…
Connect the capacitor’s 1 pin to the ground rail.
Step 22 — Connect column 25 row J → B+ rail 25
Connect the capacitor’s + pin to the separate motor supply rail.
| Connect | To |
|---|---|
| column 25 row J | B+ rail 25 |
Loading assembly…
Connect the capacitor’s + pin to the separate motor supply rail.
Step 23 — Connect column 24 row J → B- rail 23
Connect the capacitor’s - pin to the lower ground rail.
| Connect | To |
|---|---|
| column 24 row J | B- rail 23 |
Loading assembly…
Connect the capacitor’s - pin to the lower ground rail.
Step 24 — Connect column 10 row A → DC motor with leads pin 1
Connect the driver’s OUT1 pin to the DC motor with leads’s pin 1 pin.
| Connect | To |
|---|---|
| column 10 row A | DC motor with leads pin 1 |
Loading assembly…
Connect the driver’s OUT1 pin to the direct current motor with leads’s pin 1 pin.
Step 25 — Connect column 13 row A → DC motor with leads pin 2
Connect the driver’s OUT2 pin to the DC motor with leads’s pin 2 pin.
| Connect | To |
|---|---|
| column 13 row A | DC motor with leads pin 2 |
Loading assembly…
Connect the driver’s OUT2 pin to the direct current motor with leads’s pin 2 pin.
Step 26 — Connect Uno D9 PWM → column 8 row A
Connect Arduino digital pin 9 to the driver’s EN1,2 pin.
| Connect | To |
|---|---|
| Uno D9 PWM | column 8 row A |
Loading assembly…
Connect Arduino digital pin 9 to the driver’s EN1,2 pin.
Step 27 — Connect Uno D7 → column 9 row A
Connect Arduino digital pin 7 to the driver’s IN1 pin.
| Connect | To |
|---|---|
| Uno D7 | column 9 row A |
Loading assembly…
Connect Arduino digital pin 7 to the driver’s IN1 pin.
Step 28 — Connect Uno D8 → column 14 row A
Connect Arduino digital pin 8 to the driver’s IN2 pin.
| Connect | To |
|---|---|
| Uno D8 | column 14 row A |
Loading assembly…
Connect Arduino digital pin 8 to the driver’s IN2 pin.
Step 29 — Connect column 14 row J → T- rail 16
Connect the driver’s IN3 pin to the ground rail.
| Connect | To |
|---|---|
| column 14 row J | T- rail 16 |
Loading assembly…
Connect the driver’s IN3 pin to the ground rail.
Step 30 — Connect column 9 row J → T- rail 9
Connect the driver’s IN4 pin to the ground rail.
| Connect | To |
|---|---|
| column 9 row J | T- rail 9 |
Loading assembly…
Connect the driver’s IN4 pin to the ground rail.
Step 31 — Place USB-A to USB-B cable · Uno
Check all wiring. Connect the square USB-B plug to the Uno and the USB-A plug to your computer. Use Verify and Upload in the code editor below.
Loading assembly…
Check all wiring. Connect the square U S B-B plug to the Uno and the U S B-A plug to your computer. Use Verify and Upload in the code editor below.
Step 32 — Program your Uno
Choose Arduino Uno. Verify, pair the board and Upload this sketch. Keep USB connected. Drive one DC motor through the L293D. Enable on D9 controls PWM; D7 and D8 select direction. Stop before changing direction.
Step 33 — Try it and troubleshoot
Run the motor unloaded. It turns one way, stops, reverses and stops again. The L293D drops some voltage, so the motor sees less than the supply.
If it does not work
Confirm the motor’s rated voltage and stall current. The L293D is limited to 600mA per channel and can run hot. Use a current-limited motor supply within the motor rating; a rectangular 9V battery is not a suitable substitute.
Parts List
Required Parts (1)
Use the components named in this tutorial. A computer and any additional power supply are not included.
x1
$64.70
In stockProject Summary
1 part total
Unavailable items will be skipped