I'm trying to follow this tutorial

But instead of the components specified in the tutorial, I'm using the following:
- RS-360SH DC Motor
- BD139 Transistor
- 1N4007 Diode
- 220 Ohm Resistor

I understand that the components are different than specified in the tutorial, but these components are specified in another (less clear tutorial with the same schematics.

And I have the following arduino code:

int MotorPin =  9;
void setup()
  pinMode(MotorPin, OUTPUT);

void loop()
  analogWrite(MotorPin, 200);

All I can get is a buzz in the motor. There doesn't seem to be enough current to power it on. Can anyone explain what I'm doing wrong?

Edit This is my schematic (I put the 2N2222 transistor, because I tested with that one as well):


simulate this circuit – Schematic created using CircuitLab

And this is how I plugged everything onto the breadboard.

enter image description here

  • 3
    \$\begingroup\$ Press Ctrl-M and add a schematic showing how the transistor is connected. Also provide info about the supply used, and motor rating. \$\endgroup\$ – alexan_e Mar 1 '14 at 0:59
  • \$\begingroup\$ What about the power supply of the motor, are you trying to use the 5v provided from the Arduino board? Is your board the same as shown in the tutorial (UNO R3)? \$\endgroup\$ – alexan_e Mar 1 '14 at 1:06
  • 2
    \$\begingroup\$ @alexan_e I added the schematic and another figure. \$\endgroup\$ – AntonioJunior Mar 1 '14 at 2:12
  • \$\begingroup\$ You're using the -2885, right? \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 1 '14 at 2:17
  • \$\begingroup\$ @IgnacioVazquez-Abrams Yes. I connected it directly to the power source (9V), as well as to the Arduino (5V) and it works. \$\endgroup\$ – AntonioJunior Mar 1 '14 at 2:22

Your schematic is correct, basically.

Although it is not explicitly shown on your diagram, I assume you have the Arduino plugged into a USB port which supplies it with power?

What happens if you connect the 9V power supply directly to the motor? Of course the motor should spin constantly at full speed. This tests that the voltage of this power supply is appropriately matched to your motor, and the power supply can source enough current to run the motor.

Now, what happens with the wire disconnected from pin 9 on the Arduino and plugged into +5V on the Arduino? If the transistor and other parts are wired up correctly this should also cause the motor to spin up constantly at full speed.

If this doesn't work double check the pinout of the transistor.

Now, in your software, try turning the motor on with a single digitalWrite(MotorPin, HIGH) statement in the setup part of your program. Don't put anything inside the loop at this stage. This should just cause your motor to turn on and stay on all the time at full speed.

Now, if that works, try something like analogWrite(MotorPin, 128) executed once in the setup part of your program, with nothing in the loop. The motor should now turn on, and stay on constantly, at reduced speed.

Is the motor current too much for the 2N2222 to handle? (Once you know what the motor's actual specifications are for current draw, check the collector current in the 2N2222 datasheet.) You may need to consider substituting a different, higher-current transistor such as a TIP120 or BD675.

| improve this answer | |
  • \$\begingroup\$ "Now, what happens with the wire disconnected from pin 9 on the Arduino and plugged into +5V on the Arduino?" - The motor runs at constant full speed. --- "try turning the motor on with a single digitalWrite(MotorPin, HIGH)" - This works. --- "analogWrite(MotorPin, 128)" I can only hear a buzz with this. The motor won't turn. \$\endgroup\$ – AntonioJunior Mar 1 '14 at 2:42
  • \$\begingroup\$ @AntonioJunior Then you're not pushing enough current through the motor to turn it. Try higher PWM values. \$\endgroup\$ – Nick Williams Mar 1 '14 at 2:52
  • \$\begingroup\$ @NickWilliams I tried up to 255, but still got the same result. \$\endgroup\$ – AntonioJunior Mar 1 '14 at 15:44

Use a power source which can drive more current. You can use the following circuit

enter image description here

| improve this answer | |

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.