A few months ago I came across the project on AdafuitÂ
Retro Gaming with Raspberry Pi, and thought it would make the perfect gift for my brother-in-law. Â I finally got around to building it with a few tweaks of my own.
Parts:
- 1x Raspbery Pi
- 1x Arcade Joystick
- 2x Arcade Buttons
- 1x HDMI to VGA adapter (assuming you don't have an HDMI monitor)
- 1x USB A / Micro B adapter (for Raspberry Pi power)
- 1x USB wall wart (for Raspberry Pi power)
Other needs:
- Monitor or Screen (HDMI or VGA)
- USB Keyboard (for additional game buttons)
- A speaker
- A box/enclosure to mount the controls
Software configuration
If you are familiar with
Raspbian, the most popular Raspberry Pi Linux distro, the general setup of the OS is a breeze. Â If this is your first go at it, follow the instructions in the Adafruit tutorial above.
Once the base OS is installed, place the
Retrogame binary /usr/bin, which will allow you toÂ
use the joystick and button controls though the GPIO pins on the Raspberry Pi. Â I also edited /etc/rc.local to start the utility on each boot.Add this line to the bottom of /etc/rc.local:
/usr/bin/retrogame &
Next I set the machine to automatically login on each boot, so it would act more like a kiosk, which requires editing your inittab.Comment this line and add the following line to your /etc/inittab:
#1:2345:respawn:/sbin/getty 115200 tty1
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1
I also installed the utility fbi (framebuffer image viewer) so I could display a splash image on boot, and added an init script to load the image.
apt-get update
apt-get install fbi
# To test a splash image:
fbi -a /usr/share/images/desktop-base/default
I got the basic mysplash init script
here:
#! /bin/sh
### BEGIN INIT INFO
# Provides: Â Â Â Â Â asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: Â Â S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description: Â Â Â Show custom splashscreen
### END INIT INFO
do_start () {
  /usr/bin/fbi -T 1 -noverbose -a /home/pi/splash.png
  exit 0
}
case "$1" in
 start|"")
  do_start
  ;;
 restart|reload|force-reload)
  echo "Error: argument '$1' not supported" >&2
  exit 3
  ;;
 stop)
  # No-op
  ;;
 status)
  exit 0
  ;;
 *)
  echo "Usage: asplashscreen [start|stop]" >&2
  exit 3
  ;;
esac
:
And we need to make the script executable and add it to the default runlevel so it starts on boot:
chmod 755 /etc/init.d/mysplash
insserv /etc/init.d/mysplash
Next I edited my .bashrc, which is executed upon login (in this case auto-login) to kill the splash image and start up MAME and a basic menu when MAME is exited:Add to end of /home/pi/.bashrc:
/usr/bin/pkill fbi
/home/pi/mame;/home/pi/menu.sh
This is the basic menu that provides options to restart MAME, halt the system, or exit to a shell.
/home/pi/menu.sh:
#!/bin/bash
clear
echo "Select an option:"
echo "1) Start Jeff-R-Cade"
echo "2) Turn off system"
echo "3) Exit"
read option
if [ "$option" == "1" ]; then
  /home/pi/mame;/home/pi/menu.sh
elif [ "$option" == "2" ]; then
  halt
else
  exit 1
fi
And, don't forget to make it executable:
chmod 755 /home/pi/menu.sh
I also made these general setting changes that you may or may not want/need: boot/cmdline.txt:Â Add the parameter "quiet" to kernel command line
boot/config.txt: Uncomment hdmi_force_hotplug=1
This is useful if you are having problems with the HDMI to VGA adapter preventing the screen from being detected.
And you should install MAME (or whatever emulator you choose). Â I used a version of MAME built for Raspberry Pi, called
MAME4ALL for Pi. Â I just downloaded the binary and unpackaged it in /home/pi. Â
You will also need ROM's to make the system useful. Â I'll leave that to you to find. Â
Please do not contact me about locating ROMs.
Hardware Configuration
The hardware setup is actually quite simple. Â The retrogame utility takes care of all the hardware to software mapping. Â If you keep the default setup, then all you need to do is solder some female jumper cables to the joystick and buttons and plug them into the correct GPIO pins on your Raspberry Pi.
This is the default GPIO mapping (graphic courtesy of Adafruit):
And the machine in progress:
Wrapping Things Up
The hardest part of the project (at least for me) was mounting everything is a nice looking box. Â Software is easier for me than woodworking. Â But, I like the end result. Â I named it
Jeff-R-Cade.
Posted: Feb 13, 2014
Keyword tags: raspberry piarcademakeelectronics