Go Down

Topic: Controlling the speed of a dc motor? (Read 1 time) previous topic - next topic

trogers123

I know this has been asked before but I'm trying to control the speed of a dc motor with my arduino.

I looked around in the forum and found that I should use a transistor but I'm not exactly sure how transistors work or how I should wire it.

AWOL

Have you looked in the Playground for any examples or demos?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

trogers123

Yes I checked out this-->http://playground.arduino.cc//Main/DCMotorControl one and I don't care about controlling the direction of the motor just the speed. I'm fairly new and don't really understand the diagrams that are on there.

MAS3

#3
Jan 09, 2013, 11:09 pm Last Edit: Jan 09, 2013, 11:13 pm by MAS3 Reason: 1
Use PWM to control speed.

Your motor will generate spikes because of this PWM (it will generate spikes anyway), so protect your electronics (the diode across the transistor in the schematics).
If you need more info, ask specific questions.

The schematics you saw at the playground are wrong (there is a warning about that directly above it).
The box with an X in it and connected to 12 volts and pin 11 (this is the error), is supposed to be the relay used to invert direction.
As you have no use for that, you can remove it and forget all about pin 3 and the relay in your sketch.
Connect one side of your motor to 12 volts, and the other side to your transistor.
If the motor runs in the wrong direction, exchange these two wires.

[edit]
Another error in those schematics: the pot to analog pin 0 is also wrong.
Analog pin 0 is supposed to be connected to the 1 K resistor and 5 volts to where Analog 0 is now (so these two are to be exchanged).
[/edit]
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

trogers123

I was planning on using the PWM im just not exactly sure how to wire it up safely. What about this https://sites.google.com/site/arduinosoapy29/motor-speed-controller schematic? this is more what i want because im not using a potentiometer.

Go Up