Project Brief:

Shoehorn a Raspberry Pi Zero into a NES controller. Load it up with RetroPie and wire up the buttons.



Requirements:

# Requirement Justification Status 1 System must be completely contained in a NES controller A single-unit system is the main aim of the project Success. External power + HDMI cables required. 2 All ports accessible Need access for HDMI + Power. USB OTG port needs to be exposed for peripherals. SD card access required for software + ROM loading Success. All ports accessible. 3 GPIO-connected controller buttons USB OTG port needs to be available for other peripherals (e.g. Xbox controller), therefore the internal buttons must use GPIOs. All internal buttons need to be usable by the emulators. Success. GPIO-keys based driver setup. 4 External status LED So you can see what's going on Success. bi-color red/green LED shows power + CPU activity 5 Minimal parts count Easy to reproduce Partial. External bi-color LED and resistors needed. Some laser-cut parts and epoxy 6 All parts easily removable I always regret it when I glue something in. It always is a pain later With the exception of the mounting hardware - Success.

If you don't care about requirement 6, I would recommend generous helpings of hot glue instead of faffing around with bolts.

Method:



Using a real NES controller would be somewhat sacrilegious, so I grabbed a cheap USB one off ebay (£3.50 delivered!): http://www.ebay.co.uk/itm/USB-Classic-Gaming-Controller-Gamepad-For-Nintendo-NES-Windows-PC-Mac-Retro-Link-/381259815139?hash=item58c4db18e3:g:swIAAOSw3xJVVFa~



Obviously a Pi Zero is also required.

First observation is there's just enough room to fit in the Zero without needing to cut up the circuit board. This is good news.

The basic plan is:



Determine basic location for Pi Add internal mounting method Cut holes for ports Test-fit Wire up LEDs Wire up buttons Mount LEDs and buttons Close Fix it in software

Mount the Pi:



The depth is just right for a 3mm piece of acrylic to sit the Pi on top of in the bottom half of the controller. So, let's draw and laser cut the appropriate shape and tap the holes for M3 bolts. The Pi's holes are actually M2.5, but who the hell has M2.5 bolts and taps?! So, drill out the Pi holes as well to take M3 bolts.

Next, it was necessary to shave down some of the internal wall of the case to get the Pi's ports close enough to the outside world. The outer wall in the Pi corner became pretty thin, but it's OK. After that's OK it's time to glue in the acrylic - Araldite seems to do the job.





With the mount in place, it's time to start filing out the holes for the ports. Start on the bottom half of the controller, and get the Pi sitting flush with the acrylic mount.

Then bolt the Pi in, and offer up the top-half. Mark the location of the ports and get to work filing them out in the top half too. Better to take this slowly so you get a nice end result. It's a slow job of filing a bit, putting it together, filing a bit more...





Also at this point I tweaked the old cable hole a little to take a 5mm LED (it's almost but not quite 5mm already, minor filing was required).





Hook up the LEDs:



The LED-in-the-cable-hole looks pretty nifty, and it's useful too. I stuck it on a little bit of stripboard with some 0603 resistors. I wired the green LED directly to 3v3 and the red LED to GPIO19. It would be nice to not use up another GPIO, but I didn't trust my crappy iron to be able to pull off the on-board ACT LED without lifting a pad or two. If I need to use GPIO19 later I'll figure something out.

Hook up the buttons:

I want the buttons on GPIO to leave the USB OTG port available. If you don't just wire the USB cable to the Pi and call it done.

If you want to use GPIOs, you need to remove or disconnect the old chip. The old chip is a black blob of despair.

You need to figure out the button wiring. You could probably be smart and use the same wiring the USB controller did, but I wanted a nice simple software setup, so I hacked the board up to give me 8 separate common-cathode buttons. This...