# Control 5V DC motor with Arduino

I'm trying to build a circuit to control a 5V DC motor with Arduino. My issue is that I can't understand the resistance value within this scheme:

Which resistor should I use in order to make work properly the TIP132 transistor (datasheet)?

-

The resistance depends on the motor's maximum current consumption and the transistor's h(FE) - the ratio between collector and base current. As I can see in the datasheet (http://www.datasheetcatalog.com/datasheets_pdf/T/I/P/1/TIP132.shtml), TIP132's h(FE) is at least 1000. Say your motor consumes at most 2 A (which you have to find out yourself, either from its datasheet or block the rotor and measure the current consumed), so the microcontroller has to source about 2 mA to drive the transistor.

The transistor's base-emitter voltage should be about 1.5 V (it's a Darlington transistor, that is, two base-emitter junctions are connected in series, dropping about 0.7 V each), so the resistor should drop about 3.5 V with 5 V supply. Having that we can calculate that its resistance should be: 3.5 V / 2 mA = 1,75 kOhm, so 1.5 kOhm would be suitable in my case.

Again, check your motor's maximum current consumption and re-calculate the resistance. You may also find an interesting option in replacing a BJT with a suitable MOSFET (an IRL3202 could be a good choice). A MOSFET has lower "open-state" voltage drop than a BJT, so it allows to deliver nearly full supply voltage to the motor and dissipates less heat.

-
Very nice answer. Welcome! – Passerby Feb 24 '14 at 3:50
@deed02392 I meant the voltage between resistor's terminals should be about 3.5 Volts, and I expressed that with the "voltage drop" term. Probably my English wasn't perfect here. Please correct it in order for me to learn :) – motoprogger Feb 24 '14 at 13:25

The calculation "3.5 V / 2 mA = 7 kOhm" is wrong!

In reality:

the 3.5 was calculated as 5V (arduino output at logical "1" state) - 1.5 V (darlington transistor B-E voltage when conducting).

3.5 V / 0.002 A = 1750 ohms

It is better to round the value down, so the nearest E24 value would be 1600 ohms.

And: can you really guarantee that the arduino would output exactly 5 V when in logical "1" state?

if the Arduino only gives out for example 4.4V instead of 5V, the calculation would change to:

4.4 V - 1.5 V = 2,9 V

2.9 V / 0.002 A = 1450 ohms the rounded down (E24) of 1450 ohms is 1300 ohms.

To be sure, you should check from the Arduino technical specification:

the minimum I/O pin output voltage when in logical "1" state.

Then calculate the resistor voltage:

U(R) = V(I/O @ logical "1") - 1.5V

And finally, assuming the transistor is exactly hFe = 1000, if the motor current is 2 A , that hFe = 1000 means that needed base current for the transistor is the same as the resistor current I(R) = 2 A / 1000 = 2 mA = 0.002 A.

So finally:

R = U(R) / I(R)

While it is true that if you have a little too low resistance, you have a little too high base current, but the opposite is even worse:

Too small base current may not allow the transistor to go fully to saturation, and that means:

1) the transistor generates more heat

2) the voltage loss in the transistor is unnecessary big, leaving less voltage (and less power) for the motor.

-
I have edited my answer with the correct calculation of the resistance. I have mistaken with the arithmetic division and this led me to the wrong suggestion. – motoprogger Feb 24 '14 at 13:28