Go Down

### Topic: DC Motor speed control (Read 11084 times)previous topic - next topic

#### FFTMaster

##### May 13, 2012, 11:34 pmLast Edit: May 13, 2012, 11:38 pm by FFTMaster Reason: 1
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

#### dc42

#1
##### May 14, 2012, 12:36 amLast Edit: May 14, 2012, 12:41 am by dc42 Reason: 1
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### FFTMaster

#2
##### May 14, 2012, 02:05 amLast Edit: May 14, 2012, 02:10 am by FFTMaster Reason: 1
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?

#### dc42

#3
##### May 14, 2012, 10:36 amLast Edit: May 14, 2012, 01:15 pm by dc42 Reason: 1
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### MarkT

#4
##### May 14, 2012, 01:28 pm

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.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### MarkT

#5
##### May 14, 2012, 01:33 pm

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).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### FFTMaster

#6
##### May 14, 2012, 05:04 pm
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...

#### dc42

#7
##### May 14, 2012, 05:40 pm
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### FFTMaster

#8
##### May 14, 2012, 06:40 pm
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?

#### dc42

#9
##### May 14, 2012, 06:48 pm
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### dc42

#10
##### May 14, 2012, 06:50 pm
PS - Farnell has a presence in Estonia, see http://ee.farnell.com/. You can order mosfets from them.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### FFTMaster

#11
##### May 14, 2012, 07:21 pm

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

#### FFTMaster

#12
##### May 14, 2012, 07:48 pm
Pfff... sorry.... i think i got it:D
But why is it needed?

#### dc42

#13
##### May 14, 2012, 08:37 pm
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### FFTMaster

#14
##### May 16, 2012, 11:15 am
Hi guys!
I was told that maybe i should use mosfet driver on the base of mosfet transistors, is it necessary with arduino?

Go Up