# Arduino + transistor to switch PC fan on/off

I have:

• an Arduino UNO
• a 12V PC fan with 1.68W rating (140ma).
• 2n3904 transistor
• 12V 500ma power supply to connect to Vin.

What I would like to do is to simply use a digital output pin on the Arduino to turn the fan on and off (no need to PWM). What resistor should I use at the base of the transistor and in series with the fan if I want to switch the fan on and off using this transistor?

Without the transistor I see that a 100-ohm resistor seems to power the fan nicely, but in conjunction with the transistor and 100-ohm it doesn't run. My guess is that is might be due to lack of proper current management on my part of the base of the transistor and that I'll need to take into consideration the current gain.

First off, you dont need a series resistor with the fan. If its rated for 1.68W at 12V, then as you calculated it, the current through it at 12V will be 140mA. The usual rule of thumb for saturating (turning it fully on/off) a transistor is that the base current should be 1/10 of the collector current.

That means that the base current would have to be around 14mA. That much of the current the arduino is probably capable to supply. But if its possible, I would rather use a MOSFET.

Ok, lets say that you use 2n3904 transistor, this is how you'd calculate the required base resistor. Because the BE junction of a transistor forms a diode, the voltage drop on BE will be around 0.7V. And if the emmiter of the transistor is at ground potential, then the voltage at the base would be around 0.7V. Following from this is a simple ohms law: $R = \dfrac{U}{I}$.

So: $R = \dfrac{(U_{arduino-pin} - 0.7V)}{0.014A}$

$U_{arduino-pin}$ is the maximum voltage arduino can provide on the output (usually 3.3V or 5V), depends on your supply voltage.

And this is how the schematic would look like: simulate this circuit – Schematic created using CircuitLab

Also note the diode D1, it is there to protect the transistor from the back EMF, genereted by the coil (motor in the fan) when the transistor turns off.