6

There are many guides on how to set up a 5V fan for a Raspberry Pi and control its speed with PWM. Usually, this includes using a

  1. a transistor
  2. a resistor between the PWM pin and the transistor gate
  3. a resistor between the PWM pin and the ground pin
  4. a diode in parallel to the fan

For example here is a diagram that I took from the Sensoriot blog: enter image description here

I have a Noctua 5V PWM fan that has a built-in PWM speed control and a diode.

Thus I suppose, I don't need another diode, and the transistor is already in the fan as well. However, I'm confused about whether I should still add resistors, or they are already somehow pre-installed in the fan as a part of PWM support?

4
  • R2 is to limit instantaneous gate current, R1 is a pull down so there is a defined state while gate is floating . Both are necessary, however I would expect that R1 is on board already. High power drivers designed to drive fets directly don't need R2 so it is possible it is not on board to accommodate those use cases. I would plan to put one in
    – crasic
    May 28, 2019 at 20:34
  • They have a pwm spec with suggested driver circuit they recommend having a drive transistor on board regardless. If you drive directly with GPIO using a series resistor will likely still be required as it is not clear the internal topology of the pwm driver
    – crasic
    May 28, 2019 at 21:02
  • You are a rich guy! Noctua NF-A4x10 (40 x 10mm) Brown 5V PWM Fan US$14 amazon.com/dp/B07DXS86G7?tag=noctua0b-20 PS - The one and only one customer review is interesting.
    – tlfong01
    May 30, 2019 at 1:27
  • @tlfong01 I have this fan on my 3D printer and it works perfectly. Also I plan to use it on a NanoPi M4 which has a 6core CPU with two 2GHz cores, and it overheats like crazy.
    – Uko
    Jun 11, 2019 at 12:14

2 Answers 2

3

I think the IRLZ44N transistor is extreme overkill for the fan you're using. The blog you've quoted is lacking in important hardware details (I've not read his code), but it appears he's just ON-OFF banging a 2-wire fan with a GPIO pin driving a MOSFET. I'd counsel some caution in following the approach outlined here, but I may be a bit biased by people who blog about "pimping" a Raspberry Pi, and conjuring "a little bit of magic". Magic really isn't required for your project.

If I understand what you're trying to do with the fan you've selected, you won't need a MOSFET capable of sinking 4 Amps or more (depending on VDS). According to the fan mfr's website, you'll drive the Blue = PWM Signal wire of their fan with a 5v, 8mA open-drain/open-collector output. The specifications for this interface are spelled out in this document.

Wrt your question on the resistors: I'd answer "No, not needed - not even wanted." You're not building an arc-welder, so I'd suggest that you use a low-power npn bipolar transistor (e.g. 2N2222) to generate the PWM signal to drive your fan. It will sink 600 mA of current (75x what the spec requires), and requires only (approx) 1 mA of base drive (so your GPIO is not stressed at all). You will need a resistor between your GPIO pin and the base terminal of the 2N2222; use a 1.5Kohm - 3.0Kohm resistor.

schematic

simulate this circuit – Schematic created using CircuitLab

Just one other point:

Wrt the diode, the mfr. calls their diode a reverse-polarity protection diode. It serves an entirely different purpose than the diode in the blog you referenced. But you won't need a suppression diode.

0
3

For Fans with integrated PWM controllers Good practice is to install a single series resistor (50-100Ohm) to limit the current in case of accidental short circuit or failure of the fan. No additional hardware is necessary, and if you can tollerate that risk it will be fine for reasonable <1M long GPIO cables without a series resistor.

Note that some people still choose to install a discrete driver in front of the GPIO, this only needs to be a logic level device or buffer.


The manufacturer of your fan provides a global "PWM" Specification for their products. They call it a "white paper" which is simply that they do not guarantee anything in this document, but it is as good as it gets. If you can find it they reference the formal Intel Spec : “4-Wire Pulse Width Modulation (PWM) Controlled Fans”, Intel Corporation September 2005, revision 1.3

https://noctua.at/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf

Page 6 of the whitesheet we see

  1. Maximum voltage for logic low: VIL=0,8V
  2. Absolute maximum current sourced: Imax=5mA (short circuit current)
  3. Absolute maximum voltage level: VMax=5,25V (open circuit voltage)
  4. External pull-up is not necessary as the signal is pulled up to 3,3V/5V inside the fan.

They even provide a handy reference

In this case, this is a simple logic level PWM signal, with no unusual requirements and without the gate capacitance issue requiring the series resistor. They also have an onboard pullup so no floating pin concerns. Check check!

https://noctua.at/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf

Note that you still have to provide 5/12/24V to the fan. See Below.

Pinout

Power supply is provided on different pin from PWM

 B - PWM
 G - Feedback
 Y - V+
 B - GND

https://noctua.at/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf

Use case

The built in PWM means that the circuit in your question is integrated. However, the details of this are hidden from you, so we must rely on the spec and not guess what is the internal driver

Specification

Page 6 of the white sheet

https://noctua.at/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf

1
  • 1
    Thanks! For a Noctua 5V PWM fan, I ran BCM18 straight to the Blue wire on the fan (and also ran Ground, and chose to run +5V from the Pi as well). I was able to control the fan speed! I’ll add a resistor as you mentioned.
    – Colin
    Aug 25, 2019 at 7:42

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.