RetroPie Add A Power Button / Switch Raspberry Pi 1 2 3
Вставка
- Опубліковано 21 сер 2024
- HOW TO ADD A LED - • How To Add A Power LED...
In this video, i show you how to add a power button / Switch to your Raspberry pi 1 2 or 3 Running Retropie
TEXT FILE V1.1"added sudo apt-get install update"-
mega.nz/#!ppdy...
Barry Hubbard Website -www.barryhubbar...
pi/howto-raspberry-pi-raspbian-power-on-off-gpio-button/▼Do you run an AdBlocker? Consider donating-
bit.ly/2gy2ffr
▼GET A RASPBERRY PI3 ON AMAZON HERE-
amzn.to/2ea3zAQ
▼ GET A FULL RASPBERRY PI 3 KIT HERE- amzn.to/2gPNJ1F
Buy A Button On Amazon Raspberry Squid Button Twin Pack-
amzn.to/2fTAVmg
VIDEO HOW TO ADD A POWER BUTTON TO RECALBOX- • Recalbox Add A Power B...
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. DISCLAIMER: Under section 107 of the Copyright Act 1976, allowance is made for “fair use” for purposes such as criticism, comment, news reporting, teaching, scholarship, education, and research. No Games Or Applications Are Included Or Added On Or To Any Device In This Video
Great tutorial man. I think you should mention that your script for some reason is updated and there is an extra step. I'm referring to the "1. sudo apt-get install update" If anyone is playing his video side by side as you are doing this. You'll need to start at 2. of his scrip while he starts at 1. and then just follow exactly how he goes from there. Also it's worth mentioning that you have the command to reboot the RPi at 13. before you the "sudo python /home/pi/scripts/shutdown.py &" command. At this point you should skip 13. (reboot) apply said command 14. and then run the reboot command (sudo reboot). Best of luck to everyone out there.
Also not that if you have a faulty switch ( i did ) you'll see the retropie splash screen, but then the it will shut down again. Just unplug your switch, get a new one and try again.
SEEtheREPLAY You are a lifesaver! The parts you mentioned corrected my issue. I couldn't get anything to happen with my switch until I ran across your comment. Thank you for taking the time to provide your input!
I just got it working first try using your extra helping comments. Thank you ETA Prime - I'm an absolut beginner at this. Great work 👍
I realize this is now a year old but I'm using it now so I thought I'd add this.
You should still do step 1, its just he got the command wrong.
Should be sudo apt-get update
This ensures you get the latest versions of the software you are about to install and should be done before installing software on linux.
are you saying Step 14 should go before Step 13?
and what is the correct command in the first step?
"sudo apt-get update" ?
@@GarrettBlackmon Hey thank you ! that worked great like you said. you def have to do this code first or it wont install properly. thanks for the update!
HOW TO ADD A LED - ua-cam.com/video/of2p-FHg6nY/v-deo.html
Does any coding need to be changed when adding the LED? or is adding it as specified in the image enough.
ETA PRIME And could i paste all the commands in one command? I mean it doesnt change the order or so
hey ETA when I try to do "wget pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz" (without the quotation marks) it is giving me a 404 error. What should I do?
Never mind
Captain 8track how did you fix it? I'm getting the same.
I dont know why I didnt search for an ETA PRIME video first, you can spend about 20 mins searching google and then head on to youtube and see some guy drawing it out like a maths problem and a breadboard and all sorts of other videos and then boom ETA PRIME, so simple and exactly what I was looking for!
I appreciate the time put into these instructions it is helping me out and saving me so much time!
I bought a raspberry about a year ago and i tried to do this with failure. now in the future i can say that with everything ive learned because of you and others i have accomplished this objective. Thank You for everything!!!!
THANK YOU SO MUCH! Following along with you is my much preferred way of accomplishing these tasks! Really so much easier than trying to decipher 15 pages of text!
For those of you that have a Raspberry Pi 4, replace step 6, 7, and 8 with the ones below and it will work.
Next you need to get RPi.GPIO:
6. wget pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.7.0.tar.gz
Uncompress the packages:
7. sudo tar -zxvf RPi.GPIO-0.7.0.tar.gz
move into the newly created directory:
8. cd RPi.GPIO-0.7.0
Thank you
Thank you!! You solved my problem!!
Thanks. Works like a charm. Previously I could power up the PI but the shutdown did not work
I am a Noob on pi's, but knew I wanted to be able to have an on / off switch to protect to operating system. You did a great job with the video and even better job with the text file with the steps clearly laid out. Thank you very much for sharing
For some reason I cannot download from megadownload. So basically I typed in all the commands straight off the video. To my immense surprise it all works! Very nice.
James Pelt I am having to do the same.
Al goes well until I type the command into the blank script then I save press enter and get nothing.
Do you mean where you are entering text into NANO? Nano is a linux version of Notepad. At that point you are simply editing a text file that contains instructions the Pi will use later. Forgive me if I misunderstand.
James Pelt from 9.04 in. that part mate.
from the # downwards.
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True
while True:
buttonState1 = GPIO.input(5)
if buttonState1 != oldButtonState1 and buttonState1 == False:
subprocess.call("shutdown -h now", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
oldButtonState1 = buttonState1
time.sleep(.1)
James Pelt I will try it mate. ĺike I say I have to type it out so I think it's just getting it all just right.
thank you.
I just installed this now in 2023 and it works. it is amazing! Thank you for this tutorial.
This worked great. I saw many complicated tutorials involving soldering and resistors, but all I needed was to figure out a way to take a power switch from an old PC to hook up to my Pi 3. Downloading your text file instructions worked wonderfully. Thank you!
YES!!! Did this today to my cab and worked like a charm! Easy Peasy! I like how fast it works and I wired mine to a seperate LED button. Thanks ETA Prime!
this worked flawless for me. Im not that great with tapping in remote to the PI so I typed every thing out per your copy and past and it worked perfect. Thank you for doing a COMPLETE how to with all the info!!
No problem! I'm glad you got it up and working!
You have out done yourself once again ETA Prime. My micro push button is working perfectly on Retropie. Can't wait for the next vid.
This is exactly what i was looking for for my Retropie RPi3 - Thank you so much.. Keep up the great work!!
Worked great! Nice to see this is all possible without having to solder headers to the "run" holes
please be advised, entire /R/ subdirectory on the PyPi site no longer exists so the file being fetched via wget is no longer there (just tried this last night). as well, it's 'sudo apt-get update'
using 'sudo apt-get update' instead of whats in the video will solve this issue?
When do you enter this command? I'm incredibly new to all of this.
Great tutorial, I didn't manage connecting to Raspberry PI2 using Putty, so I entered all the commands one by one and it worked. thanks a lot!
Hi! did you have any issues getting python? The links seem to not be valid
No, I used both python links, and both worked for me.
Your the man, your guide is still helping people all this time later. Thanks man!
For those building a pigrrl2, this works great. If using top tft button change script from pin 5 to pin 13. Thanks ETA for making this and other very helpful raspi videos.
Started at step 2 with everything else from that step forward and it worked like a charm!!!!!!!!!
You are the best source for understanding all thing about the Raspberry Pi and Retropie systems. Thanks much!
Best Raspberry pi related videos in UA-cam! You Rock! Thank You!
Tried this for the first time in 2021. Works like a charm, thanks!
Awww yea thanks ETA PRIME. Now I have one of the original switches in my Atari 2600 pi case hooked up to allow me to turn the thing on and shut it down properly. Your instructions worked great :)
Thank you SO MUCH. I was building my RetroPie Table with EXACTLY these buttons and had a couple to spare. Perfect.. now to drill one more hole with my forstner bit..
love it! i just started to search for raspberry pi buttons and got a notification about this video. works well on raspian (I for doing it quickly, i skiped the first 2 steps)
really nice guide, if you can't type in the password screen like i had trouble, remember it just doesn't show your text is being entered and that your login password may be different
Pound-for-pound, thisnis still the best tutorial video on UA-cam
thx for having you :) appreciate your videos, voice and explaining style :)
Cool deal. Got it working! Thanks!
As a side note, the reason you can't use CTRL-X is probably because you haven't set up your keyboard as a US keyboard in raspi-config. Run sudo raspi-config and go into Internationalisation options and change the keyboard layout. Select something like a generic 101 key PC keyboard and then on the next screen if it doesn't have English (US) before your options, pick Other and go down to English (US) then go to the top and select English (US). This should fix all your key mapping problems. (Note that you do have to have a keyboard attached to the Pi for the keyboard layout tool to work)
sentry07 yeah that was it , it was odd because all my other keyboards worked without the set up
Excellent tut as always ETA. My power bottom works perfectly in my retropie arcade cabinet.
Brilliant!
Had a little trouble as the password for my pi user wasn't raspberry. Had to reset it. After that I managed to follow your excellent instructions no problem.
Now to do the LED :)
Just did it on a custom retropie img ...still worked like a charm. Thank you.
You are the best ETA. Thanks for "eating" your valiable time by helping us out. Respect....
To copy & paste text from notepad to putty. (Copy whatever text you need) Hit Shift button, then INSERT button on your keyboard.
Thank you for the video. I am just starting to experiment with a Raspberry Pi to set up retro gaming system and this will help immensely.
Just use the built in "on screen keyboard", I use it almost every single day on my 55" tv since it's easier than getting out the wireless keyboard for it. I only use a real keyboard when I have to type a bunch of stuff but "ctrl x" would work fine.
Honestly, this was easier than I thought... I'd say I'm disappointed in that, but that would be an utter and complete fabrication. Thank you for this and then some!
Essentially this would be the same for pi zero, I would just have to solder to the GPIO right?
Keep up the great work with the Pi, Loving your vids!
Many thanks. 100% works on Raspberry Pi 3 B +
Awesome work its videos like these that help grow the raspberry pi community!
Fantastic! I'm a newbie in using Raspberry Pi and this solves my problem!
Respectfully, I started having issues with the directions from the first...however, after I changed "sudo apt-get install update" to "sudo apt-get update". Everything started working fine. YMMV
Awesome! worked out beautiful! thank you for dumbing it down for all of us that are learning.
Thanks ETA PRIME ! Works perfectly. Although I'm just getting into raspberry pie and retro pie, your videos have helped a lot. Great work!
ETA PRIME, Thank you so much for your raspberry pi tutorials they are the most helpful tutorials i've found. Thank you so much again!!
YOU SIR ARE AN ABSOLUTE LEGEND. WORKED FLAWLESSLY - GREAT GUIDE!
Simple, easy to follow and right to the point. Thanks!
THANK YOU!!!!! I have used your channel for nearly all of my pi arcade projects.
Perfect diction! Reciting these detailed instruction with such diction makes everything so much simpler to follow.
Great tutorial, used the current script version on pi 3B and everything worked flawlessly.
the connection is timing out on step 6 for me. you run into anything like that?
love your tutorials so easy to follow and to the point. Thanks :)
Nice! I'll be adding this to my 128gb install tomorrow! thank you!
p.s.
is your Ethernet cord soldered to the bottom of your Pi?
I rarely comment on the videos I watch but I bought a Pi and have been playing with it and your video have been a great source of information for me. a big thanks for that. I just used this video to setup a on and off switch on my Pi and the video and step were very easy to follow and I succeed with the setup but I realize something that is if you leave the Pi plug after turning it off after a while the Pi turn on back by itself. at first, I thought I turn it on but i turn it off and waited again and sure enough, it turned back on. so small thing but wanted to let you know. thanks again and bye
ange aka Same exact thing is happening with my Pi. The switch works great for shut down and turn on. But after shutting down, and not unplugging- it turns itself back on after a while. Have you found a fix for this?
@@mmxmarc I have the same issue. any fix you've found?
@@SPRTN085 I haven't found a fix. I use the on/off switch for quick shutdowns, and have the pi power supply plugged into a wall outlet that's controlled by a lightswitch. After a shutdown I wait about 10 seconds and just turn off the lightswitch.
@@mmxmarc Ive started hitting the power button on the back of the cabinet after a shutdown. I've resigned to this being the way. Can't find any other solution unless I next attempt a hardware pull up resistor.
Awesome tutorial! Thanks a lot for all the raspberry pi/retropie videos.
This is what i wanted :) Thank you soooo much for this Video! Your Tutorials are both entertaining and helpfull :) Keep on and 1000 Thanks.
Thanks ETA, worked like a charm! I love my new switch.
Excellent video!! Keep making these informative videos on Raspberry Pi
Around to doing this - your videos are the best.
Hey thanks!
I got my RetroPi working with a simple button switch!
Thank you so much for a very clear and helpful tutorial! It works perfect!
Thanks for all the awesome help with the pi.
This put me in a boot loop....
Anyone know how to stop this?
great work!! could you do one for a reset button
Using the same tutorial this should work:
For organization:
At 8:45 in line 41 in NOTEPAD++ change "/shutdown.py" to "/restart.py"
The command:
At 9:09 find line 67 in NOTEPAD++, change "shutdown -h now" for "shutdown -r now"
1: According to askubuntu "reboot" may power your device on maintenance mode so shutdown -r is preferable.
Just did this and it works perfectly. Thank you sir!
Thanks ETA! Best tutorial. Works magic!
THANKS For creating this, i've built a retro arcade cabinet and where worried about the ruined sd card possibility.
Thanx! Worked great. I used pin 5 and 9 though as 4 and 6 are my 5v fan. The only thing now is that the fan still runs after the pi shuts down.
hey, you can use vi instead of nano. Once in vi you will need to press [i] before pasting the text then [Esc :wq Enter] to save. Excluding the brackets, they are just there to make it clear what the keybord input is.
thank you I plan on getting another sd card and running Retro pie as well to learn more especially about getting arcade like desktop boxes running.
It worked like a charm, thanks. Now i need to build something to hold the button xD
REALLY good tutorial and well explained!!
Thanks!
You can also install all the packages in the command line, Just by adding a space and doing this
sudo apt-get install python-dev python3-dev gcc python-pip
Saves on time. Other than that ETA great video
worked perfectly here, Thanks !! . But if you showed the message "starting" and "turning off" would look better
Works flawlessly! thank you.
This worked the first time. Tyvm!
I have made what you have shown and worked great.
Thank you.
I love smart people, thank you so much. And keep up the great work.
Thanks man! This works perfectly on a Pi Zero W!
Thank you good sir, you now have my (Black/white/blue hydro-dipped OG-PS1) Blueberry PieStation fully functional. 1000 likes to you if I could.
Awesome. I imagine the testing felt like watching paint dry. Thanks for another spot on lesson. And what the hell, dell?
Craven Moorehead OMG I never want to watch this thing boot up ever again. LOL
Great video! Works just as expected.
Great instructions mate. Thank you 👍👍
Worked like a charm, thank you!!!
Managed to make it work with a Pi 0 W, thank you!
You dont have to type y ;D Because when the Y is big (Y/n) then is yes selected. Just press enter :D (6:36 and before/after)
Great tutorial thanks for all the vids you do! One small issue on the text file i wanted to point out.. it should be "sudo apt-get update" instead of "sudo apt-get install update"
nice tutorial, I was looking at buying a mausberry add on board to do the same, but this seems simpler and cheaper.
Thank you so much man, it worked at my rasp pi 3b+ wirth running magic mirror os
Thanks man.
Making my decision easier now.
Fantastic Tutorial Brother!
Tks!
Great video. The button works perfectly. Thank!
Thanks, easy instructions, works great!
fantastic video works like a charm
Love the info.
This procedure needs to be updated for the RPi4. Be sure that RPI.GPIO v .7 and not .5 is installed otherwise Error 'RuntimeError: This module can only be run on a Raspberry Pi!' will occur.
I renamed the directory and .egg file in '/usr/local/lib/python3.7/dist-packages' then reinstalled with 'sudo pip3 install RPi.GPIO'. This updated it from '0.5.11' to '0.7.0' and the script worked properly.
Note: If you decide to make the change to 3.7, be sure to alter the command to the 'rc.local' file from 'sudo python /home/pi/scripts/shutdown.py &' to 'sudo python3 /home/pi/scripts/shutdown.py &' otherwise it won't run at startup.
BTW: I would assume you could do the same for python2 in '/usr/local/lib/python2.7/dist-packages' as well, at which point you wouldn't need to alter the command in 'rc.local'. - Hope it helps.
First things first, awesome video. it was easy setting this up. QUESTION. I'm using a fan on pin outs 1 and 9 now due too the shutdown switch, is there a way to have the fan shut off with the switch as well?
You would need a 5v fan and you would need to move it off pin 1 to a gpio and include it within the shutdown code.
I have not done the switch mod yet though.
Actually it looks like he addressed this in his power led video so nevermind.
Im looking to do this myself, this is an easy tutorial:
s55ma.radioamater.si/2015/11/16/controling-5v-fan-with-raspberrypi-poor-mans-pwm/
I LOVE this button! I have a Pi in my car and use this to exit the car without having to worry about the Pi3 draining the battery.
I am currently experimenting with LibreELEC for kodi instead of RetroPie and I was wondering if you could help me use this shutdown button in that OS as well. Thanks a ton. Your vids taught me all I need to know about the Pi. Youre the best.
I found an answer to my own dumb question lol. LibreELEC doesnt have enough OS to do anything, so I switched to OSMC, all I had to do was delete the home/pi/ before scripts.
All other instructions worked great. Thanks a ton ETA for setting this up, very easy for a noob to understand.
Thanks man worked perfectly.