HELP 4 motors 1 arduino

Hi, Am new to arduino and electronics.

I have 4 motors ( 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 would this work for the above motors and how fast would they run?

Any help would be great.

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).

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


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.

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

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 : Arduino Playground - AdafruitMotorShield
No soldering, but you need some program code to make it work.


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?


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.

The Arduino function for PWM output is called analogWrite().

analogWrite(11, 0); // motor off
analogWrite(11,128); // motor 50%
analogWrite(11,255); // motor on

Have fun!

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?

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.

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