Fanshim spins indefinitely when RPi4 is shutdown

I’am the happy owner of a Rpi4 and a wonderful fanshim !!!

I have just one problem : when i shutdown my Pi, the fan spins indefinitely and i have no solution to stop it…If i want to stop it, i need to unplug the RPi4 power supply. If I press the fanshim button (in order to stop it), the RPi reboot…

Can you help me !!! Do you observe the same behaviour of the fanshim ?

Remove it and reseat / reconnect it and see if that helps. It sounds like one or more of the contacts aren’t making a good contact. Pinout is here.


BCM 18 physical pin 12 is the fan control.
Did you run the installer and install the daemon to make the fan auto run?
If yes does the fan turn on and off on its own when the Pi is running?
I don’t have mine yet, its on its way. I do believe the button is supposed to turn the Pi on and off, and the fan gets a turn off signal from the PI when it shuts down. I’ll have to go read up on how it works again to refresh my memory. A bit rushed for time right now.

Thanks alphanumeric, it was not a connection problem.
In fact, I applied a few days ago the bootloader update for the Pi4 ( 2019-07-15 - RC3.3 - Git 514670a2, set ) @ https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md)

This bootloader update causes the problem I observe on the fanshim …

I install the previous bootloader (2019-05-10 RC2.1 - Git d2402c53 ) and the fanshim is now stop when the Raspberry is shutdown.

I hope this problem will be solved on the next bootloader update…

I updated to this one,
https://www.raspberrypi.org/forums/viewtopic.php?f=117&t=246027
So I can boot up and shutdown by grounding GPIO 3 / Pin 5. I’ll be getting my fan shim some time next week so I’ll see how that goes. I really hope I don’t have to go back to the old bootloader.
I also did this firmware update,
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=250990
It looks to have lowered my temps by a fair margin, about 10c.

The first update you notice on your last reply is exactly the same that i applied to my Pi4 (RC 3.3). I made this update exactly for the same reason (start stop button)
Keep me informed if you have the same problem…

I will let you know, my fan shim should arrive any day now.

Fan shim just arrived in the mail.
It won’t fit on the GPIO with the heatsink in place. Not and be anywhere near a reliable connection, it would be right at the end of the pins.
I put a booster header on the GPIO and plugged it into that. Spacing looks OK to me with the fan in the stock mounting position. I haven’t soldered anything yet. Just going to let it run and see how it works out. Software is installed and the daemon is setup.
The button will do a shutdown if its running, and a boot up if I leave it powered up. Fan stays on constant though after the Pi shuts down. Even if its off when I press the button.
Led appears to be working OK.
Might be a while before it hits 65c, its at 50c right now. Ambient is ~22c

Other than the fan not turning off when the Pi shuts down, everything appears to be working as advertised. I saw the LED go yellow, then orange, then Red. Then the fan turned on and ran until the temp went back down to 55c. Led then went green again.

I guess the next step is to go back to the stock boot loader. Is that going to break the on off button functionality. I guessing it will shutdown but won’t boot up when the button is pressed?

EDIT: I did an eeprom recovery rc3.3 but it made no difference. I’m debating just leaving it as is, either way at some point I’ll have to unplug the power supply.

EDIT: 2 If you stop, and then disable the service (daemon) that turns the fan on and off, it just runs continuously once the Pi boots up. This also appears to turn off the LED. So if you never set the daemon up, I would think the LED doesn’t work. The button still turns the Pi on off though, so thats good. I decided to just let tit run like the CPU fan on a PC runs. It should give me a consistent lower temperature with no big fluctuations. In theory anyway, we’ll see. I’m only allowed 3 posts in a row so I have to edit this one until somebody else replies. ;)

This is exactly the issue I’m facing and I think I wished I’d seen this before buying the fanshim :(

I have the updated bootloader so I can use a button+script to turn on/off the pi (script to turn off).

Even running a script to turn off the fan, as soon as I shutdown the fan starts up, I’m assuming as the pi is in low power mode and power is getting to the fan it just runs.

I really hope someone comes up with a solution as it’s not a great having a fan running (with the low fum) when the pi is “off”

If you add a 10k resistor between GPIO 18 the fan control pin, and ground, the fan will turn off by default instead of on. Your basically adding a pull down resistor to the fan control circuit. Everything will be as it was before except the fan won’t turn on by itself, it has to be turned on by software.
If you don’t install the fan shim software it won’t turn on, ever. Install the software and it will turn on and off when commanded just like before. Now though, when you shut down the fan stops. It will be off on boot up too until the Daemon turns it on.
You can also turn it on via a config.txt edit
dtoverlay=gpio-fan,gpiopin=18,temp=55000
Turns it on at 55c, change the 55000 to what ever temp you want. 35000 is 35c for example.

EDIT: The way it is setup from the factory is a fail safe mode. Plug the Fan Shim in and the fan runs. Your SOC is cooled. Forget to or don’t bother installing the software and it still runs and cools your Pi. Thats not a bad way to do it IMHO.
The downside is that to turn it off, you have to pull the fan control pin low. On shutdown it goes to a floating state which as far as the fan control goes is the same as a high and the fan turns on. The added pull down resistor will pull the fan control pin low if there is no signal to it. So now on shutdown the fan turns off.

1 Like

awesome @alphanumeric, I’ll give that a try… off to order some 10k resistors as none in drawer :)

Yeah, I use the dtoverlay=gpio-shutdown to do a shut down when the Fan Shim button is pressed. I use the button for boot up and shut down. The fan not stopping kind of bugged me so I had a go at figuring out a way to have it turn off.
Another tidbit of info is if you enable i2c the shutdown stops working. Sort of kind of. It won’t work with GPIO 3 but you can change that pin assignment to get it working again. The Fan shim button also grounds GPIO 17 when pressed so all you do is use the following.
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
The boot up function is unaffected.

1 Like

Cheers again @alphanumeric, resistors turned up today and really happy to confirm your awesome advice is working for me.

Can’t reach the fanshim button as my pi is in a case so have a q&d setup currently… I really need to get a proper button sorted (and now a tidier way of shorting GPIO18)

You may be able to also turn the LED off.
I didn’t use the Pimoroni software so my LED was always off. I run my fan continuously so I turned it on via the config.txt entry I posted above.
I did have a BLINKT attached showing CPU Load and added code to its python file to detect the button press and blank the screen on shutdown.

#!/usr/bin/env python

import os
import time
import RPi.GPIO as GPIO
import psutil
import blinkt

from sys import exit

GPIO.setmode(GPIO.BCM)  
GPIO.setwarnings(False)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)  

x = 2

blinkt.set_clear_on_exit()

def Shutdown(channel):  
    global x
    x = 0

def show_graph(v, r, g, b):

    v *= blinkt.NUM_PIXELS

    for x in range(blinkt.NUM_PIXELS):

        if v < 0:

            r, g, b = 0, 0, 0

        else:

            r, g, b = [int(min(v, 1.0) * c) for c in [r, g, b]]

        blinkt.set_pixel(x, r, g, b)

        v -= 1

    blinkt.show()

blinkt.set_brightness(0.1)

GPIO.add_event_detect(17, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

while True:

    v = psutil.cpu_percent() / 100.0

    show_graph(v, 0, 0, 255)

    time.sleep(0.01)
    
    if x == (0):
        blinkt.set_all(0, 0, 0)
        blinkt.show()
        time.sleep(30)