Thursday, October 6, 2016

Arcade Machine

My latest project is to build an arcade machine, well, more accurately an arcade emulator.




The whole rig is built around a Raspberry pi (rpi), which I conveniently had lying around. This is actually a first generation board, but with some minor tweaking worked quite well.

I started off with the latest Raspbian build, the official Debian based OS. Next I installed the most excellent arcade emulator, MAME, Multiple Arcade Machine Emulator.

The rpi has 15 available general purpose input output (GPIO) lines, which can be used for almost anything. (Further IO are available, but not without sacrificing some functionality). I wanted to be able to play with my buddies, so I opted for a two player setup. For each player, I use 4 lines for the joystick and 2 lines for action buttons. I use further two lines for 1 player and 2 player buttons, and one for credit/coin. That's 15 all together.



No other work is required but tieing the GPIO to ground, and a button press will short that GPIO to ground. No resistors or anything, just some minor soldering.



To use the GPIO in MAME, that is, the joystick and the buttons, I emulate a USB keyboard. So, when a button is pressed, a corresponding keyboard input is triggered. To do this, I use Adafruits retrogame tool. The code is open and available. All I had to do is to map the additional inputs in wanted to use to the right keyboard function. One word of warning: if you like me are not using one of their external interface boards (called HATs), you must change a 0 to a 1 in in the routine where it selects it's board, or else you will get an error where the program will try to access unavailable GPIO.

Another thing I had to do is to over clock the CPU to 900 MHz, to make things run smoother (no frame drops).

Conveniently, there are also 3.3V and 5V lines exposed, so I can light up my buttons too!

So there you have it! I'm now onto building the actual cabinet.



No comments:

Post a Comment