Using an NPN Transistor as a switch

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.

Driving a DC Motor using transistor as switch

VCC = 9V,  Vin = Arduino digital pin (HIGH = 5V, LOW = 0V)

Choosing a transistor and proper resistance values

  1. 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
  2. Now, we have to choose a transistor with maximum collector current rating greater than 940 mA.
  3. The transistor BD139 has ICmax rating of 1.5A which is well above 940mA.
  4. We know, IC = hfe x I (hfe is used to represent the dc current gain in datasheets of transistors, more commonly it is known as beta, β = IC / IB )
  5. For BD139, hfe(minimum) = 63 (we always consider minimum current gain, to ensure saturation)
  6. 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)
  7. The required base resistor value to supply 15mA to the transistor’s base is given as
    RB = (Vin – VBE) / I= (5V – 0.7V) / 15mA = 286.67 ohms ≅ 300 ohms (since, resistances are available in limited standard values)
  8. 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



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s