How to Add a Power Button to Your Raspberry Pi (+ FLIRC Case Install!)

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 348

  • @thndrpnts
    @thndrpnts 4 роки тому +9

    Aw man. Seeing those RadioShack switches brings back memories. That was my first job right out of high school!

    • @Howchoo
      @Howchoo  4 роки тому +4

      Aww yeah. I miss being able to run there to pick up a quick component or switch last minute-worth paying 5X the price :)

    • @teesdiy3993
      @teesdiy3993 3 роки тому +1

      Radio shack was called Tandy in Australia back in the day.. Gone now.. Jaycar is my shop now when I need something right then.

  • @witsend236
    @witsend236 Рік тому +1

    Works on PI 4 in March 2023. Many thanks for all the hard work saving me loads....

  • @ianpiercy6551
    @ianpiercy6551 4 роки тому +9

    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

    • @RomanOnARiver
      @RomanOnARiver 3 роки тому +2

      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.

  • @inonfarag
    @inonfarag 2 роки тому +1

    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?

  • @mikeg1zrn896
    @mikeg1zrn896 4 роки тому +1

    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.

  • @drwhowhogrub3908
    @drwhowhogrub3908 4 роки тому +2

    This is by far the best tutorial for a power button. Very easy to do thanks very much

  • @JeanPaulLapointeCGI
    @JeanPaulLapointeCGI 4 роки тому +6

    Wow! 100% on my Pi 4. This was an awesome little project.

  • @vongdong10
    @vongdong10 4 роки тому +1

    Can I use different pins? The ones you showed are occupied by a display I'm using.

  • @therealnamonid
    @therealnamonid 4 роки тому +2

    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!

  • @m.hannis9894
    @m.hannis9894 4 роки тому +2

    Excellent video!!! I just bought the premade button from your website, and will complete the project!!! Also liked and subscribed!!!

    • @Howchoo
      @Howchoo  4 роки тому +1

      M. Hannis Awesome! Glad you liked it, we’ll ship your buttons out today :)

  • @therexershow
    @therexershow 5 років тому +10

    This video should have a ton more views. Great video.

    • @Howchoo
      @Howchoo  5 років тому

      Thanks! All in good time ;)

  • @federicomilano5272
    @federicomilano5272 3 роки тому

    Hi! THANKYOU!! Only 1 question; this is a "push" button or is the "click" button?

  • @GingerWithASoul100
    @GingerWithASoul100 3 роки тому +1

    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.

  • @brianmcnaspy5073
    @brianmcnaspy5073 4 місяці тому

    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??

  • @1rowellb
    @1rowellb 2 роки тому

    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?

  • @QletTV
    @QletTV 3 роки тому

    What kind of wire stripper do you use? I really liked that one

  • @Powergeek
    @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?

  • @stefanmerk5750
    @stefanmerk5750 3 роки тому

    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?

  • @NikhchansGaming
    @NikhchansGaming 3 роки тому

    2:38 Can I use Male to female jumper cables and tape/hook in the male ends to the button's pins?

  • @namaro539
    @namaro539 10 місяців тому

    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

    • @kurtroyales2659
      @kurtroyales2659 9 місяців тому

      Hi! May I ask what type of switch did you use on your end? Will a rocker switch work?

    • @namaro539
      @namaro539 9 місяців тому

      @@kurtroyales2659 yes a 2 way rocker switch with 3 connection points

  • @jufeldalmaida5149
    @jufeldalmaida5149 Місяць тому

    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.

  • @feral7094
    @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?

  • @shingrutashish5639
    @shingrutashish5639 3 роки тому

    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?

    • @Howchoo
      @Howchoo  3 роки тому

      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.

  • @kristiknight-craddock8748
    @kristiknight-craddock8748 3 роки тому

    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?

    • @bartcowan6907
      @bartcowan6907 3 роки тому

      Did you ever find a solution for this. I would like to use a lighted button as well.

  • @raudet28
    @raudet28 4 роки тому +1

    Simple , straight forward, like that. Thanks for this video it actually was more helpful than I first imagine.

  • @Filmblanc
    @Filmblanc 4 місяці тому

    will this work with a momentary type of button/switch or does it have to be a normally open button?

  • @gary57210
    @gary57210 8 місяців тому

    It looks like the I/O connectors are too tall to clear the case. Did you shorten them somehow?

  • @stressed76
    @stressed76 4 роки тому

    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!!

  • @lauf7lauf375
    @lauf7lauf375 4 роки тому +1

    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

    • @trispycee
      @trispycee 4 роки тому

      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...

    • @jarkko4732
      @jarkko4732 4 роки тому

      @@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.

    • @trispycee
      @trispycee 4 роки тому

      @@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.

  • @aaaafaaaaf
    @aaaafaaaaf 2 роки тому

    Great video - very clear and easy to follow. Thank you for sharing..
    Is the button a momentary button..

  • @Lunolux
    @Lunolux 2 роки тому

    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

  • @olhakesta
    @olhakesta 3 роки тому

    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.

  • @TheDarkelvenangel
    @TheDarkelvenangel 5 років тому +1

    Great video, however why not use the gpio-shutdown overlay?

    • @cpassuel9857
      @cpassuel9857 3 роки тому

      Yes, I'm wondering too, it seems easier. Is there some limitations with gpio-shutdown method ?

  • @cyberstar251
    @cyberstar251 3 роки тому

    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.

  • @imsethtwo
    @imsethtwo 10 місяців тому

    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!

  • @sanjaybhatikar
    @sanjaybhatikar 3 роки тому

    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 🙏

  • @nix3649
    @nix3649 2 роки тому +2

    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

  • @ue260
    @ue260 4 роки тому

    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.

  • @KubiIay
    @KubiIay 4 роки тому

    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.

  • @rozuja
    @rozuja 5 років тому +2

    I just bought a Rasp 4 B its on its way, for retropie, loved when I just realized I could take all my roms outside my computer 2 a single machine.
    I'm not an electric engineer so IDK nothing about hardware, i've been stuying with videos how to install it in the case, put the fan, the heat sinkers (or how its called), just realized the power button its cool, Want to implement it on my purchase, I saw your video and saw where you connected the button, but the fan uses 4 and 6, and you used 5 and 6 for the button, can I rotate the fan and change 6 to 14 that is ground too? IDK nothing about this so by logic im asking. Dont wanna damage mi PI.

    • @Howchoo
      @Howchoo  5 років тому +2

      You got it right-you can definitely use a different ground for either one. So use pin 6 for the fan's GND and 14 for the button GND. :) This is a good resource for identifying pins: pinout.xyz/

    • @taylonjudd923
      @taylonjudd923 5 років тому +1

      yes, a ground is a ground doesnt matter which pin on the rpi, and the rpi has multiple ground pins for use, you can look at the pinout guid howchoo referenced, and use any ground for the fan or button that makes cable management easier for you

  • @BrianThomas
    @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.

  • @fibranijevidra
    @fibranijevidra 2 роки тому +2

    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?

    • @jonathanaknudsen
      @jonathanaknudsen 2 роки тому

      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.

    • @fibranijevidra
      @fibranijevidra 2 роки тому

      @@jonathanaknudsen No, I gave up.

  • @joshualawson7604
    @joshualawson7604 5 років тому +6

    Download link says "Sorry, the file you have requested does not exist."

  • @gabstar3029
    @gabstar3029 3 роки тому

    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

  • @toddcoello6461
    @toddcoello6461 5 років тому +1

    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?

    • @toddcoello6461
      @toddcoello6461 4 роки тому

      I was able to get a power button installed on my setup

  • @Dali-yd3bf
    @Dali-yd3bf 4 роки тому

    Hello can I connect 2 wires in the same gpio for the screen and the buttons ?

  • @teesdiy3993
    @teesdiy3993 3 роки тому

    Can I use pins 5 and 9 if I'm already using 4 and 6 for a fan etc?

  • @pugk9unit
    @pugk9unit 3 роки тому

    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?

  • @johanlaurasia
    @johanlaurasia 2 роки тому

    Great video, as the guy below stated, easy to follow and worked like a charm

  • @kjkansara
    @kjkansara 3 роки тому

    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

  • @sethzora6810
    @sethzora6810 4 роки тому

    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.

  • @johncharlesbuccat3766
    @johncharlesbuccat3766 3 роки тому +1

    WOOOOOOWW! THANK YOU VERY MUUUUUCH! Worked on first try :)

  • @cjlowe1650
    @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.

  • @iwillalwasecomelast
    @iwillalwasecomelast 5 років тому

    very new to linux, but i'm enjoying the learning... i tried this and got this back
    /usr/local/bin/listen-for-shutdown.py:8: RuntimeWarning: A physical pull up resistor is fitted on this channel!
    GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    and the button does not work.
    i'm using a 3b if that makes a difference

    • @dartveider1372
      @dartveider1372 5 років тому

      how has decided this problem? I heared we have to
      solder two resistors so that there is no short circuit

    • @nikolatotev
      @nikolatotev 4 роки тому

      From what I know, there are builtin pull-up resistors which basically prevents shorting pins when using a button. In this case I can only assume that its warning you about that, but I'm not 100% sure.

  • @StudioLad
    @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 ?

    • @tottestad91
      @tottestad91 10 місяців тому

      You can use any ground pin you want. The code would be the same.

  • @mvl8209
    @mvl8209 4 роки тому +1

    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

    • @tottestad91
      @tottestad91 10 місяців тому

      It has to be pin 5. Pin 6 can be switched out with any other ground pin.

  • @SassafrasSapling
    @SassafrasSapling 10 місяців тому

    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

  • @WorstPaperCut
    @WorstPaperCut 4 роки тому

    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?

    • @Howchoo
      @Howchoo  4 роки тому

      Almost certainly not. If the power button doesn’t work, then you should update the firmware.

    • @WorstPaperCut
      @WorstPaperCut 4 роки тому

      @@Howchoo AH i see so, pretty much i can skip the bootloader step?

  • @edisonashok3160
    @edisonashok3160 2 роки тому

    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

  • @TheRealStructurer
    @TheRealStructurer 3 роки тому

    Hi. Would this work if you are running OctoPi on your Raspberry 4?
    Just started with Raspberries so maybe it's a stupid question?

  • @bazurful
    @bazurful 2 місяці тому

    Is there a way to make it work with a nc?

  • @alexwesterhof793
    @alexwesterhof793 2 роки тому

    Thank you for the video.
    I implemented this on two raspberries that control 2 3d printers.
    It works as designed though there is one flaw.
    It looks like the gpio pins and scripts are picking up static electric discharges or so.
    When I am tuoching one 3d printer it often triggers the script on the other raspberry causing it to shut down and kill the print.
    Can the script be made less sensitive?
    Or otherwise, how can I remove the script?
    TYIA

    • @TheZeroimpact
      @TheZeroimpact 2 роки тому +1

      Add a 10k resistor to the GND cable to crate a pull up check, just google this and you will see why this will solve this issue

    • @alexwesterhof793
      @alexwesterhof793 2 роки тому

      @@TheZeroimpact TY so much for reacting, I googled it but still I am not sure that this is the only alteration needed.
      So base question from me "Is adding a 10k resistor on the GND cable of the switch enough?"
      Now the switch is connected directly to the GPIO pins but adding a 10k resistor on the GND cable will remove the annoying and unintentionally shut downs?

    • @alexwesterhof793
      @alexwesterhof793 8 місяців тому

      @@TheZeroimpact Still not certain if a 10k resistor on the gnd cable solely will suffice. Looking through many videos I get the impression that I need a cable to the 3.3V which is connect tho the switch and than the GPIO pin as well and the resistor which is than called "pull down".
      Please advise if this correct?

  • @TheOnlyOwnedbyCow
    @TheOnlyOwnedbyCow 4 роки тому

    Does this work for turning the power on as well? This seems like it will only work as a safe power off.

    • @Howchoo
      @Howchoo  4 роки тому

      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 :)

  • @Arthurnate
    @Arthurnate 5 років тому +1

    Just wondering, is it fine to use one of the other earth pins? I'm already using 6 for a small fan. Thanks :)

    • @Howchoo
      @Howchoo  5 років тому

      Matthew Morgan Yep, you can use any ground.

    • @Arthurnate
      @Arthurnate 5 років тому +1

      @@Howchoo Thanks for the reply, great vid!

    • @ThesexyMrX
      @ThesexyMrX 5 років тому

      does your fan shut down with this? im curious

  • @ninoponchev
    @ninoponchev 3 роки тому

    Great video! I tried it on raspberry zero W and it worked on first try!

  • @alexviollet7699
    @alexviollet7699 4 роки тому

    In some other video it is explained to use some resistors not to damage the pins (breadboard and 4 pads button setup). Is this due to the button being used that you don't need anything but the button in your setup ?

    • @Howchoo
      @Howchoo  4 роки тому

      This isn’t completely necessary-this is mainly to protect the Pi in case you accidentally connect the leads to the wrong pins. :)

    • @alexviollet7699
      @alexviollet7699 4 роки тому

      @@Howchoo ok I see. Thanks for the answer

  • @JoeEverett-nj1re
    @JoeEverett-nj1re 9 місяців тому

    Worked Great, I ran the code ahead of time, Thanks for the howto Video

  • @marcoburningblue
    @marcoburningblue 5 років тому

    Like it but I wonder how would that affect the cooling efficiency of the case

    • @Howchoo
      @Howchoo  5 років тому +1

      The impact would be minimal if any; the amount of material being removed for the button is minuscule compared to the area of cooling material that makes up the entire case.

    • @marcoburningblue
      @marcoburningblue 5 років тому +1

      It make sense!, good video thanks for sharing!

    • @Howchoo
      @Howchoo  5 років тому +1

      @@marcoburningblue No problem! Thanks for checking it out :) We have lots more coming soon.

  • @whitneydesignlabs8738
    @whitneydesignlabs8738 Рік тому +1

    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!!!

  • @EmptyVessel5
    @EmptyVessel5 4 роки тому

    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?

    • @Howchoo
      @Howchoo  4 роки тому +1

      This could be done by forking and modifying the code-would require some knowledge of Python, but it can definitely be done :)

  • @ayan.debnath
    @ayan.debnath 4 роки тому

    QUESTION: can I use the switch/button that is used for Computer to start or restart? I mean the PC power button?

    • @nel2834
      @nel2834 4 роки тому

      Yes, its the same thing

  • @fritss7129
    @fritss7129 4 роки тому

    Is there a way to start different video in a loop with different pushbuttons?
    I am vollanteer in a museum and want to show short video in different languages beginning with a info video to ask to push the button off there choice. The Pi starts with a pir. Sorry, english is not my native language.

  • @nurmenikrohmawati2585
    @nurmenikrohmawati2585 2 роки тому +1

    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

  • @saberpotatoboy4151
    @saberpotatoboy4151 3 роки тому

    Hey can someone tell me if after I turn of the raspberry pie can I leave the power still plugged into it or should I take that out?

  • @zatoichibeat
    @zatoichibeat 5 років тому +3

    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 👍

    • @mauznemo
      @mauznemo 3 роки тому

      with sudo apt update?

  • @mathskadarr254
    @mathskadarr254 3 роки тому

    Hey will it only work in raspbian os......

  • @johnrufino1547
    @johnrufino1547 2 роки тому

    Hi @Howchoo, can you post the updated google drive location for the bootloader files please. Currently link no longer works

  • @petebuka
    @petebuka 4 роки тому

    Thanks for the video. I have a pi4 and would like to do this with a touch power button.. is this possible. it has gnd / io / vcc ?

    • @willsarms3
      @willsarms3 4 роки тому

      yes this should be possible if you wire the gnd to gnd, vcc to 5v available on the board, and io to pin 5

  • @marlbear
    @marlbear 5 років тому +2

    Perfect!! My bartop is now 100% finished. Thank you 🙏🏼

    • @Howchoo
      @Howchoo  5 років тому

      No problem! Sounds like a cool project :)

    • @pdjames1729
      @pdjames1729 5 років тому +1

      @@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

    • @TheSimonScowl
      @TheSimonScowl 5 років тому

      Power Button: "Burrrrrrpp!!!!"
      Me: I'm cutting you off!

  • @armanditoetc
    @armanditoetc 3 роки тому

    This video is so cool! TY.
    I have a Q. why this pin now also works to turn on the Pi?

    • @armanditoetc
      @armanditoetc 3 роки тому

      I found on internet that devs aded a wake up routine on bootloader on GPIO3.

  • @Adam-rw4xk
    @Adam-rw4xk 4 роки тому

    Do power cables that have switches built-in do the same thing basically? Great video, fun to watch.

    • @Howchoo
      @Howchoo  4 роки тому

      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 :)

  • @umeshjadhav3326
    @umeshjadhav3326 4 роки тому

    simple and worked without any extra hassle......great ! Thanks to you....

    • @Howchoo
      @Howchoo  4 роки тому

      You're welcome!

  • @viva7642
    @viva7642 5 років тому +1

    So, if you press the button it will send a signal and run a script and at the end will shut-off the raspberry pi. Now, how do you turn it on again? Because this is a normally open button. I was thinking of a rocker switch.

    • @Howchoo
      @Howchoo  5 років тому

      When you press the NO button a second time it will wake the Pi. I wouldn't recommend using a rocker switch, but if you absolutely had to, you could modify the script pretty extensively. I'm just curious -- why do you want to use a rocker switch over a push button? If it's for aesthetics, you could always grab a springed rocker switch that returns the switch back to the original position (basically an NO push button in a rocker switch form factor).
      Edit: On second thought, shorting those two pins is what wakes it up! So your toggle switch should work as-is. :)

    • @MJ-ki5vc
      @MJ-ki5vc 4 роки тому

      howchoo is there a way to use it wich a nc switch. Also how to you know if it is an nc or oc switch without a multimeter
      I think I found out what kind of switch mine is. I believe it is an nc. My previous question still applies

  • @TheOleHermit
    @TheOleHermit 5 років тому

    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😎

  • @zer0b0t
    @zer0b0t 5 років тому +1

    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.

    • @Howchoo
      @Howchoo  5 років тому

      How would it break the Pi? Shorting GPIO3 to GND won’t do that

    • @zer0b0t
      @zer0b0t 5 років тому

      @@Howchoo I think I did it with gpio21. I don't know if gpio3 is different?

    • @zer0b0t
      @zer0b0t 5 років тому

      @@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.

    • @jorgealejo1968
      @jorgealejo1968 5 років тому +1

      Yea I just fried my board.... lame

    • @zer0b0t
      @zer0b0t 5 років тому

      @@jorgealejo1968 Ouch that sucks

  • @dcayus
    @dcayus 5 років тому +1

    Does the wakeup function work on rpi2 ?

    • @Howchoo
      @Howchoo  5 років тому +1

      Absolutely!

  • @NikhchansGaming
    @NikhchansGaming 3 роки тому

    5:11 Is it okay to use other ground pins? I already have a fan on the 6.

    • @ryaneis7911
      @ryaneis7911 3 роки тому +1

      I used other ground pins.

    • @NikhchansGaming
      @NikhchansGaming 3 роки тому +1

      @@ryaneis7911 Yes. I did it too

    • @ryaneis7911
      @ryaneis7911 3 роки тому

      @@NikhchansGaming hey have you had issues with your screen going black after 15 minutes or so but the fan is still running but it won't wake back up without pressing the new power button and then all mm programs that were open were then closed so it's not like it's going to sleep

    • @NikhchansGaming
      @NikhchansGaming 3 роки тому

      @@ryaneis7911 Sorry but I didn't use it much with a display. I used it as a headless device.

    • @NikhchansGaming
      @NikhchansGaming 3 роки тому

      @@ryaneis7911 you might want to check your settings in your distro. Twister OS has settings for the button press.

  • @salvodimarco4617
    @salvodimarco4617 5 років тому

    Hi
    I have an RTC module on my RPI 4 already using pin 5, may use an alternative pin for the power button? Thanks for your advice!

    • @Howchoo
      @Howchoo  5 років тому

      Unfortunately not -- does the RTC have to be on Pin 5 (SCL)? Shorting SCL to GND is required to wake the Pi; so you could use another pin, but you'd only be able to use it to shut down the Pi, not wake it.

    • @melvinvandijk7816
      @melvinvandijk7816 4 роки тому

      @@Howchoo i dont want to start the pi with the button. how can i change it that it turns off on another pin

  • @leangalz
    @leangalz 5 років тому

    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?

    • @Howchoo
      @Howchoo  5 років тому

      Oh yeah you can totally cut the power after it shuts down safely. :) Just reconnect the power and it’ll boot right up.

    • @leangalz
      @leangalz 5 років тому

      @@Howchoo Great! So this is just what I need. Thanks you!!

    • @Speccy48k
      @Speccy48k 5 років тому +1

      Does it mean the shutdown script doesn’t perform a complete shutdown (power off) of the RPi?

  • @frozzler3590
    @frozzler3590 3 роки тому

    2:40 where I can buy one

  • @00Gerny00
    @00Gerny00 3 роки тому

    Super easy and it worked on my Pi4! Thanks so much

  • @commander_fire
    @commander_fire 4 роки тому

    i want to use my raspberry as an nas with openmediavalt and i also want a power button to shut it safly down. Can i also use this or must i use an other way?

    • @Howchoo
      @Howchoo  4 роки тому

      You can use the power button that way as long as nothing else is using the same GPIO pins the power button requires. If you’re just doing a NAS, none of the pins should be in use anyways.

  • @MiekkiVT
    @MiekkiVT 4 роки тому +1

    Thanks you so much. This video helped me a lot.

    • @Howchoo
      @Howchoo  4 роки тому

      No problem! Glad it helped :)

  • @brutalpancho
    @brutalpancho 4 роки тому

    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?

    • @Howchoo
      @Howchoo  4 роки тому

      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 :)

  • @writzymovies
    @writzymovies 4 роки тому

    I like you video. could you make the shut down button time delayed so you have to hold the button down for 6 second before it shuts down?

    • @Howchoo
      @Howchoo  4 роки тому

      You can definitely modify the script to do this. :)

    • @writzymovies
      @writzymovies 4 роки тому

      Thank you for your response
      Could you please point me in the right direction on how to do it and where to put it in the script ? I have tried modifying your script with other script codes I have found on UA-cam but with no luck

    • @writzymovies
      @writzymovies 4 роки тому

      @@Howchoo so I have been looking into python before I go and install this I would like to run it by you if that's ok ?
      Under
      GPIO.setup(5, GPIO.IN, pull_up_down=GPIO_up
      # hold button for ? Seconds
      HoldTime=5
      oldButtonState 1"+ str(HoldTime) +" seconds") True
      Then edit
      If buttonstate 1!= Old button 1 and buttonstate1 == False,hold_time=HoldTime

    • @mikeg1zrn896
      @mikeg1zrn896 4 роки тому

      Did you ever find out how to add the Hold time ? Thanks.

    • @nix3649
      @nix3649 2 роки тому

      @@mikeg1zrn896 and you ? Did you find any solution?

  • @JayDubster
    @JayDubster 2 місяці тому

    Solid tutorial, thanks for this :) - Gonna try same on my RPi5.

  • @klemmbausteinbastler0501
    @klemmbausteinbastler0501 6 місяців тому

    Does this work with Windows? Because I have Windows 10 instead of Raspbian...

  • @petebuka
    @petebuka 4 роки тому

    my pi4 will shutdown but the CPU Cooler is still spinning and LED on NIC flashing like crazy. How to set it to kill all power on the 5v completely?.

  • @jacobh6272
    @jacobh6272 4 роки тому

    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.

    • @Howchoo
      @Howchoo  4 роки тому

      Great, thanks for the info!

  • @DrKazAstro
    @DrKazAstro 4 роки тому +1

    You legend. Thanks so much - this worked first go - super fast - super easy - THANKS SO MUCH