Let's Make Robots!

Controlling a motor with an NPN transistor

Apparently I don't yet fully understand transistors, so I'm hoping someone can explain what I'm missing. I'm using USB 5V to power my MCU (an Arduino), and I've got a 9V battery pack (6x AA) for my motors. I'm trying to switch that 9V off and on for a motor. I don't need to change directions or control speed, I just need to be able to give it either 0V or 9V. I thought that I could do this by using a standard NPN transistor like a 2N3904, wiring the 9V positive from the battery to the collector lead, an I/O pin to the base lead, the emitter lead to the motor's positive terminal, and the motor's negative terminal to ground. (The 9V battery pack and the Arduino's 5V power have a common ground). But for some reason, when the base pin on the transistor goes high (5V above ground), the voltage coming out of the emitter pin is only 4.5V, not the 9V that I measure coming into the collector pin. I've spent time reading all about Qfe and Vbe and Ic and I kind of understand all that, but I still don't see why the voltage would be less. It seems like the transistor should be saturated. Can one of you smarter types explain to me what I'm missing?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Try putting the motor on the collector side of the transistor, instead of the emitter side.

Have a look at http://madan.wordpress.com/category/circuit-ideas/ at the "transistor as a switch" paragraph a bit down


Hi CowGod,

In order to use a transistor as a switch in your case the base pin can only be either 0V or 9V - otherwise it will not be fully saturated.

One solution is to isolate the 9V circuitry from the 5V by using an optocoupler and then when you send 5V in one side of the optocoupler there will be 9V on the other side.

- Jimmy

Huh. I checked the local electronics stores and nobody had optocouplers/optointerrupters, so I just tried wiring the motor on the positive side of the transistor as jka suggested, and that actually seems to have worked. I don't really understand why though. Is it the kind of thing you can explain? Either way, I'm glad it works now, and I can continue working :) Thanks for all the answers.


I'm not that much into the theory of electronics, so I can't come up with the grand explanation. My reason for suggesting this was the everlasting "that's what everybody else does" :)

I found some more theory here: http://www.kpsec.freeuk.com/trancirc.htm. Remember to use a diode across the motor to protect the transistor. 

If you are looking for optocouplers, I have used some called 4N25 before with success. Try searching for them on the net.

usually i see most npn transistors sitting on the ground side of the load, have you tried this?



I gave that a try and that seemed to make a big difference. Of course, I've since realized that 9V is too much for those little motors, so I scaled it down to 4.8V, so now it wouldn't have mattered anyway :)