Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news


  

Author Topic: Power button for retropie  (Read 3007 times)

0 Members and 1 Guest are viewing this topic.

GrizzlyThunder

Power button for retropie
« on: May 01, 2017, 08:24:02 am »
Hey all,

Is there a script for the retropie to hook up an arcade button to the gpio for the power function. My cocktail cabinet currently is out of range of the wireless router therefore I believe I would need to directly write to the pie.
« Last Edit: May 15, 2017, 10:59:55 pm by DeLuSioNal29 »

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1966
  • I have a gaming addiction.....
Re: Power button for retropie
« Reply #1 on: May 01, 2017, 08:30:51 am »
There are scripts out there that will turn the pi off.

I use a mausberry circuits power switch to turn my pi on and off though.

1500points

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 380
    • How to succeed at Robotron
Re: Power button for retropie
« Reply #2 on: May 01, 2017, 09:17:23 am »
ETA Prime on YT shares a python script that works great for powering off the pi with a momentary push button.


The scripts here work equally well and give you a few more options, like an LED light and a game reset button, too.
http://www.westaby.net/nespi/assembly2.html
doesn't require the pcbs you see in the pic, just-->
put a latching switch across gpio pin 5 to gnd.
put a momentary switch across gpio pin 7 to gnd.
put an LED+resistory across gpio pin 8 to gnd.
gpio pinout- http://www.westaby.net/nespi/images/electronics/RP2_Pinout.jpg

when i was first getting started with this stuff i bought an expensive powerblock. never could get it to install properly, so tossed it in a box.

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 171
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: Power button for retropie
« Reply #3 on: May 11, 2017, 12:03:08 am »
Posts like these that contain stuff that everyone has issues with should be a sticky! awesome find. I knew about ETA primes solution and even Daft Mikes.. but this other guy Westaby seems very easy to follow and has made improvements. awesome!

GrizzlyThunder

Re: Power button for retropie
« Reply #4 on: May 12, 2017, 05:29:45 pm »
ETA Prime on YT shares a python script that works great for powering off the pi with a momentary push button.


The scripts here work equally well and give you a few more options, like an LED light and a game reset button, too.
http://www.westaby.net/nespi/assembly2.html
doesn't require the pcbs you see in the pic, just-->
put a latching switch across gpio pin 5 to gnd.
put a momentary switch across gpio pin 7 to gnd.
put an LED+resistory across gpio pin 8 to gnd.
gpio pinout- http://www.westaby.net/nespi/images/electronics/RP2_Pinout.jpg

when i was first getting started with this stuff i bought an expensive powerblock. never could get it to install properly, so tossed it in a box.

I tried following those guides but the problem I'm having is that my workshop is out in BFE and there's no internet out there. Therefore I have to connect with Ethernet, which I cannot successfully connect. I found a few scripts that I can manually enter but the pi is not recognizing the language change and won't run it.

I figured this part of the project would be difficult, but even the dang language is hassling me.


Sent from my iPhone using Tapatalk

1500points

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 380
    • How to succeed at Robotron
Re: Power button for retropie
« Reply #5 on: May 12, 2017, 08:59:20 pm »
ETA Prime on YT shares a python script that works great for powering off the pi with a momentary push button.


The scripts here work equally well and give you a few more options, like an LED light and a game reset button, too.
http://www.westaby.net/nespi/assembly2.html
doesn't require the pcbs you see in the pic, just-->
put a latching switch across gpio pin 5 to gnd.
put a momentary switch across gpio pin 7 to gnd.
put an LED+resistory across gpio pin 8 to gnd.
gpio pinout- http://www.westaby.net/nespi/images/electronics/RP2_Pinout.jpg

when i was first getting started with this stuff i bought an expensive powerblock. never could get it to install properly, so tossed it in a box.

I tried following those guides but the problem I'm having is that my workshop is out in BFE and there's no internet out there. Therefore I have to connect with Ethernet, which I cannot successfully connect. I found a few scripts that I can manually enter but the pi is not recognizing the language change and won't run it.

I figured this part of the project would be difficult, but even the dang language is hassling me.


Sent from my iPhone using Tapatalk

I suppose you could type everything from the prompt but putty sure is good with the ability to right click and paste the entries.

Can you hotspot your phone then wifi?   Bfe..and we all know where that is.  He he, i haven't heard that in ages.


Sent from my iPhone using Tapatalk

GrizzlyThunder

Re: Power button for retropie
« Reply #6 on: May 12, 2017, 09:28:39 pm »
Quote

I suppose you could type everything from the prompt but putty sure is good with the ability to right click and paste the entries.

Can you hotspot your phone then wifi?   Bfe..and we all know where that is.  He he, i haven't heard that in ages.


When I typed everything from the prompt the dang thing still used the British pound sign even though it's been changed to English. That shouldn't be a problem and I wrote it word for word but it still gets an error.

I will have to use my hotspot on my phone.. if I get signal lol.

I'm moving to the big city in July and will be moving the cabinet as well. Fingers crossed something will work then.

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 171
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: Power button for retropie
« Reply #7 on: May 12, 2017, 10:15:24 pm »
... the dang thing still used the British pound sign even though it's been changed to English...

British pound is English... Americans just don't use it often

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2503
  • Back from the dead.
Re: Power button for retropie
« Reply #8 on: May 13, 2017, 09:58:35 am »
I think he meant he attempted to change his keyboard to US English from UK english. That threw  me at first too... the keyboard assignment being set just slightly different out of the box.
Formerly known for the (apparently now defunct) arcadeartlibrary

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2503
  • Back from the dead.
Re: Power button for retropie
« Reply #9 on: June 13, 2017, 01:36:23 am »
For future reference, this is how i do it on my Pi3

I use a momentary with the input wire on 21 (the last one next to the usb ports, closes to the edge) and the ground on it's mate (next to usb ports, closer to one of the processors, just next to 21) . In my retropie autostart.sh script I call a script (/home/pi/.off-button.py).

Autostart:
/opt/retropie/configs/all/autostart.sh

Code: [Select]
python /home/pi/.off-button.py &
emulationstation


.off-button.py script:
 
Code: [Select]
#!/bin/python

import RPi.GPIO as GPIO
import os

gpio_pin_number=21
# number may be different in other Pi versions. This is for Pi3
# pin must be an input so as to not short the Pi

GPIO.setmode(GPIO.BCM)

GPIO.setup(gpio_pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)

try:
    GPIO.wait_for_edge(gpio_pin_number, GPIO.FALLING)
    #Use falling edge detection to see if pin is pulled low to avoid repeated polling
    os.system("sudo shutdown -h now")
except:
    pass

GPIO.cleanup()

That's the cleanest way I've figured out to setup a power switch. You can do something similar for resets. I don't have a reset button though, so it's not in the script. If anyone needs reference on that I can look it up. I think there are some dedicated pins for power and reset without programming these days, but It's just not what I  have set up at the moment  :)  There have been a few times where I wanted to disable the power button (kids)... this way lets me do it from a script instead of disabling hardware.
« Last Edit: June 13, 2017, 01:39:50 am by mahuti »
Formerly known for the (apparently now defunct) arcadeartlibrary

GrizzlyThunder

Re: Power button for retropie
« Reply #10 on: June 13, 2017, 08:39:38 am »
This is great! Thank you.


WeChat: GrizzlyThunder

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4457
  • I dont get no respect.
    • Skenny's Outpost
Re: Power button for retropie
« Reply #11 on: June 18, 2017, 09:32:59 am »
I have used the mausberry switch circuit on all my builds so far. It has connections for power and reset buttons, and powers down the RPi after shutdown.
Though it's not real expensive (around 17 US bucks), I would still like to "build my own" shutdown circuit. Im thinking a relay that is held on by a GPIO output until shutdown, then relay turns off power to the RPi, but after all is said and done, the mausberry switch is a lot simpler and easier.

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 171
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: Power button for retropie
« Reply #12 on: June 18, 2017, 10:20:55 am »
simpler than 1 switch and 1 script?
have you looked at the Solution presented by ETA prime? doesn't need a circuit board... just 1 gpio

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4457
  • I dont get no respect.
    • Skenny's Outpost
Re: Power button for retropie
« Reply #13 on: June 18, 2017, 05:49:39 pm »
Yes that does look promising, but does it kill power to the pi after shutdown?

Sparkoids

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • I want to build my own arcade controls!
Re: Power button for retropie
« Reply #14 on: June 26, 2017, 05:32:20 pm »
We have a new product for the Raspberry Pi called the Pi-Safe. What it does is provide power for long enough to allow the Pi to shutdown on power off.

Basically you just switch the arcade machine using a Pi off as normal and it uses a rechargeable battery to keep the power on whilst running a script to shut the Pi down. The user doesn't know that is happening they just use an arcade machine with a Pi as if it's a Jamma board.

There is a script for shutdown that anyone is welcome to use. The links to the script and the info are here: http://www.ekey-solutions.com/page-5/index.html

DeLuSioNal29

  • Global Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4594
  • Build the impossible -"There is no Spoon"
    • DeLuSioNaL's YouTube Videos
Re: Power button for retropie
« Reply #15 on: July 03, 2017, 10:40:50 am »
So I've finally jumped in head first to the Raspberry Pi3 scene.  I've done some research and figured I'd post the power button stuff here.

I stumbled across this great video on Youtube with a script (I've pasted the txt file below with the instructions and script).
! No longer available


DeL
Stop by my Youtube channel and leave a comment:

chito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 171
    • forum.arcadecontrols.com/index.php/topic,151843.0.html
Re: Power button for retropie
« Reply #16 on: July 03, 2017, 06:53:53 pm »
I stumbled across this great video on Youtube with a script (I've pasted the txt file below with the instructions and script).
youtube


ETA prime's video are already mention above. he also has a few power videos for the Pi all essentially work the same way

so i have a few mausberry circuits and was going to use 1 for another build. I started a thread about the power issue amd someone pointed out that the Pi doesnt need to be powered off, in fact it functions better left on. it draws such little power (turn other hardware off but). i looked into it an totally agree. so ive adjusted my plans to work this way

DeLuSioNal29

  • Global Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4594
  • Build the impossible -"There is no Spoon"
    • DeLuSioNaL's YouTube Videos
Re: Power button for retropie
« Reply #17 on: July 03, 2017, 08:42:45 pm »
I need to shut mine off. It's a portable bartop. :-)
Stop by my Youtube channel and leave a comment:

stigzler

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 870
  • It seemed like a good idea at the time....
    • Mago Arcade
Re: Power button for retropie
« Reply #18 on: August 01, 2017, 06:39:49 pm »
I'm new to Pis and recently came across this scenario. I wanted a way to:

- Turn Pi on and off with momentary switch
- Have a 'Pi On' light
- Control a small 5V fan for CPU cooling - on/off via gpio and software to regulate to cpu temp
- Have an additional pad for the 5V supply - essentially meaning could run an LED to it if I wanted to show power being supplied to the Pi.

Dead simple with 2 resistors and one transistor. You can know one together quite easy. Schematic:



Knocking together some boards to:



Can give pin outs if anyone needs them.

petrockblog

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 4
  • Tinkerer, programmer, father, founder of RetroPie
    • petrockblock
Re: Power button for retropie
« Reply #19 on: November 01, 2017, 06:55:48 am »
Since many RetroPie users asked us in the forums, we designed the PowerBlock (https://blog.petrockblock.com/powerblock/) exactly for that use case. In the meantime, the installation of the driver has become a one-line command.

@1500points: If you ran into any problems, I would be happy to support you with troubleshooting!

  
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31