Old Schoold by Harri Kauhanen

Hartmut Wendt Raspberry Pi Mini Arcade Cabinet

In addition to my Raspberry Pi based emulator console, I had great fun building this arcade cabinet from Hartmut Wendt. On the cabinet, I plan to play some MAME games.

Building the cabinet was a big task for me, as I don’t have much experience with electronics or hacking with hardware.

Most of the software setup went the same than in my console emulator project, but cabinet needed some additional steps. This post includes my notes about these.

Hardware

Mini Arcade would also work on Raspberry Pi 2, but requires a different kit from Hartmut Wendt.

Linux configuration

Additional configuration steps:

  • Bigger font
    • sudo dpkg-reconfigure console-setup
      • Terminus 12 x 24
  • Wireless network
    • sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
      • network={ ssid="my-network-ssid" psk="my-password" }
    • sudo reboot

Sound config

The sound quality was terrible initially. I could hear a lot of “cracks”. I could not get it perfect, but some improvements are possible. Notes:

  • This firmware update did not work
  • Best way to reduce noise problems is to unplug all USB devices
    • Removing WLAN helps a lot
    • Removing keyboard/mouse-adapted helps a little
  • Unfortunately, it is impractical to have them removed
  • To make the situation decent, adjust volumes
    • Adjust high voice level from software
    • Adjust the voice level potentiometer as low as you can
  • To adjust from software
    • You could do it from Emulation Station
    • Create a startup script adjusting the sound level
      • sudo nano /usr/local/bin/vol
#!/bin/bash

MIX=amixer
declare -i LO=0 # Minimum volume; try 10 to avoid complete silence
declare -i HI=100 # Maximum volume; try 95 to avoid distortion
declare -i ADJ=3 # Volume adjustment step size

usage ()
{
  echo "Usage: `basename $0` [ - | + | N ]" >&2
    echo " where N is a whole number between $LO and $HI, inclusive." >&2
  exit 1
}

# Zero or one argument

[ $# -le 1 ] || usage

# Argument must be one of: empty, -, +, number

[[ $1 == ?(-|+|+([0-9])) ]] || usage

ARG="$1"

# Number argument

if [[ $ARG == +([0-9]) ]]; then
  # Strip leading zeros

  while [[ $ARG == 0+([0-9]) ]]; do
    ARG=${ARG#0}
  done

  # Must be between LO and HI

  (( ARG >= LO && ARG &2
  exit 2
fi

GET=$($EXE cget numid=1)
declare -i MIN=$(echo $GET | /bin/grep -E -o -e ',min=[^,]+' | /bin/grep -E -o -e '[0-9-]+')
declare -i MAX=$(echo $GET | /bin/grep -E -o -e ',max=[^,]+' | /bin/grep -E -o -e '[0-9-]+')
declare -i VAL=$(echo $GET | /bin/grep -E -o -e ': values=[0-9+-]+' | /bin/grep -E -o -e '[0-9-]+')

if (( MIN >= MAX || VAL MAX )); then
  echo "Error: could not get the right values from $MIX output." >&2
  exit 3
fi

declare -i LEN=0
(( LEN = MAX - MIN ))

declare -i ABS=0
(( ABS = VAL - MIN ))

declare -i PCT=0
(( PCT = 100 * ABS / LEN ))

if [ ! -z "$ARG" ]; then
  declare -i OLD=$PCT

  if [[ "$ARG" == "+" ]]; then
    (( PCT += ADJ ))
  elif [[ "$ARG" == "-" ]]; then
    (( PCT -= ADJ ))
  else
    PCT=$ARG
  fi

  if [[ "$PCT" != "$OLD" ]]; then
    (( ABS = PCT * LEN / 100 ))
    (( VAL = MIN + ABS ))
    $EXE -q cset numid=1 -- $VAL
  fi
fi

echo $PCT
exit 0
  • sudo nano /etc/rc.local
/usr/local/bin/vol 100

# ...

exit 0

Controllers

The controllers on this cabinet can be installed similar to AdaFruit arcade controls.

Checkout input codes and the following image for the actual mappings we are going to make.

Cabinet CPIO mapping

  • wget [https://github.com/adafruit/Adafruit-Retrogame/archive/master.zip](https://github.com/adafruit/Adafruit-Retrogame/archive/master.zip)
  • unzip master.zip
  • mv Adafruit-Retrogame-master Adafruit-Retrogame
  • cd Adafruit-Retrogame
  • nano retrogame.c
ioStandard[] = {
// This pin/key table is used when the PiTFT isn't found
// (using HDMI or composite instead), as with our original
// retro gaming guide.
// Input Output (from /usr/include/linux/input.h)
{ 25, KEY_LEFT }, // Joystick (4 pins)
{ 9, KEY_RIGHT },
{ 10, KEY_UP },
{ 17, KEY_DOWN },
{ 23, KEY_Z }, // A/Fire/jump/primary
{ 7, KEY_X }, // B/Bomb/secondary
{ 11, KEY_BACKSPACE }, // Coin / Select
{ 8, KEY_ENTER }, // Start
{ 27, KEY_ESC },
// For credit/start/etc., use USB keyboard or add more buttons.
{ -1, -1 } }; // END OF LIST, DO NOT CHANGE
  • sudo nano /etc/udev/rules.d/10-retrogame.rules
SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"
  • sudo nano /etc/rc.local
/home/pi/Adafruit-Retrogame/retrogame &
exit 0
  • sudo reboot

Note that Raspberry Pi felt somewhat slower after this. Make sure to overclock to at least 900 Mhz or more.