# 9V wallwart powering a fan via Raspberry Pi

I have a fan rated at 12V, 0.14A, 12/0.14 = 85 Ohms (taken from an old PC case) and a wallwart that outputs 9V, 1A.

I have connected the fan directly to the wallwart and it works fine.

Now I'd like to connect them to the Raspberry Pi so I can turn the fan on and off using a simple script.

The problem is that I've never done something like this (the electronics part), while I know some theory from school I've never applied it.

So I decided that the 2N3053 transistor would be a fit choice for what I need ($I_c = 0.7\text{A} > 0.14$A of my fan and $V_{ce} = 40\text{V} > 9\text{V}$ of my wallwart) and then I proceeded with calculating the resistance I need to saturate this transistor:

$$I_b = I_c/h_{\text{fe}}$$

$$I_b = 0.14\text{A}/50 = 0.0028\text{A}$$

$$R_b = \frac{3.3\text{V}}{3 \times 0.0028\text{A}} = 39.28\Omega$$

simulate this circuit – Schematic created using CircuitLab

Is this OK? Would this work? If not, then please explain keeping in mind that I'm a beginner with these things.

• You might consider using a FET; they're a bit easier to work with because you don't have to calculate base resistor values (or waste current on them!) Commented Jun 19, 2015 at 14:59
• Do note that you will have to connect the grounds on the rPi and the wall wart for this to work Commented Jun 19, 2015 at 17:24
• I'd connect the wallwart and transistor ground to the rpi's ground pin, right?
– Paul
Commented Jun 20, 2015 at 5:08

I take it that you've used the multiplier factor of 3 over minimum hFE to ensure saturation. You seem to be missing the Vbe voltage, and to have slipped a decimal place, but the approach is valid.

The base resistor would be:

R = $\frac{(V_{GPIO} - V_{BE})}{3\cdot 2.8mA}$

Assuming the output voltage is 3V with that load, and Vbe is 0.7V

R~= 270$\Omega$

The Rpi has programmable output current capability of up to 16mA but I've not easily found the specification of minimum output voltage at 8mA source current. Assuming it's in the 3V range, your circuit should work fine as is, with a 270 ohm base resistor.

It might be a good idea to put a reverse-biased diode across the fan to deal with any inductance the motor windings have.

Edit: Here is a typical fan controller chip (inside your 12V fan) output section:

When your transistor turns off the energy stored in the inductance of the motor windings causes the voltage on the outputs to rise until the zener diodes conduct turning the transistors partially on, causing the chip to heat and wasting power. If you put a diode across the fan then more of the current will be used in the coils providing torque for the fan motor and resulting in less stress on the controller chip.

• I'll try to go over your explanation and understand.
– Paul
Commented Jun 19, 2015 at 16:12
• Could you please add a small explanation as to why the reverse-biased diode will be helpful?
– Paul
Commented Jun 19, 2015 at 16:12
• When a voltage across an inductive load suddenly turns off a reverse voltage spike will occur. The diode will shunt the voltage. Commented Jun 21, 2015 at 1:08
• What kind of diode should I use?
– Paul
Commented Jun 25, 2015 at 4:42
• 1N5819 would be a decent choice. Commented Jun 25, 2015 at 12:07

I would do that this way:

$$I_{C}=\frac{9\text{V} - V_{CE\text{sat}}}{85\Omega}=90\text{mA}$$ $$I_{B}=\frac{I_{C}}{50}=1.8\text{mA}$$ and then $$R_{B}=\frac{(V_{\text{GPIO}}-V_{BE})}{I_{B}}=1.4\text{k}\Omega$$ $1$k$\Omega$ resistor should work just fine but $270\Omega$ seems a little low.

• Could you please explain why you calculated Ic that way? and not just 12/0.14 as I did? This difference in results scares me a little.
– Paul
Commented Jun 20, 2015 at 5:15
• You are powering up the fan with 9V not 12V. An ideal way would be to measure the current drawn when you power the fan directly with your 9V PS. These small power supplies only provide 9V when the max current is drawn. Otherwise the voltage is always > 9V. Commented Jun 21, 2015 at 1:00
• OK, but what does that have to do with Vce at saturation that you used in the Ic equation?
– Paul
Commented Jun 21, 2015 at 9:22
• That's the voltage between C and E when BE is at 0.7V. Commented Jun 22, 2015 at 11:29