I decided to build a retro games controller based on something I saw on the internet. There are lots of discussions and videos and howtos, but to be honest I’ve never been particularly good at following instructions so I just bought a kit from arcade world (the two-player xin-mo board one – here’s a link) and had a go at bodging it together.
It came with some instructions. Here’s a picture of the instructions, along with a pound coin for scale. I did read these instructions. Then I googled, to find slightly more detailed instructions. Then I went “fuck it” and just got on with the job.
Prototype #1 had 6 buttons per player (with select and start, too). It was based on a plank we found in our garage when we moved in.
The buttons look pretty cool when they’re attached. Nice bright colours. Tidy.
Then I wired it up. The kit came with “easy” clip-together wires which had a jumper at the board end and a metal clip at the microswitch end. I can tell you now that it is remarkably easy to wire a joystick up incorrectly – upside-down is my most common error.
However, this wiring and board had a lot of good properties for a prototype.
- If I plugged it in to my laptop (running linux, of course), and ran jstest on /dev/js0, and pressed the buttons, they all sent some kind of signal
- If I plugged it into a Raspberry Pi running Retropie it identified as a controller
- Plugged into the laptop it could control, badly, a driving game. Accelerate and reverse were unintuitive, but left and right worked
- The joysticks might have been upside down but they felt really cool to play
There were also a couple of negative aspects, though.
- I couldn’t get retropie to calibrate the thing as it was expecting more buttons on a xin-mo (I thought)
- The left and the right joystick both controlled the same character so 2-player didn’t really work
- The left and right controls were too close together anyway for comfortable play
So I removed the components from the board, smashed it up with a hammer, and put it in the woodpile. Time for a new plank and a new start with a little more understanding. Not too much understanding though. There were a couple of big mistakes left to go.
Removing the components from the board is non-trivial as the metal clip on attachments don’t come off easily – indeed, once they’ve clipped on they’re not supposed to come off at all. So a small screwdriver and a bit of leverage was required every time I wanted to change the wiring. For example, to remove the components from the old board, and then to make sure the joysticks were wired the right way up. Again. Prizing the connectors open was fiddly and slippery and generally not straightforward.
Of course having bent the metal clip open they then started falling off all over the place during testing. So then I had to squeeze them all shut again so that I wasn’t debugging software and hardware at the same time.
Anyway I got it all together on the new board with each button attached to the xin-mo interface on the right pin (eventually). Tested it on the laptop – worked OK. Tested it on the retropie set up and I could navigate menus, select stuff, and even start a game. There is a modification you have to make to some config files to get the controller to identify two joysticks, so I did have to edit some stuff (instructions here: on the retropie site). Getting closer.
Still one big problem though. Some of the buttons were behaving really strangely. Back to jstest to see what’s what…
What jstest gives you is a big table of inputs and when you touch the controls, it shows you what’s coming in for each input. The snippet below shows me moving the joystick (Axes up and down), and pressing button 0, 1, 2, and 3 in turn.
Axes: 0: 0 1:-32767 Buttons: 0:on 1:off 2:on 3:off ... Axes: 0: 0 1: 0 Buttons: 0:on 1:off 2:on 3:off ... Axes: 0: 0 1: 32767 Buttons: 0:on 1:off 2:on 3:off ... Axes: 0: 0 1: 0 Buttons: 0:off 1:off 2:on 3:off ... Axes: 0: 0 1: 0 Buttons: 0:on 1:on 2:on 3:off ... Axes: 0: 0 1: 0 Buttons: 0:on 1:off 2:off 3:off ... Axes: 0: 0 1: 0 Buttons: 0:on 1:off 2:on 3:on ...
Now the more observant reader will notice that some of these switches default to on, and others default to off. Whoops. Turns out that microswitches have three prongs to attach wires to and it actually matters which ones you choose. Who knew? On the side of the switch, top prong good, bottom prong bad.
Finally there were a couple of buttons which didn’t have leads (maybe I lost a piece of wire? or maybe they were spare buttons?). I soldered those in with a spare cable I stole from Tom of Sam and Tom industries. Doesn’t everyone do their soldering on the cooker?
Finally tested, I put a base plank on so that you can have the controller on your lap on the sofa as well as on a surface. This is the finished product:
And this is Sonic the Hedgehog II on my nice big telly.