[Tutorial] OnOff SHIM exposed - neat Powerswitch from Pimoroni
-
For whomever stumbles upon this topic trying to customize the On-Off Shim, please note that not all GPIO PINs are usable for this circuit.
This is an undocumented bug, which is quite important to know if you try to change the default pins on which the board is connected.
In fact, for the "poweroff pin", which is by default on GPIO 4, only GPIO pins from 0 to 8 can be used. If you use pins over 9, the raspberry will never turn on.
This is because the OnOff Shim relies (undocumented) on the "poweroff_pin" being "ON" all the time, since startup.
As documented on https://elinux.org/RPi_BCM2835_GPIOs the pins 0-8 are by default "pulled HIGH", while all the other pins are "pulled LOW".
There is no problem for the other pin "trigger" (or "status" as it is labeled on the circuit), which can be moved to any other GPIO pin.
Personally, I moved them to pins GPIO 6 (physical 31) and GPIO 16 (physical 36) so they do not interfere with any other attached circuit.
It took me a couple of hours to figure this out, I hope this could be of help to someone else.
-
@kzar said in [Tutorial] OnOff SHIM exposed - neat Powerswitch from Pimoroni:
For whomever stumbles upon this topic trying to customize the On-Off Shim, please note that not all GPIO PINs are usable for this circuit.
This is an undocumented bug, which is quite important to know if you try to change the default pins on which the board is connected.
In fact, for the "poweroff pin", which is by default on GPIO 4, only GPIO pins from 0 to 8 can be used. If you use pins over 9, the raspberry will never turn on.
This is because the OnOff Shim relies (undocumented) on the "poweroff_pin" being "ON" all the time, since startup.
As documented on https://elinux.org/RPi_BCM2835_GPIOs the pins 0-8 are by default "pulled HIGH", while all the other pins are "pulled LOW".
There is no problem for the other pin "trigger" (or "status" as it is labeled on the circuit), which can be moved to any other GPIO pin.
Personally, I moved them to pins GPIO 6 (physical 31) and GPIO 16 (physical 36) so they do not interfere with any other attached circuit.
It took me a couple of hours to figure this out, I hope this could be of help to someone else.
Kzar, would you know or quickly be able to see if the very oldest pi (the A, not A+) would be able to work with the on-off shim? The pinout for the 26 Pi looks very similar for pin 1-12, including GPIO4 but I am not an expert and Pimoroni only mentions they are compatible with 40 pin Pis? But from the pinout I do not understand why. Just checking as I have a pi-hole running great on this old Pi, but an on-off button would be amazing.
Many thanks for any thoughts on this.
-
@muze I have the shim running on a 1st generation Pi B 256Mb. Runs flawless even with 26 pin header.
And yes Pihole rules 😋😍
-
@cyperghost Do I need to modify your script if I am using a non momentary button? Right now, I followed your script and instructions press the button in the off position the pi shuts off immediately.
-
@cnoto The script in this posting does not need to be modified it supports both kind of switches
Momentary buttons and latching ones -
@cyperghost got it. I am attempting to change my setup from a nespi case to an onoffshim with a non momentary switch. I used your instructions, to setup the onoffshim, but the system cuts power as soon as i press the button to initiate the shutdown script. (No 3 blinks, just off).
Could the original install of the raspi-gpio for the nespi case impacting things?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.