If you're building a robot or other microcontrolled gadget, you will need to drive DC motors forwards and backwards. In this instructable, I'll demonstrate a simple and inexpensive circuit that controls a DC motor from two I/O pins. It requires no integrated circuits, and uses commonly available parts. I recommend you build it on a breadboard the first time. I designed this circuit, but I'm not the inventor of this type of motor controller. I got interested in motor control circuits like this one when I saw the amazingly precise movements of the Makerbots and CNC routers at Maker Works in Ann Arbor.
Step 1: Parts List
Here are the parts you'll need. All of them should be available at your local RadioShack or hobby store.
(1) DC motor
(4) MOSFET transistors. I used the IRF540N, but any N-channel MOSFET will do.
(2) NPN bipolar transistors. I used the BC548.
(2) PNP bipolar transistors. I used the BC327.
(4) 2200 ohm resistors (red-red-red)
(4) 10K ohm resistors (brown-black-orange)
Some jumper wires and a breadboard, if desired
The resistor values are not critical. Values that are fairly close will most likely work fine.