Here I will show you how I went about building my arcade machine that uses a Raspberry Pi running MAME to emulate games. As everyones setup will be different this will be general in nature but will hopefully supply enough information so you can get started yourself ! This is my first instructable but hopefully it will all go well. Enjoy !
Step 1: Parts you need- An old CRT television with an AV input
- A Raspberry Pi (any type should do)
- Strong timber for your CRT frame
- AV leads
- Arcade buttons and switches
- USB interface ( I got mine here, or make one here)
Many of the arcade specific pieces (buttons, joystick, interface etc. are available online, google is your friend here, shop around get the best price you can)
You will also need various tools, saws, drills etc. aswel as bits and pieces like screws and bolts. As everyones CRT will be different you'll need different amounts
Step 2: Getting MAME working
If you havent already gotten your Pi up and running you will need to do so. There are tonnes and tonnes of tutorials out there so I wont cover it here.
MAME (Multi Arcade Machine Emulator) is a programme that will run games. These games are called ROMs and you will need some before you can get started. I suggests you try and find something simple. I used Donkey Kong for all my testing and it worked a treat. I will not tell you where to get them nor will I help you find them and I definitely wont tell you to go to google and search for MAME roms as that would be down right silly......
Now I'm running raspbian wheezy (28 Oct 2012 version) and it works a treat so I would recommend you use this version of the OS as I have had trouble with later releases of raspbian.
Ok now to the nitty gritty, I am just telling you exactly what the tutorial here told me to do but this is a more detailed step by step process purely for completion of this instructable. However I claim no ownership of this.
1 - Download a copy of AdvanceMAME form Silvermans blog (link above)
2 - Open up the GUI interface on your Pi (boot up your pi and type "startx" then hit enter)
3 - Transfer the .zip file you downloaded to the pi directory on your raspberry pi (USB stick is probably the easiest way)
4 - Unzip the file (simply double click and xarchiver should open up)
5 - Run advmame, this is done through terminal. Pending on what the file that gets extracted is called (mine was called mameBin for some reason, however normaly its just called mame) run the following commands.
sudo chmod 777 /dev/fb0 - hit enter you may need to input a password
/bin/advmame - hit enter and you'll get some text mentioning the creation of a file. Folder name is whatever the folder you extracted is called.
6 - Now you need to edit the file called advmame.rc. to do this go into th pi directory, right click and select the option of "show hidden". there should be a folder called ".advance", open that and there should be a file called advmame.rc. Double click it to open it. It should open in leafpad and look like a bog standard text file. Scroll to the end and put this in
device_video_clock 5 - 50 / 15.62 / 50 ; 5 - 50 / 15.73 / 60
Save the changes and close the document.
7 - Now place whatever rom you have into the "rom" which is found in mame/share/advance/rom
8 - Run the emulation by typing the following into terminal where folder name is mame, mameBin etc and rom name is the name of the rom
/bin/advmame - hit enter and it should boot up.
It will probably run really slowly if you are still in the GUI however if you logout and run it from the boot terminal it should be fine !
Step 3: USB Interface setup and Buttons
No I'm aware that the GPIO pins could be used as a means of hooking up the arcade buttons. However I opted for an interface that is designed to work around MAME i.e I'm lazy..... You can also make one if you have an old keyboard laying around
So this step will vary depending on the interface you get. Mine was pretty straightforward but you will need to follow the instructions yours comes with in regards to wiring, syncing it to MAME however should be the same for everyone. I found it easies to make a mock up controls pannel for my buttons and joystick fron a bit of 7mm plywood, drilled some 28mm holes (using a spade) and the buttons affixed into place. I then wired them up according to the wiring diagram I got with the interface. Plug in the USB lead and boot up your pi.
Launch MAME (any rom will do) and hit the tab key. here you will find the options menu.
Select Input (general)
Select Player 1
Then all you do is scroll through using the arrow keys on your keyboard, hit enter and press the corresponding button, then hit the down key.
eg say you want so set the player 1 "up" button. highlight P1 UP, hit enter, push the joystick up (you should get some sort of response from MAME, it will put into the line highlighted something like j:trig or l;pinkie, so long as you get a response all is well.), then press the down key.
Do this for all your inputs, or just the inputs you need and test it. If you find that some of the pins don't work it might be MAME not recognising them, just change the pin and try again.
Step 4: Disassembly of CRT
I got my CRT from a hard rubbish recycling place for the grand sum of FREE ! Check your local paper and online trading sites (craigslist, gumtree, trading post etc.) you can usually get them free from people.
WARNING !! The following is for informational purposes only and do not attempt unless you have experience. Needless to say all this work was performed while the TV was UNPLUGGED.
CRT's use high voltage and if you don't disassemble it correctly you can seriously shock yourself (I have done it before and trust me I was lucky not to have been seriously injured oh and yes it hurts !)
Start by laying the TV down on a padded surface (a towel folded over a few times ontop of a wooden table works well). Take out as many screws as you can find, there may some snap lock clips and other things of that nature so I took my time when I did this, when all fittings and screws have been removed the shell can come off.
Safely discharge the CRT (if you don't know what this means then you shouldn't be doing this)
Remove any and all internal screws. Then proceed to remove the electronic components until all you have left is a bare CRT.
It's a good idea to take photos and mark things so that when you go to hook the CRT back up together you don't forget anything.
Step 5: Build a Frame for the CRT
Most CRT's have mounting holes in the corners. Again everyones CRT will vary so this is very general but not to hard to sort out yourself.
I decided to build my frame from thick timber and have it so the CRT simply "dropped" in. I started by getting rough measurements and did a quick mock up frame. A basic rectangle frame with some legs that seemed to fit around the CRT nicely. I put some large triangle blocks in the corners the the mounting points to be rested on and bolted into.
I then put 45 degree bracing brackets on all the legs so as to sturdy it up.
Next I dropped in the CRT and botled it into a nice position.
Step 6: Re attach electronics
This part is pretty tricky but you'll need to find a place within the frame where you can easily and safely mount the circuit boards you removed and have them close enough to the CRT that all the wires reach. I decided to put 2 bits of timber horizontal across 2 of the legs. This worked out really well and the boards fitted nicely and all the wires reached.
The wires were hooked back up to EXACTLY where they were before disassembly.
It was then a simple matter of hooking up the pi to the TV and then the keyboard and USB interface to the pi. It is possible to hook the audio up to the TV and use it's speakers (3.5mm jack to AV style connector should do the job) But I just have mine hooked up to some stand alone speaksers.
I launched MAME and all is working !
I'll probably stain the wood a nice dark cherry colour.
Step 7: Enclosure and Controls
This bit was a little tricky but I just cut out some panels of ply wood that attached nicely to the legs. Clamps helped a lot here with the aligning. The controls board was easy I just decided on an angle I wanted it to sit at, the best thing to do is sit down and eyeball where you'd like it to go, once you have an angle you think is comfortable then decide how high you want it to be. Again roughly eyball it then measure it out.
I'll probably stain the wood a nice dark cherry colour.
Hope this inspires you to make one as it is a great bit of fun and guests love it !