Reputation: 103
I have tried setting my motor up using this example: http://www.dummies.com/how-to/content/how-to-spin-a-dc-motor-with-the-arduino.html
But the motor will not work – it is not broken, it works if I attach it directly to a battery. I do however hear a extremely vague clicking sound from the motor.
Any suggestions on what is wrong, and how to fix it? Am I missing something obvious?
The motor name is: H30480 MOT4, Mini DC motor - 7,2Vdc / 500mA 16200rpm
This is the code:
int motorPin = 9;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
digitalWrite(motorPin, HIGH);
delay(1000);
digitalWrite(motorPin, LOW);
delay(1000);
}
And here is my setup:
Im quite new to Arduino, so suggestions are much appreciated.
Upvotes: 2
Views: 1565
Reputation: 1501
Code seems ok. Although i see that you power your arduino via USB. The computer limits the current to 500mA but about 50 - 80mA goes to the Arduino itself. So you get about 450 - 420 mA for your DC motor that is not enough. If you use external power for your Arduino you will probably be able to properly power the motor via the Arduino but 500mA is still a lot of current.
The best solution is to externally power the DC motor.
Upvotes: 4