Pages: [1]   Go Down
Author Topic: HELP 4 motors 1 arduino  (Read 1093 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Am new to arduino and electronics.

I have 4 motors (http://www.dealextreme.com/p/high-torque-80rpm-12v-dc-geared-motor-91628 found here).

And I was wondering what's the best way to link them to my arduino.

I need to be able to control the speed of each motor, but they only need to spine in one direction.

The only way I have set up motors before is like this http://www.oomlout.com/oom.php/products/ardx/circ-03 would this work for the above motors and how fast would they run?

Any help would be great.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They use only little current, so the schematic with the transistor is a good solution.

The Arduino has a number of pins that are PWM capable. You need those pins.
If the motor is full on, and you use it with 12V, the motor gets about 12V (maybe 11.9V because of the voltage drop of the transistor). How fast they would run, depends on the motor.

The PWM output is able to change from 0 (completely off, output pin is 0V) to 255 (completely on, output pin is 5V).
Logged

UK
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that Krodal, is there any way that I could rig the motors up to run off 12v and use the arduino PWM?

Thanks
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No problem.
The motor and the 'flyback' diode can be connected to 12V.
The ground of the 12V has to be connected to the ground of the Arduino.

The transistor gets it's base current from the Arduino (through a resistor), and it controls the motor which is connected to 12V.

Instead of transistors, resistors and flyback-diodes, you could use a ULN2803. The ULN2803 has the resistors and flyback-diodes build-in.
Logged

UK
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So based on this diagram
I would connect the 12v + to the motor and the 12v grd to the diode and the grd of the arduino?

Thanks again
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the schematic is a little confusing.
In my attachted drawing I use the same 12V power supply for the Arduino and the motor. But you could use two different power supplies, as long as both grounds are connected to each other.

You could buy a motor shield. Have you thought about that?
I had fun with an Ebay clone of the Adafruit motor shield : http://arduino.cc/playground/Main/AdafruitMotorShield
No soldering, but you need some program code to make it work.


* output-driver-example.png (5.33 KB, 354x492 - viewed 10 times.)
« Last Edit: June 28, 2012, 04:12:19 am by Krodal » Logged

UK
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that so if I understand you correctly it will be wired up like this?



and I would be able to control the speed of the motor using the Arduino?

Thanks.
« Last Edit: June 28, 2012, 08:11:46 am by jardeth56 » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino makes it's own 5V. The Vin can be 6 ... 12V.

You can use the USB connector for the 5V.
Or you can supply an external +5V to the 5V pin of the Arduino.
Or you can supply an external 6...12V to Vin.
So I would prefer to connect the +12V to Vin.

Everything else is okay.

The PWM is able to switch fast, and by using different pulse widths the speed of the motor can be controlled.
http://en.wikipedia.org/wiki/Pulse-width_modulation
The Arduino function for PWM output is called analogWrite().
http://arduino.cc/en/Reference/analogWrite

Code:
analogWrite(11, 0); // motor off
delay(5000);
analogWrite(11,128); // motor 50%
delay(5000);
analogWrite(11,255); // motor on
delay(5000);

Have fun!
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i cant believe I didnt know that about VIN.  I always thought it had something to do with aref. 
this takes a few steps out of my projects with dual power supplies...
so if you power arduino off vin can you just run your 9v wall wart to vin and ground on the arduino and it doesnt afect anything else.  I mean its still 0-5v at the pins right.
any additional protection advised between wall wart and vin?
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No protection is needed. The 5V pin of the Arduino will be 5V.
The voltage regulator on the Arduino board could get hot if too much current is drawn from the 5V.
Logged

Ontario, Ohio
Offline Offline
Full Member
***
Karma: 1
Posts: 208
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A TIP120 is much less likely to burn up than your PN2222.
Logged

Pages: [1]   Go Up
Jump to: