Driving using a single MOSFET
Logic-level outputs (such as the I/O pins of a Basic STAMP or a PIC chip) have nowhere near enough current capacity to drive a motor directly. Typically they can source (i.e. connect to +5v) or sink (i.e. ground) up to 20mA without damage. You need to be able to use the logic-level output voltage (0v or 5v) to turn on/off a device that can handle 100mA of current, or more, up to 30A, depending on the motor being controlled.
Relays. There are many ways to do this. Conceptually simplest is to use a relay; some relays can be closed by 5V at 40mA or less. (The coil resistance would have to be 125 ohms or more.) Even 40mA is too much for many chips, however.
MOSFETs. Most practical is to turn on/off a MOSFET. MOSFETs in their open state may have a resistance of 10^12 ohms, while in their closed state as little as 0.01 ohm - a remarkable dynamic range. Further, they are turned on by a "gate voltage" with essentially no current required. There is some gate capacitance, typically 5nF, but this won't require much current except at very high switching rates.
MOSFETs have three terminals, called Drain, Source, and Gate. If you are familiar with bipolar transisitors, an N-channel enhancement-mode MOSFET may be compared to an NPN transistor, where Drain-Source-Gate of the MOSFET are Collector-Emitter-Base of the NPN, respectively.
We'll use a MOSFET with the Source grounded, the Drain connected (through the load) to a positive supply voltage, and a logic level applied to the Gate, which will turn the Source-Drain connection on/off.
MOSFET Gate Voltage
MOSFET specifications indicate an "on voltage" applied to the Gate (with respect to Source), required to turn the Source-Drain connection on. The higher the Gate voltage, the lower will be the resistance of the Source-Drain connection. Graphs show the dependence of Drain-Source current on Drain-Source voltage for various Gate-Source voltages. Often these are called just Drain current, Drain voltage, and Gate voltage.
For many MOSFETs, turning them on fully requires as much as 7 to 12 volts at the Gate -- which is more than a standard logic level. The IRFU3708 is nice in that it requires relatively low Gate voltages, and conducts high Drain currents. (see graph)
The circuit diagram shows how to use the IRFU3708 to control a high-current load, such as a solenoid or a brushed DC motor. Note that the logic level applied to the Gate is 0 or +5 volts, but the +V applied to the load can be much higher than that; for instance you can control +24v applied to the load.
Protection diode. The diode is important for inductive loads such as motors, relay coils, solenoids, or electromagnets. Recall that once a current is flowing in an inductor, it has an "inertia" and will not easily stop. If the MOSFET is suddenly turned off (opened), the (downward) current flowing through the inductor will be able to continue briefly (upward!) through the diode. Without the diode, the inductor could generate a high voltage (V = L*di/dt) and burn out the MOSFET.
What if you want to put a current in the opposite direction through the motor, to make it turn the opposite way?
With a single MOSFET, you can't. You can use an H-bridge, which contains four MOSFETs. Or, you can use a DPDT relay as a "reversing switch" to reverse the motor within the circuit. The coil of that relay will have to be driven by its own logic signal and MOSFET of course. The last circuit shows a DPDT relay arranged as a reversing switch.
Handling, Wiring and Heatsinking your MOSFET
Static. MOSFETs are static sensitive. The Gate junction (metal oxide) is only a few angstroms thick and a static charge can blow a hole in it. Once installed in a circuit you are unlikely to harm it; it is most sensitive while being carried around. Take precautions in storage and handling. That said, I have never managed to static-damage a MOSFET, even in the winter.
Wiring. The leads of the IRFU3708 MOSFET are too thick to stuff in a plug-type protoboard. You can cram them in, but you'll stretch out the contacts and then you will get unreliable connections forever more. Instead, solder the leads into the top of an IC socket, or something else that has appropriate lead thicknesses. (photo a)
You can also attach wires to the MOSFET. (photo b) In the photo the order of the leads, left to right, is 1-2-3, Gate-Drain-Source, brown-black-white. The tab on the top and back is also connected to the center lead (Drain).
Heat. If you always turn the MOSFET full on (Gate voltage = +5) or full off (Gate voltage = 0) it should not wind up dissipating much power, even with large currents and voltages. That's because power P=iV, where i is the current through the MOSFET (and the load) and V is the voltage across the MOSFET. In the ON state the Drain-Source voltage is very low (the supply voltage is mostly across the load), and in the OFF state the current is zero. In between on and off the MOSFET could dissipate a lot of power and burn up, so don't run it there.
Heatsinking. If you do need to conduct away more heat from the package to keep it cool, you can heatsink it. (It's perfectly happy running at 175C, however.) The tab at the top is intended to be soldered to a copper plate, and you can do this if you do it quickly (see the datasheet about how long it can withstand soldering temperatures).
Another way, not as effective as soldering but still much better than air cooling alone, is to connect it to an aluminum plate as shown in photo c. You probably can't put it directly on an aluminum plate because the tab on the back of the MOSFET is electrically connected to Drain and you probably don't want your whole aluminum plate to share that potential (unless it is a heatsink dedicated to just this one MOSFET).
Instead, put down a layer of thin electrically insulating tape or plastic. Mylar and kynar tape are good, or even non-sticky films. Plain old Scotch tape will work too. Don;t use black vinyl electrical tape which is not very thermally conductive. Use a dab of Thermal Compound (white, in the photo) to increase the thermal conductivity. A small binder clip will hold it all together.