Rigging reset and shutdown buttons
-
I'm building a pi zero gaming system and would like to setup buttons reset and power. I've seen plenty of tutorials walking through one or the other, but not how to do both.
If anyone can help, I'd be really grateful
:-)
-
There are several question you should answer yourself?
- How is the system powered?
1.1 via usual USB power cord
1.2 via an external switch like PowerBlock, Mausberry, ATXpi....
Then you can might answer
2. Which Button to use
2.1 Momentary
2.2 Latching- Reset Button (a momentary makes most sense)
3.1 Action just as GPIO input so a software process takes action
3.2 Action as hardware input so acts as real/hard reset for Raspberry
3.3 Action as hardware to act as reset button for an external power device (Powerblock or Mausberry)
So out of this list I recommand following points
1.2 so buy an Mausberry or Powerblock
2.1 I would recommand momentary buttons
3.1 Use as GPIO input, to reset/restart ES or to terminate running emulators or to do a reboot if you press the button longer than 5 seconds or so (this is a software thing)I assembeld this during my last (small) project Yet annother Retroflag NESPi case
I strongly recommend @meleu's wonderful shutdown service!
and this tut made by @Yahmez hereBut you will have to do some steps in programming but don't panic - there are lots of helpfull people here. So feel free to ask if you have questions :)
- How is the system powered?
-
Okidoki here is my answer
- Using a stock 2.5a Rpi PSU
- Momentary for the reset and power (I believe this is consistent with the original megadrive.
- I would prefer the reset to cause a sudo shutdown -r to occur. BUT I would settle for ES terminating back to main menu.
I think I now have the power button in the bag, using a Pimoroni on/off shim.
-
@haemogoblin said in Rigging reset and shutdown buttons:
Pimoroni on/off shim
Yes this looks suitable, too
You connect the power button with the shim to fullfill power on power off actionsThe reset button has to be connected to the GPIO. With a bit programming you can do whatever you want. I think the best thing would be a small piece of software like this
Pseudocode
Hold reset button for 0,5sec and if you release it within 2-2,5 secs than if an Emulator is active then terminate this and go back to ES if ES is active then restart ES (usefull if you want refresh Favourites or custom collections ....) and if you release it __NOT__ within 2-2,5 secs than proper terminate all instances of EMULATORS and ES (important for not loosing metadata) and reboot the Pie
-
Yes that would be perfect, where do i find that code?
-
@Haemogoblin Take a look at this here is a good code example for your purposes
@cyperghost said in Rigging reset and shutdown buttons:But you will have to do some steps in programming but don't panic - there are lots of helpfull people here. So feel free to ask if you have questions :)
-
@haemogoblin said in Rigging reset and shutdown buttons:
I think I now have the power button in the bag, using a Pimoroni on/off shim.
I've written a small tutorial for the OnOff SHIM here
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.