Adding Power Off Button To Raspberry Pi 4 w. Volumio

Hi Everyone

New to the world of Raspberry Pi/ Volumio

Im currently trying to add a physical power off button to my Volumio/RPI 4 setup.

I tried a few different approaches. One of which was to add

dtoverlay=gpio-shutdown,gpio_pin=26 to config.txt

(Im trying a different pin than GPIO 3 as I need I2C for DAC/ ALLO DIGIONE)

I was able to do so, but unfortunately when I connect pin 26 to ground nothing happens.

Note for this tests I did not have the DIGIONE DAC hat connected, but I did have a GPIO extender mounted. This one here. GPIO Edge Extension SKU: EP-0121 - 52Pi Wiki

From what I can this just spits each pin.

Any thoughts as to why the shutdown feature isnt working?

2 Likes

you can also use the gpio button plugin and then use gpio pin 3.
that way you can shut down the raspberry pi and start it up again with the same button.
I don’t know if it will work with a digi one on top.

IIRC Volumio currently uses systemd version 215. According to this readme the “gpio-shutdown” overlay additionally needs a udev rule if systemd version is older than 225:

ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", ATTRS{keys}=="116", TAG+="power-switch"

Noob question but I’m assuming I add this in the udev.config located in etc/udev ?

1 Like

No, you need to create a rules file in /etc/udev/rules.d like this:

sudo nano /etc/udev/rules.d/99-gpio-shutdown.rules

Copy the line from my previous post, paste it into the nano editor (text must remain as one line) and save the file with Ctrl+x, y and Enter.

Then execute

udevadm control --reload-rules && udevadm trigger

or reboot.

I gave that plugin a try. Shutdown works on GPIO pin 3 but not with any of the other pins I tried.

Also odd, I thought i needed to connect the selected pin (GPIO 3) to ground in order to trigger the shutdown . Here I just need to touch the pin with a piece of metal and it shutdowns. Is this correct?

Ok that worked! Thank you so much :slight_smile:

Thanks for the feedback. If appropriate maybe mark the thread as solved.

2 Likes

you need a Push momentory button, one on gpio 3 (pin number 5) and the other on ground (on pin number 6, not gpio) which is normally opposite.

and indeed when your gpio 3 directly makes a short connection to the ground (for example a small copper cable) then the raspberry pi will indeed shut down, a mommentory push button does exactly the same.

Be careful with this because before you know it you accidentally short circuit.

Something like this.