-1

I am trying to control a 3V DC motor (FA-130) with my Arduino Uno, and am trying to do that using an NPN transistor (2N3904) as a switch, as shown in this diagram.

Diagram - Arduino, NPN transistor, DC Motor

I used the Blink example and modified the pin used for the output to be the one attached to the transistor's base (e.g. pin 2 in the diagram).

The motor does nothing. If I replace the motor with an external LED component it works, blinking on/off every 1 second. If I connect the motor directly to my Arduino's 5V and GND (or even 3.3V and GND) then the motor runs fine.

Why does the motor not run when connected using the transistor? Is there a significant enough drop in voltage/current/something else?

0

It depends on the transistor. You might not be driving it to full saturation, or it's "on resistance" may be too high to pass enough current to drive the motor. You'd need to tell us the specific transistor, as well as the specs on the motor before we could figure out what's going on.

An LED draws a whole lot less current than a motor, so the transistor may not have any problem powering your LED. (You usually need a current limiting resistor when you drive an LED from 5V to avoid burning it out.)

I would suggest using a MOSFET transistor instead. This one, for example, can drive up to 30A at 60V: https://www.adafruit.com/product/355

It has very low on resistance, and is fully turned on by a 5V CMOS logic output, and requires very little current through the base to turn it on.

As CrossRoads pointed out, if you're using an NPN or other BJT transistor you really need a current limiting resistor between the Arduino output and the gate so you don't draw too much current from the Arudino pin and fry it.

Note that regardless of what type of transistor you use, you need a "flyback diode" on the motor to protect the transistor from back EMF from the motor's inductive coils. Without a flyback diode you run the risk of destroying your transistor.

  • The transistor is 2N3904. The motor is FA-130, I will update the question with that info. What specs do I compare? Arduino "Output Current Limit", transistor "peak collector current", and DC motor "Stall current"? – user453441 Jul 18 '19 at 1:17
  • Collector current is 200mA, its peak is 300mA. DC motor's "no load current" is 150mA, and Arduino's "output current limit" is 500mA~1A. It seems like the motor should draw enough current to at least start turning? – user453441 Jul 18 '19 at 1:27
  • Arduino has no output current limits. If you attempt to draw too much current, the 5V regulator may just overheat and shutdown, or it may fail catastrophically, or the reverse voltage protection diode may die. If current is coming from the USB connection, the USB polyfuse may overheat and open, or the PC for example might complain of a surge and shut down the port. – CrossRoads Jul 18 '19 at 12:37
  • The IO pins are similarly not current limited. You may have blown the pin driving the transistor base. The base pin acts like a diode to Gnd, with Vbe from 0.6V to 0.85V mccsemi.com/pdf/Products/2N3904(TO-92).pdf If the '328P is hot to the touch, that's an indication you blew the output pin's internal protection diodes. Replace the chip. If not, try a different pin and put a 120 to 150 ohm resistor between the Arduino pin and the transistor base to limit current flow. – CrossRoads Jul 18 '19 at 12:43
  • @CrossRoads I thought the Arduino's 5V regulator had a protection circuit and would shut down if you drew too much current. I was mistaken? – Duncan C Jul 18 '19 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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