Hi,
I am running a pi4 with a Pimoroni Fan SHIM, and want to be able to safely shutdown the pi with a button. I have ordered and received an onoff SHIM and before I install it, I want to make sure it will work together with the Fan SHIM? Are they ok to work together?
Thanks!
Phat Stack Configurator show it will conflict . pHAT Stack Configurator
If you add this
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
to your config.txt file you can use the fan shim button to do a proper shutdown.
Leave the Pi powered and pressing the button again will have it boot back up.
Looking at the pinouts,
Fan SHIM at Raspberry Pi GPIO Pinout
OnOff SHIM at Raspberry Pi GPIO Pinout
GPIO 17, pin 11 is the conflict. But IMHO its not really a conflict. Its the button signal on both. Pressing either button while the Pi is up and running will do a proper shutdown. And the one on the On Off shim will turn it back on. So just use the On Off shim button and ignore the Fan Shim Button. The button on the Fan Shim isn’t used with the default setup anyway. To make sure just use the --nobutton option when setting up the service.
sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 2 --nobutton
–nobutton to have the Fan Shim ignore the button and
–noled to turn the LED off.
perfect thank you, will give it a go. I will be adding an external button as my pi is in a mini arcade machine. Currently I have the fan SHIM and am using --noled (as I am using pin 8 for LED) and --nobutton as I do not need that functionality on the SHIM. Am I ok to continue to us pin 8 as an external power led?
You can use that dtoverlay I posted above, with just an external button wired to a GPIO pin. You wire it up so it grounds that pin when pressed. I’ve gone this route on several of my headless setups that I have a need to occasionally shut down.
Just edit the pin= to match the GPIO pin used. It’s the BCM number.
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
dtoverlay=gpio-shutdown
Uses GPIO 3 (pin 5) by default, which is the same pin used to boot it back up. one button does both. If your using i2c though, you have to use the long version and a different pin.
One advantage of the on off shim is it removes power to the Pi on shutdown, if you need that function go back to plan A, if not, it can be a lot simpler to get working.
Should be OK to keep using pin 8 for your LED.
Thanks all, got it all working fantastically. I simply used the on/off pins on the SHIM to an external momentary and wired pin 17 to the LED as per the github page:
pimoroni/clean-shutdown: Python daemon to watch a GPIO pin and trigger a clean shutdown. (github.com)