Trying to control the speed of a DC Motor (MFA 918D100112/1 found on https://www.rapidonline.com/mfa-918d100112-1-gearbox-motor-100-1-4mm-shaft-12-24v-37-1224) using PWM pin on Arduino connected to the base of an npn BJT (2N3904 https://www.onsemi.com/pub/Collateral/2N3903-D.PDF). This is the proposed circuit: enter image description here

I am not sure of the resistor values to choose. As I understood correctly R2 is used as a weak pull down resistor for when the base is floating, and R1 is used to ensure a Vbe is 0.7 V for saturation when the Arduino pin supplies 5 V. R3 is used as a current limiting resistor in order not to fry the transistor.

How do I choose the right values for the resistors? I hope I have understood the theory correctly.

  • 2
    \$\begingroup\$ Did you consider adding a flyback diode in parallel to the motor? Motor has coil and with pulses it will cause huge voltage spikes at the transistor collector each time the pulse goes off. \$\endgroup\$
    – user16307
    Mar 22, 2018 at 11:02
  • 1
    \$\begingroup\$ Choose R1 so that the current though Q1 base is enough to saturate it. R2 should probably be in the 100 kohm range. R3 can be 0 unless you need to limit some inrush current from the motor. Also diode across the motor. You are most likley better of with a N-MOSFET instead of NPN for Q1. \$\endgroup\$
    – winny
    Mar 22, 2018 at 11:06

3 Answers 3


Some things you are going to have to resolve.

  1. The motor you linked runs on 12 to 24V. Not the 3V you show in your proposed circuit.
  2. The 2N3904 NPN transistor is unsuitable for this application. They are typically good for up to ~200mA whilst the motor specs a load current of 300mA and that will grow as more load is placed on the motor.
  3. A resistor in series with the motor is not really going to work. You need to let the motor windings limit the current and then pick a transistor (hopefully a MOSFET) that can handle the current.
  4. When driving an inductive load with active switching you surely need a flyback diode across the motor or else the inductive kick at the turn off time will kill your transistor.
  5. Use a MOSFET and you can limit the amount amount of current load on the Arduino output.

Ok @elecstud ... ball is in your court now.


Here is the circuit being discussed:

There are a number of problems.

  1. R3 is pointless and will only waste power. You are already modulating the motor drive with PWM, so I can't even guess what you think R3 is supposed to accomplish.
  2. You forgot the flyback catch diode across the motor. Without it, the transistor will fry in short order. The best would be a Schottky in reverse across the motor. The lower voltage drop of a Schottky will yield a slightly higher efficiency.
  3. R2 is way too low. It's main purpose is to make sure the transistor stays off when nothing is driving the input. 100 kΩ can accomplish that while not having excessive current requirements of its own during normal operation.
  4. R1 depends on what the digital output can source. Figure the B-E drop of Q1 is 700 mV. If the digital output goes to 3.3 V when high, then that leaves 2.6 V across R1. Let's say the digital output can source 10 mA when high. Now you use Ohm's law to find R1. (2.6 V)/(10 mA) = 260 Ω. Anything less than that will draw more current than the digital output can source in this example.
  5. You have to consider the maximum motor current and the gain of the transistor to see whether this circuit will work at all. Let's say the base current is 10 mA when on. If the transistor has a minimum guaranteed gain of 50, then it can support 500 mA of motor current. That sounds small, especially for startup, unless this is a very small motor.
  6. A BJT is not a good choice here anyway due to possible gain problems and its saturation voltage. With only a 3 V supply, the 200 mV or so drop of the transistor in saturation is significant. That's a 7% loss right there.

    I'd use something like the IRLML2502 FET. It goes down to below 80 mΩ with 3.3 V gate drive, and 45 mΩ with 5 V gate drive. Drive its gate directly from the digital output. R1 is then not necessary, and R2 of 100 kΩ will keep the gate from floating on, but not get in the way.

  • \$\begingroup\$ Seems it is a late question. For point 5, what makes you take 10mA as an example for base current? If we take a higher value, should't the Ic can be higher? \$\endgroup\$
    – mannok
    Apr 7, 2020 at 2:16

Instead of BJT, using a MOSFET will be effective since the transistor you used (2N3903) have maximum collector current of 200 mA whereas Motor specifications tell us that the load current is 300mA.

enter image description here

Also as Michael said, You are using a battery of 3V whereas the motor needs 12-24 voltage as it's spec told. So you have to replace a battery with the new one of 12V or 24V capacity.

Also, in order to prevent transistors from frying of inductive loads, either it is MOSFET or BJT you need a Flyback diode, not a current limiting resistor. Because inductive loads will generate voltage spikes when you turn off the circuit and it will fry your transistor. So you need to provide a path for those voltage spikes after the circuit is switched off. That is why Flyback diode is used here.

Here is the recommended circuit for your requirement

enter image description here

EDIT: As Trevor mentioned in a comment, Rgate Resistor (R2) is added in a circuit.

  • \$\begingroup\$ YOu are missing the series gate resistor... \$\endgroup\$
    – Trevor_G
    Mar 22, 2018 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.