This question already has an answer here:
I would like to control (switch) some 12V DC motors using the GPIO pins. I do not have (or want to use) an expansion board. Nevertheless, I think this should be possible using a transistor switch (and some resistors). So, assuming an external 12V DC power supply and motor, what is the best (and safest) way to wire a control circuit to the GPIO pins, and exactly what kind of transistor should I use? In the first instance I'm interested in relatively low power motors (say, 12W/1A), but could be interested in higher power motors in the future.