Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: Conscripted on May 24, 2010, 11:06:20 AM
-
Hello all. I'm looking for a way to run a small 6v motor from a microcontroller. I don't need proportional speed or direction. Simple on/off is what I'm looking for. What is the easiest way to accomplish this? Can it be done with a simple transistor? I'd like to be able to put a pin high and have the motor run. Put the pin low and it turns off. My thinking is that this can be accomplished with a NPN Transistor but I'm not sure how to wire it up.
Thank you for any input you can provide.
Conscripted.
-
First result in google...
http://www.tigoe.net/pcomp/code/category/Picbasic%20Pro/62 (http://www.tigoe.net/pcomp/code/category/Picbasic%20Pro/62)
-
Thank you for the response. That looks like it will work well. I'd already looked around a little on google. Evidently I wasn't asking the correct question.
What is the purpose of the 1k resistor on the pin used?
Would this work as drawn if I'm using different batteries for the motor and logic (with the grounds tied together)?
Conscripted
-
The 1k resistor is to set the transistors base current.
The motor could be run from a higher voltage than the processor. The emitter is the common reference for both the motor and and processor.
-
And proportional speed is done by using PWM on that I/O pin if you need that later on (still in only one direction of course).