Lets, say we want to drive a small 9V 100rpm DC geared motor, which has stall current of around 722mA. Since the Arduino pins can only provide maximum of 20mA current, we cannot directly interface the motor to the Arduino.
Here we will use an NPN transistor in common-emitter configuration as shown in the circuit below to drive the motor from arduino pin.
VCC = 9V, Vin = Arduino digital pin (HIGH = 5V, LOW = 0V)
Choosing a transistor and proper resistance values
- Our maximum load current here is 722mA, which is also the collector current of the transistor. For practical purposes it is advisable to consider 30% more than the maximum load current to ensure that the transistor always gets saturated.Therefore, IC = 722mA + 30% of 722mA = 938.6mA ≅ 940mA
- Now, we have to choose a transistor with maximum collector current rating greater than 940 mA.
- The transistor BD139 has ICmax rating of 1.5A which is well above 940mA.
- We know, IC = hfe x IB (hfe is used to represent the dc current gain in datasheets of transistors, more commonly it is known as beta, β = IC / IB )
- For BD139, hfe(minimum) = 63 (we always consider minimum current gain, to ensure saturation)
- Therefore, the base current is given as IB = 940mA / 63 = 14.98 mA ≅ 15mA (Arduino’s digital pins can easily provide that amount of current)
- The required base resistor value to supply 15mA to the transistor’s base is given as
RB = (Vin – VBE) / IB = (5V – 0.7V) / 15mA = 286.67 ohms ≅ 300 ohms (since, resistances are available in limited standard values)
- A general purpose diode is connected in parallel to the dc motor as a flyback diode to prevent high voltage spikes from damaging the transistor.
- Using Bipolar Transistors As Switches By Mike Martell, link
- Flyback diode, link
- Arduino reference, link
- 100 rpm dc motor specifications, link
- BD139 datasheet, link
- General purpose diode (1N4001-1N4007) datasheet,link