Electronic – arduino – Is this arduino motor driving circuit correct

arduinodc motortransistors

I got an Arduino Pro Micro and some parts to play with. I want to control a little 5v motor from an external power supply by using the Arduino to trigger a transistor. Like this:

enter image description here

Is that at all correct? Will it work? I want to experiment but I don't want to break my new toy in the process. The transistor I am using is an NPN, 2N3904.

Best Answer

You want to use your transistor as a switch. I found a nice site about that which gives this circuit:

enter image description here

Now forget about all the garbage and strip the design down to this:

schematic

simulate this circuit – Schematic created using CircuitLab

Your circuit is correct, except that it's missing the base resistor (R1) and the pull-down resistor (R2). Also, the load (your motor) has to be on the collector of the transistor, not on the emitter. At last, use a flyback or flywheel diode with the cathode to Vcc, like in the first image, to avoid high voltages.

So in the end, your schematic would look like:

schematic

simulate this circuit

Explanation of the circuit:

  • R1 is required to limit the current on the base of the resistor and thereby the current drawn from the Arduino. If you do not use the base resistor, your Arduino might break.
  • R2 is a pull-down resistor which makes sure the voltage on the base of the transistor is low enough to not conduct whenever there is no input signal from the Arduino. So this resistor makes sure you know in what state the circuit is when the Arduino is disconnected. This resistor is not required, but recommended.
  • D1 is a flyback diode which eliminates the voltage spike when the motor stops or starts working. It goes too far to explain why, but whenever you let a current flow through a coil or when you stop letting the current flow, a voltage spike may occur. With the flyback diode, you make sure that spike is eliminated immediately. Usage of this diode is highly recommended.

One last thing to explain: why the motor has to be on the collector side and not on the emitter side of the transistor. Wouter explains this in his answer, in short: with the load on the collector side you are in charge of what voltage the motor gets; with the load on the emitter side, this voltage cannot be higher than the voltage on the base (minus something).