Works on PI 4 in March 2023. Many thanks for all the hard work saving me loads....
@Howchoo4 жыл бұрын
Don't have a soldering iron? Get a pre-soldered button here! howchoo.io/pi-power-button-pinned See the full guide on howchoo: howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi
@thndrpnts4 жыл бұрын
Aw man. Seeing those RadioShack switches brings back memories. That was my first job right out of high school!
@Howchoo4 жыл бұрын
Aww yeah. I miss being able to run there to pick up a quick component or switch last minute-worth paying 5X the price :)
@teesdiy39933 жыл бұрын
Radio shack was called Tandy in Australia back in the day.. Gone now.. Jaycar is my shop now when I need something right then.
@drwhowhogrub39084 жыл бұрын
This is by far the best tutorial for a power button. Very easy to do thanks very much
@ianpiercy65514 жыл бұрын
Hi, nice video, I am using the 7 inch touchscreen which utilises pins 5 and 6 already, is there an alternative pin out location i can use for the button?? TIA. Ian
@RomanOnARiver3 жыл бұрын
The only two pins actually required for the touchscreen are 5V and GND - consider if your use case actually requires you to use any others - it might not.
@namaro5399 ай бұрын
Managed to make it work with a switch rather than a button. followed your instructions carefully and it works! now I need to figure out how to turn off the fan
@kurtroyales26598 ай бұрын
Hi! May I ask what type of switch did you use on your end? Will a rocker switch work?
@namaro5398 ай бұрын
@@kurtroyales2659 yes a 2 way rocker switch with 3 connection points
@JeanPaulLapointeCGI4 жыл бұрын
Wow! 100% on my Pi 4. This was an awesome little project.
@mikeg1zrn8963 жыл бұрын
Hello, Running Buster on a Pi 3b+, your script is the only one I got to work, thank you. Question, is possible to add a "Hold" time in the script so the button has to be held down for x number seconds before shutting down. Many thanks.
@inonfarag2 жыл бұрын
Thanks working great! just one question, I've tried to change the script from PIN 3 to PIN 21, now it only shuts down the pi and not waking it up. any suggestions?
@therexershow5 жыл бұрын
This video should have a ton more views. Great video.
@Howchoo5 жыл бұрын
Thanks! All in good time ;)
@sanjaybhatikar3 жыл бұрын
I have implemented this on a Raspberry Pi 3 and it works very well. Kudos to you for very clear instructions. I have a question that perhaps you can help answer. Will this solution work to power down the pi running on battery power when the battery is running low? I am guessing that pin 5 will go logic low as battery runs out, effectively same as shorting with pin 6 (GND). Thank you 🙏
@raudet284 жыл бұрын
Simple , straight forward, like that. Thanks for this video it actually was more helpful than I first imagine.
@aaaafaaaaf2 жыл бұрын
Great video - very clear and easy to follow. Thank you for sharing.. Is the button a momentary button..
@stressed764 жыл бұрын
Man that worked like a charm! Thanks for saving me from pulling my hair out🤣. Tried older diys with no luck, then finally found this! Thank you sooooo much!!
@Howchoo4 жыл бұрын
No problem!
@m.hannis98944 жыл бұрын
Excellent video!!! I just bought the premade button from your website, and will complete the project!!! Also liked and subscribed!!!
@Howchoo4 жыл бұрын
M. Hannis Awesome! Glad you liked it, we’ll ship your buttons out today :)
@therealnamonid4 жыл бұрын
I have a question. If we are already using Pin 5 for another thing like a controller, is there any way to change the pin settings for the button? Also great video!
@federicomilano52723 жыл бұрын
Hi! THANKYOU!! Only 1 question; this is a "push" button or is the "click" button?
@JayDubsterАй бұрын
Solid tutorial, thanks for this :) - Gonna try same on my RPi5.
@GingerWithASoul1003 жыл бұрын
Great video, thanks for sharing this. Is there an easy way to add a delay for shutdown? I’m using this in my vehicle and it has some interference. I figured if I add a .5 sec shutdown delay (hold the button for .5 sec) it will keep the noise from shutting down my PI.
@whitneydesignlabs8738 Жыл бұрын
Awesome!! Thanks so much for your scripting, your video and the detailed write up on your site. I just wired and installed on my Pi4 which is in vehicular use. Now, so much easier to shut down gracefully, with a physical button, instead of the GUI (or worse, turning off ignition key and hard-crashing the pi). I was prepared to copy and paste the code, run it at boot up etc etc. But your script did all the heavy lifting. Cheers!!!
@zatoichibeat5 жыл бұрын
For a raspberry pi 4 you can now update from the Terminal so no need for the boot loader, but once you install everything do a reboot first and then the button turns off and on. Thanks for the tut 👍
@mauznemo3 жыл бұрын
with sudo apt update?
@QletTV3 жыл бұрын
What kind of wire stripper do you use? I really liked that one
@fibranijevidra2 жыл бұрын
I have installed your script on the RPI4 with Volumio, but the response was: File "/usr/local/bin/listen-for-shutdown.py", line 4, in import RPi.GPIO as GPIO ImportError: No module named RPi.GPIO How do I fix this?
@jonathanaknudsen2 жыл бұрын
Did you ever find a fix? I am running into the same error. When I install before volumio, it allows me to wake the pi but not shut it down.
@fibranijevidra2 жыл бұрын
@@jonathanaknudsen No, I gave up.
@johanlaurasia2 жыл бұрын
Great video, as the guy below stated, easy to follow and worked like a charm
@johncharlesbuccat37663 жыл бұрын
WOOOOOOWW! THANK YOU VERY MUUUUUCH! Worked on first try :)
@ninoponchev3 жыл бұрын
Great video! I tried it on raspberry zero W and it worked on first try!
@Lunolux2 жыл бұрын
Great video, thx I think i will add a led if i do that, idk if it worth i but i like having visual that its "on" when using button like that
@jufeldalmaida514917 сағат бұрын
Hey @Howchoo, I find the code working! But there's one thing which bugs me, when i first turn on the power supply, the pi boots up instead of waiting for a button press. Do u have any idea if this can be avoided?? Thanks in advance.
@JoeEverett-nj1re7 ай бұрын
Worked Great, I ran the code ahead of time, Thanks for the howto Video
@cjlowe1650 Жыл бұрын
This works great. Just 2 things. 1). I get a message there is a resistor on GPIO3 when executing the script. 2). My Power does not fully go down. My Fan is still on although it looks like the USB ports are not active and of course the RED Led is still on. But this does Stop (shutdown) and Restart when I push the button.
@brianmcnaspy50733 ай бұрын
can i use the same button for 5 raz-pi's so long as i wire them right ?or should i split them up between a few buttons??
@mrgatez20073 жыл бұрын
CRACKING I love it I now if have my raspberry pi 4 in a *" fractal pc case "*
@mrgatez20073 жыл бұрын
Using the cases power button to boot it up I will upload a video to my channel of it running off a power bank on my Sony 43 TV I LOVE IT with only 1 cable out of it witch is the HDMI cable
@vongdong104 жыл бұрын
Can I use different pins? The ones you showed are occupied by a display I'm using.
@umeshjadhav33263 жыл бұрын
simple and worked without any extra hassle......great ! Thanks to you....
@Howchoo3 жыл бұрын
You're welcome!
@nix36492 жыл бұрын
Now, I think we can simply use "dtoverlay=gpio-shutdown" command in "/boot/config.txt" instead of this script. This script constantly shutdown my pi4 randomly while the 'dtoverlay' commande does not. Probably because of a debounce param missing, I guess. Thanks anyway for sharing
@marlbear5 жыл бұрын
Perfect!! My bartop is now 100% finished. Thank you 🙏🏼
@Howchoo5 жыл бұрын
No problem! Sounds like a cool project :)
@pdjames17295 жыл бұрын
@@Howchoo is usb3 speed still shafted on the 'new' firmware - I'm holding off on updates as All of the ones released so far have had other issues. I know it's a small risk but I'd reticent about bricking another one - having had one dev machine blowing it's hdmi 0 socket off from under-powering
@TheSimonScowl4 жыл бұрын
Power Button: "Burrrrrrpp!!!!" Me: I'm cutting you off!
@jacobh62724 жыл бұрын
Awesome video I got my rpi 4b on dec 25 and it worked no problem no need to get the latest version. Btw recommend turning off the pi through the interface like you would a regular laptop or pc but turning ot on worked no problem.
@Howchoo4 жыл бұрын
Great, thanks for the info!
@VeryMuchBlessed4 жыл бұрын
Great instructive video howchoo! I've been looking for this to add to my Pi 4B for days. Works great. Thanks much for making this video.
@Howchoo4 жыл бұрын
No problem! Stay tuned for more :)
@xflow794 жыл бұрын
Thanks for the nice tutorial, now i was easily able to add the power button and status led to some pi3 and a pi4! thank you!
@MiekkiVT3 жыл бұрын
Thanks you so much. This video helped me a lot.
@Howchoo3 жыл бұрын
No problem! Glad it helped :)
@Filmblanc3 ай бұрын
will this work with a momentary type of button/switch or does it have to be a normally open button?
@1rowellb2 жыл бұрын
looking to add an LED on my Raspberry Pi 4b. Can I also add a raspberry pi fan as well? Or are the pins taken up by the button?
@00Gerny003 жыл бұрын
Super easy and it worked on my Pi4! Thanks so much
@shingrutashish56393 жыл бұрын
Thank you for the video. can I install directly now without that bootloader thing because its been two years now. do these things updated now?
@Howchoo3 жыл бұрын
Yep, you don’t need the boot loader as long as you don’t somehow buy a super old Pi 4 that still has the original firmware (like old stock or something). Try skipping the firmware step and see if everything works. You can always do that step afterwards if needed.
@stefanmerk57502 жыл бұрын
hi, thanks for showing. I have a question, can you do this with a touch (capacitive) button? By touching the button for 3 seconds? that would work and if so, how?
@Adam-rw4xk4 жыл бұрын
Do power cables that have switches built-in do the same thing basically? Great video, fun to watch.
@Howchoo4 жыл бұрын
Thanks! And not quite-using a power cable with a switch is the same as ripping the cord out of the wall. That physically cuts power without SAFELY shutting the Pi down, which is bad :)
@joshualawson76045 жыл бұрын
Download link says "Sorry, the file you have requested does not exist."
@brutalpancho3 жыл бұрын
really good tutorial thanks. no idea why there are any thumbs down. only thing is, for me, I have 2 fans running on the same pin so will have to see if theres a way to move them or the button elsewhere?
@Howchoo3 жыл бұрын
Which pin are they running on? If it’s pin 5, this is definitely required for the power button’s “wake” functionality. But you can likely move your fan to another one (any other GPIO pin) since the fan probably only needs basic GPIO functionality :)
@itstbe762 жыл бұрын
Nice work, thank you! Works fine with my new Pi-Hole. 👍
@viva76423 жыл бұрын
That's a 3d printed coffee cup!! :D nice vid.
@Powergeek Жыл бұрын
Which pins should I use when doing this with a 7" pi touch screen? Pin 6 is used as part of the wiring for that so are there alternatives I could use instead?
@kjkansara3 жыл бұрын
Great tutorial, thanks a lot. I was wondering how can I keep the host connection active even if I shut down the pi. PS. I am using Putty on Windows
@DrKazAstro4 жыл бұрын
You legend. Thanks so much - this worked first go - super fast - super easy - THANKS SO MUCH
@ue2603 жыл бұрын
Thanks for this, very helpful. My PI ws turning on and off fine but all of a sudden it only turns it off. It won't turn back on and a reboot command is the same, shuts off but won't come back on.
@xaniac24294 жыл бұрын
Thank you for the tutorial! Very easy to follow along and it worked just like a charm.
@salze1454 жыл бұрын
clean and nice work!
@Howchoo4 жыл бұрын
Thanks!
@milanowns2 жыл бұрын
Excellent tutorial! Simple to follow and no bs!
@Howchoo2 жыл бұрын
Aw, thanks so much! Glad you enjoyed it :)
@kristiknight-craddock87483 жыл бұрын
Excellent Video......Thank you......I would like to use a button with an LED light ring. How can I use a flat metal actuator, surrounded by a green plastic LED ring. On the back there are 3 contacts for the button (common, normally-open and normally-closed) and 2 for the green LED ring (+ and -). Connect 3 to 6V to the LED and the Normal Open as in your video. My question is what would I connect the LED ring to on the board?
@bartcowan69073 жыл бұрын
Did you ever find a solution for this. I would like to use a lighted button as well.
@imsethtwo9 ай бұрын
Hey quick question, so if I am supplying power from an OBD2 adapter in my car, stepped down from 12v to 5v and then plugged directly into the usb port, if I run this script will it still shut down the pi? I am trying to think of ways around splicing a toggle into the obd cable. thanks!
@gary572107 ай бұрын
It looks like the I/O connectors are too tall to clear the case. Did you shorten them somehow?
@McCawley744 жыл бұрын
An aesthetically pleasing case destroyed.
@armanditoetc3 жыл бұрын
This video is so cool! TY. I have a Q. why this pin now also works to turn on the Pi?
@armanditoetc3 жыл бұрын
I found on internet that devs aded a wake up routine on bootloader on GPIO3.
@TheRealStructurer3 жыл бұрын
Hi. Would this work if you are running OctoPi on your Raspberry 4? Just started with Raspberries so maybe it's a stupid question?
@KubiIay3 жыл бұрын
Will the raspberry also turn on when you re insert the power (usb) cable or can you just insert it and need to press the power button? Because I don’t want it to unnecessarily turn on when inserting power cable. Just like a normal computer for instance.
@pugk9unit3 жыл бұрын
So does the button only work on sd cards that you have written this code to? So if you reflash your sd card with another software, you'd have to redo all these steps? Does this work with other OS's like retropie, OSMC, or Kodi?
@feral7094 Жыл бұрын
This worked great for my arcade cabinet power button until I needed to add a fan in 5v mode using pins 2 and 6. Can I use any other pins for a power button?
@pandaguan2 жыл бұрын
I don't recommend stripping and soldering jumper wires, those are usually made of iron. It will corrode over time, specially that it would be exposed to the heat of the solder. Use a regular stranded copper wire instead.
@EmptyVessel54 жыл бұрын
Hello! I'm currently planning out my first RPi project ever and I'm curious whether or not you know if there's a way to have it where you have to hold the button to shut down. With the project I'm planning, I'd imagine there's a chance of the button getting accidentally hit during use, so I want to mitigate this problem before it even begins. You wouldn't happy to have any thoughts regarding this, would you?
@Howchoo4 жыл бұрын
This could be done by forking and modifying the code-would require some knowledge of Python, but it can definitely be done :)
@olhakesta2 жыл бұрын
Hi! Good work! Unfortunately, however, although following all the steps indicated, this scheme does not work on my Raspberry Pi B+ V1.2 (2014) either with regard to the led or the on/off button (cf. the other video). Do you have any suggestions that can help me? Thanks in advance.
@SassafrasSapling8 ай бұрын
How do you do the software if you have a different operating system installed on the raspberry pi? I have Emteria OS installed on mine
@FMDev13 жыл бұрын
Hey Zach! Love you channel, and appreciate all of your work.
@pseudonym3690 Жыл бұрын
Thank you for your script. Works great even on a Raspi 1 :)
@MrElofix4 жыл бұрын
Werry well explained man. Thank you verry much! The only thing i suggest is to get another case with bigger hight and position the button at the back nect to the sd card. This red button on your case loocks like an emergancy stop :) Technicaly....10 points, design....2 points ;)
@Howchoo4 жыл бұрын
Haha thanks for the feedback!
@timosman14083 жыл бұрын
Worked perfectly thanks!
@cyberstar2513 жыл бұрын
does ground need to be pin 6 or can it be any ground pin on the board? because 6 is already populated by a pwm cooling fan on mine.
@WorstPaperCut4 жыл бұрын
Hello sir, I have a raspberry pi 4 model B 4GB. I purchased this pi on November 8th, 2020. Do I need to do the bootloader step at all this time because you said that the download link for the bootloader will probably change when the raspberry pi 4 updates its firmware?
@Howchoo4 жыл бұрын
Almost certainly not. If the power button doesn’t work, then you should update the firmware.
@WorstPaperCut4 жыл бұрын
@@Howchoo AH i see so, pretty much i can skip the bootloader step?
@gabstar30293 жыл бұрын
Hey I have octoprint on my pi3b+ I was wondering if this will work with my instance of octoprint or it will corrupt my pi
@toddcoello64614 жыл бұрын
I have a raspberry pi 4 and the pi 7 inch touchscreen. it uses the same pins is there a way to add a power button to that setup?
@toddcoello64614 жыл бұрын
I was able to get a power button installed on my setup
@nurmenikrohmawati25852 жыл бұрын
I have an error even though I have installed the rpi.gpio library. pi@raspberrypi:~ $ Traceback (most recent call last): File "/usr/local/bin/listen-for-shutdown.py", line 4, in import RPi.GPIO as GPIO ImportError: No module named RPi.GPIO I appreciate any help from you, thanks
@TheDarkelvenangel5 жыл бұрын
Great video, however why not use the gpio-shutdown overlay?
@cpassuel98573 жыл бұрын
Yes, I'm wondering too, it seems easier. Is there some limitations with gpio-shutdown method ?
@TheOleHermit5 жыл бұрын
This looks like a good solution for saving power on a RPi4 connected surveillance camera, but using a low power WiFi connected ESP32 (& motion detector) instead of a mechanical switch. Assuming that the RPi4 never really powers down, how much power does it use while in 'sleep' mode? Does it require a RTC battery to keep it 'alive'? Thanks😎
@lauf7lauf3754 жыл бұрын
Hi Howchoo, great and easy tutorial, however please help with one detail: I got the momentary NO button with 4 contacts (additional 2 contacts represent built-in LED functionality) - how should I connect /solder my button? Thanks for advice for anyone in this world. Cheers
@trispycee4 жыл бұрын
I wish I had the answer to this, my Rpi 4 isn't working with this script and I don't know if it's the bootloader or the way I've soldered my button...
@jarkko47324 жыл бұрын
@@trispycee I think you should be able to test your button with the instructions given between 02:07 - 02:28. Although the instructions are for a bit different thing (to detect if your button is a "normally open" or "normally closed" button), you can use the same style to detect which pins in your button are used for the button press if you try different pin combinations.
@trispycee4 жыл бұрын
@@jarkko4732 just an update: it works now! All I had to do was do a Sudo apt get update then Sudo apt upgrade and it updated the bootloader.
@joshg83913 жыл бұрын
Awesome work, man. Thank you a lot :D
@mvl82094 жыл бұрын
Can this only be done on pins 5&6? I have a case with a fan, and that uses 4&6 on my Raspberry Pi 4B Edit: I don't need the reboot/wake-up, I only want the safe shutdown
@tottestad919 ай бұрын
It has to be pin 5. Pin 6 can be switched out with any other ground pin.
@leangalz5 жыл бұрын
Awesome! I will use this for the arcade I'm working on. A question tho, Can I "unplug" the power cable after the script runs without any risk? Or the rpi stays on some kind of hibernation state? I'm asking this because I have a main switch on the Arcade to cut off all the electricity. (for safety reasons AND because I'm using a CRT tv that I turn off/on like this) and I pretend to use the button/script first and then press the main switch. Any thoughts?
@Howchoo5 жыл бұрын
Oh yeah you can totally cut the power after it shuts down safely. :) Just reconnect the power and it’ll boot right up.
@leangalz5 жыл бұрын
@@Howchoo Great! So this is just what I need. Thanks you!!
@Speccy48k5 жыл бұрын
Does it mean the shutdown script doesn’t perform a complete shutdown (power off) of the RPi?
@BrianThomas Жыл бұрын
What if the power button had an LED light built-in with 4 pins, and all the pins are the same length? Where would place the resister? I have an + /- pin. I know where they go, but I'm not sure about the LED.
@redpogo3 жыл бұрын
Obrigado! Fiz e deu super certo.
@Dali-yd3bf4 жыл бұрын
Hello can I connect 2 wires in the same gpio for the screen and the buttons ?
@bazurfulАй бұрын
Is there a way to make it work with a nc?
@mathskadarr2543 жыл бұрын
Hey will it only work in raspbian os......
@endlessbeast5 жыл бұрын
Nice!! Thanks for share!!
@fabian32654 жыл бұрын
awesome, works!
@Howchoo4 жыл бұрын
Good to hear!
@TheOnlyOwnedbyCow4 жыл бұрын
Does this work for turning the power on as well? This seems like it will only work as a safe power off.
@Howchoo4 жыл бұрын
Yep, this will also “wake” the Pi. Shorting those two particular pins wakes it from a shutdown state so it can consume 0 power while off. Check out the full guide linked in the video description for a better explanation of how it works :)
@zer0b0t5 жыл бұрын
I did a similar project some time ago, the only problem with this is that if for example the script doesn't load for some reason or you load another image that doesn't have the script loaded and you push the button it may break the Pi, so it's safer to at least add a resistor to the switch or ideally make a pull up-down resistor circuit.
@Howchoo5 жыл бұрын
How would it break the Pi? Shorting GPIO3 to GND won’t do that
@zer0b0t5 жыл бұрын
@@Howchoo I think I did it with gpio21. I don't know if gpio3 is different?
@zer0b0t5 жыл бұрын
@@Howchoo But I believe the problem is that the pin stays at high voltage (3 or 5v) and doesn't use the internal push down or up resistor unless you enable it with the software.
@jorgealejo19685 жыл бұрын
Yea I just fried my board.... lame
@zer0b0t5 жыл бұрын
@@jorgealejo1968 Ouch that sucks
@sethzora68104 жыл бұрын
Does this work with a regular non monetary NO switch? The pi is in a setup with a few other things that require a latching switch.
@percypappiono84643 жыл бұрын
thanks helped a lot :)
@edisonashok31602 жыл бұрын
Can you please provide me instructions to make it work on libreelec This works on osmc, but after the wake (power on by switch) does not play videos and rpi4 is slow, Need to reboot it to work properly
@teesdiy39933 жыл бұрын
Can I use pins 5 and 9 if I'm already using 4 and 6 for a fan etc?
@StudioLad Жыл бұрын
Can I use a different ground to pin 6, say pin 9 ? As I am trying to add a power switch to a Rasperry pi 3 b Kano kit. I assume the code would be different ?
@tottestad919 ай бұрын
You can use any ground pin you want. The code would be the same.
@pajaspk3 жыл бұрын
:D same third hand , same soldering machine :D i just have blue one :D awesome one for its price