0

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.

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 **
1
  • 1
    Is that a 4-wire fan?
    – Majenko
    Nov 29, 2021 at 12:02

2 Answers 2

5

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.

8
  • 1
    The BC337 has relatively high DC gain. 4-pin fans often can not be dimmed-to-off with PWM, I guess that's why the OP wants to use the transistor.
    – Sim Son
    Nov 29, 2021 at 17:40
  • @SimSon Every 4 pin fan I've ever used has stopped at 0% duty cycle... That's how you achieve silent computing.
    – Majenko
    Nov 29, 2021 at 18:27
  • - I did try to change the resitor to a low value 120 Ohm, but that did not change the outcome. - it is a 4wire fan, but it does not stop at 0% duty cycle. I was surprised too but apparently it's not that uncommen. Instead of buying new fans I decided I would add a transistor as a switch Nov 30, 2021 at 19:44
  • I'm fine to switch to a mosfet, but don't have any laying around. Do you have a suggestion which one to use? Could I use it as a drop-in replacement in the same circuit? Nov 30, 2021 at 20:00
  • This guy perhaps, IRLZ34N? eu.mouser.com/ProductDetail/Infineon/… Nov 30, 2021 at 20:06
1

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?

12
  • the transistor did get hot after a some time say 20-30s. I also lowered the resistor to 120 Ohm with no effect, still gets hot. Then I changed from the Digital out to just the 5V and tested with both resistors, both seem to make the fan go full speed with the pwm disconnected. Then I connected the pwm in the same config and it could be controlled. So the digital out seems to be the issue, I tried to use 3 different pins 6, 7, and 8. All seem to produce the same issue. Nov 30, 2021 at 19:53
  • @user1908460 it's also possible that the transistor is broken. The base resistor ist quite critical: if it is too low, you may exceed the base's or GPIO's current rating. If it is too high, the transistor is not operating in its saturation region, which leads to high power dissipation. Chances are that the transistor got destroyed during your previous attempts.
    – Sim Son
    Dec 1, 2021 at 15:56
  • Good idea, I just tested two other ones with the lower resistance. Fan Also spins really slow. Connecting it to the 5V directly worked as well though. Dec 1, 2021 at 18:16
  • @user1908460 set the GPIO high and measure a) voltage between GPIO and GND, b) voltage accross the base resistor, c) voltage between collector and emitter. A picture of your wiring might also help.
    – Sim Son
    Dec 1, 2021 at 18:31
  • 1
    there is a) 0.8-0.9V over over GPIO-gnd, b) 0.24V over the resistor (120ohm), and c) 7.7V over collector-emitter. I also tested GPIO-GND w/o any load and that was 5V. Dec 2, 2021 at 9:19

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.