Oct 10, 2012

RasPiSNES - Design

On the build of the RasPiSNES, some design decisions were made considering the needed connections, and based on the projects incorporated here, namely gamecon_gpio_rpi.

To drive the controllers, the flat cable that was connected to the original SNES board was used, keeping the front plate almost intact. The bonus in using this connection was to get the SNES power led acting as it should.

To show those connections, below are the representation of the RPi header, at left, and the flat cable that came from the front panel, at right, to which the gamepads are connected.

Control Pad connections

For the hotkeys, I was considering the use of an old usb keyboard, but it would kill a good usb port, and to keep it simple I discarded the possibility of an usb hub. Luckily, as only four GPIO pins were used for the two gamepad ports, thirteen remained free!

As the RPi allows for very easy GPIO access with C, C#, python and even shell, among other languages, lets put these pins to work. It is always good to use some spare parts we have as result of some years of collecting junk electronics work, so I took some push-buttons for the essencial operations needed: to pause and manage savegames.
The default operations until this point were based on these keyboard keys:
  • Escape: Exit the retroarch emulator and get back to emulationstation.
    • Map to EJECT on console.
  • H: Reset the current the retroarch emulated console.
    • Map to RESET on console.
  • F2, F4: Save and load games.
    • Map to SAVE, LOAD on the hotkeypad.
  • F6, F7: Change the current.
    • Map to SLOT-, SLOT+ on the hotkeypad.
  • P: Pause games.
    • Map to PAUSE on the hotkeypad.
 Note: I had to remap key F4 to F3 for game load in retroarch.cfg, so if this button got pressed while in emulationstation, it does not quit to the shell. This is quite easy:
#in file
#added line
input_load_state = f3
These hotkeys are located as hidden as possible at first sight, on the back of the console, and their connections go as this:

Power and Hotkeys

To protect the RPi from some misconnection, I have added a bunch of 10kΩ resistors inline with the pushbuttons. The python script that drive the keys make use of the internal 60k pull-ups, so these were not needed externally.
To make the keys work, the script must be running as user root. As the RetroPie script can make the emulator start on boot, it is only a matter to find where it calls the emulator and start it before:
# in file
# insert this line..
sudo python /home/pi/rpi-gpio-SNES-commands.py &
# ... before the call to the emulator
The remaining cables (USB, Audio, LAN, Composite) are only passive connections, so no interface is internal, and all ports remain accessible (including one self-made extension for the SD slot).


  1. Hi,

    I came across your site while searching google on how to do exactly what you did with your reset button. I can't seem to get it to work with the directions I have found in the various files. I was wondering if you would be so kind as to provide me/us with the exact syntax for getting the GPIO pin to output "h" so it can be read and used as the reset button.

    Thank you!

  2. Hi AirBurn,

    In the python script link above, you can find the needed mappings:
    # Pin Number - Using mode GPIO.BOARD)
    pin_h = 11
    # Enable as input and pull_up resistor)
    GPIO.setup(pin_h, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    # Register the triggered event as user input for key H)
    events = (..., uinput.KEY_H, ...)
    # Inside the main loop, look for button press and release
    if (not key_h) and (not GPIO.input(pin_h)): # H button pressed
    key_h = True
    device.emit(uinput.KEY_H, 1)
    if key_h and GPIO.input(pin_h): # H button released
    key_h = False
    device.emit(uinput.KEY_H, 0)

    If you need more help, feel free to send me your script by e-mail,



Share your thoughts about this workpiece