First blog post!
Hi all, this is my first blog post, I set this blog up to document some of my projects (only one of which is "complete" thus far) because I thought they might be of interest to others. Certainly other people's blogs have been invaluable for both inspiration and information for my own projects.
Why put a Raspberry Pi in a NES?
This first project is my Raspberry Pi inside an old NES. Why did I do this? I'm really into retro games, yet I never owned a NES, instead I had a SEGA Master System (an awesome console). Recently I really started to fee like I'd missed out on a whole lot of gaming cultural touch stones, so many often discussed games that I'd never even played. So I thought I would buy a NES, and then I thought about how many cartridges I would have to buy and how expensive it would be and how much space it would take up (incidentally I am trying to reduce the amount of stuff that I own right now). So my solution was to buy a NES that was broken beyond repair and put a Raspberry Pi in it.
My approach and goals with this project
Given that's where I'm coming from, just a few notes on how I approached this project. I wanted to experience the NES as close to what it was really like as possible. That meant doing this project in a way that kept the gameplay experience and the operation and appearance of the console as authentic as possible. There are quite a lot of these projects around, and without meaning to offend anyone I think most of them are pretty clumsy implementations. E.g. many use a dremel to gouge ugly holes in the side of the case to put in HDMI or Ethernet ports or even replace the controller ports on the front with USB ports. At that point, to me I feel like "what's the point?" This is of course only my own opinion and relates to what I want to get out of the experience, those other projects are still great and without reading about them I'd never have gotten anywhere with my own.
So my goal with this project was that from the outside there would be no telltale signs that this was a modified NES, it had to look completely original (at least with the cartridge slot lid closed). That meant using all the original AV ports and original controllers.
Other projects that really helped
Probably the two most helpful blogs along the way were Igor's (http://www.igorkromin.net/index.php/2013/01/08/raspberry-pi-in-a-nes-case-part-1-wiring-up-the-front-panel-and-external-connectors/), who's project achieves the same goal as mine, using all the original ports, and James' (http://jamesparsons.com/2013/11/raspberry-nes-project), who's project had a couple of great features that I also implemented in mine. Now, on with the show...
This isn't a proper build blog because I didn't document the process as I went, so I've just photographed everything as I was implementing one of the final features and will try to explain how I went about it.
I won't say too much about the software, I'm using the retropie SD card image, you can find plenty of information about it elsewhere. I barely understand electronics and I understand Linux even less so thankfully Retropie is very easy to get up and running. Very unlikely that I can help with any questions regarding it's setup beyond the most basic, I followed the instructions of others.
Mounting the components
Because I didn't want to alter the actual NES case by drilling any holes in it or anything I cut a small sheet of perspex upon which to mount everything. This sheet then screws onto the mounting posts that the original NES motherboard and other internals were attached to using the same screws, so I just had to drill a few holes in it in the right places. The Pi is attached to the perspex via the bottom half of a case (you can see the top half of the case in the background in the image above and below) which has been screwed down. The powered USB hub that I'm using (7 ports) sits on top of a platform at the right height to place it in the cartridge slot, it's attached to the perspex with adhesive velcro and the platform posts are some long screws and the barrel of a ball point pen.
Underneath is a keyboard encoder (I-Pac 2 VE from ultimarc.com) which is also screwed in (I'll explain it's purpose later)
You can see here that sticking out the front of the hub is a WiFi USB dongle, this one is really small and works out of the box with the Raspberry Pi so I'm really pleased with it.
The AV and Power ports
This is the small chassis that houses all the AV ports, I've removed the PCB that was attached to it and soldered a composite video cable to the video port, and a 3.5mm stereo cable with one channel soldered to the audio out port and the other channel soldered to the RF port, so the option for stereo sound is there if you are running something that needs it. I've also soldered the power cable from the USB hub to the DC in port. I then added a compatible male plug to the DC adapter for the hub so that it would plug into the DC port on the NES just like the original power supply (not pictured).
The power and reset buttons
I haven't taken a picture of it specifically but the power buttons and power LED are attached to a small PCB with 5 wires coming off it, this is convenient, all you have to do is remove the blue connector from the end of the 5 wires and then you can hook those wires up to whatever. Take note of the colours, or just look underneath the board and trace their connections to the various components.
Here's the keyboard encoder, this is basically a keyboard, where you can hook any switch up to the terminals to simulate a keyboard stroke. These are sold for the purpose of setting up a MAME machine so that you can get arcade controls working with ease on a PC. This is a bit of an overkill way to implement this but I'm using this so that the reset button functions as the escape key, this is so that I can exit games and get back to the game select screen. The two original wires from the reset switch just screw into the terminal for the escape key and the ground terminal. Another option is to just use a specific button combination on the controller to exit the emulator, that can be setup easily, but I didn't like this idea because there's only 4 button ons a NES pad and I wasn't convinced that I wouldn't press the combination by accident or when throwing a tantrum because I died.
I originally had this setup by just splicing the power switch into the wire providing power to the hub, which was fine for booting up, but then I had to shut down the Pi from the menu in emulationstation and then press the power button again once it shut down to return it to the off position - a bit clumsy.
This image is from a bit later in the build, but it shows the control port setup. There are chips you can buy from Retrousb.com that have usb cables already attached to them, and all you have to do is solder wires from the back of the control ports to the chip. Then when you plug an original nes controller into the control port the raspberry pi will recognise this as a normal USB controller. This is a really great option. Another way to go is wiring the ports directly to the GPIO pins, and using SNESdev which is included with Retropie. This is the approach that Igor used and is what I originally tried to do. I could NEVER get this to work properly, it drove me insane. I could get one controller working fine but the other never would, and I couldn't get anyone to give me any kind of solution. I even bought a second Raspberry Pi in case it was a hardware problem. I also experienced control delay when I did have one controller running like that, something that isn't present at all using the USB chips. I'd save yourself the headache and do this instead, unless your much more comfortable with linux than I am (there is a good chance you might be). Using these chips didn't require any setup, it just worked and there is no response delay. I believe it may also add less overhead to the whole thing than using SNESdev does, and you won't run into any problems where something has been updated and breaks SNESdev. In the picture below the chips are covered in electrical tape cause having them floating around like that makes me a tad nervous.
The full setup, almost done!
Here's a couple of pics just showing the whole layout
Up and running with the lid on and hooked up to a small 9" CRT. The nintendo logo is one that I made to replace the default Retropie bootscreen.
Running SMB, of course.
Power LED and casing the Raspberry Pi
The last thing I wanted to do was hook up the power LED. I left this till last because I had no idea what resistors I needed or how to find out. I simply used the advice of others. One blog said they used a 10k resistor, another one said they used 170, but two others said 330 so I went with that. I desoldered a 100 and a 220 from the original broken NES motherboard and put them inline. It's a little confusing here because there are two sets of blue and white wires, but the blue and white ones that are running along side each other are the ones that connect to the Mausberry circuit and are on side by side pins (see second image), while the other white wire on the right is from the power switch PCB and connects one side of the LED to a ground GPIO pin. The blue wire on the left connects the other side of the LED (which I detached from the PCB) to the 3.3V GPIO pin - you can see the red heatshrink in the middle which covers the two resistors.
Showing where these wires connect to the Pi
I drilled a few holes in the appropriate places and put the case on the Pi now that there will be no more GPIO connections.
Here you can see where the blue wire connects to the LED on the powerswitch PCB, and you can see the five wires I spoke of earlier disappearing out the other end.
Power LED working
All done! The usb cable connecting the Mausberry circuits shutdown switch is missing in these pics so that you can see the detail a bit better (need to replace it with a shorter cable that isn't all coiled up in there)
Here you can see the AV ports
What's left to do?
It's pretty much complete. The only two further modifications I'd like to make is as mentioned above putting something over the front of the USB hub to make it look neater, maybe a grey piece of plastic with the shape of the hub cut out. Also still tossing up whether to add a micro HDMI port where the channel switch used to be at the back.
What could I have done better?
I'm pretty happy with the whole thing, I didn't want to permanently alter the Case itself, and I've implemented all the functionality I wanted without doing that, so I'm happy about that. If someone one day wanted to use this case to restore an original NES they could, and it would be free of blemishes (except those imposed by a hard life of gaming). I originally wanted to leave the cartridge spring mechanism inside so that you had to push down on the top of the USB hub to make it pop up, but the mechanism was too large and didn't leave me enough space for everything else. It probably could have been done but would have been cramped. It also made it problematic to access the back of the hub without drilling holes in the mechanism, which goes against one of my goals with the project.
Can you help me?
One thing I'm not happy about is using a 40 dollar keyboard encoder just to turn the reset button into an escape key. I'm also building a MAME cabinet so I would like to use the encoder for that and not have to buy another one. The Mausberry circuit works by activating a bash script (is that the right term? it's a *.sh file) that you have to install on the system. There's a second set of terminals on the circuit for a reset switch which by default resets the whole system. I'm wondering if by altering the script, a switch hooked up to the circuit's reset terminals could be made to either simulate a keyboard stroke or send the exit emulator command to Retroarch or Emulationstation (whichever handles that function). If anyone knows how to implement that or has any other suggestions of how to elegantly implement this functionality please get in contact.
Happy to answer any questions you have regarding this project, I'll do my best to help with my EXTREMELY limited knowledge :)