Monday, 16 February 2015

Build A Cheap Arcade Cabinet With A Raspberry Pi 2 & RetroPie

The idea of nostalgia!

Welcome to my first ever blog.

I have always loved retro games and especially arcade games as my brothers and I would go to the shopping center every Saturday with our pocket money in hand and cue up to best anyone at Turtles In Time. Now that time has gone by and I am in my mid 30s I still have a longing for that old school feeling, and more importantly share it with my children.

I ordered the new Raspberry Pi 2 a few days ago, and it’s been sitting on my desk pretty much ever since waiting for an idea. I had some vague ideas about using it with RetroPie to be the brains in some sort of arcade machine. But what sort of arcade machine would that be?

Then I came across the iCade cabinet and thought about using it as the basis for a little Raspberry Pi-based arcade cabinet. If you’re not aware of the iCade, it’s a cabinet that accepts and pares with your iPad using Bluetooth, and allows you to play supported games using the built in arcade stick and buttons.

There are many iterations of what I have achieved but for a non Linux user I had a hard time trying to piece together everything from hundreds of web-searches, forums and videos. I had noticed that no one had made a all in one post / tutorial that guided you through the steps required along with configuration tips.

To that end this is my attempt! I will try to be clear and list all available links to downloads and code snippets. This is in-depth but only to make it easier as I have done all the hard googling myself.

Step 2: Prepare the Micro SD card with the RetroPie Image

In order to use your Micro SD card on your Raspberry Pi you need an operating system. There are many different types depending on the system you are trying to build for example a desktop computer, a media center or in our case a arcade machine. Before we start we must bake (flash) the image onto the Micro SD card. Please see below for the procedure depending on your operating system of your computer. Remember the link to the RetroPie image can be found above.

Insert your SD Card adaptor and then run Win32DiskImager.exe. It may give an error message on startup, but you can often ignore it. It should find your SD Card drive or if not select it. Select the file '#.img' image file you wish to use and then press write. Once it completes you are ready to go, insert your SD card into the Raspberry Pi.

MacOS X:

Download ApplePi Baker from the link below and there is also a very good tutorial on how to use it on the same page.

Step 3: RetroPie Setup OMG!!

This section will be the beef of the build as it is better to get RetroPie working before it is even installed within a cabinet and you find that it does not even work. To tackle this I joined the RetroPie community site and watched allot of YouTube videos in particular by a person called "Floob", as it turns out Floob is also a RetroPie community member,

Floob has an excellent video on how to setup RetroPie and must do configurations, this is where I started so I recommend watching this first.

I wouldn't expect you to start using the command line without knowing how it works. Essentially, it is a method for instructing the computer to perform tasks. It’s really not all that different from pointing and clicking, only you’re expected to use text. I have used generic linux commands here to show the basics.

When you first access the command line, you’ll see the pi@raspberrypi $ prompt – whenever this is displayed you’ll be able to enter commands.

Display Hardware Information

On a Windows PC or Mac you can easily find hardware information by looking in System or About This Mac. To find out about your Raspberry Pi’s hardware, enter the following:

cat /proc/cpuinfo

This will output information about the device’s processor. For instance, where you see BCM2708, this indicates that the chip was manufactured by Broadcom.

Various other hardware information can be found by running commands under the proc directory.cat /proc/meminfo displays details about the Raspberry Pi’s memorycat /proc/partitions reveals the size and number of partitions on your SD card or HDDcat /proc/version shows you which version of the Pi you are using.

All of these details can be used to assess what your Raspberry Pi might be capable of. Further information can be acquired using the vcgencmd series of commands, which can reveal things like CPU temperature (vcgencmd measure_temp). This can prove vital if you’re concerned about airflow.

Other technical commands include free -o -h to see how much free system memory is available, while vcgencmd get_mem arm && vcgencmd get_mem gpu will reveal the memory split between the CPU and GPU, something that can be adjusted in the Raspbian config screen (see below).

As with the file structure, the ls command can be used to list items attached to your Raspberry Pi, specifically USB hardware. Use lsusb to display a list of attached devices – you’ll find this crucial for setting up a wireless network, mounting a hard disk drive or attaching any other USB hardware that requires some configuration.

Important Terminal Commands

Perhaps the most important command line instruction is sudo. This single word instructs Linux-based systems such as Raspbian that the following command is to be carried out with “super user” privileges, an advanced level of access similar to (but not the same as) administrator on Windows computers.

One of the most common commands for Raspbian users is sudo raspi-config. This opens the configuration screen for the operating system, which has been updated considerably since it was first released.

When you’re done in the Raspberry Pi command line, and you’re using the Raspbian (distro), enter startx to return to the graphical, mouse-driven interface. If, on the other hand, you wish to shutdown, use sudo shutdown –h now to immediately begin the system halt and shutdown process.

You can restart with sudo shutdown –r now. A timed shutdown can be set by including a value, such as 5 minutes, or a time, such as 21:55:

sudo shutdown –h 21:55

Setting up the TP-Link TL-WN725N Wifi Adaptor

To setup the WiFi adapter please follow the advice used in the link below but instead of using the 8188eu.ko files mentioned use the ones that I have provided below as they have been updated for the Raspberry Pi 2 new Kernel.

RetroPie and in particular "Emulation Station" runs emulators (virtual systems) and roms (game files) you are allowed to download, keep and run roms if you own the original game. I will not cover how to download roms but Floob has another awesome video on how to install them on RetroPie. I know this was slightly covered on the last video.

Step 4: Putting it all together

Ok now the actually easy and fun bit. I started by taking apart the iCade's control panel box to reveal the arcade stick, buttons and Bluetooth module.

This is the iCades Bluetooth module (We don't need it)

Unclip the cables and remove the Bluetooth module. This is not needed as it uses a special API for iOS and would be allot of hassle to get working. I then clipped the end connectors off as I was going to solder these to the XBOX 360 controller. I recognise that there are harnesses that can be used but I didn't want to wait for one to come from China.

I then started soldering the ends to the XBOX 360 controller that I had dismantled to allow the arcade controls to operate the joy-pad. I chose this because RetroPie works really well with the XBOX 360 wired joy-pad. It is not the easiest approach tho. I have added a picture below to best show how it will connect before and after.

This shows the XBOX 360 button connectors and describes the pinout

This is a example of how I connected the iCades controls

Next I took apart the speakers to revel the raw speakers and the control board. I screwed the control board to the rear of the iCade with small wood screws utilising the original screw holes. I then hot glued the hell out of the back of the speakers and stuck them to the rear also. I took care to make sure they were level and secure. Point to note I cut the end off an old phone charging cable and soldered it to the speakers power-board so I can run its power from the Raspberry Pi.

Hot glue is your best friend! secure it or loose it

The next step was to attach the Raspberry Pi 2 to the rear of the iCade. I adopted the same approach as the speakers and used more wood screws through the existing mount holes to fix the Pi to the cabinet. This took a little bit of thought as the placement was crucial for the ports that I would need access to. To make some additional lighting and power possible I opted to a breakout board also just to give me more access to a 5V and Ground pins. I mounted this near the Pi for convince. I will explain what the breakout board is doing later.

Raspberry Pi 2 mounted with breakout board. I will explain the cables later :-)

Next I installed the screen I started by working out where I wanted it to be on the cabinet and I added some double sided tape to hold it in place temporary. I then marked with a pen where the ribbon from the screen is and used my Dremel to make a slit in the wood to allow me to pass the ribbon cable through this would allow me to mount the screen controller board to the rear. I choose this as I wanted all the cables to be at the back.

I then mounted the control board in the same fashion with wood screws.

LCD ribbon cable coming through front front to control board

1st things 1st as the screen did not come with any instructions I manage to find a video on how to assemble it. Actually self explanatory but just in case.

The LCD also came with button controls and a infra-red receiver for the remote control. This needed to be mounted on the front of the iCade cabinet using wood screws. I mounted it above and central to the screen.

LCD Buttons and Infra-Red receiver mounted to the front above the LCD

I needed to feed the XBOX 360 controller cable from inside the arcade control box so I could plug it into the Raspberry Pi. I also had to deal with a hole I made by removing the iPad stand from the front of the cabinet and I also wanted to keep the coin light at the front and use it as a power light.

So for the XBOX controller I made a hole in the bottom of the cabinet's control box and fed all the excess cable within that so I was left with just the USB cable pocking out, I used some cables ties and connected it to the Raspberry Pi USB socket.

All cables come from somewhere! Right?

The yellow and black cable coming out the bottom right goes into the Raspberry Pi breakout board to provide 5V and ground for the front light as shown below. This ensures that the light comes on when the Raspberry Pi receives power.

Let there be light! or it would if it was powered on lol

Removing the iPad stand left me with a nice rectangle hole so I had a LCD screen lying around originally designed for PC modding. I hope to have it display the Pi's temperature and voltage rating in the future. It was glued in place with superglue.

Simple but does the job

Step 5: Power

It was always a plan of mine to have only one power cable coming out the back and initially I was confused how I was going to do this as this build needs to power a few items and at different voltages. See below for a breakdown;

Raspberry Pi 2 requires 5V

USB Speakers requires 5V

Front LED light (Power light seen above) requires 5V

XBOX 360 Controller requires 5V

Wifi dongle requires 5V

LCD Screen and control board requires 12V

I have a basic understanding of power so thats why I opted for a power supply rated at a clean 5V with a load of 2A. I started testing the components out one by one with my multimeter and as I expected The Pi 2 was able to supply the power via the USB sockets and the GPIO pins connected to the breakout board.

One real surprise was that the 12V (Rated 12V by seller page) is able to run perfectly with a 5V input? I don't quite understand why and I tested it for heat and power drain but it all appears perfect. GET IN!! Only one cable.

I created a power cable for the LCD controller board by using a old multi-plug adapter and soldering on two fairly larger cables and applying hot glue :-)

LCD Controller power cable powered from Raspberry Pi GPIO pins

LCD Controller power plugged into the board

Raspberry Pi B+ Pin-out is the same as the Raspberry Pi 2

Step 6: Finishing up

All that remains was to put in the HDMI cable between the Raspberry Pi and the LCD Controller board. Plug in the 3.5" audo cable between the Raspberry Pi and the speaker power-board. I do however need a smaller one but this will be fine for the minute.

Micro USb cable plugged into the Raspberry Pi 2

Audio and HDMI cable plugged into the Raspberry Pi 2

HDMI cable plugged into the LCD Controller board and audio plugged in

Additional steps

I will do some additional steps to make it look more like a Arcade cabinet like mount some lights on the lid for a marquee and add a hinged door to the rear to cover the exposed electronics. I also want to make a screen bezel to cover the screen, but I might wait out for a bit as I am undecided that I might upgrade the LCD to a 9"

LED Strip lights might work?

Final thoughts

I enjoyed the build and working with the Raspberry Pi 2 and Linux. I have also enjoyed this process of putting thoughts down on a blog it must be what it is like to keep a diary. I have built many projects that I may start to post about here. If you have found this useful or not please comment below. I will use your feedback to decide on future posts or not. If you comment on my writing that's fine but ill just comment back in the same bad style lol.

Thank you so much for you kind words. You are correct I did mention that there is a wiring loom that would effectively make it solderless for the controls. The plugs that come out of the Bluetooth module would just plug in to the the arcade control controller board.

The board is called the "Zero Delay USB Encoder PC To Joystick" and can be found here http://www.ebay.co.uk/itm/171251607368?clk_rvr_id=785191787576&rmvSB=true it then just plugs into a USB socket.

Thanks for the toturial! I just picked up an iCade at my local thrift store for $10 now I need a Pi and other materials to get started. I'm a total noob at this, I will take my time and hopefully everything works out.

Dude. Awesome tutorial. My only question is this: how on earth did you supply the 5v from the LCD monitor through the Raspberry Pi? I don't know if that question made any sense but that is the best i can word it out. I have read through the entire tutorial and i still don't understand how to do the 5v LCD power thing.

Hi mkunlimited123, To be honest I have no idea and I think I mentioned that in the tutorial. The box for the screen said that it required 12v however when I tested it on the Raspberry Pi 2 it just worked?? I did however make sure that I gave it a good clean 5v at 2A through the Pi. I did some research since and I found some threads stating that the screen is capable of running from 5v. It was perfect especially as it is 7". I have since bought a 5" and that does not power from the Pi so I will always use that 7" one again for future projects. I hope that helps.. Thanks for reading my tutorial. Cheers Keith

Thanks for the tutorial. I ran into an issue with my Tontec 9" TFT LCD display. When I power it on the LED on the controller board flashes red/green, in your video the LED is a solid green light. I am running a 12v 2A ebay power supply. What might cause this problem? I'm thinking a defective lower supply?

Nevermind, I found the problem, not sure if it was a defective power supply or one that wasn't strong enough. Luckily I had a 12V 5A 60W power supply powering up my LED strips, I tested it and it powered my display just fine.

Thanks for your article and sharing your expertise, it's really appreciated.It helped me a lot for what i was searching for. Keep it up. For more details about Arcade Machine Visit: Cocktail Arcade Machine

Wow, I'm a man cave modder fan now for life. This walkthrough was really in-depth. It's definitely being added to my "potential next projects" list and that's largely thanks to the fact that you detailed the process so well. I, personally, just threw money at the problem and bought a cabinet but I might still make one now anyway!

Wow, I'm a man cave modder fan now for life. This walkthrough was really in-depth. It's definitely being added to my "potential next projects" list and that's largely thanks to the fact that you detailed the process so well. I, personally, just threw money at the problem and bought a cabinet but I might still make one now anyway!

Hello :)In which Ports have you plugged in the cables for the 5v electricity on the GPIO board? I want to build this on my own, but i cant find any pictures where i can see how the Pins ae connected. What could I use instead of the XBOS controller? I dont have one and i dont think i should buy a new one only for this...Thank you for the help :)These Arcade-Machines are so nice :D