Home » Blog » Microelectronics » The RetroPie GPIO Adapter

The RetroPie GPIO Adapter

UPDATE: The RetroPie GPIO Adapter is replaced by the ControlBlock, which supports more controller types and provides even a power switch functionality. The ControlBlock is has its own page here.

If you want to use your Raspberry Pi for gaming you certainly want to attach some sort of controller(s) to it. Since the Raspberry comes with two USB ports one way would be to simply attach any sort of USB gamepad or joystick via these ports to it. Besides the configuration this approach has the disadvantages that one or both USB ports become occupied and, what I think is even more disturbing, that an active USB hub might become necessary to provide enough energy to the controller(s). Also, if you want to get the real retro feeling you certainly want to use original controllers. The GPIO pins of the Raspberry allow the communication with all sorts of hardware and attaching, for example, SNES controllers can be done in quite a few steps. A user-space program that polls the controller(s) in the background was presented here. In the following I am presenting a dedicated GPIO adapter for the Raspberry Pi that allows an easy and safe connection of up to two NES or SNES controllers.

The RetroPie GPIO adapter

Based on the experiences with a previously presented adapter PCB I designed a new SNES adapter PCB specifically for the use with the Raspberry Pi.


This GPIO adapter aims at

  • an easy and practical installation
  • as well as providing circuitry protection
  • and a button that can be used arbitrarily by software

Update 28.09.2014: Revision 2.0 of the RetroPie GPIO Adapter is released! The functionalities of revision 2.0 are exactly the same as the previous revision. However, the hardware design has changed due to the Raspberry Pi (TM) model B+ design. In contrast to revision 1.X, the new RetroPie GPIO Adapter revision is now mounted horizontally on the RPi. In the following descriptions of the adapter, photos of both revisions will be shown.

An easy and practical installation of the adapter board is achieved by using a 2×13 pins female header for a connection to the GPIO pins and 2×5 pins male header for the connection to, for example, (S)NES controller sockets. The only tinkering needed for a connection to (S)NES connectors is the soldering of the ribbon cable to the connectors. The size of the adapter PCB is only 0.91 in x 1.32 in (23 mm x 33.5 mm). This size does not increase the needed overall volume of the Pi much and allows the usage of most existing cases.

A word to SNES sockets: One way for obtaining these is to use the ones from SNES extension cables. Alternatively, a community member published 3D models of the connectors here.

For a practical application the adapter is provided with a circuitry protection as it was proposed in a thread of the official Raspberry Pi forum. To handle over currents a resettable fuse is put on the supply rail. Possible transients are taken care for by a buffer IC 74HC125. As stated by RPi wiki site about circuitry protection these ICs provide an in-line connection which is buffered via an internal transistor switch to isolate the input from the output.

Four GPIO pins, which would correspond to two data lines, the clock, and the latch in case of (S)NES controllers, are buffered by the adapter.

Revision 1.X of the RetroPie GPIO Adapter
Revision 2.0 of the RetroPie GPIO Adapter
Revision 2.0 of the RetroPie GPIO Adapter

A momentary on push button is also part of the adapter board. The button is also connected to one of the GPIO pins and, thus, the status of the button can be polled with any suitable software. This allows, for example, to add a reset/back button that is needed with a keyboard-less setup and controllers with no redundant buttons like the SNES or NES controllers.

Button on revision 1.X of the RetroPie GPIO Adapter
Button on revision 2.0 of the RetroPie GPIO Adapter

Pin Out

The exact pin out together with the according pins on the SNES connector are listed in the following and shown in the diagram (for revision 1.X of the Raspberry Board):

  • VCC (3.3V): pin 1
  • Ground: pin 6
  • Clock: pin 19 (out)
  • Button: pin 11 (in)
  • Latch: pin 23 (out)
  • Data 1: pin 7 (in)
  • Data 2: pin 5 (in)
Pin out for revision 1.X of the RetroPie GPIO Adapter

Connectors pin out for (S)NES connectors: The (S)NES connectors are soldered to a 10-wire ribbon cable that has a 2×5 pins female ribbon crimp connector at the other end. The pin out together with the according pins on the SNES connector are shown in the diagram:

The pin out of the ribbon cable can be derived from the 2×5 pin header and is as following (shown from the top side):


Here is an image of two SNES connectors soldered to the ten-wire ribbon cable and connected to the adapter board. Note that the 2×5 pin header has to point inwards the Raspberry Pi PCB:

Ribbon cable connected to revision 1.X of the RetroPie GPIO Adapter.
Ribbon cable connected to revision 2.X of the RetroPie GPIO Adapter.
Ribbon cable connected to revision 2.X of the RetroPie GPIO Adapter.

For those of you that are interested in the components details, here are the manufacturer part  numbers:

  • Tri-state buffer: SGS-Thompson Microelectronics M74HC125M1R
  • PTC resettable fuse: ESKA LP60-010
  • Momentary switch: APEM PHAP3305D

Schematics and assembly Guide: You can find the schematics of the RetroPie GPIO Adapter revision 1.X and  assembly guides here.

A comprehensive guide for getting started with the adapter can be found in this post.

Additional GPIOs on revision 1.X: It can also be seen from the schematics that revision 1.1 of the adapter breaks out four additional GPIO pins (GPIO pins 0, 14, 21, 22) together with ground and the 3.3V pin. This provides the possibility to attach additional hardware to the GPIO and use the RetroPie GPIO adapter at the same time. Note, however, that these additional pins do not provide any circuitry protection.

The dimensions of the adapter revision 1.X match the ones of the PetRockBlock PIE case. This means that  both can be combined with each other to build a keyboardless gaming console with the RPi at its center. The RetroPie GPIO Adapter revision 2.X has a different hardware design is not compatible to the PetRockBlock PIE case.


In order to use the RetroPie GPIO adapter a driver is needed that reads the states of the controllers and the button and maps these to the input system of the operating system. This can be done in kernel- or in user-space. The SNESDev software is an example of an user-space application that interfaces with the controllers and the button on the RetroPie GPIO Adapter. It is recommend to use SNESDev as driver for the adapter board.

Adding a jumper between pins 5 and 6 of P1 results in /boot/config.txt being ignored (except for avoid_safe_mode) and a default cmdline.txt is applied, followed by loading kernel_emergency.img. As stated in the official forum

if you connect external hardware to that pin, the worst that will happen is it falsely triggers safe mode.

To avoid this safe mode when the adapter is attached a setting has to be made in /boot/config.txt. This could be done, for example, by opening the config.txt with

sudo nano /boot/config.txt



and saving the changes with “Ctrl-X”, which has to be confirmed with “Y”.

Demo video

A video of the adapter in action can be found in this post.

Installation and Troubleshooting

You can find a complete getting-started guide for the RetroPie GPIO Adapter on this page.

With the SNESDev driver enabled you can test for working connections between the game pads and the RPi with the jstest command (Ctrl+C exits the tool):

jstest /dev/input/js0


jstest /dev/input/js1

will test the first and the second game pad.

If you are using SNESDev for polling the game pads you need to use the option “poll game pads and button” in the menu of the RetroPie Script. If everything ism assembled and set up correctly button presses on the game pads will act as keyboard input and you will see according outputs on the console.

A long press (more than 1 second) on the button will lead to a key press of “r” which, again, can be checked on the console.

Conclusion & Getting it

The RetroPie GPIO adapter allows an easy and practical connection of NES and SNES controllers via the GPIO pins of the Raspberry Pi. The size of the adapter is kept as small as possible and should fit into most existing cases. It contains circuitry protection against over currents and transients. Furthermore, a momentary push button is installed on the adapter that can be used, for example, as a back or reset button. The pin out of the GPIO male header is matched to the already existing gamecon RPi GPIO driver, which can easily be installed and updated with the RetroPie Setup script.

If you are interested in an adapter please have a look here. The RetroPie GPIO Adapter kit also includes a ribbon cable (about 10 cm long) and a ribbon crimp connector.


Check Also

Python module for MCP23S17 for use with the Raspberry Pi

Some time ago I revised the hardware design of the ControlBlock and added test points …


  1. Hello,
    First, many thanks for the great job 🙂

    I assembled my GPIO adapter and configured the drive of my 2 SNES pads and the button with SNESDev.
    Everyting seems to work as expected. The button works perfectly, both of the pads work with jstest and in emulationstation as well.

    My problem is when I launch any emulator, I get the messages saying “Joypad port #1/#2 SNES to gamepad device connected”, but in the games, none of my pads are working.

    I tried to disable the joypad autoconfig and set a fixed configuration in the config of retroarch without any success.

    I use also on my pi a Logitech rumblepad2 which works well (in both fixed/auto config).Is anyone has an idea about this?

    Thanks in advance,

  2. HI, I’ve ordered, received, soldered and configured my PetRock Block GPIO adapter, I’m using it with 2 generic SNES controller socket that I’ve soldered with the adapter as well.

    Everything “works” but it’s very sluggish, almost unusable! The ABXY + R/L + D-pad buttons work with 1/2 second latency, and the Start/Select buttons for some reason I have to hold the button nearly 1 second for it to be activated. I tried it with Super Mario World, and the pause screen wouldn’t come up when Start was pressed normally, I really had to hold the button. It’s very frustrating!

    Now I’ve bought all that stuff because I was told that it was better than regular USB controller or adapter, almost cost me 30$ in total with shipping! I have a PS2 to USB adapter with which I used it with a Logitech Wireless Controller, It was working very well. But I needed a second controller and I had Original SNES controller laying around, so I figured I might put them to use. I really regret buying the Petrock Block GPIO adapter.

    Up to now I’ve tried it with EmulationStation Ver. 1.9.1 & 1.10.1, I will try it with the new one but I doubt it will change anything regarding the slugginess.

    Anyone has a solution ??

    Thanks !

    • What steps did you make for the configuration of SNESDev? Did you install additional controller drivers, e.g. the gamecon one, (bluetooth) PS3, or Xbox 360? The Raspberry Pi is known to behave non-deterministic when certain USB devices are connected.
      I can assure you that the delay does not come from SNESDev, which is the device driver for the RetroPie GPIO Adapter. To test your adapter setup, you could use a fresh SD-card installation and activate SNESDev from within the RetroPie-Setup Script. This step registers the SNES connectors as game pad devices and can be used, e.g., for configuring the input for EmulationStation.

      • I think I was installing too much stuff maybe yeah. I’ll try just installing a fresh copy with the SD image and then just activate the SNESDev and that’s it. Thanks for the tip !

  3. Hi there, great product! I was wondering whether it would be possible to use this GPIO Adapter alongside say a Mausberry shutdown circuit as I would rather the on/off switch soft shutdown the rPi. Thanks, Jacob

    • Hi Jacob, the RetroPie GPIO Adapter also has a pin out for the 5V input as well as for GND and 3.3V output. Thus, you could use a shutdown circuit like the Mausberry one with the GPIO adapter.

  4. Erik Pettersson

    Hi! Thank you for your great effort with this excellent adapter, I’m currently slowly building me a Retro Arcade (will come back with pictures and links later)… However I do have a suggestion to improve the adapter a bit i think. I’m going to fit everything in a small a box as possible, so I’mm going to feed the power through the GPIO port (5v (pin 2) and gnd (pin 6)) instead of USB. I don’t want to use the micro USB port to power the PI because it adds to much to the total length. I will basically solder two extra pins on top of the GPIO connector on your adapter. My suggestion is that you just change the PCB so there are two extra holes to solder pins for a alternative power source to be plugged in to. 🙂

  5. Hi, I wonder if you can offer me any advice with the issue I’m having, or direct me to where I could find some help. I have put a raspberry pi into an old NES and I am having some trouble getting both controllers to work, here is where I’m at so far:
    I have a 512MB revision B raspberry pi. I used the latest retropie img for my installation. Enabled SNESDev to poll just for the pads. Wired up the control ports to the GPIO as per instructions you’ve provided elsewhere, with data1 on pin 7 and data2 on pin 5. However only the player one controller seems to work. I can do a jstest for js1 and everything works fine, but I simply get no response on js0 (this is a little strange because I thought js0 was player1, but it appears to be the other way around).
    Things I have eliminated as an issue:
    It’s not the controller itself, they both work if I try them in the first control port.
    I don’t think it’s my wiring, I tested it all with a multimeter and if I swap the data 1 and 2 wires then control port 2 works flawlessly instead (as js1), suggesting that all my voltage, clock, latch, ground and data wires are all fine.
    It almost seems as if the pin itself (pin5) is not working properly, but I don’t know if that’s possible or how I would test it.
    Please let me know if there is any other information I can provide to help shed light on this, or if I should be asking elsewhere. I am a real novice with this stuff, but I have managed to get everything working so far, I just can’t get player 2 controls to work, otherwise I am able to navigate the menu, and play nes games with the player 1 controller just fine.
    One other thing, there appears to be some input lag, is this normal? I had originally tried to get the gamecon driver working instead because it should be faster, but no matter what I tried it kept giving me errors that my kernel needed to be updated or something like that.

    • Take care that SNESDev and the game con driver is not running at the same time, because both do interfere with each other.

      • How do I ensure that the gamecon driver is not running? I never elected to install it in the setup, is it running by default?

      • You can install the gamecon driver with the RetroPie Setup Script. If you did not use the RetroPie Setup Script to explicitly enable the gamecon driver then you most probably do not have it installed.

        You can try and install the latest version of SNESDev via the RetroPie Setup Script via the source-based installation. Make sure that you only select SNESDev there.

      • Hmm, I did try installing the latest SNESDev but I’m getting a failure to compile error upon completion. It says see debug log for info but there’s nothing useful I can see there accept a line about ‘/home/pi/RetroPie/supplementary/SNESDev-Rpi/bin/SNESDev’ not existing. No idea why that would be a problem, creating that directory doesn’t seem to fix it.
        There’s a couple of things I’m unclear on. Is jstest used for SNESDev or Gamecon? The description in the article above implies that it is for gamecon, which suggests that I do have gamecon enabled even though I never told it to install. However I lose the jstest function if I disable SNESDev, which would imply that they go together. Additionally, even though I managed to get one control pad working, pressing it’s buttons doesn’t result in keyboard strokes in the console, and unless I’m mistaken that should happen if I’m using snesdev. Lastly, I’m not sure why the controller with it’s data connection on pin 7 detects as js1, because I thought pin 7 was for js0 and pin 5 for js1.
        Can you confirm for me the current pin configuration for SNESDev and gamecon? Are they the same? I have found some articles suggesting they are the same and some suggesting they are different.
        Basically the way I ended up getting the control pad to work was by running Jstest, taking note of what numbers each button was associated with and then modifying the input lines in retroarch.cfg to match this. I dunno if any of that is informative.
        I appreciate your attempts to help me.

      • The gamecon driver and SNESDev must not run at the same time.

        Maybe you get some other ideas at for a solution at http://blog.petrockblock.com/forums/forum/retropie-project-forum/emulators/

      • I just wanted to thank you for this post. You just saved my day. I was having similar issues where I could not get any of my controllers to respond. I was using the SNESDev driver, and was expecting a button press on the controller to type a number to the console. Using jstest (and realizing the js1 is player 1 and js0 is player 2…), it showed that the buttons were getting pressed. I will follow a similar approach to yours and just use those numbers in the retroarch.cfg file. Not sure why jstest picks up the button presses, but it doesn’t write anything to the console. I thought that SNESDev was basically a virtual keyboard…

      • SNESDev registers as two joysticks in Raspbian. Because of this you can use jstest to poll the two game pads and see the status of the buttons. Because they are handled as joysticks SNESDev will not lead to key presses when the joystick buttons are pressed. However, the button that is part of the RetroPie GPIO Adapter leads to a simulated key press by SNESDev. I hope this clears things up a little bit.

      • Ok, that’s great to know, so this is normal behaviour it would seem. My problem is that I can’t get js0 to respond. Are you using the gpio adapter or did you just wire your control ports directly to the gpio?

        Also which version of the raspberry pi do you have?

  6. hello

    question, what is the button # for the reset/back button connected to pin 11 (in) and Ground: pin 6

    I want to configure RetroPie/configs/snes/retroarch.cfg
    input_exit_emulator_btn = “bt#”


    • SNESDev simulates the press of the ESC key – so it is not a joystick button!

      The setting in RetroArch that is responsible for exiting the emulators by a key is

      input_exit_emulator = “escape”

      This configuration comes per default with the RetroPie Setup Script.

      If you want to use a gamepad button for exiting the emulators then you need to enable the “hotkey” functionality within retroarch.cfg.

  7. Hi, I recently received the adapter board, thank you very much! I just have a quick question however, would it introduce any issues if I used a longer ribbon cable, crosstalk, signal degredation etc..?

  8. Hello – I’m having a slight issue that has been driving me mad and was hoping someone here could kindly point me in the right direction.

    I have RetroPie running on my RPi, the only emulator I have installed is NES. I have ROMs loaded and the function fine with the keyboard. I recently purchased the RetroPie GPIO Adapter, wired it up and attached it to my Pi. I enabled SNESDev with the SetupScript. I launch EmulationStation which prompts me to configure joysticks. Both controllers function perfectly and register. I then run the retroarch-joyconfig scrip and receive errors about pre-pressed buttons, however it allows me to map the ones I need for NES. I manually edit the cfg file to add joypad1 for player2. When I run a game all buttons on player2 function fine, and all buttons except the ‘B’ button on player one work fine. I first figured it was a bad controller, but I swapped it with a working one an the ‘B’ button fails.

    Has anyone run into an issue like this before? Please let me know if you need any further information.

    • Does this also happen with emulators other than NES?

      Also, some ROMs have problems with two controllers (see, e.g., https://github.com/retropie/RetroPie-Setup/issues/158). Unfortunately, there is no overview about this topic so far.

      Do you have NES or SNES controllers connected to the GPIO adapter? In its current version SNESDev follows the protocol for SNES controllers. SNES and NES controllers are very similar in their protocol so that SNESDev might also work with NES controllers out-of-the-box. However, I did not test this yet and it could be that I would have to update SNESDev for that (which would not be so much work).

      • Thanks for the quick response!

        I’ve only tried it with the NES emulator so far.

        I’ve tried many different ROMs, all with the same issue.

        I’m using NES controllers connected to the GPIO. Trying to keep the project as retro as possible.

      • The emulators need to be configured separately from Emulation Station, e.g., in /home/pi/RetroPIe/configs/all/retroarch.cfg.

      • Also what is odd is that the controllers and all the buttons are detected perfectly with EmulationStation, but not with RetroPie.

  9. I got my controllers working with SNESdev using your RetroPie image, but the button does not seem to do anything. Can you point me in the right direction for either configuring the button for exiting the emulator and shutdown or configuring a multi-input button sequence for the same purpose?

  10. I tried the multitap-support yesterday, it´s not working 🙁

  11. Ich bin auch mal so frei und poste auf deutsch 😉

    Ich verfolge das Projekt hier schon einige Zeit, und habe jetzt für mein Pi den gpio adapter bestellt (danke für die nette Bestätigungsmail =) ).

    Einsatzzweck: wird direkt an die Controlleranschlüsse eines alten, defekten SNES gelötet, welches als Case für das Pi fungieren wird (entsprechende Stromanschlüsse für USB & LED sind schon verlegt). Ein paar Bilder kann ich bei Interesse gern hochladen.

    Lange Rede, kurzer Sinn: vielen Dank für all die Mühen, die du dir hier mit dem Blog etc. machst, es ist einfach sehr inspirierend!

    • Thanks a lot! And thank you for your order, which directly supports this blog 🙂

      Your project sounds very interesting and I am sure that quite a few people would be interested in pictures in the forum.

      • I will post some Pics on sunday =)
        Just one Question: does the gpio-adapter support Multitap?

      • I have not tried to attach a Multitap yet. I am not sure, but I think that the Multitap needs all pins of the SNES connectors. The RetroPie GPIO does not provide a corresponding pin for each of the connectors pins, but only uses “clock”, “latch”, “GND”, “VCC”, and “data” (see also RetroPie GPIO Adapter Schematics). However, the adapter provides additional break outs of GPIO pins, which could also be used. The software side (the gamecon driver and SNESDev) would probably also needed to be modified.

      • thx for your response =) I think the best way to find out: i will triy it as soon as the adapter is connected to the snes-pins, maybe tomorrow.

  12. So am I able to connect 2 snes controllers directly to the GPIO pins? Such as hard wiring both controller’s clocks to GPIO pin18, and so on with the rest?

    • Yes, it is possible. The GPIO adapter “just” provides protection circuitry against current and voltage transients. So you need to take care for that, if you directly connect the SNES controllers to the GPIO pins. The adapter also makes the connection with the SNES controllers easier by using a 2×5 pins connector as interface to the SNES connectors.

  13. Ich bin mal so frei meine Frage auf Deutsch zu formulieren :)hallo ich habe folgendes Problem:
    ich habe mir den Adapter zum selber basteln gekauft alles zusammengelötet und eigentlich keine Probleme gehabt. ich habe den Adapter an meinen pi angeschlossen und testbutten laufen lassen testbutton zeigt mir immer wenn ich auf den angelöteten Knopf drücke an Pressed aber nicht, wenn ich einen Knopf auf dem Pad drücke. Nun habe ich meinen SNES controller angeschlossen (auch beim Adapter keine Probleme gehabt alles sieht so aus wie auf den Bildern. Dann habe ich alles wie in der Anleitung installiert. Ich habe einmal den Einstellungsbildschirm für den Controller angezeigt bekommen leider hatte das drücken von tasten keinen einfluss und ich habe alles auf die Tastatur gelegt. Ich habe die emulationstation geschlossen. Dann habe ich probiert, ob jstest meinen Controller erkennt. Manchmal blinkt kurz on auf oder die Achsen zeigen komische werte an. Ich bin ratlos viellicht ist mir doch beim löten ein fataler Fehler unterlaufen… dann würde ich mir noch mal einen fertigen Adapter kaufen, wenn die wieder vorhanden sind. Aber vielleicht habe ich ja auch etwas vergessen ich hoffe du kannst mir helfen.

    • testbutton prüft tatsächlich “nur” den einen Knopf an dem GPIO-Adapter. Die Funktionsweise der angesteckten SNES-Controller kannst Du mit jstest /dev/input/js0 (bzw. js1) kontrollieren. Wenn alles richtig gelötet wurde, kann man mit jstest sämtliche Knopfdrücke nachvollziehen. Deiner Beschreibung nach Schätze ich, dass irgendwo noch ein Hardwareproblem vorliegt.

      • danke für die schnelle Antwort. kann ich davon ausgehen, dass der gpio Adapter funktioniert durch die Tatsache, dass testButton einen Anschlag verzeichnet? dann werde ich mich auf die suche nach einem snes machen und meinen Controller kontrollieren vielleicht ist dieser beschädigt. Falls der Testbutton Anschlag kein Zeichen für einen funktionierenden Adapter ist gibt es eine Möglichkeit um nachzuvollziehen ob der Adapter funktioniert (mit einem Spannungsmesser o.Ä.)? außerdem werde ich noch einmal die Verbindung zwischen dem kabel und dem snes Adapter prüfen. Dort hatte ich Probleme, da das Plastik sehr schnell geschmolzen ist.

      • Besides testing the button circuitry with the testbutton program provided with SNESDev you would also need to ensure that the pins data1 and data2, clock, and latch are working fine. You can use a multimeter for that. Note that due to the tri-state buffer you need to consider polarity (see also the schematics of the GPIO adapter above).

  14. Is it possible to just direct wire the 2 SNES Connectors to the Raspberry, or is the Adapter needed? I am bored right now, and would like to play with SNES Controllers.

  15. This is a good project. I recently bought a GPIO adaptor (pre-assembled), and installed all the software from the RetroPie-Setup script. And for the life of me, I can’t seem to get anything working from the controller. I can’t even get the jstest to work.
    I have a Rev 1 RPi, and have set the memory split to 128. What am I doing wrong? I have double and triple checked the pinouts, and all is as it ‘should’ be.
    What am I missing?

    • Did you install the gamecon driver and/or SNESDev?
      Did you try to poll the button state via the testButton program in the supplementary folder of SNESDev?
      Do you have the possibility to test the connection between the game pad and the RPi with a breadboard (without the GPIO adapter on between)?

      • Thanks for the reply Florian. I recompiled the source, and it seemed to work. Since then, I used the testButton program (sorry, didn’t see it before), and all is fine. Now I get a heap of warnings (cuts out of the game to command, and then back again) which says: RetroArch [WARN] :: [GL]: Stock GLSL shaders will be used.
        But the GPIO works fine! thanks!

    • hey andy, im interested in getting the pre-assebled GPIO adapter, where can i get one?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

We use Cookies and similar technology to collect and analyse information about the users of this website. We use this information to enhance the content, advertising and other services available on the site. Please click ‘Accept cookies’ to consent to the use of this technology by petrockblock. You can manage your preferences at any time by visiting our Cookies Policy page.