The transistor only allows you to control a DC motor in one direction. If you want to change the direction also, you need to use an H-Bridge circuit.
The L293D is a good, basic H-Bridge IC suitable for controlling DC motors and bipolar stepper motors. It contains two full H-Bridges, so you can control 2 DC motors or one stepper motor with one chip.
- Supply voltage: 4.5V–36V
- Output current: 600 mA
- Peak output current: 1.2A
- Built-in kickback diodes
- Pin-compatible with the SN754410
Using the L293D With Arduino
Download a PDF file of the schematics and drawings: L293D_full
The enable pin that is connected to pin 9 on the Arduino controls the H-Bridge on/off. The pins 10 and 11 on the Arduino control the motor direction. This table will help you figure out how to control the motor. Note that this is just for one side of the H-Bridge
|PIN 9 (ENABLE)||PIN 10||PIN 11||FUNCTION|
|HIGH||HIGH||LOW||Motor turns left|
|HIGH||LOW||HIGH||Motor turns right|