04-09-2022, 12:08 PM
Hi guys,
On my other Pi (not moOde) I've done it as below. No python installed or scripts added to autostart needed:
1. connect one switch terminal to GPIO 3 (pin 5) and GPIO 17 (pin 11)
2. connect the other switch terminal to GND (pin 6, 9, etc)
3. add a below line to /boot/config.txt :
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up,debounce=1000
4. done
A quick explanations: GPIO 3 is a power up pin as defualt, the line added to config.txt activates GPIO 17 as a shutdown, "debounce" option adds 1000ms delay (so you have to press and hold for 1 sec) before shutdown (I added that, so it won't shutdown when coincidently pressed. I think a default debounce value (if you don't add it at all) is 200ms.
I hope it helps.
On my other Pi (not moOde) I've done it as below. No python installed or scripts added to autostart needed:
1. connect one switch terminal to GPIO 3 (pin 5) and GPIO 17 (pin 11)
2. connect the other switch terminal to GND (pin 6, 9, etc)
3. add a below line to /boot/config.txt :
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up,debounce=1000
4. done
A quick explanations: GPIO 3 is a power up pin as defualt, the line added to config.txt activates GPIO 17 as a shutdown, "debounce" option adds 1000ms delay (so you have to press and hold for 1 sec) before shutdown (I added that, so it won't shutdown when coincidently pressed. I think a default debounce value (if you don't add it at all) is 200ms.
I hope it helps.