The Raspberry Pi arcade now has controls!
The controls have been connected to an Arduino which then uses SPI to connect to the Raspberry Pi. The following hardware design was used:-
Its important to use a logic level converter for the 5v to 3.3v conversion.
After hunting around for good ways to simulate key presses on the Pi I stumbled across the Adafruit retrogame code which uses GPIO as inputs. I’ve forked this on github and changed it to request the state of the buttons over SPI and update the presses. It currently polls and doesn’t seem to be using much CPU, although it would be possible to use a separate GPIO pin to tell the Pi that there is a change in state. The code is available at https://github.com/markpudd/Adafruit-Retrogame. This also includes the Arduino code to connect the inputs too.
The SPI protocol basically send an 0xFF command to the Arduino which returns 3 byte, which are P1 status,P2 Status and Aux Status. The Aux status is used for P1/P2 button and the coin mech.
I’m currently building an input board to replace the Arduino which is basically the ATMega broken out with some connector for P1/P2 and aux. I’ll publish this at the end of the week.
I also added some audio amplifier and speaker this week. There is still a bit to do on this project such as getting some artwork printed, painting the cabinet and fixing up the monitor mounts!