DC Motor not running

Hi,

Attached is my circuit and code. I am trying to run a small dc-motor. I was able to do the LED blinking and servo motor examples. However, the dc motor is not working.

Am I doing something wrong here?

Thanks in advance.

Code:

void setup() {
// initialize digital pin 13 as an output.
pinMode(9, OUTPUT);

digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(9, LOW);

}

Hi,

I have the same problem - so I wonder if you made it work?

I followed this description: http://www.dummies.com/how-to/content/how-to-spin-a-dc-motor-with-the-arduino.html

But the motor doesn’t react. There is nothing wrong with it, if I test it by connecting it to a battery.
However, I do hear a extremely vague clicking sound coming from the motor.

So if you found a solution I would be happy to hear - or in case someone else has a suggestion?

My motor is a H30480 MOT4, Mini DC Motor - 7,2Vdc / 500mA 16200rpm (3-9V)

And this is the code:

int motorPin = 9;
void setup() {
   
 pinMode(motorPin, OUTPUT);
}
void loop() {
 digitalWrite(motorPin, HIGH);
 delay(1000); 
 digitalWrite(motorPin, LOW);
 delay(1000);
 
}

IMG_6401.JPG

You cannot power a motor direct from the arduino

You need a transistor to supply power to the motor and use the arduino to control the transistor

Furthermore, you should use a separate battery or power supply for the motor. Motors create electrical noise that can damage an Arduino. Connect the grounds of the two power supplies together.

Thank for your answers! Do you happen to know a tutorial on adding a separate battery and transistor?

amag:
Thank for your answers!
Do you happen to know a tutorial on adding a separate battery and transistor?

Attached is a typical schematic. Use analogWrite() on the pin to the transistor if you want to vary the speed, else just digitalWrite() it high or low for on or off.

These links will help explain:

Transistors

Transistor circuits

motor and transistor.png