Raspberry Pi RetroPie Shutdown Button

Поделиться
HTML-код
  • Опубликовано: 21 дек 2024

Комментарии • 51

  • @sethproaps8899
    @sethproaps8899 6 лет назад +2

    I love that you added how to chenge the shutdown pin, because in my case I have a PiMoroni battery supply, that takes up pins.

  • @johnjames01
    @johnjames01 6 лет назад +3

    This is great. I ordered my Pi 3b+ today and I intend to put Retropie on it. I'm a novice at this but willing to give it a go. Excited to get going with it 😊

  • @jamesferguson9354
    @jamesferguson9354 6 лет назад +6

    Is there a way to power the raspberry pi on with this button

  • @maverickgoose2956
    @maverickgoose2956 5 лет назад +3

    Thank you! Worked first time. No haste what so ever. 10/10.

  • @Hiroak
    @Hiroak 5 лет назад

    This was perfect, very easy to follow even for someone like me with zero experience working with "coding" if this is coding I don't even really know. It works perfect for my retropie gaming setup.

  • @obtainiumgaming4472
    @obtainiumgaming4472 4 года назад +1

    Thank you sir. Short and to the point. I like.

  • @KAKAROTOCES1981
    @KAKAROTOCES1981 6 лет назад +3

    Hi, there is a way to use this button to power on / turn off with the same gpo pins???.

  • @BSAElectronics702
    @BSAElectronics702 5 лет назад +1

    Very good walk thru and thanks for making your script public. Subscribed!

  • @theAristocrap
    @theAristocrap 2 года назад

    What if I have another board (audio card) over pi and I don't have open slots. Can I solder directly over card? (X400)

  • @defiant3636
    @defiant3636 5 лет назад +1

    Nice video man. Super simple for a noob for me and works like a dream. Works great only question, is there a way to update so it turns the system on two? Please could you do a video on that ?

  • @mattivirta
    @mattivirta 2 года назад

    i do my raspi4 8gb bullseye all this manual scripts and somethink but not shutdown if bush button newer. somethink this video have lot wrong. crontab have make and can see this all py scripts have /home/pi folders. and has sudo reboot after all has make. but button no working i change only code my button have installer gpio 21 and gnd.

  • @TheREALBadpun
    @TheREALBadpun Год назад

    thank you so much for this, it still works and it just saved my ass thank you!

  • @khanali5390
    @khanali5390 11 месяцев назад

    Will this work on any OS ? (New to pi)

  • @fabioferrara1574
    @fabioferrara1574 5 лет назад +3

    Thank you so muck, all is perfect!

  • @WellBeSerious12
    @WellBeSerious12 6 лет назад

    How to change script for pin headers 5 and 6?

  • @TheNikolasNick
    @TheNikolasNick 6 лет назад +2

    How did you get power for the led in your switch ? Did you connect it to the +5v gpio?

    • @RPiSpy
      @RPiSpy  6 лет назад +1

      The illuminated switch had two LED contacts and was designed for 12V. I just connected them to Pins 4 (5V) and Pin 6 (Ground). It has no effect on the switch functionality but looks a bit nicer. There are more details on that style of switch on my blog post : www.raspberrypi-spy.co.uk/2018/03/raspberry-pi-retropie-shutdown-button/

  • @aboimpinto
    @aboimpinto 6 лет назад +1

    Would be nice to have a button that turn the RP3 on and off like this

    • @RPiSpy
      @RPiSpy  6 лет назад

      To add a button to completely turn off the power you would need additional hardware. The hardware would need to cut off the power after the Pi was shutdown but without cutting it off too soon. For me this was a good enough compromise. If the mains isn't switched off at the wall it doesn't really matter as the power consumption is so low at that point. But, yes, a proper universal power switch would be nice :)

  • @rbndmx
    @rbndmx 4 года назад

    Thank you so much for share, this is exactly what I needed, i'm very happy =)

  • @mvl8209
    @mvl8209 4 года назад

    Will this work with the Pi 4B (aka the exact way like int this video)? Or do I simply have to look up the pin layout of the GPIO on my Pi 4B that runs Raspberry Pi OS Lite?

    • @RPiSpy
      @RPiSpy  4 года назад

      This should work on the Pi 4 as the 40-pin GPIO header is the same as it is on the previous Pi models.

  • @PeterRome
    @PeterRome 6 лет назад

    Great tutorial covering exactly what I needed. Do you know by any chance how to add an LED that would be powered when the PI is on? Thanks a lot.

    • @RPiSpy
      @RPiSpy  6 лет назад +1

      There are a few options for the LED. You could put an LED in series with a resistor across either 5V or 3.3V and ground. That would illuminate while the Pi has power. The other option is put the LED on a GPIO Pin, turn that Pin High on startup and then turn it off once the shutdown script has been activated.

    • @PeterRome
      @PeterRome 6 лет назад

      Thanks a lot. How would you define the resistor for the LED?

    • @RPiSpy
      @RPiSpy  6 лет назад

      If you are using a standard LED that will have a forward voltage of ~2V. So using 5V will drop 3V over the resister. A current of 5mA will be OK and using this calculator : www.raspberrypi-spy.co.uk/tools/simple-ohms-law-calculator/ gives a resistance of ~600ohms. If you play with current values of 3mA-10mA gives you a range of 300-1000ohms. I have lots of 330ohm resistors so I tend to use those.

  • @louf7178
    @louf7178 4 года назад

    For a blind shutdown [no monitor]:
    [may need to press MENU to wake wireless controller]
    (MENU (Start) [wake from screen saver])
    MENU (Start)
    RIGHT SHOULDER (6 clicks down), A
    RIGHT SHOULDER (3 clicks down), A, A
    Unplug (power off) unit
    Shorthand [with wakened controller]:
    (M), M, R.S., A, R.S., A, A

  • @jymferrier
    @jymferrier 5 лет назад

    this was perfect. Thank you!

  • @ricardovargasopitz4549
    @ricardovargasopitz4549 5 лет назад +1

    I was searching for a way to power it up :( , to shut down i can do it from the menu.

  • @mikem8145
    @mikem8145 6 лет назад +1

    GPIO 15 or 22 ? I'm confused

    • @RPiSpy
      @RPiSpy  6 лет назад

      Pin 15 on the 40-pin header is GPIO22.

  • @troymcdonald
    @troymcdonald 3 года назад

    Thanks for this. Is this the same for RPi4? And, have you figured a way to shut down the pi and then machine (lights/monitor) after the pi shuts down? (A one button solution)
    Thanks

  • @fen411
    @fen411 6 лет назад

    Did anyone manage to use this single switch to turn the machine back on again? In other words, if you press and hold the button it turns off and if you press and hold the same button again it turns back on?

    • @RPiSpy
      @RPiSpy  6 лет назад +1

      It's not possible to use the same switch as once the Pi has shutdown there is no system running to monitor the GPIO pins. You could fit a momentary switch to the 2-pin "RUN" header which will re-boot the Pi assuming the power is still applied to the microUSB port.

    • @fen411
      @fen411 6 лет назад

      Thanks for the quick response. I'm a NOOB so be kind. I found this bit of script:
      #!/usr/bin/python
      oldButtonState1 = True
      while True:
      # Check the current button state
      buttonState1 = GPIO.input (22)
      # Check for button push
      if buttonState1 != oldbuttonState1 and buttonState1 == False:
      subprocess.call ("shutdown -h", shell=True,
      stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      oldButtonState1 = buttonState1
      time.sleep (.1)
      Although promising I couldn't get it to work :(
      But not knowing python at all I don't know why, I was wondering if it was possible to combine the two??

    • @HoolyHoo1
      @HoolyHoo1 6 лет назад +4

      Raspberry Pi Spy Yes it is possible. You simply need to use gpio 3 (physical pin 5) instead in the script. That pin will reboot the pi similar to the run header when grounded but can still be used as the shutdown gpio in the script. As long as the microusb is powered it will work as a dual on/off switch.

    • @fen411
      @fen411 6 лет назад

      Awesome cheers

    • @msyahabudinishak6920
      @msyahabudinishak6920 6 лет назад

      HoolyHoo1 cool... can this switch use to reboot while in the main menu? instead of going to restart emulationstation...

  • @christophermugford4555
    @christophermugford4555 6 лет назад

    Do you know how to uninstall? Thanks!

    • @RPiSpy
      @RPiSpy  6 лет назад +1

      Uninstall GPIOZero?
      sudo apt-get --purge remove python3-gpiozero
      but you would also need to delete the entry from the crontab to stop it trying to run the script on boot.

  • @Resimaster
    @Resimaster 5 лет назад

    Great video! Thanks for posting. Is there a way to get a script to run other commands with an external button press, for example "insert coin"?

  • @meande-man5351
    @meande-man5351 5 лет назад

    Works a treat!

  • @horizon42q
    @horizon42q 4 года назад +1

    Good video

  • @vikvanderhaeghen200
    @vikvanderhaeghen200 5 лет назад

    Thank you!

  • @StanMoi
    @StanMoi 5 лет назад

    Thanks!!!!!

  • @willmoindrot
    @willmoindrot 4 года назад

    Thanks for this useful video, it helped me get started. However I found on my install (RPi4 Retropie) adding as cron (following your instructions) did not get it working. It would run if I started your python from the command line but on reboot nothing happened. I tried logging but that didn't report anything, I also tried putting in a sleep duration, still no dice. Instead I added as a command in rc.local and that got it working on a reboot (no idea if that approach is now depracated): www.raspberrypi.org/documentation/linux/usage/rc-local.md

  • @jnkmal9519
    @jnkmal9519 5 лет назад +3

    @5:51 Your outlets have power switches?! Sliiiiiick

    • @RPiSpy
      @RPiSpy  5 лет назад

      LOL. Yeah we're truly living in the future :)

    • @DigitalGus75
      @DigitalGus75 5 лет назад +1

      Australia too... all our outlets are switched.