:The Project:

 

So, I was trawling the internet one day when I stumbled over an article about retro-game emulation here: LifeHacker Article. I grew up on Nintendo, ZX Spectrum, Atari 2600, Megadrive and Super Nintendo, so my interest was piqued. Then I followed that article onto the Retropie project and what wonders they were managing to cram into the Pi.

I remembered I had some old consoles knocking around in the loft, so I rooted about and sure enough there was an old broken NES that I’d rescued from the bin long ago. It was dusty, yellowed in parts, minus cables/controllers and all the other things to make it go, so I thought why not try and make my own.

I found lots of help on the internet, here are a few of the main ones that I took inspiration from:

It was this last one that pointed me towards the shutdown circuit and wiring in the original power switches to the Pi so I could power it on and off safely as if it was a real console. After deciding that I would take the plunge, I began to knock together a list of items I’d need to make it happen.

:Shopping List:

 

As I said, I already had the NES, so I just needed the insides and some way of whitening up the yellowed case.

It looked a bit sorry for itself to be fair, a bit like this:

nes

(I forgot to take before pictures, so this is just one off the net…)

I didn’t really want to re-spray and I found this guide on how to whiten up the chassis:

https://www.geekwithenvy.com/2013/07/how-to-make-a-yellow-snes-look-new/

With that in mind, some hydrogen peroxide gel went on the list.

The rest of the list was mainly electronics and fixings for putting them in the case and wiring them up. I found another project that mounted all of the internals on a plexiglass shelf, so I thought I’d try the same and I used an old lid from a storage tub for the purpose. My thinking was that wiring could be routed underneath the small shelf and keep the area around the main components tidy.

So, I bought/acquired the following:

  • Raspberry Pi 2B
  • 32GB micro SD
  • Clear plastic case for Pi 2
  • Heatsinks – just to be on the safe side
  • Official power supply (important to have one of these)
  • Mausberry Circuits power circuit (the use your own switch model) – http://mausberrycircuits.com/
  • Short cat 5e cable and cat 5e joiner block
  • Male micro usb to female micro usb lead
  • Male hdmi lead to female hdmi lead
  • Female to female prototyping wires
  • 4 port USB hub (for connecting controllers)
  • SEGA and SNES USB controllers
  • 330ohm resistor (for going between the NES’s LED and the 5v pin of the Pi’s GPIO
  • Sugru mouldable glue (for mounting the female ends of the leads as inputs to the case – it’s also an electrical insulator which was a bonus)
  • Random screws for mounting Pi etc
  • Hydrogen Peroxide gel
  • Borrowed soldering kit (I didn’t have one, but my father-in-law did)

:Construction:

Part 1 – The Chassis

Now I had the innards, I set to work taking the NES motherboard and other internals out. I kept the screws that held the boards down as I was going to re-use the mounting posts for my plexi-glass Pi platform, plus screws are always handy to have in a toolkit. The game tray was still in good condition and I had toyed with the idea of keeping it in, and I’d seen other people utilise it as part of their build. Logistically though, it was big and bulky and I didn’t want to be hacking it all up to make it fit on my first attempt at this kind of thing. As I said, this NES was dead and I was happy to sacrifice it. I did actually sell the board on eBay for £1, so not all was lost on it!

Looking at the insides, my plan was to mount the Pi over towards the left hand side (looking from the front) so it was close to the power button and giving me plenty of room to route the wires for the HDMI, power and network ports out of the existing holes where the old inputs went. I didn’t want to wire up the old controller ports like you can do to the GPIO pins because I didn’t have any NES controllers, plus I didn’t want to make it any more difficult as a first project anyway. But I didn’t want to back them up in case I fancied trying it at a later date. I foiled up the wires and secured them to the inside of the base instead.

But before that, I needed to lighten up the case. So I followed the guide, pasted lots of the gel on the top half of the case (the base was fine), sealed it in a zip-lock bag and lay it in the sun. All day. I live in the North of England and this was the winter, so I completely misjudged the situation. There was little sun, the case stayed yellow, and all the peroxide did was melt the lettering off the game-cover and left a clean outline where there had once been lettering 😦

I then had to re-spray, so got a can of slate grey plastic spray paint and an enamel lacquer from B&Q. I also found somebody in Greece selling the logo stickers for custom NES projects, so I got one ordered and decided to re-spray the case whilst I wait. The sticker, for the record, is great quality and recommend using this chap if you do try this yourself. His eBay account is art-o-cube.

After a few coats it looked pretty slick, though a little too close in colour to the original plastic of the base. So I thought I’d do that matte black and re-spray the power and reset buttons to the same grey as the top.

I didn’t think it looked too bad in the end, especially with the new logo stuck back on the game-slot cover:

I should also mention that I bought the controller sticker on the white fascia from a website called Redbubble which is a community-design site that sells the creations for independent artists. Plus is looked cool.

Part 2 – The Brains

I had already had the Pi configured and running under my TV for about a month before I got round to putting it all in my case, so I don’t know why this is only just part 2. Anyway, I followed the step-by-step guide at Retropie.org.uk  which is a great project with some great developers. If you’re stuck, just head on over here and there is a real community there more than willing to offer a guiding hand, as well as extensive WIKI data on how to configure almost all aspects of there excellent work. Please remember though, this is not a commercial product, and the Pi is always meant to introduce people to coding so please try and get your hands dirty and learn. I know I have, and it’s been very satisfying and has inspired me onto other projects which I will document further on this site. If it all had just worked out of the box, I don’t think I’d have been as interested. Again though, it’s not hard to get it configured to a basic standard where you can play games.

I wont go on too much about Retropie and EmulationStation as the resources at the website are more than enough. Needless to say, it put plenty of consoles at my fingertips and I was itching to get it all packaged up into my NES asap.

I will say though, one of the features I saw that gave the whole thing that polished console look was the addition of a boot video and the option to hide all the Pi boot-text from the terminal. I thought that would give my whole setup a real finished look, so I made myself a nice simple one that reminded me of Gameboy, SNES and the like.  It lasts just long enough for the Pi to boot past the EmulationStation splash screen and get into the console select screen. Here it is: NES Boot Video

I had thought about impressive 3D efforts, and I’d even downloaded some animation and video editing tools to try, but it felt wrong in the NES chassis somehow. This video was made in Photoshop for the stills and then animated in Windows Movie Maker. Simple as that and it took maybe an hour all in. I spent longer toying with the other software and produced nothing!

Part 3 – Wiring and Mounting

As I said, I am not an advanced electronics expert. I’ve worked in IT since I finished Uni, but I’ve not stripped circuit boards down or anything mad like that. Putting my own PC together was the extent of my customising to be honest, but I did that stuff 9-5 and just wanted to play Football Manager in my offtime. I had a fight with a soldering iron and an iPod Touch way back when, and the iron won and I had to send the iPod off to an expert. I was apprehensive about the soldering, but again if you are careful and patient (not my strongest qualities) it is quite straightforward to do.

I started by making the plexi-glass platforms, mounting them and the Pi, lining up the extension cables and securing them down in place. Once I’d done that, I stripped out the power buttons and set about the scary task of hacking that up and soldering my own wires on. One of the projects I found helpful had a good descriptive guide on how to do this. They had themselves completed a similar project with the Mausberry power switch, and they even had a rudimentary wiring guide. So, I used (stole) it. For reference though, that website is here and I take no credit for the investigative work: http://imgur.com/gallery/f4jGz

It also mentioned in here about the resistor required so that you don’t burn out the original LED on the power/reset board. I picked up 25 for 99p from eBay, so it’s a bit of a no-brainer really. It also mentioned a small trace on the printed circuit that linked the LED to the reset switch (that cuts the LED power when you press so you know it’s resetting). To bypass this, and have the LED independent of that, you just need to notch the circuit board (I used a sharp craft knife and lots of patience) in order to break this link. As I said, be careful that you don’t apply too much stress and crack or break the board.

kcjcdeo

This is the circuit diagram I used from that page as well. Please note, this is specifically for the Mausberry Switch and the guide and setup script for it all do mention connecting to GPIO23 and 24 in order for the shutdown command to work correctly for a clean system halt. I did toy with the idea of using the reset switch as a hard reset like shown in the diagram, but I had heard you could get the GPIO pins to possibly send the emulator exit hotkey when triggered, so I was going to try that instead as then the reset switch was an exit-game button instead.

I managed to do this exit game button by finding a thread on Reddit here: GPIO Exit Emulator Button Article (I found Reddit as well as the Retropie forums invaluable for helping me tinker with things I knew little about). Basically, I used the code halfway down this page to setup an “escape” command.

 

 

escape.py

from time import sleep
import os
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

def exitEmulator(channel):
    print('exitEmulator')
    pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]

    for pid in pids:
        try:
            commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
            if commandpath[0:24] == '/opt/retropie/emulators/':
                os.system('kill -QUIT %s' % pid)
                print('kill -QUIT %s' % pid)
        except IOError:
            continue
GPIO.add_event_detect(17, GPIO.RISING, callback=exitEmulator, bouncetime=500)

while True:
    sleep(10)

escape.sh

#!/bin/sh

cd /
cd /home/pi
sudo python escape.py
cd /

Add this to cron (sudo crontab -e)

@reboot sh /home/pi/escape.sh

To do this, you need to ssh to your Pi and create the files. It’s all in the Reddit as to how to do it, in case you’re not too sure. There’s not much you can break with this to be honest, so it’s worth having a crack like I did. The pins it mentions relate to which ever pins you want to wire your reset switch wires to. I wasn’t sure which way round they needed to be, so I just messed about until it worked really. If you need the GPIO reference, it’s here:

raspib-gpio_lightbox

This is the same for each model since the Pi model B onwards (so 2, 2b, 3 and zero)

Then it just came down to mounting the internals, routing the wires and testing I hadn’t messed up anything (I was worried about my soldering, even if there was only about 4 things I soldered in the end).

I was pretty happy with the end result, though I had to open up the casing for the cat 5 joiner block in order for the rest of the cables to fit around it (it was quite a bulky case and unnecessary in this build). One other addition I hadn’t factored in initially was that Retropie can run SCUMMVM. Being a boy who loved Monkey Island, I couldn’t resist so I purchased a small wireless keyboard with touchpad that I could use for these games and I put the receiver in one of the internal USB sockets. This gave an added bonus of not needing an external keyboard if I wanted to mess with config without using a separate PC; I just needed the pad. It was this one from BangGood.com and it works a treat. It’s rechargeable too, which was an added bonus.

The only thing I failed to mention so far was the USB hub which I decided to mount on the inside of the top cover. I fashioned a fascia from, of all things, UPVC window trim. It was almost perfectly the right dimensions to fit the gap, was easy to trim and work with, and cost me £1.50 for a a metre of it. My 4 port hub was a cluster of 2×2 which meant it looked better to one side so I opted for the opposite edge of the case to the Pi, secured it with Sugru to the fascia-board and then glued the rest in place with good old superglue! I reinforced the whole thing later on with some more Sugru down the inside-edging of the faceplate to make sure that plugging USB controllers in and out wouldn’t weaken the bonds. All that was left was to screw the whole thing back together and get playing!

++Video++

(NB: I only decided to spray up the bottom after I’d assembled it once. I got impatient and wanted to play a bit of Track and Field on the Playstation!)

IMG_20160327_155130227

…still got it as well!

After getting it looking nice on the outside, I worked on the config setting up various controllers (PSX, SNES, XBOX USB, SEGA Saturn USB) and setting each emulator to use different button combinations to exit the emulator by editing the retroarch.cfg files individually. I wanted to make it feel authentic and didn’t want to just use an XBOX pad for everything (ended up with it for N64 as can’t seem to get the cheap USB one I bought work right!) so each pad fit each console. As well as that, I wanted to try and make the wrapping look professional. I themed my EmulationStation with the help of the Retropie community and a skin by Rookervik called Pixel which kept with the retro 8-bit concept. I then went about skinning the emulators themselves so that they had customised borders. This meant that the games were not just stretched to 1080p HD and then again weren’t just surrounded by black-borders of nothingness. My favourite is the Gameboy borders which look like a Gameboy screen close up. There’s all kinds of shaders you can apply over the top too in order to give it the old CRT feel but I decided against them in the end. I might investigate the Gameboy shaders later so it’s even more authentic, though a professional sheen to the edges was important for me right away. As mentioned, the forums at Retropie.org.uk were of great help, though I did find a chunk of the borders and config to implement them at this site: Retroarch Borders and though not specifically for this platform, they work perfectly for it. As Retropie utilises Retroarch as a base for its emulators, there is also this community where you can draw aid from too for customisation.

It took a bit of tweaking, re-working and Photoshopping to get what I wanted. But that’s it really, it’s what you want it to look like and that’s why I enjoyed putting it all together.

 

:Overview:

So, that was my introduction into electronics, and I have to say I got the bug. I had seen, whilst researching setup for my Retropie configs, projects in old Gameboys, and 3D printed cases, and they started to look less beyond me the further I got into this build. One that I saw which did get me interested was building a Pi Zero running Retropie into a games controller (namely this NES Controller project). This ended up inspiring my next project which I’ll be documenting here soon.

Feel free to comment, share, or steal any ideas you find helpful here. Linking to my page and giving me a little pat on the back would be nice if you do though…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s