Who doesn’t love a good old fashioned arcade game? Seriously, there’s something about those 80’s titles that just draws you in. Imagine our delight, then, when we got MAME going on our Raspberry Pi. But, for the full-fat retro gaming experience, we really, really wanted to hook up a joystick.

Now back in the day, we had ourselves a state of the art Competition Pro 5000 – joystick heaven – which we foolishly sold along with our Amiga stuff. So after ransacking eBay we eventually picked one up in its original box:


The circuit

The first step was to hook this beauty up to the RPi general purpose input output (GPIO).

We used a breadboard with our homebrew Pi Cobbler at one end and a similar connector at the other wired up to an old PC serial card cable that had the right (male) DB9 connector for the joystick plug (female).

Then it was just a matter of adding some pull up resistors (10K) and some patch cables:



Setting up the input

We hate to admit it, but at this point we realised we’d entered a blind alley.

Having already seen gpio-keys we reckoned we’d be using that, but when it came to the crunch we just didn’t have a clue where to start. We probably needed a package of RPi kernel source. Anyway, we told ourselves we probably really wanted gpio-mouse anyway.

After some digging around the Raspberry Pi Forums we stumbled upon a comment about using Python to generate keystrokes. This was the pointer we needed, and we headed in the direction of Python uinput (a module that can create keypresses)…

sudo modprobe uinput
git clone https://github.com/tuomasjjrasanen/python-uinput
cd python-uinput
sudo python setup.py install –prefix=/usr/local

Wrapping it up

Sensing victory, we knocked together some code that turns GPIO into keypresses. But sadly it seems that AdvMAME derives its input in a way that completely ignores uinput for keyboard. Doh! Back to the drawing board…

But not to be put off our gaming nirvana, we kept digging around the examples for Python-uinput until we found one for…YES! joystick

With a racing pulse, we attempted the task of creating a GPIO connected variant, and with that saved as rpi-gpio-jstk.py it was a simple case of running:

sudo python rpi-gpio-jstk.py &


We tested it using advj, and it showed input. And when we fired up AdvMAME the joystick worked – HALLELUJA!

We’re now the proud owners of a fully working vintage joystick for our classic games. Truth be told, we’re not entirely happy with the Python based approach (particularly as it uses polling) but we’ve seen nastier hacks. We’d love to get a proper kernel module working, especially if it can use interrupts rather polling. And we should probably also check out internal pullups so we can simplify the wiring for when we make a more permanent (dual?) joystick adaptor.

But these are carping criticisms. We have a joystick. And we’re not afraid to use it. Let the action commence…


Like what you read? Why not show your appreciation by giving some love.

From a quick tap to smashing that love button and show how much you enjoyed this project.


Onze website maakt gebruik van cookies en vergelijkbare technologieën om u een betere service te bieden bij het zoeken naar of plaatsen van een bestelling, voor analytische doeleinden en om onze advertenties te personaliseren. U kunt aan de hand van ons cookiebeleid uw cookie-instellingen wijzigen. Indien u geen wijzigingen aanbrengt, nemen we aan dat u akkoord gaat met ons gebruik van cookies.


Please select an option to see content specific to your location and shop online.

Browse the US site