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!

Comments

author
Kincaid83 (author)2016-07-15

Nice project, would love to have one of these myself but I'm not sure if I'm capable of doing it (especially the soldering, never did that yet).

Would it be possible to fit the pi and a battery competed into an original
NES controller without the 3D printed backside or isn't there enough room? I guess your printed version is a little bit higher then the original.

author

Hi there. Not really feasible. The screw-down posts would get in the way of all the components that need to be put in there. If you didn't mind breaking all of those off and using hot glue to put everything together, it might work...

author
GregW82 (author)2016-07-02

please could someone link me there image working with the buttons working via the gpio as I am encountering errors with the kernel module as this will also be helpful to people who make this in the future

author

Hi Greg. Sorry for the delay in responding. I've been out on vacation. Can you describe in more detail which image you are looking for?

author
DavidF1 (author)2016-03-12

I get removing the original chord for the remote, but won't you still need an hdmi cable out for your video? Isn't there a greater chance of the hdmi chord comming out when the player starts to become aggressive in their movements? Or am I missing something and it has the ability to transmit video wirelessly?

author

Hello. There is an HDMI output on the Raspberry Pi that gets inserted into the controller. The opening in the case for the Pi allows for the HDMI cable to fit snug enough in that unless you are very animated playing your games, you probably won't have any issues.

author

Ok, I get it. I re-read your intro. I missed the part of still having one cable. I thought your goal was to remove all of the cables from the remote.

Have you thought of hacking into a NES console and placing the Pi in there and tapping into the remote receiver on the console? This would make it look more original and it wouldn't require a 3D printer. Tho it does assume you already have an NES.

author

Hi again. I actually have an old NES case that I gutted and put a Pi into for emulation. The drawback on this is that it's a bulky setup and doesn't travel well. It looks nice, but I wanted something I could take with me. Other options for this footprint could include Miracast on the Pi (i.e. Piracast) but then you need Wi-Fi and a receiving device that supports Miracast. Once you add Wi-Fi there goes your battery life...

I like the idea of no cables, but not sure Pi technology is ready for it yet.

author
satchelfrost (author)2016-02-25

Great job! It would be awesome if you did a project like this for N64

author

Interesting idea. It would take some further research though:
1. Will the Pi Zero (or maybe another small computer) have the horsepower to do the 3D video that the N64 needs?
2. How to handle the analog joystick inputs? Pretty sure EmulationStation will handle it, but not sure about the Pi GPIO or if this would have to go through USB.
3. Does the N64 controller form-factor work for stuffing a small computer and battery inside of it?

author

Pi Zero is too weak for most n64 games. (B+ can handle about 20-30% of the n64 games.)

author

Did you enter the Pi Zero contest?

author

I entered the Raspberry Pi 2016 and Hack Your Day contests on Instructables (please vote for me!) and the Adafruit Pi Zero contest on Hackaday.io.

author

Nice! good luck, I voted you.

author
NickF52 (author)2016-02-28

This project gives me a overwhelming urge to try something similar with a GBC

author
StephenN20 (author)2016-02-25

wtg, hell I got an idea for a simi-portable emulator station but I need some help, does anyone know if the "pumpkin" android double din will let you download emulates off the Google market?

author

Sorry. I really don't have any recent experience with Android.

author
JavaProgrammer (author)2016-02-24

very cool! for a larger battery I would recommend looking at an iPhone 5 replacement battery, they are long, skinny, flat and are 1400mah! in order to use it best you may need to remove the cover and ribbon cable at the top, but then you get nice and easy solder pads. plus there pretty cheap, sub $10

author

Good idea. Thanks! I'm going to order one and see if I can shoehorn it in without a major design overhaul. The screw posts that hold the top and bottom together are pretty limiting for battery size.

author
KevinO16 (author)2016-02-23

Nice build! Can't wait to put one of these together.

I've got everything except the pi Zero, any idea where I could get my hands on one? Adafruit/PiHut/element14 are in a sold-out pattern.

author

Thanks!

The only place I've seen them available right now is on eBay. You're going to pay more than street value for them for a while because of market supply issues.

author
wold630 (author)2016-02-23

Great job documenting all your steps! Thanks for sharing your project!

author

Thanks for the encouraging words! It was a challenging design and fun build.

About This Instructable

7,798views

159favorites

License:

More by CircuitsNutsAndBolts:NESPi Controller
Add instructable to: