DC Motor speed control

Hi guys!
I am creating musical fountain with arduino duemilonove. I want to drive DC motor with arduino, only thing i need to control is speed.
The motor i am using is here http://www.mabuchi-motor.co.jp/cgi-bin/catalog/e_catalog.cgi?CAT_ID=rs_360sh
To run motor i chose this scheme from youtube tutorial http://aksoapy29.comoj.com/diagram2.png
Well i have few problems, i tried this scheme without arduino, using 2 batteries that output 3V. 3V on transistors base and 3v on motor(as it is in the picture). I thought that maybe i should use higher voltage on motor, i bought 9V battery. Before i tried connecting my 3v battery directly to motor and motor worked, now i tried connecting 9V battery to the motor and it does not work… Can u explain why it is that way? Why transistor may not work and is this scheme adequate at all? That video is here: http://www.youtube.com/watch?v=hcpqt-BREqI&feature=related
I would be really thankful for fast replys as it is my bachelors work and i am a bit low on time. Yes i know since i study in university i should know more, i forgot a lot of things that we learned since never practiced them, but well it comes back slowly:D
UPDATE: Transistor is 2n2222

  1. What value resistor are you using between the Arduino pin and the transistor base? The diagram shows 1K, which is only suitable for very small motors. 100 to 180 ohms would be better (do not go below 100 ohms).

  2. The stall current of that motor (assuming you are using the -2885 variant) is 8.6A which is much higher than a 2N2222 can switch. Use a mosfet to switch it instead of the 2N2222.

  3. A standard 9v battery is intended for low current applications and is not capable of supplying enough current for that motor.

Thank you very much for your reply!
About stall current…it should still work with 2n2222 if there is no load? Or is stall current needed to start the engine?
I will write what results i got…
Tried to search for mosfet in local shops… it seems harder than i thought… could u suggest me some models that u know that are cheap enough? I cant put more money than 10 euros in that. If there is none, maybe some different scheme?
What about using thyristor?

It is hard to find mosfets in local shops, and those that you do find are typically not suitable for logic level gate drive (i.e. 5V, not 10V). It's better to buy them online, for example from Farnell/Element14, RS or Rapid Online. Here are some suitable part numbers:

STP40NF10L
STP40NF03L
IRLZ24PBF
IRL3303PBF

Avoid IRL540, it's one of the more commonly available mosfets but not suitable for driving directly from an Arduino because it needs 10V gate drive.

Thyristors are not good for switching DC because once turned on, they stay on until the current through them drops to near zero.

I wouldn't continue with the 2N2222, if the base resistor is too high then it won't pass enough current, and if it is low enough to pass the running current then you will exceed its current rating when the motor is starting up or stalled.

dc42:

  1. What value resistor are you using between the Arduino pin and the transistor base? The diagram shows 1K, which is only suitable for very small motors. 100 to 180 ohms would be better (do not go below 100 ohms).

Do not go below about 150 ohms - the 40mA rating is an Absolute Maximum, I like to keep it down to about 25mA from a pin to prevent long-term deterioration of the output stage.

dc42:
Avoid IRL540, it’s one of the more commonly available mosfets but not suitable for driving directly from an Arduino because it needs 10V gate drive.

Absolutely - its got truly awful specs (it is a decades-old design). For 8A you should choose a device with Rds(on) < 0.008 ohm (no heatsink), or < 0.05 ohms (moderate heat sink). The IRL540 has Rds(on) = 0.54 ohms and can only be used upto 1A with a heatsink.

Stick a 180 ohm resistor between the Arduino pin and the MOSFET gate, and a 10k resistor between MOSFET gate and source (source is connected to GND).

Hi!
Basically it seems to be too long to wait for motors to come...i have about a week to complete whole thing. All that is needed is to control DC motors... 4 of them... Could u guys tell me a way to control a motor that is cheap enough and its details could be bought in local shops?
Today i went to shop..bought some useless stuff, since there was nothing suitable... I bought 9v battery that is suitable for my motor, and 2 voltage regulators: L200CV and L78S10CV. Well can i use any of those for my needs? Or will it be too complicated? If there is no other way i will wait for those MOSFETs then...

You haven't said which country you are in, however in the developed world you can generally order components online from a major distributor in your own country and get them delivered next day.

Apart from mosfets, you have one other possibility, which is darlington power transistors such as TIP102 or TIP120. This is an inferior solution, because these devices drop around 2V. So you will need a higher battery voltage, and they will probably get hot. But you might find them (along with suitable heatsinks) in local shops.

Yeah darlington solution is pretty nice, found it in catalogs right away... i will buy those tommorow. I will try to order mosfets from local shop and will see how fast they will get me those.
BTW I live in Estonia:D
Thank you... will probably update tommorow.... Anyway even if i cant get them i can still write on paper that this scheme is working one only 2n2222 will be switched for mosfet or darlington and then will give some samples of models that u mentioned here....
And as i understood i should put 10K resistor before ground as MarkT mentioned? Basically is scheme below suitable?

The 10K resistor doesn't go there, the source terminal of the mosfet must be connected directly to ground. The best place for the 10K resistor is between the arduino output pin and ground.

PS - Farnell has a presence in Estonia, see http://ee.farnell.com/. You can order mosfets from them.

dc42:
The 10K resistor doesn't go there, the source terminal of the mosfet must be connected directly to ground. The best place for the 10K resistor is between the arduino output pin and ground.

I am really sorry but it seems kind of confusing to me. Arduino output pin is Arduino PWM so it is connected to 180 resistor and then to MOSFET, do u mean something like this:

Sorry if i misunderstood u:S
Thank you for pointing out farnell to me...well i ordered from shop nearby and as i understood they order them from there...

Pfff... sorry.... i think i got it:D
But why is it needed?

Yes, that's correct. The purpose of the 10K resistor is to ensure that when the Arduino is still starting up and the pin hasn't yet been configured to be an output, the mosfet remains turned off.

Hi guys!
I was told that maybe i should use mosfet driver on the base of mosfet transistors, is it necessary with arduino?

It’s only necessary to use a mosfet driver if you are switching the mosfet at a frequency much higher than the standard frequency used by the Arduinio PWM pins. So you don’t need to use one.

Okay my project leader told me that i have to somehow theoretically prove that arduino can drive those mosfets. As i understand apart from voltage and current frequency of pwm and capacity of mosfet is also important. What is frequency of PWM? is it clock frequency or something?
Basically he wants some calculations from me. Like after which frequency impendance will be too big and will hinder the signal... not like i understand what this information will give me and how can there be impendance when its dc.
Sorry if some things may sound real stupid...its just that i do not have full understanding yet.
Will PWM frequency and current be enough for 4 motors?

See Arduino Forum for how to estimate the mosfet switching time, and analogWrite() - Arduino Reference for the Arduino PWM frequency.

Hi again!
Is arduino able to control 4 motors???
I was testing today the mosfets i got... i did not plug in arduino but started with 3v battery in place of arduino and it did not work, well it also can be because i was in a hurry and could make a mistake, but i think i should ask if it should have worked with battery 3v in place of arduino and 9v on the motor as it was on the scheme...

but i think i should ask if it should have worked with battery 3v in place of arduino and 9v on the motor as it was on the scheme...

Does the data sheet for that MOSFET say they should turn-on with 3V on the gate? Do you have a common-ground between the battery and 9V power supply?