PWM pin to weak?

Hi there,

I'm new to Arduino but already am a web/app developer. But i have a qeustion i'm trying to spin a DC motor which works perfect with the 5v pin on my aduino uno. But i wanted to being enabled to slow the motor down using a PWM pin?

Somehow if i use PWM the power is not strong enough to power the DC motor anymore well i hear the sound but it's so weak? and with the 5v pin it works perfect???

This is my code:

int driveMotor = 11;

void setup() {
  // initialize digital pins as output.
  pinMode(driveMotor, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  analogWrite(driveMotor, 255);
}

And i know i don't need to put analogWrite in the loop but i was trying to change it and so far as i know 255 is full power? but somehow its to weak???

The output pins on the Arduino are not powerful enough to drive a motor. You can damage the outputs doing this.

That's correct. A Arduino IO pin can only supply 40mA at best. To low for a motor and can even damage the Arduino. The 5V pin is not a IO pin, it's simply the power supply.

So google "Arduino motor" ;)

aarg: The output pins on the Arduino are not powerful enough to drive a motor. You can damage the outputs doing this.

septillion: That's correct. A Arduino IO pin can only supply 40mA at best. To low for a motor and can even damage the Arduino. The 5V pin is not a IO pin, it's simply the power supply.

So google "Arduino motor" ;)

OMG, thanks guys.

Well i also have a motor shield i think i need to use that but i can't find a clear tutorial over how to set-up 1 motor and is this a solution for my problem?

EDIT: Another question can i connect a 7.4/7.9V accu to the arduino uno?(red/black wire)

What is an accu? accu?

Or would this help more? http://www.pighixxx.com/test/portfolio-items/connect-a-dc-motor/?portfolioID=610

aarg: What is an accu?

battery* sorry.

SynteX: battery* sorry.

Yes, you can connect it to the barrel jack input. Your motor shield should have some examples and documentation with it, or available elsewhere on the net if it is a clone.

I have this one: http://www.miniinthebox.com/nl/l298n-stepper-motor-driver-controller-board-module-voor-arduino-werkt-met-de-officiele-arduino-boards_p903378.html

If i search on internet for the same type they use older versions?

Yes, you can use that to drive a motor (even 2 individual), it's designed for the task. Would be a bit stupid if it could not do so. It's kind of the same as the transistor but all in one. Bit more complicted then that, you can also reverse the motor etc. The board is all you need to drive 2 motors. Just connect the power, the motor. And connect GND, ENA, IN1 and IN2 (for motor 1) to the Arduino. Connect ENA to a PWM pin for the speed. And with IN1 and IN2 you can change the direction.

Note: I don't have this board so I'm not 100% sure. For example, what are the jumpers doing? Seems like pull down selecters so good to have on. And if the motor supply is also 5V you probably want to remove the 5v_en jumper and connect the Arduino 5V to +5V as well.

septillion: Yes, you can use that to drive a motor (even 2 individual), it's designed for the task. Would be a bit stupid if it could not do so. It's kind of the same as the transistor but all in one. Bit more complicted then that, you can also reverse the motor etc. The board is all you need to drive 2 motors. Just connect the power, the motor. And connect GND, ENA, IN1 and IN2 (for motor 1) to the Arduino. Connect ENA to a PWM pin for the speed. And with IN1 and IN2 you can change the direction.

Note: I don't have this board so I'm not 100% sure. For example, what are the jumpers doing? Seems like pull down selecters so good to have on. And if the motor supply is also 5V you probably want to remove the 5v_en jumper and connect the Arduino 5V to +5V as well.

Thank you so much, i'll try it out this evening.