Subscribe via RSS

Creating your own MAME Arcade Controllers

Right, now for something completely different... The following article goes out to all those 80s kids who remember that familiar clicking sound of real mechanical microswitches. We all spent our pocketmoney on Bubble Bobble, Snow Bros, Rampage, Street Fighter; but now you don't have to. Just install MAME and build the following controllers...

Here's the photo album of the construction of the controllers...

Note, before starting this, you should really just skip the keyboard hacking and buy one of these.
Also, for a LOT of information on doing this, visit Arcade Controls.

Initial thinking...

All peripherals for a computer need to connect via an I/O port. Although there are quite a few available on most modern machines, the one we will use is USB. I've chosen this port because they will be around for decades and the old style Serial, LPT and Gameports have pretty much already been phased out.

Now, there are many options once we choose USB:

From the above, the cheapest method is to rip open a keyboard. Officeworks here in Australia was selling the Microsoft Wired Keyboard 600 for AUD$11.97 and I couldn't resist.

MS USB Keyboard MS USB Keyboard

One big question here was cabling. Once I'd hacked a keyboard apart and wired up one controller.. would I then use other keys from that first keyboard and run a cable to the second controller? I looked at the price of data cabling and realised it was cheaper to buy another USB keyboard than it was to rig up a sophisticated central box that both controllers ran to.

I therefore bought 2 USB keyboards.

Now, there is an issue here... I will be 'emulating' keyboard buttons presses when the joystick buttons are pressed. Since once computer can accept multiple different keypresses at once, this will work, but it cannot distinguish multiple presses of the same letter/key from different keyboards (i.e. if the 'A' key is pressed from two different devices.) This means that the second controller will have to be mapped to a different set of keys... pretty obvious, yes?

Update/Note that buttons 5 and 6 for Player 2 aren't set by default... I've set these to I and K as they were free... for some reasons I didn't check Player 3 and 4 controls first and this is a direct conflict with Player 3 directional keys! So, you can use the below but be careful... in my this blog post I've remapped them to U and O respectively.

Button Keymapping 1 Pins Keymapping 2 Pins
Joy UP UP 12, 24 R 11, 22
Joy LEFT LEFT 12, 26 D 16, 21
Joy DOWN DOWN 4, 26 F 11, 21
Joy RIGHT RIGHT 8, 26 G 11, 24
Button 1 L-CTRL 13, 25 A 18, 21
Button 2 L-ALT 9, 24 S 17, 24
Button 3 SPACE 1, 26 Q 18, 22
Button 4 L-SHIFT 10, 23 W 17, 23
Button 5 Z 18, 20 I 6, 22
Button 6 X 17, 20 K 6, 21
Player Button 1 18, 19 2 17, 19
Insert Coin 5 11, 25 6 7, 25

Hardware

So, from the above, you'll need 2 USB keyboards for the PC interface. You'll then need the actual arcade joysticks and controls. Below is the kit I found recently on eBay for around AUD$50. I'm sure you could get it cheaper; my purchase was on a very large impulse and I had a few regrets afterwards as there were better joysticks on offer for the same price.

Arcade Controller Kit Player 1 and Player 2 Joysticks!

The buttons themselves are exactly what you'd find in real arcade machines... the microswitches make their motion feel perfect as well.

Arcade Button Arcade Button + Microswitch

So, with all the components, it's now time to get it connected together. Start by ripping open the keyboard...

Decoding a USB Keyboard

Keyboards are built on a matrix. Just like the LED project previously with the Arduino, each button on a keyboard is connected to one row and one column of the circuit board inside. The circuit board will scan each row and column hundreds of times a second to check which buttons are pressed and then report this back to the computer.

Dismantling MS USB Keyboard Opened USB Keyboard Button layering
Controller + Keyboard Matrix Splitting Matrix

As you can see above, the controller inside the keyboard is not soldered to the matrix. This is great news as I was expecting to have had to solder to fiddly little wires instead of the nice connection pads that you can see.

Firstly I pulled out the multimeter and started decoding the keys I'd need to use. To do this I put one probe on the pad circle of the key and I then ran the other probe across the connection to see which wire it connected to... I then recorded all of my findings:

Multimeter Deciphered key codes

The data I gathered is in the table above. Each key has two pins and these map from left to right on the controller connection seen above. I have only decoded the keys that I need, but it's easy enough to work out the rest when you have an opened keyboard in front of you.

I then began to wire up the controllers. One the first attempt, I thought I would solder short wires to the controller and then use these for connection points. This worked OK until I was up to the final wires. It seems that constant moving around of the controller puts pressure on the soldered joints and I ripped many of the tracks off. I then had to get my tiny copper wire and re-solder the tracks as the pads were gone. This became quite tedious, but I learnt my lesson very quickly.

Soldering to controller Broke a track... Copper to the rescue Player 1 controller wired

I got enough of the wires connected for the first joystick and then quickly connected it to test. I then managed to play a quick game of Bubble Bobble. Impressive! You can see below my initial prototype housing for the controls. The washing basket was the worst idea on earth... but it was a cheap mistake.

Mounted on cardboard for test Failed washing basket prototype Playing Bubble Bobble

Building real housing

I ended up at Bunnings looking for ideas for a box to house the controls. There was nothing off-the-shelf, so I opted for enough wood to make a deep enough box for the controls. This was a pretty simple and ugly construction... but it did the job.

Construction of actual housing Marking out control spacing Construction of actual housing
Building Player 2 Power drill + Hole saw So much quicker than manual drill
Wiring up the controls Completely wired up Player 1 controller ready

Finished products

After testing, I put backing panels on both of the controllers.

Controller done Player 2 finished

Each controller can only ever be used as Player 1 and Player 2 respectively as they are mapped to specific keys on the keyboard. Of course, you could change the configuration of MAME, but that would be tedious... Although sometimes on games it'd be nice to be able to play as one of the other 2 players (3 or 4) ... but I'll create two more controllers for that.

Future plans

I want to build two more of these... 'The Simpsons' arcade and 'Teenage Mutant Ninja Turtles' require 4 players for the most amount of fun, and 'Rampage' needs all three creatures bashing up buildings.

avatar

About stevenh

Trains… trains… trains… + Electronics + Japan.

Comments (13) Trackbacks (0)
  1. Hey, hope you’re not bothered that I’m still reading your blog. :) Your set-up looks great! (As does your choice of games, TMNT ftw.) My girlfriend and I made one of these a while back. We used one PS/2 keyboard controller and two USB games controllers. A bit more expensive, though cheap USB game controllers (leaf joystick etc) are about $5 to $10, so it wasn’t so bad. I was thinking at the time that by hooking the arcade stick and buttons to a game controller we could then use it to play all sorts of games which didn’t support keyboard remapping. Of course, we actually just played MAME all the time, so that consideration was ultimately irrelevant and we could have just used a keyboard.

    • Nicholas,

      No problem at all :) I was considering my options for actual PC interface, but couldn’t go past the flexibility of a keyboard. I understand using a gamepad for other games, but I don’t think I’ve ever played a game on the PC that needs a gamepad? I also couldn’t use PS2 as my Zotac HD-ID11 only has USB.

      The blog-reading goes both ways too… except low-level mobile phone hacking is well over my head. My next trick (between building the Arduino model railway) will be to disassemble “Gadget – Past as Future” and add it to an emulator, such as ScummVM.

  2. Just made my mame controller and it works great! It takes time to map out the keyboard matrix using the multimeter, but its worth it! good cheap way to interface the controls to the computer. i used a cheap keyboard i got for free and a controller i got at goodwill for 5 dollars. the controller has happ like buttons and a joystick that uses the micro switches just like the mame buttons and stick, plus its in a nice metal housing. Sometimes you get lucky at goodwills and thrift stores and find good cheap stuff like that. If your interested, ill send a pic of it. do you do any other electronic projects??

    carey

    • Carey,

      Nice work, glad you found motivation to do your project from this article.
      Please do email me pictures! Would be happy to post them here.

      I do love the second-hand shopping too… if it’s not random op-shops here in Australia, then it’s the electronic/model-railway second-hand stores in Japan. So much treasure to uncover!

      Steven.

  3. ok ill send u pics as soon as i can. :)

  4. The edge of the keyboard logic board SURE looks a lot like a PCI card. Do you think a PCI socket, suitably sawed to allow clearance, would help with the soldering?

  5. Hi, I really admire your work. I tried to made one by myself, but I can’t get the tin to glue on the pins. I removed the black layer over the pins with sandpaper. Then I cleaned electric contacts with a nail cleaner. The contacts are now clean, but it seems there is no way to get the tin stay on them. Have you got some suggestions? What am I doing wrong?

    • AnSin,

      This method requires heat… and fortunately electronics nowadays can handle it.
      Your best bet is to use the soldering iron, when at full heat, to thoroughly remove the coating from the contacts you are trying to solder.
      Wait for the iron to heat up and then gently scratch away at the contact… apply a small amount of solder to the tip, but also to the spot right between the contact and the soldering iron.
      It’ll take a short amount of time (up to five seconds) but it should eventually meld with the contact.

      Also, if you’ve used any chemicals to clean the contacts, then get some paper towel (with no liquids) and clean the areas prior.

      Steven.

      • Thank you for your reply. I’ll try to follow your suggestions. In this period I’m a little busy, but I hope that in the future (maybe Christmas holydays) I will have the time to build a project like yours, that is a very simple and clever way to build controllers and customized keyboards.
        Have you ever tried the conductive glue (“soldering glue”). Do you think it could be useful or a good alternative to the good’n’old soldering method (with this specific case)?

        Thank you.

        Cheers

  6. Hi, I’ve got another couple of questions for you. I’ve seen your photo album. According to your experience, which are the best buttons & stick? Concave or convex buttons? In image 75 you show all four arcade joystick you’ve built. Is the black control (the one wih shaped like a drop) better than the green (or pink) one? Is it only a matter of shape or there are relevant technical differences beetween the two?

    Thank you
    Have a good day
    AnSin

    • AnSin,

      There’s quite a bit of difference between the joysticks in both styles of controllers. The pink/green joysticks are much ‘looser’ (i.e. you can get to the diagonal positions much easier) and are easier to hold if you like having your grip from underneath the knob. Actually, it could depend on how you hold a wine glass :) … do you hold it with your hand upside-down and the stem between two of your fingers? If so then I recommend the pink/green style.

      The black joysticks are much stiffer and an older style. They go up/down/left/right more than diagonal and they are much ‘clickier’ (noisier!) and I like this. They’re better if you are used to using a joystick like a mouse where you hand will be on top.

      As for the buttons, the buttons with the black joysticks are deeper and easier to press as they are dimpled. They are also ‘clickier’. The buttons with the pink/green are softer and shorter, so you could have a shallower box to build it all in to, but they also are slipperier as they are, as you’ve stated, convex.

      I’d recommend going to an arcade (if any still exist around you?) and checking out the different styles.
      They’re all then available on eBay for sale.

      Good luck! Steven.

      • Thank you, Steven. I love mechanical keyboards (Cherry MX Blue etc…), so probably the black joysticks and the concave buttons are closer to my taste.

        PS: For my soldering problem… no way… The f****g solder doesn’t stick… maybe the
        contacts of my controller are made of teflon :) I’ll try with another controller… This time I’ll use a microsoft keyboard.

        Thanks for your clear answer!
        Bye
        AnSin (Frank)


Leave a comment


*

No trackbacks yet.