Okay, that helps a lot. As I understand it, you’re trying to wire up a manual shutdown switch which will be monitored by the python script at https://github.com/OpenAgInitiative/openag_safe_shutdown/blob/master/safe_shutdown.py
That script imports
RPi.GPIO which looks like it’s provided by the
raspberry-gpio-python package. And, the basic usage documentation for that package is at https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/.
If you scroll down to the section titled “Pin numbering”, it explains there are two possible pin numbering schemes that the code can use. The wiki describes the
GPIO.setmode(GPIO.BCM) method–as used by OpenAg’s script–as the lower-level option that is specific to pin numbers of a particular Broadcom SoC. As far as I can tell, the Pi 3 and Pi 2 should have the same GPIO.BCM (SoC) to GPIO.BOARD (hardware pins) mapping–like this:
BCM 17 = BOARD 11
BCM 27 = BOARD 13
BCM 22 = BOARD 15
(BOARD 16 is 3 volt power)
source: https://pinout.xyz (click on pin labels in the image on the left for details on specific pins)
According to the openag_safe_shutdown script’s code, it expects that:
- From lines 19-22: BCM pin 22 (board 15) is an output for controlling some sort of power relay. It’s not clear what the relay is for. It seems to be turned on when the script starts, but I don’t see how it would ever get turned off.
- From lines 24-27: BCM 17 (board 11) appears to be configured as a ground reference for the power switch.
- From lines 14-17: BCM 27 (board 13) appears to be an input for the switch using an internal 3v pullup resistor. From the debounce code in the loop, it looks like this is supposed to be connected to BCM 17 with a momentary pushbutton switch to initiate a manual
sudo shutdown -h now.
Also, fair warning… I don’t have the hardware to test this on or compare it to, and I wasn’t involved in writing this code. My interpretation from reading the code and docs might be wrong, and it might not match your hardware.