I've been trying to create a simple transistor circuit with a 2N3904 that will toggle a geared DC motor on and off without drawing power from the arduino - I've followed the schematic seen in the 2nd image.

(Breadboard view)


The circuit isn't behaving as I expect it to. For testing purposes, I've been feeding the 5V from the arduino into the base pin (before the resistor) to activate the 'switch' of the BJT. This only powers the motor when I have a low valued resistor at the base (~10ohms). When I use 1k resistor, the motor does not turn on. Also, I have used a digital pin set at high to attempt to power the base pin and toggle the motor on/off, but this does nothing, regardless of the value of the resistor.

Perhaps my circuit is incorrect? All I want the circuit to do is turn the motor on and off when I feed it a high signal from the arduino.

Notes: The red wire coming into the node at the top is from a 9V battery. The ground bus on the breadboard has both the arduino ground and battery ground connected to it.


4 Answers 4


Your motor that you linked to is a 4.5V 190~250 mA (No Load) motor. At 9v, the current probably increases. You are overdriving it by 200%. And any load/weight will cause it to increase in current requirements as well. Stall current is probably 10x that at least.

You are missing the protection diode across the motor, that can easily kill the transistor.

The Transistor you are using is a 100mA standard, 200mA Absolute Maximum. One of those motors by itself without any load, can easily kill that transistor.

The base resistor is calculated as (Base Voltage - Base-Emmiter Voltage) / Current required. Base Voltage is the Arduino pin, so 5v, Vbe depends on the collector current which is 200 mA here, so typically 1V. Current required is calculated as Collector Current (200mA) / Hfe (From datasheet, 10~30). On the safe side, lets go with 10, so 200 / 10 = 20mA needed at the base.

(5V - 1V) / 20mA or 4V / 0.02A = 200Ω resistor. A 1kΩ resistor would only allow 4mA at the base, which times the Hfe of 10, would only allow 40mA at the collector, probably no where enough to tun on the motor.

TLDR: You need the protection diode, your 9v power source is too high, and your transistor is too weak for the motor you are using. And you need a bigger resistor at the base because the motor requires more current then you are figuring. A common 2n2222 transistor with a 470Ω resistor would do much better.

Edit: Not making the pin an output also puts a damper on things. Answer, Arduino pins default to input.

  • \$\begingroup\$ Not to mention, a 9V battery can't supply anywhere near 250mA. \$\endgroup\$
    – Phil Frost
    Jul 29, 2013 at 0:44
  • \$\begingroup\$ Hi Passerby, I implemented all of these changes today - added a 1n4001 in parallel with the motor and capacitor, following the circuit shown in this video: youtube.com/watch?v=5bHPKU4ybHY, swapped out the 2n3904 with a 2n2222, and changed the base resistor to 470ohm. I still have the same problem however. If I feed the base with the 5V from the arduino, the motor turns on, but feeding it a HIGH signal from a digital I/O pin yields nothing. I'm stuck yet again :s \$\endgroup\$
    – pwee92
    Jul 30, 2013 at 0:42
  • \$\begingroup\$ @pwee92 that makes it seem like a code issue. The arduino gpio pin is roughly the same as vcc, or 4.9volts, and can source enough for that resistor. There should be no difference. If you put an led + that 470Ω resistor instead of the transistor, does it light up? Can you post your code? \$\endgroup\$
    – Passerby
    Jul 30, 2013 at 1:54
  • \$\begingroup\$ I'll try the LED when I get home tonight and get back to you, thanks for all your input so far btw. I've pasted my code here: pastebin.com/HwudHKSU \$\endgroup\$
    – pwee92
    Jul 30, 2013 at 16:12
  • 1
    \$\begingroup\$ Oh man. Its always the simple things isn't it? I guess that's why having a second look is so crucial. Thanks! \$\endgroup\$
    – pwee92
    Jul 31, 2013 at 1:32

The most likely explanation is that the motor needs more current than the transistor wants to deliver. Have you measured the motor current?

For that matter, it may be that the motor requires more current than your 9V battery can supply. Have you run the motor directly off the 9V battery?

The second most likely is that back EMF from the motor has popped the transistor. Substitute a small incandescent bulb for the motor, and see if you can shed some light on the subject.

Put a reverse-biased diode across the motor. I'd probably grab a 1N4001 or something similar.

  • \$\begingroup\$ Hi John, I haven't measured the motor current as I dont have access to a multimeter at the moment (mine appears to be broken). I've run the motor directly off the 9V with no issues, so I feel that it should provide enough current for this application. My understanding is that since the 9V is providing the current, when the base is triggered it should allow all of this current to flow through? However it seems like the current provided to the motor is a function of the current in the base. I'll try your suggestions when I get a chance. Cheers. \$\endgroup\$
    – pwee92
    Jul 28, 2013 at 23:26
  • \$\begingroup\$ I don't know where you live. Where I live, acceptable commodity Chinese DVMs go for about ten bucks a pop at the local tool store. \$\endgroup\$ Jul 30, 2013 at 4:46
  • \$\begingroup\$ Heck, harbor freight gives their 5~10 dollar one away (coupon in their flyer) like every other week. @JohnR.Strohm \$\endgroup\$
    – Passerby
    Jul 30, 2013 at 22:08

For what it's worth, I think that N-channel MOSFETs with logic level gates are much easier to use than NPN transistors for these kinds of driving. A one kiloohm resistor would work fine for the base, as there's only a small amount of charge needed to make the MOSFET conduct, and then it will draw basically nothing.

The BS170 (similar to 2N7000) comes in a 500 mA version that's great for general purpose experimentation, and you can buy 25 for a few bucks. The IRLB8721 N-channel MOSFET is great for driving bigger things (easily over 10 Amperes without heat sinking) and is about a buck each. For good measure, you probably want a 220 Ohm resistor into the gate of that, to turn it on nice and quick.


You may have invested too much faith into the transistor. When I look at the datasheet for the 2N3904, it has a max collector current of 200mA, which is what your DC motor is getting. DC motors are high current devices, try to find out the current needed to turn this motor.

The collector current of the transistor will be a function of the current to the Base of the transistor. Remember that B*I(b) = I(c).

When you use the 5V pin from the Arduino, you are connecting directly to the output of the on-board LDO. This will be much better suited to drive your DC motor, which is why this pin will work (Higher base current equals higher collector current).

However the Arduino can only output a max of 40mA per I/O pin, I haven't checked the max current of the LDO but I'm sure it's much higher.

Here's the schematic for reference: Arduino Schematic

Anyway, the most pragmatic advice I can give is that your transistor should only be used to drive little toy motors. If you have a DC motor of value, it is necessary to be using a relay or a more robust transistor.

  • \$\begingroup\$ Hi Nick, The motor I am using is for toy/robot purposes - jameco.com/webapp/wcs/stores/servlet/… I feel like the current given from the i/o pin should be enough, especially given tutorials like this: youtube.com/watch?v=5bHPKU4ybHY I tried to follow that example exactly (minus the diode, I cant grab one right now), but to no avail. \$\endgroup\$
    – pwee92
    Jul 28, 2013 at 23:30
  • \$\begingroup\$ Theoretically at this point, everything should work. What you will need to do, is purchase a multimeter and measure the current flowing through the DC motor. You will need to know for sure whether or not the motor is being supplied enough. Best of luck. \$\endgroup\$ Jul 28, 2013 at 23:39
  • \$\begingroup\$ I'll try to get a multimeter asap, thanks. If the current provided from the arduino pin is not enough, do you have any suggestions for what I should do (perhaps a different approach)? My project revolves around toggling the motor on and off based on logic written in my arduino program \$\endgroup\$
    – pwee92
    Jul 28, 2013 at 23:42
  • \$\begingroup\$ @PhilFrost Yeah, that was a rushed comment I made and I wasn't very specific; my intention wasn't towards all transistors, but to the specific transistor. I'll make an edit. \$\endgroup\$ Jul 29, 2013 at 1:10
  • \$\begingroup\$ @pwee92 You won't be measuring the current from the Arduino. You'll want to measure the current to the collector because that is the current the motor is getting. You will also want to consider Passerby's comment about the voltage across the motor. \$\endgroup\$ Jul 29, 2013 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.