Relay FAN

Hi there, I have been searching for a while now, I use a relay module to run a Noctua fan in my custom 3D-printed case.

I found here the instructions to use the dtoverlay to turn the fan on (dtoverlay=gpio-fan,gpiopin=24,temp=60000) proposed by the user MichaIng that worked at making the fan run.

The problem I am facing is that due to poor design, the restrictive air flow of the case makes it quite noisy!! :cry: :cry:

Doesn’t matter what I change the temperature in the settings the fan is always on, could anyone enlighten me, or point me towards the solution (to make the fan turn on only at 60 Celsius).

Only now I am learning about the DToverlay stuff, and I am not good with Kernel stuff. But if to make a guess it would be towards the gpio low being 1(on) when I need it to be 0. But as I said, that is a guess.

Please help. :face_with_raised_eyebrow:

I have to add that I accidentally missed one number in the “temp” settings making it “temp=6000” instead of 60000 and the fan didn’t start at all, that makes me even more puzzled. :thinking:

I have found a work-around that proves that the issue is with the pin LOW/HIGH setting. (When cold it is HIGH and when hot it changes to LOW)

TEST: I have set the temperature to turn the fan off at 50 Celsius, and I run a stress test (stress --cpu 4).

RESULT: When the temperature reached 50 Celsius, the relay was turned off (relay wiring was biased off).

WORK-AROUND: I then open the box and rewired the fan to be biased on. It now works as intended, once the temperature reaches 55 Celsius the relay turns off, causing the fan to turn on.

But that is not intended behaviour as I have current flowing most of the time to keep the relay switched, and I want to avoid that.

Is there a way to set the gpio (14 in this case) to default LOW?

Not sure if I understand 100%. It does not automatically turn on/off when reaching the defined temperature (including a reasonable hysteresis)?

Generally GPIO states can be changed (low level to high level) via RPi.GPIO python module, via WiringPi which ships the gpio command, or via WebIOPi which serves a web interface to toggle GPIO states.

Hi MichaIng thanks for the reply, yes I agree I made it a bit confusing, below I will try to explain it again.

1 - The RPI relay module I am using is connected to the GPIO=24, it is a standard RPI 2 channels relay module (the blue one).
2 - I am using the dtoverlay command in /boot/config.txt (dtoverlay=gpio-fan,gpiopin=24,temp=60000).

Problem: Immediately at boot, the GPIO 14 turns HIGH, causing the fan to turn on, even though the temperature is < 60 Celsius. And turns LOW when the temperature >= 60. Meaning that the GPIO is set to HIGH by default.

Proposed solution: I need to know how to set the GPIO default to LOW (Invert) in the Kernel (Again, I don’t know much about Kernel stuff).

Reasoning: Note that I am attempting to avoid running a software/script, and I would like to do it in the Kernel if possible (I am eager to save power and CPU usage as I am already abusing my RPI 3 B+ powering the relay module and an external 1 TB HDD, also a few too many services. I have already disabled Wi-Fi and Bluetooth, and I am even going to disable the LEDs)

Ah there seems to be a way via config.txt now:

However, not sure if the gpio-fan overlay will still turn it LOW when the temperature raises above 60°C while you want it HIGH then, or does it only toggle the state, so that it depends on the initial/default state only?

Yeah, I think I need an invert option like what I can see in gpio-ir “Invert”

so it works inverted. I will read through the link you sent tomorrow and I will update here, I am running a restore now (samba > “A log of GB”) I will test all options available so far.

Additional: I have a work around as the relay module has a “biased on” so I wired that way, but I intend to use a Solid State Relay that only has the regular LOW = off and HIGH = ON option, so I really need to solve this problem, so I can use the silent relay.

Isn’t it an option to use a GPIO which defaults to LOW? I guess the default gpio-fan pin does this and then also is toggled correctly when reaching the break point.

I haven’t thought about that, I will try it and let you know. It may not be today, as today is quite a busy day for me.