Raspberry Pi Zero W
For this guide, we'll be using a Raspberry Pi Zero W, which -- if you're not familiar -- is a very small $10 computer built by the Raspberry Pi Foundation. Many people have had trouble locating a Raspberry Pi Zero since until recently supplies have been extremely limited; however, Pimoroni and other distributors have them in stock. You can also use the regular Raspberry Pi Zero as it is only $5, but it lacks the handy WiFi and bluetooth support. Either one will work just fine, but I recommend the W!
Because the Raspberry Pi Zero requires the use of HDMI and USB adapters one of the most difficult parts of this guide was finding and ordering (and often reordering) adapters that would fit inside the NES cartridge. To make it easier for you, I've linked to the exact parts I used at the top of this guide.
The USB hub is only necessary if you want to use more than one controller. I decided to install one in my Pi Cart since it was inexpensive and I'd like to be able to play 2-Player games with my buddies. Because USB hubs draw a bit more power, I recommend using an AC adapter that is at least 2A (linked above).
NES Game Cartridge
Don't destroy a good game -- I was found some crappy NES games for $2 each at my local gaming store. If you don't have such a store near you, you can find an inexpensive cartridge on eBay (hint: NES sports games are generally very inexpensive since most were terrible).
I went with a copy of Back to the Future because it's terrible (thanks LJN).
Nintendo used proprietary security screws on their cartridges. I recommend spending a few bucks on a security screwdriver, but if you want to save some money you can also make your own (though I didn't have much luck with this approach).
Remove the 3 security screws and marvel at how small its contents actually are. Then, you can toss aside the old cartridge board. But before you do..
Fun fact: On the board you can see the famous NES "lockout" chip -- this is the chip that Nintendo rationed to game developers to ensure that only "authorized" developers could release games for the NES. Companies like Tengen (an Atari subsidiary) were able to get around this (illegally) by successfully petitioning the U.S. Patent Office for documents that detailed how this chip worked.
By controlling the quality of the games that could be played on the NES, Nintendo was able to pull the video game industry out of the video game crash of 1983. Tengen was sued by Nintendo and the U.S. Patent Office changed how they handle the secrecy of software patents as a result of this case.
RetroPie is a software package for the Raspberry Pi that will ultimately run our games for us. I've written a separate guide on installing RetroPie since it has several steps, but it doesn't take long. You can even set up your Raspberry Pi without a keyboard, mouse, or monitor if you wish!
Since there's no real reason to install a WiFi adapter on your Pi Cart, simply use the USB drive approach for installing ROMs rather than transferring them over your network.
If you're using a Pi Zero W, which has onboard WiFi, you can connect your PiCart to the Internet to transfer ROMs over your network. But you already knew that! :)
Before we begin putting everything into the cartridge, we need to test our connections to make sure everything is in working order. Connect the Micro USB and Mini HDMI adapters to your Pi. Then, connect your USB hub, USB controllers, and HDMI cable. Lastly, connect your AC Adapter. Your Pi will now boot and you should be able to see the RetroPie UI. Shut everything down safely (as mentioned in my other guide).
To mount our various ports in an accessible way, we're going to remove a piece of the cartridge housing near the opening.
Using a razor blade or Dremel, remove the cartridge opening "cross-support" from both halves of the cartridge. To easily remove this cross-support, I scored it several times on each side using my box cutter and then snapped the piece off using a pair of pliers.
The USB hub I used is housed in a plastic casing; we don't need that, and it takes up a lot of space. Using a flathead screwdriver (or your fingernail), pry open the casing and toss it.
If you're handy with a soldering iron, now would be a good time to shorten the hub's USB cable or solder a Micro USB cable directly to the hub. I decided not to do this out of laziness.
One more thing -- the USB hub I used has a pretty tall LED that gets in the way when trying to close the cartridge. Use a pair of pliers or clippers to carefully remove this LED (you don't need this one and it isn't visible with the case shut anyways). You can also desolder it if you wish.
To secure the various ports/adapters, I'm going to use hot glue. Superglue or Gorilla Glue will also do, but I want to be able to remove these easily if needed. Most people don't know you can use a drop of acetone to break the hot glue's grip on your board. Thanks /u/jsprada!
Using hot glue, glue the USB hub in place. Don't recess the ports too far into the cartridge or it may be difficult to plug USB devices into it! I installed the hub so that the USB ports are flush with the edge. Bonus: the USB hub I used fits perfectly between the cartridge opening and a back support (see photo to see what I mean).
A note on cartridge orientation: I suggest you mount your components in the cartridge half that doesn't contain exterior screw holes. This will make it easier to open and close the case without things getting in the way.
Glue the female HDMI and Micro USB ports into place. I originally used hot glue to secure the ports, but I was worried that the ports might come loose (the ports are very smooth and hot glue doesn't work as well when adhering strictly to smooth surfaces), so I ended up using a bit of super glue instead.
I chose to used double-sided foam tape for this. It's a bit easier to remove than hot glue and will provide a bit of shock absorption as well.
Pay attention to where you mount your Zero -- certain areas will make it easier to route your cables. I tried a few different configurations and the location in the attached photo is definitely most convenient.
This part will become obvious to you after completing the previous steps. The challenging part is routing the cables in a neat way -- check out the attached photo for help.
There are two Micro USB ports on the Pi Zero -- the top one is for the AC adapter input, the other is for the USB hub. They're labeled, but be sure to connect them correctly.
Connect the tiny Micro USB adapter connector to the hub and then connect it to the remaining USB port on your Pi.
Just take your time and everything will fall into place.
There were a few notes I wanted to add to this guide that didn't seem to fit anywhere in particular:
The Raspberry Pi Zero doesn't get very hot (it would be a different story if this were a Pi 3). The ports we installed in the opening of the cartridge actually cover less than 50% of the total surface area of the opening, providing plenty of ventilation. I've been using the Pi Cart for a very long time and it's barely become warm to the touch.
It doesn't have one! In order to lower cost while promoting an interest in electronics and programming, the Raspberry Pi Foundation decided not to include a power button. However, you don't want to simply unplug your Pi while it's running as this can corrupt the SD card. No worry though -- you can simply shut down the Pi through the RetroPie menu before unplugging it. I also wrote a separate guide to show you how to add a Raspberry Pi power button.
Consoles the Raspberry Pi Zero can emulate
The big limitation on which consoles/games you can emulate is actually the Pi's GPU. The Pi Zero can pretty much emulate every game for every system up to (but not including) the N64. However, there are thousands of titles for the NES, SNES, Genesis, Atari, and countless others -- not to mention nearly every arcade game ever -- that you won't have time to miss the newer systems.
Planned Raspberry Pi and Pi Cart guides
I have a few more guides planned for the near future related to the Pi Zero, so stay tuned:
- Install a status LED: this will blink while booting, stay solid while booted and turn off when it's safe to unplug. done!
- Build a Game Boy Zero: similar to the Pi Cart but in an original Game Boy, you can play this one on the go.
- Build a Pi Cart in a smaller form factor (looking at you, Game Boy or Game Gear cartridge).
Anyone interested in a PCB for this?
I'm toying around with building a printed circuit bord for the ports that will fit directly into the cartridge slot with cables preattached (and no cutting required) -- if you might be interested in ordering one of these, post in the comments below so I can gauge interest and decide whether to proceed. :)
Post below! I'd love to hear them.