Introduction: NESPi Controller

Who doesn't love classic game emulation? Super Mario Bros and Zelda were so iconic, and so unforgiving in game play mechanics.

The short of this project is: A Raspberry Pi Zero, a LiPo boost charger, and a LiPo battery stuffed into a custom-designed NES controller. The software is based on the RetroPie distro. Yes. I know this has been done before in different forms. The basic concept was in the MagPi magazine. I wanted some improvements though. One cord for starters. Zero cords would be awesome, but let's start with more realistic goals. Power should be battery-based. I also wanted access to the micro SD card after the case was screwed together.

I had a couple of goals for this project, one was the battery. The other was to use as many off-the-shelf parts as I could. I wanted a project that others could reproduce with minimal engineering work.

The basic 500 mAh battery used in this project will provide around 1.5 hours of play time. Thanks to commenters on this Instructable, I hacked an iPhone 5 replacement battery to use in this project. This triples the battery capacity!

This is an electronics hardware project. Very little software configuration needs to be done, unless you really like tweaking a Linux distro. If that's your thing, then go for it! There are opportunities for that too after you build this project.

Happy hacking! Please vote for my project in the contests.

Also check out my other projects on Hackaday.io.

Step 1: Materials Needed

Items consumed by this project:

Items only used during initial software configuration:

Step 2: Tools Needed

  • Soldering iron
  • Wire cutters (angle cutters)
  • Wire strippers
  • Helping hands
  • 3D printer or access to a 3D printing service
  • Crimper (if using Dupont connectors to breadboard)
  • Hot glue gun (or use some thin double-sided foam tape)
  • Needle nose pliers
  • Multimeter (helpful for troubleshooting)
  • Screwdriver
  • Heat Gun or Hot Air Rework Station (if modifying an iPhone battery)

Step 3: Disassembly

Disassemble the NES Controller and cut off the cord. I built out everything on a breadboard so I crimped some Dupont ends on to the wires. However, if you are a brave soul, you could skip straight to stripping and tinning the ends of the wires with a soldering iron and proceeding with the build out. I would really encourage a breadboard build if you can. The reason for this is that the instructions for the software driver state that everything will work fine with 3.3V power. However, my controller was unresponsive until I gave it 5V. See this site for reference.

Step 4: Breadboard

Breadboard all the connections according to the schematic.

For the Pi connections, I loosely soldered breadboard wires to the GPIO pin holes with just a tiny bit of solder. Later on for final assembly I desoldered them by heating, gently pulling the pins out, and using a solder sucker to clear the holes. For the boost charger, I did solder a pin header in and later cut the black plastic apart and desoldered the header pin-by-pin using the same method as above. Be sure RetroPie boots and your controller inputs work. More on the configuration of RetroPie and RetroArch later in the instructions.

Step 5: 3D Print

3D print the controller back with your 3D printer or your favorite printing service. Pop the switch in to the finished print.

The design files for this project are hosted on Thingiverse

Step 6: Start Assembly

Cut your wires further if you need to and strip & tin the ends. Tinned wires go through holes a LOT easier than when they are not tinned. Braided wire can fray apart and cause electrical shorts if you aren't careful.

Gather the Pi Zero and the PowerBoost module. You'll need them for the next couple of soldering steps.

Step 7: Solder Controller to Pi Zero

Solder the controller connections according to the schematic. A set of helping hands goes a long way here in avoiding frustration.

Turn the Pi Zero over and clip off any extra wire sticking through the back side with a pair of angle cutters.

Step 8: Attach Wire Leads to PowerBoost

Cut, strip, and tin some wire leads. It helps to put the components in the case to judge how much wire you need. Wire ribbon really helps to cut down on the amount of loose wires in your way when putting together the project. Use if if you have it.

Solder the wire leads to the PowerBoost. Turn the PowerBoost over and clean up the back side with an angle cutters.

Step 9: Solder PowerBoost to Pi Zero

Solder the 5V and GND wires from the PowerBoost to 5V and GND connections on the Pi GPIO. Check the schematic for reference.

Clean up the back side of your new solder joints.

Step 10: Solder PowerBoost to Switch

Solder the BAT, EN, and GND wires from the PowerBoost to the rocker switch. Check the schematic for wiring reference. Be sure to put the switch in the case BEFORE you solder the wires on.

Step 11: IPhone Battery Hack

Bonus Edit!

I was able to make this project work with an iPhone 5 or 5S battery replacement with some minor modifications to the battery itself and the 3D print. Using the iPhone battery gives you 3x the battery life as the 500 mAh LiPo. If you don't want to do this, skip this step. Start by using a heat gun to desolder the connectors on the battery. After that is done, you will be left with solder pads. It's very tempting to just remove the ribbon connector altogether and use the solder pads that the battery circuitry connects to. Don't do it though! You'll be left with a raw LiPo with no protection circuitry. This circuitry will protect the battery from over discharge, which damages the cells.

Identify which pads are + and -. See graphic, courtesy of RipItApart. Use a multimeter to confirm that you get about 3.8V. It may register slightly lower than 3.8V because the battery shipped without a full charge.

Solder the 2 wire JST connector, red to + and black to -. Be careful to avoid shorts. You are working in a small area with small solder pads. Give your wires a gentle tug to be sure they soldered to the pads. Again test your leads with a multimeter to ensure you have voltage. Fully charge the battery OUTSIDE and AWAY from flammables. Don't blame me if you charge your cheap Chinese knock off battery inside your house and it catches fire or explodes. Check in on it every once in a while to make sure it doesn't expand or get hot. You are using an Adafruit PowerBoost charger for a battery it was not designed for. Add that to possible shoddy knock off construction and fires are a real possibility.

Once charged, hot glue the battery ribbon down to the battery and glue over all the exposed solder pads. Cover the battery hack with electrical tape over top from one side to another and then around. Modify your 3D print with a pair of pliers. Break off the lower left RasPi Zero mounting post. High-tech and complex, right? :-) Hot glue the battery in place and use one less screw when mounting the RasPi Zero in the following steps.

Step 12: Put All Components in Case

Slip the battery in place and tack it down with either hot glue or double-sided tape. Insert and screw down the PowerBoost and Pi Zero. Be careful with the length of screws you use and how much you tighten them. The screw down posts can be somewhat fragile. If you break one, mend it with superglue or hot glue.

Tidy up your wiring. I coiled and tacked down the extra lead length on the LiPo with hot glue. You want to ensure that the wires do not get in the way of the screw down posts when you are closing up the case.

Step 13: Remove Some Posts on Controller Top

You will have to break some of the posts off on the top part of the NES controller near the directional pad. If you don't, they will impact the rocker switch and your case won't close. See pictures to identify which specific ones. Use a needle nose pliers or angle cutters. No need to be a clean freak about the jagged plastic left over.

Step 14: Close Up the Case

Close up the case. I re-used the screws from the original controller.

Step 15: Load RetroPie

Load the RetroPie distribution to the SD card.

Connect up the HDMI, micro USB adapter, and a USB power cable to the Pi. Connect a hub with keyboard and Wi-Fi or ethernet adapter to the micro USB adapter. Insert the SD card into the Pi. Connect the HDMI cable to your TV and boot it up!

Exit by pressing the F4 key. Press another key to stop EmulationStation from restarting.

Run "sudo raspi-config"

Expand the file system, set your locale, time zone, and keyboard settings and reboot.

Again exit out of EmulationStation and run "sudo raspi-config".

Set the pi user password using the raspi-config or passwd command. Don't be one of those people who leaves a default password in place. Even if this thing isn't connected to the network most of the time, it likely will be at some point when you want to update the distro or add new ROMs.

Step 16: Configure RetroPie and RetroArch

Run "sudo ~/RetroPie-Setup/retropie_setup.sh"

Configure Wi-Fi under Setup/Configuration if you are using a Wi-Fi adapter.

Enable the gamecon GPIO driver. It should appear under the Setup/Configuration menu. It will ask you if you want to enable the configuration for 2 SNES controllers. Even though you're not using SNES controllers, say yes. It will input entries into other files that you will go modify to make it an NES controller. Also say yes to modify the retroarch.cfg file and to permanently enable the configuration.

Exit out to the shell and run "sudo apt-get update" and then "sudo apt-get upgrade" to update the software packages included with the distro.

Run "sudo nano /etc/modules". I'm not going to torture you with vi...

Edit the line for gamecon_gpio_rpi to look like this:

gamecon_gpio_rpi map=0,0,0,0,2,0

Save and exit.

Run "sudo nano /opt/retropie/configs/all/retroarch.cfg". For some reason RetroPie maps the player 2 input to 0 and the player 1 input to 1. They are backwards and this is only a 1 player setup. Scroll down and find "input_player1_joypad_index". Change it to look like this:

input_player1_joypad_index = 0

Change input_player2_joypad_index to look like this (commented out):

#input_player2_joypad_index = 1

Scroll down to the Input Device Buttons section and modify it to look like this:

input_player1_a_btn = 0

input_player1_b_btn = 1

#input_player1_y_btn = 3

#input_player1_x_btn = 2

input_player1_start_btn = 3

input_player1_select_btn = 2

#input_player1_l_btn = 4

#input_player1_r_btn = 5

# input_player1_left_btn =

# input_player1_right_btn =

# input_player1_up_btn =

# input_player1_down_btn =

# input_player1_l2_btn =

# input_player1_r2_btn =

# input_player1_l3_btn =

# input_player1_r3_btn =

Save, exit, and reboot.

Step 17: Load ROMs and Play!

Test out your joystick configuration when EmulationStation boots back up. You should now be able to map button presses to actions in the joystick configuration screen that starts on initial boot.

Copy ROMs to your SD card in the "/home/pi/RetroPie/roms" directory. Ensure you choose the appropriate subdirectory to put them in. In this case, I was only setting up the original Nintendo so I copied my ROMs into the "nes" directory. I found it easiest to copy ROMs using secure copy (SCP) while the Wi-Fi network card was plugged in.

Enjoy gaming and relive childhood!