Raspberry PiCade – Lunchbox edition.

Following on from the other day (see blog post https://stiggyblog.wordpress.com/2013/08/14/raspberry-pi-arcade-controls/) I thought I’d make a quick and simple case for my Raspberry Pi and no stranger to a spot of lunchtime retro gaming fun, I thought why not combine the two?

Here’s my Raspberry Pi Arcade – Lunchbox edition.

mame_board (Custom)

Starting with a fairly thick and robust  two litre lunchbox as we don’t want the lid wobbling about too much,  I cut out a couple of 28mm holes for the  buttons/Joystick and then gave them a bit of a sand down.  It then has a bit of a clean as we don’t want any loose bits ending up ones sandwich nothankyouverymuch!

IMG_3992 (Custom)

A couple more holes cut into the sides for the HDMI, USB , Power cable and SD card.

IMG_3994 (Custom)

The fun bit next – putting it all together.

IMG_3996 (Custom)

Referring back to my wiring diagram/pinout notes from the other day to ensure that I’m connecting them to the correct GPIO pins

IMG_3997 (Custom)

A quick test to ensure that all was working o.k before I start wrapping up the wiring and getting everything positioned inside the lunchbox.

IMG_3998 (Custom)

Sorting out the mess…..and making a Sandwich.

IMG_4001 (Custom)

I FTP’d the default Mame4All splash screen over to my  PC  and jazzed it up a bit with Photoshop.

mame_lunchbox (Custom)

Game on and snacks for later 😉

mame_dk (Custom)

Here’s a quick video of my PiCade in action.


Raspberry Pi Arcade controls.

As I’m still not very mobile and jobs put of until I am,  I thought I’d get my Raspberry Pi out and have a play around with the GPIO headers to see if I could connect them to a few  arcade controls. I’ve not really used my Pi that much since the ‘AtarBerry project’ and now that my Ouya is taking care of  XBMC duties, said little Pi is a little redundant.

My first job was to format a spare 4GB SD card, download the latest copy of Raspian (wheezy) to start off with a fresh canvas. I was already to start after prepping the SD card  when sadly,  I hit my first snag of the day! No matter what I tried I simply couldn’t  get the Pi to boot…in fact, I couldn’t even get it to display anything on screen at all. The power light was lit and a very very dim green ‘OK’ light was lit.

I spent an hour browsing around the Raspberry Pi support forum and it appears that this is quite a common problem and points to either a failed Pi, a dodgy power supply or an iffy SD card (not much then!). Well, the power supply checked out o.k with the  meter and the SD card could be read/written to on my PC. I swapped out the power adaptor for another (I’m using a USB mains adaptor from my iPad) and I also tried a few other SD cards but still no joy.

I disconnected everything  apart from the power cable and tried again but I was still getting  nothing other than the Red power LED and the faint Green LED.

On close inspection I couldn’t see anything wrong with my PI until I took a closer look. There, stuck right at the back of the SD card slot next to one of the header pins was the tiniest piece of blue plastic. It’s the same colour plastic as my SD cards and I can only guess that whilst swapping between different SD cards (I tend to huse separate SD cards with different  O/S builds/functions) , a piece of plastic must has been shaved off. Maybe the slot is slightly misaligned?  Anyway, after removing the offending blighter with the help of a pin (it was that small!)  I switched my Pi on and it booted perfectly…yay!

After the initial setup via SSH  from my main PC, I  installed Mame4All and FTP’d over a few test roms to check the everything was good to go.

…..some time later (Phoenix is such a classic game!), I dug around in my spare box to see what I had to use.

Here’s what I came up with

  • A Bat topped Sanwa 4/8 way stick.
  • Two arcade buttons with clunky microswitches that were previously swapped out from my iCade. 
  • A fistfull of coloured wire taken from the remnants of an old Jamma arcade loom.
  • Female Lucar terminals.
  • A header block from an old PC that was used for connecting USB ports to the motherboard.

Here I’ve started cutting and crimping the cable ends and fitting them to the USB header block. I originally thought about reusing those two PC floppy drive cables instead but the USB header block was working out much better and with eight holes I’d only need to use the one block.  In total, I’ll need seven cables – four for the joystick controls, two for the buttons and one (daisy chained) common ground cable.

DSCF0099 (Custom)


The GPIO header pins are slightly different on each version of the Raspberry Pi. Mine is an early Model B board so the header looks like this. It so happens that there’s a nice line of pins (including a GND)  flowing in one straight line going from GPIO0 through to GPIO22. Perfect for my block.



All looking good so far. Now to crimp and attach the control swtiches.


DSCF0105 (Custom)


It’s a bit messy at the moment but I’ll tie wrap these up later on.


DSCF0107 (Custom)


Back on the PI, i downloaded this rather handy program to help configure the pins so that they map to keyboard inputs. There’s also really handy guide that comes with it too – https://github.com/adafruit/Adafruit-Retrogame/archive/master.zip

Contained within the zip file is a sample config file that will need editing and  recompiling to suit your own wiring configuration if not using the defaults. There’s also a handy test program so that you can check that all is working o.k  I hit another snag though as  I struggled to get my controls to work at first and there was much in the way of  head scratching and coffee breaks.

Pi connected to the TV and nano via SSH to edit the config file.

DSCF0110 (Custom)


The original config file has a few lines that read like this –

{ 17, KEY_RIGHT },

Which basically means pin number 17 should map as cursor key right.

So all you have to do is change the pin numbers to reflect your own wiring and enter an appropriate keymap. Mine was changed to read –

{ 0, KEY_RIGHT }, – which is  is the red cable in the picture above.


Try as I might, when I tested again, the controls simply didn’t work.

As a test, I restored the config file to it’s original state and wired in only one control to the same pin header as listed in the file. Namely –


It still didn’t work…….more coffee!

I tried again but this time I replaced ‘KEY_LEFTALT’ with a regular letter key. Namely ‘D’.

It flippin well worked this time!

So, using the old retro classic layout Q,A, O & P I changed the file and recompiled.

{ 0, KEY_P },
{ 1, KEY_O },
{ 4, KEY_Q },
{ 17, KEY_A },
{ 21, KEY_Z },
{ 22, KEY_X }

With Mame loaded, i went into the usual option menu and remapped the controls.

It all seems to be behaving really well now. I’m guessing this setup could now be used with other emulators.

DSCF0108 (Custom)


Now to think about a case….after one more game!




Mame Arcade Machine – New buttons

My order from Gremlin Solutions arrived today with a fresh set of buttons for the arcade machine.


I had no idea that they come supplied with switches so it was a nice surprise to find them included too. Most of the control panel switches were replaced last week but I think there’s one or two of from the original set that remain on the 2-up side. Now I’ve got a few spare, I  think I’ll swap these out for new too.

IMG_3309 (Custom)


I really do like working on this flip down control panel. I wished my Phoenix cabinet was the same.


IMG_3310 (Custom)


I’ve also swapped out the four (x2) joystick bolts. All were rusty and looked horrible. Note to myself….don’t misplace the 9/32 sockethead or you’ll have to undo them bit my bit with pliers!

Much better I think.