user81570: I want to control a fan with an arduino from 0 rpm to full rpm. Using a (modified) pwm signal from the arduino I can control the speed w/ the pwm signal, but it cannot go all the way to 0 rpm.
So I decided to add a transistor as a switch using following schematic.

The fan is a Snowman F120, I used BC337 as a transistor (800mA) and a resistor of 2.2 kOhm, for controller I use pin 6 on an arduino nano and set it high/low. Arduino and the fan are both run from the 12v power supply. I removed the pwm signal to just have it full on or off for testing purposes.
I was hoping to use the transistor as an on/off switch and when on just send the pwm signal as that was working already.
The fan can now be turned off/on with the arduino but it spins super slow, say 10% of full pwr. Can someone explain why this is? Is there a better way to control this?
Edit: I did try to remove the resistor completely and the fan still moves only slowly
Edit: it is a 4 wire fan, but it cannot go all the way to 0 with pwm. That's why I want the 'switch'
I lowered the resistor to 120 ohm, and switched gpio pin, no effect, if I wait long enough the transistor gets hot
Edit: I connected the transitor to the 5V of the Arduino instead of the Digital out (high) and low and behold fan works well (resistor still in between, both 120 and 2.2kOhm tested, both situations work). I guess the digital output cannot provide enough current?
**
Solution:

Used IRLZ34N mosfet with a 120Ohm as gate resistor
and a 100 kOhm as pull down resistor to GND as otherwise the mosfet would always be open
**


user38721: I have used the BC337 to switch small loads like fans, so I know this works in general. As Majenko explained, 2.2kOhm base resistance is a bit high, though.
"I did try to remove the resistor completely and the fan still moves only slowly" - if you controlled the transistor without base resistor, chances are that the GPIO got damaged, try another GPIO with 500-1000 Ohm.
As a rule of thumb: If the transistor gets warm when switching a small load, something is wrong. If there's a reasonable voltage drop between emitter and collector, reduce the base resistance if possible.
Another thing is that you should not low-side-switch a 4-pin fan if you want to control it with its PWM input at the same time. In case the ground path is disconnected, the entire fan's circuit is at supply voltage level: Arduino will see 12V at its pins. Use a high-side switch instead
Edit: did you actually make sure that the fan had 100% duty cycle at the PWM input when the transistor was on?

user4143: With a 2.2K resistor you're massively limiting the current that can flow through the transistor.
I haven't looked up the specs on that transistor, but taking typical values for Vbe (0.6V) and Hfe (100) we can calculate:
Ibe = (5V - 0.6V) / 2200 ohm = 0.002A

Ice = Ibe x Hfe = 0.002 x 100 = 0.2A

So even though your transistor is capable of 800mA you're actually only allowing 200mA maximum.
Add to that the voltage drop of the transistor and you have a recipe for a slow fan.
Really you would be better off using an N-channel MOSFET for this job since it is controlled by the voltage at the gate, not the current flowing through it. Also in saturation mode they are more like a very low value resistor rather than a couple of diodes.
Also if your fan is a 4-wire fan (as the ones I have found on Google looking for that model are) then you don't even want a transistor: one of the pins of the fan is a PWM input which you can connect (along with fan ground) direct to the Arduino (it basically includes the transistor internal to the fan) for speed control.

81570: <p>I want to control a fan with an arduino from 0 rpm to full rpm. Using a (modified) pwm signal from the arduino I can control the speed w/ the pwm signal, but it cannot go all the way to 0 rpm.</p>
<p>So I decided to add a transistor as a switch using following schematic.</p>
<p><a href="https://i.stack.imgur.com/hapjQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hapjQ.png" alt="schematic" /></a></p>
<p>The fan is a Snowman F120, I used BC337 as a transistor (800mA) and a resistor of 2.2 kOhm, for controller I use pin 6 on an arduino nano and set it high/low. Arduino and the fan are both run from the 12v power supply. I removed the pwm signal to just have it full on or off for testing purposes.</p>
<p>I was hoping to use the transistor as an on/off switch and when on just send the pwm signal as that was working already.</p>
<p>The fan can now be turned off/on with the arduino but it spins super slow, say 10% of full pwr. Can someone explain why this is? Is there a better way to control this?</p>
<p>Edit: I did try to remove the resistor completely and the fan still moves only slowly</p>
<p>Edit: it is a 4 wire fan, but it cannot go all the way to 0 with pwm. That's why I want the 'switch'</p>
<p>I lowered the resistor to 120 ohm, and switched gpio pin, no effect, if I wait long enough the transistor gets hot</p>
<p>Edit: I connected the transitor to the 5V of the Arduino instead of the Digital out (high) and low and behold fan works well (resistor still in between, both 120 and 2.2kOhm tested, both situations work). I guess the digital output cannot provide enough current?</p>
<p>**
Solution:</p>
<ul>
<li>Used IRLZ34N mosfet with a 120Ohm as gate resistor</li>
<li>and a 100 kOhm as pull down resistor to GND as otherwise the mosfet would always be open
**</li>
</ul>
 38721: <p>I have used the BC337 to switch small loads like fans, so I know this works in general. As Majenko explained, 2.2kOhm base resistance is a bit high, though.</p>
<p>&quot;I did try to remove the resistor completely and the fan still moves only slowly&quot; - if you controlled the transistor without base resistor, chances are that the GPIO got damaged, try another GPIO <em>with</em> 500-1000 Ohm.
As a rule of thumb: If the transistor gets warm when switching a small load, something is wrong. If there's a reasonable voltage drop between emitter and collector, reduce the base resistance if possible.</p>
<p>Another thing is that you should not low-side-switch a 4-pin fan if you want to control it with its PWM input at the same time. In case the ground path is disconnected, the entire fan's circuit is at supply voltage level: Arduino will see 12V at its pins. Use a high-side switch instead</p>
<p>Edit: did you actually make sure that the fan had 100% duty cycle at the PWM input when the transistor was on?</p>
 4143: <p>With a 2.2K resistor you're massively limiting the current that can flow through the transistor.</p>
<p>I haven't looked up the specs on that transistor, but taking typical values for Vbe (0.6V) and Hfe (100) we can calculate:</p>
<pre><code>Ibe = (5V - 0.6V) / 2200 ohm = 0.002A

Ice = Ibe x Hfe = 0.002 x 100 = 0.2A
</code></pre>
<p>So even though your transistor is capable of 800mA you're actually only allowing 200mA maximum.</p>
<p>Add to that the voltage drop of the transistor and you have a recipe for a slow fan.</p>
<p>Really you would be better off using an N-channel MOSFET for this job since it is controlled by the voltage at the gate, not the current flowing through it. Also in saturation mode they are more like a very low value resistor rather than a couple of diodes.</p>
<p>Also if your fan is a 4-wire fan (as the ones I have found on Google looking for that model are) then you don't even want a transistor: one of the pins of the fan is a PWM input which you can connect (along with fan ground) direct to the Arduino (it basically includes the transistor internal to the fan) for speed control.</p>
