I've started playing with some basic tutorial/toy electronics stuff using the Arduino platform and the "SparkFun Arduino Inventors' Kit" (hardly "inventors'", but anyway...) after picking it up as part of an order from the awesome outfit Little Bird Electronics. While generally good, I've hit an interesting issue with the kit that's worth documenting for anyone else who has it.
The short version: If you're using the SparkFun kit that specifies a 10kΩ resistor and the test circuit doesn't work (the motor won't spin) you might need to use a lower valued resistor between the transistor and pin 9 of the Arduino board.
If this is the case, you'll find that when you flick the motor's drive around with your fingers so it spins, sometimes it'll spin down slowly and sometimes it'll stop suddenly, depending on whether the Arduino is currently trying to drive it or not.
Check for all the usual errors before assuming the issue described here is what's wrong with your circuit. You might've reversed the flyback diode, made a poor connection on a power rail, etc etc.
The SparkFun kit for
CIRC-03 ("Spin Motor Spin - Transitor & Motor") is based on Ardx CIRC03 but it has one difference that looks like it may be a significant error.
The SparkFun instructions specify a 10kΩ resistor but, at least with the motor supplied in my kit, the test circuit won't actually work with that much resistance between the
P2N2222AG (actually marked
P2N222A18 in my kit) transistor's base pin and pin 9 of the Arduino Uno board. Replacing the 10kΩ resistor with a 2.2kΩ resistor - like that specified by the ardx instructions - fixes the problem, allowing the transistor to pass enough current to let the motor spin.
A quick read suggests that
P2N222218 are functionally equivalent, with different date codes or serial numbers, so that shouldn't be the cause of the issue.
If you bought the kit and don't do any other electronics stuff you may not have a 2.2kΩ (red-red-red) resistor or anything vaguely similar lying around. If so, you can always connect up 6 (or so) of the 330Ω resistors supplied in the kit in series to achieve roughly the same resistance. Or you can wind four 10kΩ resistors in parallel, which might be easier.
Remember that to get them connected in series you must put the input of one and the output of another alone on a breadboard row. Connecting five or six of them will give you a sort of stair-step or saw-tooth pattern where you have resistors connecting, say, F14-G13, F13-G12, F12-G11, F11-G10, F10-G9 and F9-G8. You can then plug the lead from the transistor base pin into F8 and the lead from Arduino pin 9 into the other end of the resistor series at G14. If your resistors have long leads and you don't want to clip them you have to space everything out a bit more than this to avoid shorts across all those resistor wires; this is just an example of how it can work.
To make sure my motor wasn't just defective I bridged it across the +5V and -GND rails. This probably wasn't a smart thing to do without a resistor in series with the motor; I got away with it, but you might not.
Update 2012:: Note that I put the motor between the +5V supply rail and GND, not between a digital output pin and GND. The latter might fry your Arduino, don't do it. The Arduino has USB over-current protection, but it doesn't have any over-current protection on the digital output pins.