View Full Version : PiCore Player and gpio-poweroff / gpio-shutdown overlays

2018-07-25, 07:29

We are upgrading our power manager board to make it working with native gpio-poweroff and gpio-shutdown overlays instead of the python script you kindly integrated to Picore.
We succeded to use these overlays under Volumio2 and Dietpi, so now we are looking to use them under Picore.


Good news, after editing config.txt, the gpio-poweroff is working.

But not gpio-shutdown, as I think a service must be added to monitor shutdown pin.
On Dietpi it's systemd-logind service, but I have no idea what is the equivalent under Picore.

Do you think Picore player could care these overlays later ?

Thanks !

Name: gpio-shutdown
Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin
is configured as an input key that generates KEY_POWER events.
This event is handled by systemd-logind by initiating a
shutdown. Systemd versions older than 225 need an udev rule
enable listening to the input device:

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

This overlay only handles shutdown. After shutdown, the system
can be powered up again by driving GPIO3 low. The default
configuration uses GPIO3 with a pullup, so if you connect a
button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
you get a shutdown and power-up button.

2018-07-25, 08:17
Obviously we don't run systemd, but anything is possible. Listening to a GPIO pin is rather easy. And then integration of the overlays into our interface. Please drop us a PM or an email, and we can discuss the specifics.

2019-05-08, 06:50
Moving a discussion over from here (https://forums.slimdevices.com/showthread.php?107001-ANNOUNCE-SqueezeButtonPi-Tool-to-use-buttons-and-rotary-encoders-on-a-RPi&p=940053&viewfull=1#post940053), to avoid spamming that sbpd thread with unrelated issues.

Trying to use gpio-shutdown with GPIO3, so that a single button can halt the system or wake-from-halt.

With the following settings the shutdown works occasionally - the wake-up always works.

http://www.cjh.me.uk/MyPhotobucket/cache/DIYHifi/RPi%20Board/Pi%20System/Shutdown%20settings_1024.jpg (http://www.cjh.me.uk/MyPhotobucket/albums/DIYHifi/RPi%20Board/Pi%20System/Shutdown%20settings.jpg)

Another user, meq123, reported success using a different pin for the shutdown. Possible reasons for the difference are that I2C uses GPIO3, and GPIO3 has a hardwired (1k8) pull-up resistor.

2019-05-08, 08:00
GPIO3 is the only one that can work without a SHIM or power relay board. But as you noted, i2c runs on gpio3, so if you use i2c, or a DAC that uses i2c, then you cannot use it.

2019-05-08, 08:33
In the case where I2C isn't being used for anything else, is there an obvious reason why the shutdown doesn't work 100% reliably with GPIO3? The hardwired resistor value of 1k8 is quite a lot lower than the value suggested for external pull-up resistors (e.g. 10k), and it's not possible without a bit of surgery to add another resistor. I understand this low value is the minimum required to limit the current sufficiently, whilst also allowing the pin to handle high speed voltage changes.

But I wonder if a bit of downstream resistance (i.e. between the pin and GND) would be enough to split the 3v3 voltage so that GPIO3 doesn't actually go low enough to register '0'. I can't see an obvious way to do anything about that if that is the case, and also it doesn't explain why the wake-from-halt function works reliably. Maybe some measurements will throw light on this. Actually, it would need about 500 Ohms between the pin and ground to keep GPIO3 up around the 'zero' threshold of 0.8V, so I doubt this is the problem.

2019-05-08, 08:36
Have you turned off i2c in your config.txt?

2019-05-08, 08:45
I haven't! Didn't even know that was an option!

2019-05-08, 10:27
Have you turned off i2c in your config.txt?

That's fixed it, thanks for the suggestion. Completely reliable now.


I have a couple of pCP devices running LMS. One is mounted in my DIY amplifier and is powered 24/7, but a way to shut it down cleanly is still good to have. The other is in my camper van, so is powered down often. Good to know that I now have a way to power it down without having to log in to access the pCP web page on some device, and without risk of corrupting the SD card.

2019-05-08, 14:18
Cool. Glad it's working.