Fan shim random speed?

Hi!

I have been using the Fan Shim for my RPi 4 (Raspbian Buster 4.19) for over a month now and it really is a game changer for my CPU-intensive tasks. I am using the automatic script to toggle the fan on and off, and it seems so be working fine (except for the button which wouldn’t on/off in automatic mode, but whatever).

I noticed that the fan speed is different between the different fan toggles. Sometimes it would spin at full speed which is quite noisy and sometimes it would spin “normally” and make 0 noise. I have been wandering in the code of FanShim repo but couldn’t find anything that explains it.

Could somebody explain why does it turn at different speeds? And if it is possible to set only one?

Thanks,
Mathieu

I don’t think its variable speed? Not by design anyway. My understanding is if the fan control pin (GPIO 18) is a logic low the fan is off, and if its high or floating (not pulled low) the fan is on.
The button has to be manually programed to do something. It’s not used by the Pimoroni Fan Shim service. I use mine to do a proper shut down when pressed.

Thank you for your answer. Concerning the button, I was talking about the one on the Shim. I still can’t figure out why the fan spins at different speeds.

So was I. Any time I have installed the Fan Shim Service, the button does nothing when pressed while the Pi is booted up. If the Pi is shut down but left powered, pressing it will boot up the Pi. The button grounds GPIO 3 while pressed. Momentarily grounding GPIO 3 will boot up a Pi. Thats just a default thing built into the Pi.
If you want to have the button turn the fan on off you have to tell it so with some python code. Have a look see here.

It can be programed to do other things like shut the Pi down. You just add this to your config.txt.
dtoverlay=gpio-shutdown
If you have i2c enabled use
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
The Fan Shim button also grounds GPIO 17 when pressed.
You can also turn the fan on with this config.txt edit. No having to load the pimoroni service.
dtoverlay=gpio-fan,gpiopin=18,temp=55000
It will turn on at 55c and off again at 45c. Change the 55000 to what ever you want. The LED won’t do anything this way though.

Is it actually spinning at different speeds, or just “sounding” like its spinning at different speeds?
I’ve seen a few posts suggesting the fans orientation can make it noisy, vertical instead of horizontal etc?
I haven’t noticed this myself. The one noisy fan I had was noisy regardless of how it was or wasn’t tilted etc.

For me it does. When I install the FanShim service, I can switch with the button automatic mode. When not in automatic mode, a short press should trigger on/off the fan (according to the documentation). When I short press, the fan starts for a few seconds and then stops.

It is sounding like it is spinning at different speeds. The noise is clearly different between runs even though the Pi wasn’t moved at all.

Ok, my apologies, I may have gotten it wrong? I probably pressed it the once and nothing happened, then assumed it didn’t do anything. Ops. I don’t run the service, other than to test if the Fan Shim works as advertised. IE, the fan turns on and off and the LED changes color.
Plus me setting the dtoverlay shutdown option, pressing the button would just do a shut down. As I said ops. My bad.
I’ll have to edit out my dtoverlay shutdown option and load the service and have another look see. Thanks for pointing that out. I’ll go play with mine a bit and get back to you.

1 Like

Ok, disclaimer, I have a 10K pull down resistor wired from the fan control pin GPIO 18 to ground. I did this so my fan will shut off when I shut down my Pi.

That being said, with the service loaded as normal, a short quick button press does nothing. Which is likely why I thought the button didn’t do anything. A longer press gets me a blue flash from the LED and likely a switch to manual mode. Pressing the button after that makes my fan spin for a second or so and stop. My pull down resistor may be messing things up on me though? Repeated short presses just get me the same short spin and stop. Holding the button down gets me another blue flash and it appears it goes back into auto mode. It’s turning on off at what I had set the service too.

I don’t think that your resistor is interfering as I observe exactly the same behavior you describe. Seems like a general issue then.

Maybe still related to this: https://github.com/pimoroni/fanshim-python/issues/3

For the fan speed, my question was mostly out of curiosity and will to make it perfect. Never mind, I’ll stick to status quo.

Thanks for your answers @alphanumeric

So I made some measurements by putting my phone mic just next to the fan. I was not mistaken and the noise vary quite significantly, between 80 and 87 dB. I didn’t move the Pi nor the mic during the recordings. Any idea why this would happen?

@mathieudefosse What sort of power supply are you using? Do you have anything else connected to the Pi?

@sandyjmacdonald I am using the US 120V with an official RPi alimentation. Same observation with 220V when is Europe.

Nothing else is connected but my CPU is running at full load.

I have a brand new Fan Shim on the way, should have it early next week some time. I’ll put it through its passes unmodified and post back what I get with the button presses etc.

1 Like

I had a friend test his stock fan shim and he is seeing the same thing.
Long press, LED flashes Blue, fan stops.
Short press, fan spins for a second and stops.

I did some testing and noticed something. If you increase the delay setting when loading the service the fan spins longer when toggled to manual mode. If I use the following it doesn’t spin at all in manual mode
sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 0
Also try something like
sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 30
And see how long yours spins when you switch to manual mode. Mine spun for a lot longer time before stopping on a button press in manual mode.
There must be some kind of interaction going on?

Interaction with what? I don’t see how it would interfere neither the fan speed nor the button behavior.

The delay setting is affecting how long the fan spins when toggled to manual mode via the button. The service is still running in the background. My best guess is something got missed in the switch to manual mode. The default delay is 2 seconds if you don’t specify one.

I wonder if this PR is related? It’s quite dated now, but they’d spotted this issue and attempted to fix it way back in September 2019. https://github.com/pimoroni/fanshim-python/pull/46

I was mulling over having a look see on the Fan Shim GitHub page for info on this. Thanks for that link Phil
I’m waiting for a brand new Fan Shim to arrive to redo my install on one I haven’t modified. The two I have I’ve added a pull down resistor to so the fan stops on shutdown. It’s a bit of a pain to remove it so I’ll just wait for my new one, which should be here any day now.
To be honest, I don’t normally run the service. I just use the gpio-fan dtoverlay.
dtoverlay=gpio-fan,gpiopin=18,temp=55000
And use the Fan Shim Button for shut down.
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up

I would like to focus the topic on the fan speed now if possible.

Sometimes when the fan turn on, it would spin normally and be completely silent. Other times, it would just make more noise (+10dB!).

Is there an explanation to that? My CPU is running at full load FYI.

Thanks again.