Premium Only Content

Installing a Power Button for RetroPie - PiStation Video Series # 5
In this video, we are installing and setting up a script for a power button on our PiStation. Big shout out to ETA Prime, as he is where I learned how to do this. Check him here : https://www.youtube.com/user/Mretaprime
***************************************************************
INSTRUCTIONS:
Open up PuTTY and log in
Type the following commands and allow time to install
sudo apt-get install update
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install gcc
sudo apt-get install python-pip
wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz
sudo tar -zxvf RPi.GPIO-0.5.11.tar.gz
cd RPi.GPIO-0.5.11
sudo python setup.py install
sudo python3 setup.py install
mkdir /home/pi/scripts
sudo nano /home/pi/scripts/shutdown.py
This is the content of the script: Copy and paste it in the blank area
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
# we will use the pin numbering to match the pins on the Pi, instead of the
# GPIO pin outs (makes it easier to keep track of things)
GPIO.setmode(GPIO.BOARD)
# use the same pin that is used for the reset button (one button to rule them all!)
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True
while True:
#grab the current button state
buttonState1 = GPIO.input(5)
# check to see if button has been pushed
if buttonState1 != oldButtonState1 and buttonState1 == False:
subprocess.call("shutdown -h now", shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
oldButtonState1 = buttonState1
time.sleep(.1)
Press CRTL X Then Y
sudo reboot
Now you will need to re-log back into PuTTY. Enter the following command:
sudo nano /etc/rc.local
Add the following info to just below where we put the line of code regarding the background music:
sudo python /home/pi/scripts/shutdown.py &
Press CRTL X Then Y
That is all. I would probably do another reboot, but you should now have a working power button. Good luck! As always, make sure to give us a thumbs up, subscribe to our channel and turn notifications so you don't miss any of our videos!
-
9:06
Colion Noir
10 hours agoKid With Gun Shoots & Kills 2 Armed Robbers During Home Invasion
16.9K3 -
54:28
LFA TV
1 day agoUnjust Man | TRUMPET DAILY 2.27.25 7PM
19.7K2 -
20:10
CartierFamily
7 hours agoAndrew Schulz DESTROYS Charlamagne’s WOKE Meltdown on DOGE & Elon Musk!
36.8K45 -
1:36:39
Redacted News
5 hours agoBOMBSHELL EPSTEIN SH*T SHOW JUST DROPPED ON WASHINGTON, WHAT IS THIS? | Redacted w Clayton Morris
145K242 -
2:03:31
Revenge of the Cis
6 hours agoEpisode 1453: Fat & Fit
48.6K8 -
2:38:12
The White House
7 hours agoPresident Trump Holds a Press Conference with Prime Minister Keir Starmer of the United Kingdom
160K60 -
1:01:04
In The Litter Box w/ Jewels & Catturd
1 day agoDrain the Swamp! | In the Litter Box w/ Jewels & Catturd – Ep. 751 – 2/27/2025
91.7K35 -
1:11:24
Dr. Drew
8 hours agoNEW: Cardiac Arrest In Healthy Young People After mRNA w/ Nicolas Hulscher – Ask Dr. Drew
72.7K32 -
4:24:53
Right Side Broadcasting Network
12 hours agoLIVE REPLAY: President Trump and UK Prime Minister Starmer Meet and Hold a Press Conference 2/27/25
166K47 -
2:12:33
Adam Carolla
2 days agoKamala Harris vs. Trump Wildfire Response + Jillian Michaels on Motherhood/Ayahuasca & Sperm Donors!
57.1K21