# DC Motor Control

Hi,

I'm trying to control a DC motor with the Arduino Uno. I have looked up a few other threads related to this and looked up PWM etc. I have used some electronics simulation software to simulate what I want (http://www.thebox.myzen.co.uk/Workshop/Motors_1.html) and it works fine but I'm slightly cautious of doing it for real and would just like to ask a few questions related to actual hardware.

I am using this motor: http://www.cornwallmodelboats.co.uk/acatalog/graupner_1794.html 3.3 amps, 7.2 volts.

Will I need a slightly higher tolerance transistor, say 4 amps 10 volts? The picture in the Motors 1 link has a 3K3 resister, is this a 3k ohm resistor, if so what does the final 3 mean?

Also, is the 0V the ground on the Arduino or does it need to be a different ground?

Thanks a lot and sorry for my incompetence :)

Depending on the load on the motor it can pull 2 to 3 times as many amps at startup so a 10 amp transistor would probably be good.

0V is ground on the Arduino.

1) I've found this transistor, 10A and more than enough room for my required voltage. http://uk.rs-online.com/web/p/general-purpose-transistor/5449371/ Is this right? Good price?

2) Been following this: http://www.electronics-tutorials.ws/transistor/tran_2.html According to the transistors docs the current gain is 5 at 10A and 20 at 4A therefore:

Ic = 10A Ie = 10 * 5 = 50A ? Ib = 50 - 10 = 40A ?

3) Thirdly what resistor will I need, as in, how many ohms? I understand the Arduino has a 40mA max but I should probably not go that high? Not sure on how to calculate current/resistance when using transistors. I think I need a 500 ohm resistor based on my calculations, but I don't know if transistors do something fancy.

4) The Arduino pin at 5V right?

5) Also, diodes. No idea on this one as all circuit diagrams just say "put a diode here". I presume they have max ratings and such. Will it also need to be 10A and > 7.2V? This is to stop current induction when the power is cut to the motor right?

Again, new to transistors so help appreciated :)

thetree: The picture in the Motors 1 link has a 3K3 resister, is this a 3k ohm resistor, if so what does the final 3 mean?

3k3 ohm = 3.3kOhm. i.e. the "k" is taking the place of the decimal point.

thetree: The picture in the Motors 1 link has a 3K3 resister, is this a 3k ohm resistor, if so what does the final 3 mean?

3k3 ohm = 3.3kOhm. i.e. the "k" is taking the place of the decimal point.

Ahh I see, thanks for clearing that up, just wanted to be sure :)

Sorry, I don't mean to be pushy but could someone give me some guidance regarding my previous post?

Thanks

For a 3A motor, you would be much better off using a logic level N-channel mosfet instead of a transistor. It will run much cooler and you won't have a problem providing enough base current. In that circuit, replace T1 by a logic level mosfet, and replace the 3k3 resistor by one in range 100 to 220 ohms.

My rule of thumb: - to switch up to 500mA, use a transistor - to switch more than 500mA, use a mosfet - never use a darlington

PS - that motor has a current drain of 21A @ 7.2v when stalled. So unless you implement some form of current limiting, the mosfet needs to be rated at 21A or more. The diode in parallel with the motor similarly needs a peak (not necessarily continuous) rating of 21A.

dc42: For a 3A motor, you would be much better off using a logic level N-channel mosfet instead of a transistor. It will run much cooler and you won't have a problem providing enough base current. In that circuit, replace T1 by a logic level mosfet, and replace the 3k3 resistor by one in range 100 to 220 ohms.

My rule of thumb: - to switch up to 500mA, use a transistor - to switch more than 500mA, use a mosfet - never use a darlington

PS - that motor has a current drain of 21A @ 7.2v when stalled. So unless you implement some form of current limiting, the mosfet needs to be rated at 21A or more. The diode in parallel with the motor similarly needs a peak (not necessarily continuous) rating of 21A.

Thanks for the quick response. Can I just ask how you came to 100 - 220 ohms?

I'm struggling to find diodes rated to 21A - the current limiting plan might be a better option. Also, if I want to limit this to 10A then I'll need a 0.72 ohm resistor. Finding it hard to find a 0.72 ohm resistor too, so would having a 1 ohm resistor limit the current to 7.2A matter? The motors normal current is ~3A so it would only limit the spin up current, meaning it would just be slightly slower when accelerating? If I were to use a 1 ohm resistor its not going to drop a significant voltage across it as I assume the resistance in the motor is much higher?

thetree: Thanks for the quick response. Can I just ask how you came to 100 - 220 ohms?

The gate of a mosfet behaves like a capacitor. The purpose of the series resistor is to limit the peak current to/from the Arduino pin when it changes state. 100 ohms limits it to around 40mA (the maximum continuous rating), and 220 ohms limits it to around 20mA. Higher values will slow down the mosfet switching, causing it to run hotter - especially if you are using PWM to control the motor speed.

thetree: I'm struggling to find diodes rated to 21A - the current limiting plan might be a better option. Also, if I want to limit this to 10A then I'll need a 0.72 ohm resistor. Finding it hard to find a 0.72 ohm resistor too, so would having a 1 ohm resistor limit the current to 7.2A matter? The motors normal current is ~3A so it would only limit the spin up current, meaning it would just be slightly slower when accelerating? If I were to use a 1 ohm resistor its not going to drop a significant voltage across it as I assume the resistance in the motor is much higher?

There are plenty of diodes available rated 21A or above - just search the distributor web sites. For example, http://uk.farnell.com/ixys-semiconductor/dss-25-0025b/diode-schottky-25a/dp/1080065. Alternatively, you could use a second mosfet of similar type. If you connect the gate to the source, the mosfet will be permanently off. However, all power mosfets have a body diode between source and drain, and this diode is normally rated to carry at least as much current as the mosfet channel itself.

The DC resistance of the motor is 7.2v/21A = 0.34 ohms. At 3A, a 1 ohm resistor would drop 3v, which is quite significant given that the power supply is only 7.2v. You could use a 0.4 ohm resistor (which you can make up from three 1.2 ohm resistors in parallel), which when added to the 0.34 ohm motor resistance will limit the current to 10A.

Alternatively, you could implement active current limiting, i.e. sense the current and turn off the mosfet for a short time if the current reaches some limit. You might want to implement current limiting for other reasons, e.g. to protect the motor from burning out, or to protect the battery or power supply.

dc42:
The DC resistance of the motor is 7.2v/21A = 0.34 ohms. At 3A, a 1 ohm resistor would drop 3v, which is quite significant given that the power supply is only 7.2v. You could use a 0.4 ohm resistor (which you can make up from three 1.2 ohm resistors in parallel), which when added to the 0.34 ohm motor resistance will limit the current to 10A.

Right. The current limiting seems the best route as it will also make sure I can preserve the battery for that little bit longer. I’m actually using 4 motors so I’ll probably have to buy smaller ones that use less current or else I will need one beefy battery.
Now the current is limited to 10A I can get 10A rated parts. I just want to make sure I’ve got the right thing.
I’ve made this circuit diagram which I think is correct.

Farnell is so much better than RS for searching.

I’m slightly worried about the MOSFET as it was the cheapest one on the list, though I can’t see much difference between it and others, other than a slightly lower voltage rating which is still much higher than I’m using.
Is the temperature a risk on relatively low current circuits like this? I see that most transistors/MOSFETs/diodes have a hole for a heat sink, but I won’t need that right? They are not going to be in an enclosed position or anything, and will be quite close to a propeller which is what the motors are driving.

So yeah, are these OK?

Thanks for all the help.

The diode looks more than adequate, however the Rds(on) of the mosfet at Vgs=4.5v is quoted for Id=5A. Also the Rds(on) is on the high side, given that you want the mosfet to pass 10A. Look for a mosfet with Rds(on) as low as possible (certainly below 50 milliohms), quoted at Vgs=4.5v and Id >= 10A.

dc42: The diode looks more than adequate, however the Rds(on) of the mosfet at Vgs=4.5v is quoted for Id=5A. Also the Rds(on) is on the high side, given that you want the mosfet to pass 10A. Look for a mosfet with Rds(on) as low as possible (certainly below 50 milliohms), quoted at Vgs=4.5v and Id >= 10A.

http://uk.farnell.com/vishay-formerly-i-r/irliz34gpbf/mosfet-n-60v-20a-to-220fp/dp/8660069 ? Vgs is 5V, will that be a problem?

That one is not too bad, Rds(on) is quoted at 70 milliohms @ 4v 10A, 50 milliohms @ 5v 12A.

Bear in mind that the power dissipation is I^2*R. So at 10A and 50 milliohms this is 5W and you will need a heatsink. You might consider something like http://uk.farnell.com/stmicroelectronics/stu95n2lh5/mosfet-n-ch-25v-80a-ipak/dp/1752195 which has Rds(on) of 5 milliohms typical at 5v and 10A, so won't need a heatsink as long as you drive it hard enough to switch fast (indeed, that device is not in a TO220 case, so heatsinking it is not easy). Or you could play safe and go for http://uk.farnell.com/stmicroelectronics/stp85n3lh5/mosfet-n-ch-30v-80a-to-220/dp/1752172 which comes in a TO220 case.

dc42:
That one is not too bad, Rds(on) is quoted at 70 milliohms @ 4v 10A, 50 milliohms @ 5v 12A.

Bear in mind that the power dissipation is I^2*R. So at 10A and 50 milliohms this is 5W and you will need a heatsink. You might consider something like http://uk.farnell.com/stmicroelectronics/stu95n2lh5/mosfet-n-ch-25v-80a-ipak/dp/1752195 which has Rds(on) of 5 milliohms typical at 5v and 10A, so won’t need a heatsink as long as you drive it hard enough to switch fast (indeed, that device is not in a TO220 case, so heatsinking it is not easy). Or you could play safe and go for http://uk.farnell.com/stmicroelectronics/stp85n3lh5/mosfet-n-ch-30v-80a-to-220/dp/1752172 which comes in a TO220 case.

Ahh, I looked for ages trying to find something like the two you posted. As you can tell I’ve not done this before so I’ll play it safe just in-case in gets too hot. I shouldn’t be running it for too long though so it should be fine.

Thank you so much for all your help, and everyone else who posted earlier on

I find that the trick for finding logic-level mosfets on the Farnell site is to filter for typical threshold Vgs of 2V maximum, and whatever other filters you need e.g. maximum Rds(on) and minimum Id(max). Then check on the datasheet whether a value for Rds(on) is specified at Vgs=5v or less. Filtering on Rds(on) test voltage unfortunately doesn’t work because most logic level mosfets are also specified at Vgs=10v, and this is what shows up in the summary data that you can filter on.

PS - those 2 mosfets have a high gate charge (it comes with having a low Rds(on)), so I suggest using the minimum value series resistor to drive the gate, i.e. 100 ohms.

dc42: PS - those 2 mosfets have a high gate charge (it comes with having a low Rds(on)), so I suggest using the minimum value series resistor to drive the gate, i.e. 100 ohms.

Ok will do, thanks :)

Sorry to bring this up again but I overlooked the buying of the resistors. Turns out my source of resistors didn't have any 1.2 ohms or anything that could be used to make a 0.4 ohm total. I went looking on Farnell and RS but I'm now not sure of the number of Watts I'll be dissipating across each resistor. This is regarding the 3 1.2 ohm resistors in parallel. The 100 ohm MOSFET resistor power is tiny and not a problem.

Using 10A and 4V I came to 13.3W per resistor, but this seems rather high and any resistor with this kind of rating seems way too big for what I'm doing. I mean most of them have heat sinks attached and look like they should be controlling something 10x the size of my motors. Have I made some silly mistake with the 13.3W or is this correct? If so, am I just failing at finding resistors?

Thanks a lot, once more :)

If you use a single 0.4 ohm resistor (or 0.39 ohm, which is the nearest standard value), then it will indeed dissipate around 14W when the motor stalls. If you use three 1.2 ohm resistors in parallel, then each one only takes one third of the 10A current, so they dissipate just under 5W each.

dc42: If you use a single 0.4 ohm resistor (or 0.39 ohm, which is the nearest standard value), then it will indeed dissipate around 14W when the motor stalls. If you use three 1.2 ohm resistors in parallel, then each one only takes one third of the 10A current, so they dissipate just under 5W each.

At 10A the PD across each of the resistors would be 4V (0.4 * 10)? Therefore the power dissipated would be 4 * 10/3 = 13.3W. I thought I'd already compensated for the 3 resistors by dividing 10 by 3?