Having trouble running a motor

I’m attempting to drive a small DC motor using a 2N222A transistor but am having a bit of trouble. I have everything hooked up (the diode is to protect from voltage spikes the motor might cause; I’m not sure if this is 100% necessary, but I’m erring on the side of caution) as shown in this picture:

http://ticklemethere.com/images/arduino%20motor.png

I am currently just using the Arduino to provide 5v to my breadboard, but will later be using one of the PWM pins to control the motor speed.

With the above setup, when I press the switch (upper left of breadboard) to bring the base of the NPN transistor high nothing happens. To test and make sure I didn’t have any loose connections or have anything in backwards I tried it with an LED in place of the motor and it worked just fine.

When connecting the motor directly to the 5v and GND rail on the breadboard it spun up just fine, so I know it is good and will run on 5v.

Any ideas?

You have your NPN transistor configured as a high side switch for the motor. This means the positive power supply is connected to the transistor first, next the motor, then GND. For the NPN to work you need to create a voltage large enough to create a biasing current through the base/emitter junction. Since the motor is connected to the emitter and the motor has both a resistance and an impedance, it increases the voltage necessary to create current flow through the base. If the emitter voltage relative to GND isn’t too large, you may be able to make it work by reducing the value of your base resistor.

What you really should do it convert the circuit to a low side drive. In this arrangement, the motor would have one terminal connected to +5V, the other terminal connected to the transistor’s collector, and the emitter tied to GND. The push button would be wired as is. Since the transistor is now GND referenced, you can use the full 5V to set the current through the base and drive the motor. Here is an example of what I mean. Replace CRIO with your switch or Arduino. The 466 Ohm resistor would change to fit the characteristics of your motor and your 5V (vs. 3V) supply.

http://forums.ni.com/t5/image/serverpag … bl-1&px=-1

-Bill

Thanks for the quick reply.

So something like this?

http://ticklemethere.com/images/arduino … 0drive.png

I will give that a try this evening and play around with the base resistor value some to see if I can get it working.

That should do it!

-Bill

You might find this thread interesting …

viewtopic.php?f=14&t=30976&p=137688&hil … 03#p137688

As said above the value of that resistor will depend on the supply voltage and the current draw of tthe motor. If the 466 ohms doesn’t make the motor start, or run fast enough, don’t be afraid to reduce it somewhat.

I hooked everything up just as shown above (with a 220ohm base resistor) and the motor drives just as expected when the button is pressed.

Thanks again for your help!

Glad to hear you are all situated!

-Bill