-2
\$\begingroup\$

I am trying to connect a DC motor to an arduino.

When I set it up like in the first image below, it works and the motor rotates. However, when I set it up in the second image it does not work, am I missing something really obvious? Any help would be great..

image 1

image 2

Code I am using for image 2:

int pinMe = 11; // the pin we will use as output

void setup() {
  // put your setup code here, to run once:
  pinMode(pinMe,OUTPUT);
  digitalWrite(pinMe,HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(pinMe,HIGH);


}

Also when I check the voltage in the second image from pin 11 to ground it reads 4.98V but when I add the two wires from the motor to the bread board (in image 2) the voltage reads 0.14V

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What is the specification of the motor? What voltage, operating current and stall-current is specified? At least one answer has explained that an Arduino pin is very unlikely to work okay driving a motor. However, we can't help you find a good solution without the motors specification, or at least a link to the part. \$\endgroup\$
    – gbulmer
    Commented Apr 12, 2015 at 11:49

2 Answers 2

3
\$\begingroup\$

You have connected your motor directly to an OUTPUT pin of a microcontroller rated at 20mA output current, bad idea.

Firstly it will destroy your micro, the reason you see such a low voltage when you connect the motor to a output is because the PTC is saving it or as @gbulmer mentioned that you may have fried the internal driving circuitry of the AVR(the main chip on the arduino), you should confirm this with a LED and resistor.

The load is inductive also this will destroy your arduino.

You should have the following setup, using a transistor, current limiting resistor and a flyback diode:

http://www.electronics-tutorials.ws/io/io32.gif?74587b

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I agree, the OP should not connect the motor directly to an Arduino I/O pin; that'll likely destroy something in the MCU. However, I think "the reason you see such a low voltage when you connect the motor to a output is because the PTC is saving it" is incorrect. Otherwise the same PTC would protect the 5V connection in the same way, and prevent the direct-to-power motor connection from working. It may be the ATmega pin driver electronics is now broken (confirm with an LED+resistor), or that the driver resistance is too high, and the voltage drops too low. Your solution looks okay. \$\endgroup\$
    – gbulmer
    Commented Apr 12, 2015 at 11:46
  • \$\begingroup\$ @gbulmer - I did have that thought about the PTC working when the motor is driven from VCC, its 500mA, would explain why it ran. I also second that the OP should check he hasn't trashed the driving circuit. \$\endgroup\$
    – RSM
    Commented Apr 12, 2015 at 12:05
1
\$\begingroup\$

Your problem is very simple and common. If you read the specifications for Arduino Uno you will find that the max current per I/O pin is only 40mA.

The motor you are using will need much higher current(if not constant then pulsating), without the current your motor fails to start and hence you are not able to get the motor to rotate.

When you connected directly to 5V, you got enough current as it was from the input which you have given to the Arduino.

A simple solution to your problem is to use a motor driver IC like L293D or if you want you can also use a transistor to drive the motors.

\$\endgroup\$

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.