Partecipa alla nostra ROCK SBC Engineering Challenge e vinci una partnership da $ 50.000 con noi - Ulteriori informazioni


Making A Raspberry Pi Joystick

Scroll down

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
cd python-uinput
sudo python 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 it was a simple case of running:

sudo python &


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…


Come quello che leggi? Perché non mostrare il tuo apprezzamento dando un po' d'amore.

Da un tocco veloce a schiacciare quel pulsante dell'amore e mostrare quanto ti è piaciuto questo progetto.


Il nostro sito web utilizza cookie e altre tecnologie simili per fornirti un servizio migliore quando effettui una ricerca o fai un ordine, per finalità analitiche e per personalizzare la nostra pubblicità. Puoi modificare le tue impostazioni per i cookie leggendo la nostra politica sui cookie. In caso contrario, supporremo che accetti il nostro utilizzo dei cookie.


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

Browse the US site