RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Exit roms via GPIO

    Scheduled Pinned Locked Moved Help and Support
    gpio exit roms
    11 Posts 8 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • _
      _DamnIt
      last edited by

      Hi!

      I have a RPi 3+ with RetroPie 4.5. Everything works grate.

      I´m installing it in an old NES-consul. I have made the power button turn on and off the pie, made the LED light work, but now i´m trying to make the reset button exit roms.

      I have googled and checked YT, and searched the forum, but didn´t find anything that really seemed to handle my issue.

      To eliminate any risk of misunderstanding, I´m trying to get the physical reset button on the NES to exit roms.

      Do you guys have any suggestions?
      Thanks!

      mituM cyperghostC markyh444M 3 Replies Last reply Reply Quote 0
      • D
        Dopy25
        last edited by Dopy25

        Seems highly possible and that is a great idea. I am working on a similar project, I even put a hard drive into an old cart.

        You're onto something. I know the gpio pins can be set to listen to specific events. I am not sure if you can write a script to send a keypress upon event, but that may work.

        I will post back if I find anything else. Also following because I would like to do the same.

        EDIT::

        I found this:
        https://www.reddit.com/r/RetroPie/comments/5elv5e/using_original_nes_powerreset_buttons/

        It seems like you would use the script to press your hotkey button combination using GPIO.

        This one is about a custom case (retroflag) but the process would be similar.
        https://www.reddit.com/r/RetroPie/comments/adty12/how_to_bind_reset_button_from_retroflag_case_to/

        1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @_DamnIt
          last edited by

          @_DamnIt You can wire up @cyperghost's shutdown/poweroff script to the GPIO button press, calling the script with the --closeemu argument, this will exit any emulator started from Emulationstation/Runcommand.

          1 Reply Last reply Reply Quote 1
          • cyperghostC
            cyperghost @_DamnIt
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • _
              _DamnIt
              last edited by

              This is super! But unfortunately, I forgot to tell you that I have no idea what I'm doing. First time trying script, and my other programming on this, was done with copy/paste.

              Is there a very clear guide anywhere whit what I should type in?

              Thanks!

              1 Reply Last reply Reply Quote 0
              • V
                vivesladron
                last edited by

                I did it with a Zero Delay USB Encoder changing /opt/retropie/configs/all/retroarch/autoconfig/Microntek USB Joystick.cfg values to set specific functions to each button

                input_device = "Microntek USB Joystick "
                input_driver = "udev"
                input_l_btn = "5"
                input_load_state_btn = "10"
                input_start_btn = "6"
                input_exit_emulator_btn = "8"
                input_down_axis = "+1"
                input_r_btn = "4"
                input_save_state_btn = "11"
                input_right_axis = "+0"
                input_state_slot_increase_axis = "+0"
                input_select_btn = "7"
                input_left_axis = "-0"
                input_state_slot_decrease_axis = "-0"
                input_l2_btn = "9"
                input_up_axis = "-1"
                input_a_btn = "0"
                input_b_btn = "1"
                input_reset_btn = "9"
                input_r2_btn = "8"
                input_x_btn = "2"
                input_menu_toggle_btn = ""
                input_y_btn = "3"

                and deleting the line with:
                input_enable_hotkey_btn =

                I don't know if it's possible via GPIO

                photo_2019-07-31_09-56-13.jpg

                1 Reply Last reply Reply Quote 0
                • E
                  ericbsmith42
                  last edited by ericbsmith42

                  @_DamnIt said in Exit roms via GPIO:

                  in an old NES-consul. I have made the power button turn on and off the pie, made the LED light work, but now i´m trying to make the reset button exit roms.
                  I have googled and checked YT, and searched the forum, but didn´t find anything that really seemed to handle my issue.
                  To eliminate any risk of misunderstanding, I´m trying to get the physical reset

                  My suggestion is that you install crcerror's shutdown script, which supports both a Power and smart Reset button. You will almost certainly need to uninstall whatever shutdown script you previously used.

                  Pressing Reset while an emulator is running will exit the emulator; pressing it in Emulation Station will restart ES. The script is intended for use with RetroFlag cases, however it just uses standard GPIO pin assignments so can be used with any Raspberry Pi. I recently installed the script on my Pi Zero. While I had to do a few tweaks, it works just fine on a Pi. The only downside to using it is that it uses an extra GPIO pin as a feedback pin for the GPI cases to tell them to cut power to the Pi completely (this is a special function of the RetroFlag cases).

                  crcerror's shutdown script uses the following pin assignments which you can attached a standard momentary button for power & reset and a resistor & LED for power lamp.

                  GPIO 2 (Pin 3) for Reset
                  GPIO 3 (Pin 5) for Power
                  GPIO 4 (Pin 7) for Shutdown feedback
                  GPIO 14 (pin 8) for LED control (note, you shouldn't connect an LED directly to a GPIO, best method is to use a resistor to protect the GPIO from damage).
                  ​
                  Those pin assignments can be reassigned by editing the following file:

                  /opt/RetroFlag/SafeShutdown.py

                  _ 1 Reply Last reply Reply Quote 0
                  • _
                    _DamnIt @ericbsmith42
                    last edited by

                    @ericbsmith42 said in Exit roms via GPIO:

                    @_DamnIt said in Exit roms via GPIO:

                    in an old NES-consul. I have made the power button turn on and off the pie, made the LED light work, but now i´m trying to make the reset button exit roms.
                    I have googled and checked YT, and searched the forum, but didn´t find anything that really seemed to handle my issue.
                    To eliminate any risk of misunderstanding, I´m trying to get the physical reset

                    My suggestion is that you install crcerror's shutdown script, which supports both a Power and smart Reset button. You will almost certainly need to uninstall whatever shutdown script you previously used.

                    Pressing Reset while an emulator is running will exit the emulator; pressing it in Emulation Station will restart ES. The script is intended for use with RetroFlag cases, however it just uses standard GPIO pin assignments so can be used with any Raspberry Pi. I recently installed the script on my Pi Zero. While I had to do a few tweaks, it works just fine on a Pi. The only downside to using it is that it uses an extra GPIO pin as a feedback pin for the GPI cases to tell them to cut power to the Pi completely (this is a special function of the RetroFlag cases).

                    crcerror's shutdown script uses the following pin assignments which you can attached a standard momentary button for power & reset and a resistor & LED for power lamp.

                    GPIO 2 (Pin 3) for Reset
                    GPIO 3 (Pin 5) for Power
                    GPIO 4 (Pin 7) for Shutdown feedback
                    GPIO 14 (pin 8) for LED control (note, you shouldn't connect an LED directly to a GPIO, best method is to use a resistor to protect the GPIO from damage).
                    ​
                    Those pin assignments can be reassigned by editing the following file:

                    /opt/RetroFlag/SafeShutdown.py

                    What kind of resistor?

                    Not sure if i could make it work, have absolutly no idea of what i´m doing. Total beginner on this. :)

                    cyperghostC 1 Reply Last reply Reply Quote 0
                    • cyperghostC
                      cyperghost @_DamnIt
                      last edited by

                      @_DamnIt Use http://ledcalc.com/ to calculate resistor value according used LED. There is no need for a 100% hit in resistor value but use one to avoid burn out of LED.

                      The Pi uses 3.3 for GPIO output.
                      Standard USB output is 5.0V

                      1 Reply Last reply Reply Quote 0
                      • markyh444M
                        markyh444 @_DamnIt
                        last edited by

                        @_DamnIt I actually did this with my NES project. If you follow the link in my signature, there's a section on me creating the script and all that jazz. It did work fine, till I re-imaged my Pi with newer Retropie and don't set it back up (I found I hardly used the button to exit games, it meant I had to get up rather than use the wireless controller hotkeys).

                        There's basically 2 scripts, one a python script and another a shell script. You set the shell script to call the python script at boot and it monitors the defined gpio pins for input. Once it gets them, it sends an escape press which exits the game.

                        Retropie in a NES - Pi 3 with Mausberry circuit shutdown switch wired to buttons and 8bitdo NesPro30 controller
                        Retropie in a Saturn Controller - Pi Zero, GPIO controls using DB9 driver
                        Retropie in a PSX - Pi3
                        https://markyh444.wordpress.com

                        1 Reply Last reply Reply Quote 0
                        • CapemanC
                          Capeman
                          last edited by

                          I put an exit game button on Gpio in my atari console build by simply installing Adafruit’s retrogame application on my Pi, which makes the gpio able to take keyboard inputs, then I just set one of the pins to activate the escape key.

                          Vector Artist, Designer and Maker of Stuff: Laser Cut Atari / Pixel Theme Bartop

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          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.