Fan Speed Regulation PWM GPIO

@Sleep don't tie the grounds together until you have verified that the signal pin you are connecting to the fan can never have more than 3.3 volts on it, otherwise you may destroy the pi output pin, if not the pi itself.

1 Like

Good point Colin. I had assumed the Noctua input circuitry took care of that.
I've looked at their datasheets and they don't show what's inside the fan's enclosure.

As I said before, I never allow my IoT students to connect things to the GPIO pins as it's so easy to destroy a Pi, much safer to use a Wemos or some other cheap microcontroller to do the interfacing.

Does it say what input signal it expects?

I found this in their spec - looks like it will accept up to +5V TTL levels, so +3V3 should be acceptable ?

In terms of damage to the pi, the question is what voltage is on the pin when it is floating. If it floats up to 5v (which may be the case if it expects a pulldown signal) then it may damage the pi. The spec may well not define that. If I were doing this myself then I would probably not connect it directly.

Agreed - that's what I think I said at the start of this thread.
A pair of NMOS and PMOS transistors are dirt cheap and would avoid damaging a precious Pi.

Thats how it is connected. Should I connect the PWM signal cable to the GND?
Should I use pullup or down?
What about the RPM speed signal?

Time is the limiting factor right now. There are plenty of Pi:s

Thanks for your time

OK - if you have plenty of spare Pi:s and willing to take the risk...

I would some how get a connection from the GND on the Fan or power supply to a GND pin on the Pi.
This might mean breaking into the GND wire on the lead that goes to the Fan's 4-pin plug.

Let's get the PWM part working first, then we can investigate the Speed-feedback.

Hope it works for you.

PS:
Can I ask... is this part of a uni/college/school project?

PPS:
Just to prove your RPi is still working, you could try wiring an LED to an output pin, like I showed above, and make sure you can control its brilliance via PWM, otherwise you could end-up trying to sort out the 'wrong' problem. Hope that makes sense?

Sounds as if you are making progress.
What frequency setting are you using for the PWM node?
Looking at the spec on the Noctua datasheet it says... Target freq is 25kHz with an acceptable range between 21kHz to 28kHz. So you could try 25000 Hz in the PWM node.
I have no idea what the max value the PWM node will support, you'll have to look that up.
See @Colin comments below.

I may not be up to date, but I suspect the standard node will not do anything like that frequency. I think you have to use a different node (node-red-node-pi-gpiod?) which uses the hardware rather than s/w to do the pwm. As I said, I may not be correct in this though. Hopefully someone more knowledgeable will comment.

2 Likes

Yes. Better to use pi gpiod node as @Colin suggests

1 Like

Here's part of a PM message I exchanged with @Sleep first thing this morning.

I read somewhere that two pins on the Pi use hardware to perform PWM, the others use software (I assume 'bit banging') which may limit the switching frequency. You'll have to look that up.

See this link: Using Raspberry Pi to Control a PWM Fan and Monitor its Speed - DriftKingTW's Blog

1 Like

Thanks for sharing your link - I'm sure that will help @Sleep tremendously.

I've got two Noctua 12v PC fans running from an ESP8266 (Same outputs as the Pi). You will find that the fan has 4 wires,

  1. +12vdc
  2. GRD
  3. PWM input (12vdc)
  4. Tach (Hall effect speed sensor) References ground.

I had no luck driving it at 3.3v from the ESP, I had to use a level shifter (3.3v to 12v) with common ground to get it to work reliably.
1khz turned out to be the optimal PWM frequency (Less motor whine)

The schematic for my installation:

Block chart:


Installation images and some additional context:

And finally, the (still work in progress) NR flow to control it (via Home Assistant).

Reading the thread, you seem to have the PWM part of the Pi working ok, so now you need to step up your pi's GPIO voltage to 12v to drive the fans internal circuit, and remember to use a suitable resistor on the output to protect the Pi - 47k will do it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.