loading

Introduction

Do you like classic console and arcade games? Are you looking for a fun project with a steep learning curve and a great reward? If so, let's try to put a Pi Zero microcomputer into a SNES controller to emulate and play your favorite 80's and 90's games. We will also add some additional features to keep the fun high:

  • Internal power supply
  • Soft On/Off switch
  • USB ports to charge and for external devices
  • Keep controller functions

We will:

  • Cut plastic
  • Etch and populate circuit boards
  • Solder wires
  • Write some python code

Credits

Anthony Caccese: The build is based on this great video.
Othermod : A good source of inspiration and great tutorials.

What you will notice

  • English is not my first language :-)
  • I will use the metric system
  • Links will refer to german providers

Step 1: Shopping List - Bill of Material

Required Material

  • Raspberry Pi Zero v1.3 - The heart of the build - Provider: PIMORONI, adafruit, PiHut (try to get a kit)
  • Original SNES Controller - That is how we play - Best bet: Ebay (~15 € is a good deal, be aware of fakes)
  • Micro SD Card (4GB+) - This is where our operating system will live - Amazon (check compatibility)
  • 5V power supply with MicroUSB cable - To charge the battery - This or this will do it (~2A, 5V)
  • USB Type A to miniUSB Type B adapter cable - Later we will charge from miniUSB- Amazon
  • Blackberry LS1 battery - Our power supply - fits best - Ebay (the height is the critical parameter and should not exceed 5mm)
  • Li-Ion charging board 1000mA - Charging board for our battery - Ebay
  • Step up Converter - The battery will give ~3,7V but the Pi Zero needs ~5V - Amazon
  • Slide switch - For a very basic on / off switch. This basic switch will just cut the power. This can cause SD card damages.- Amazon
  • Mini HDMI to HDMI Adapter- To connect the Pi and the TV - Amazon (mini HDMI cable is also an option)
  • Wires - To connect things.Try to get a small cross section (e.g. 0,08mm^2) - Amazon
  • Solder - To connect electrical components and wires - Amazon
  • Soldering flux - To create nice & strong solder connections - Amazon
  • Double sided tape - This will keep the battery and the Pi Zero in place
  • Screws and nuts M1,6- We need these to hold down the controller PCB - Ebay
  • Epoxy 2K adhesives (highly recommended) - To keep things in place - Amazon

[Optional] Advanced on / off switch

It's possible to use a simple switch to cut power. But I recommend using a soft On/Off circuit. This will shut down the Pi properly and avoid any SD card damages.

Since we will etch the conductor board ourselves we need few more things.

  • Momentary switch - To turn the system on and off - Ebay, Amazon (fancy with LED)
  • Conductor board without photoresist coating - This will hold our electrical components - Conrad
  • Dual Diode BAT54C - Makes sure that the current runs in the right direction - Conrad
  • Dual Mosfet IRF7319 - Heart of the circuit to switch between on and offstate - Conrad
  • 2x 300k SMD 0805 Resistor - Yes SMD we don't have much room - Conrad
  • Iron(III) chloride - To etch the PCB - !ACID! - Amazon
  • Glossy paper or photo paper - To transfer the circuit layout to the conductor board (any magazine paper will work)
  • Laser printer - We need a laser printer (ink won't work) to print the circuit on our glossy paper
  • Flat Iron - To transfer the circuit layout from our glossy paper onto the PCB
  • Protection gloves and glasses - THIS IS NOT OPTIONAL

[Optional] USB connection

You can cut big holes in your SNES controller in order to have access to the USB capabilities.

Since I do not want to have big holes in my case I will extend the USB connectors from the Raspberry Pi and the power supply.

  • MiniUSB Female SMD Connector - Our final power supply connector - Ebay
  • USB Type A Female SMD Connector (ideal length ~10mm) - Our final USB connector - Ebay
  • Micro USB 5 Pin connector - We need this to extend the micro USB connector comming from the Pi to the USB Type A connector - Ebay

Required Tools

Recommended Tools

  • Third hand - This or your partner will hold the wires - Amazon
  • WLAN stick - Makes installation so much easier - Amazon
  • Micro USB Hub - To attach temporary periphery like keyboard, WiFi etc. The final build will use USB Type A- Amazon
  • Desoldering braid - Good to have if you mess things up - Amazon
  • Multimeter - Conrad

Step 2: Setting Up the SD Card

[Required] Installing Raspbian Linux and Retropie under Windows

In this section, I will describe how to install the required software components. We will use Raspbian Linux as operating system and Retropie as emulation software.

Installing Raspbian Linux & Retropie (also see Github)

  1. Download and install Win32Diskimager - Sourceforge
  2. Download the Retropie Image - Use the "Raspberry Pi 0/1" - Link
  3. Unzip the archive using 7-Zip
  4. Put your micro SD card into the card reader and start the Win32Diskimager
  5. Select the image and output devive and press start

If you have any trouble try this page for further reading.

[Required] Basic configuration

  1. Take your Pi and put in the micro SD card
  2. Connect the HDMI adapter and the micro USB hub with Wifi stick and a keyboard
  3. Connect the microUSB charger to start the Pi
  4. Wait until you see the Retropie main menu
  5. Hold the "Enter" key on your keyboard to configure basic navigation with your keyboard. I used the following mapping:
    Left: left arrow key
    Right: right arrow key
    Up: up arrow key
    Down: down arrow key
    Start: Enter
    Select: Ctrl
    A: "A"-key
    B: "B"-key
    X: "X"-key
    Y: "Y"-key
    Skip the rest holding an arbitrary key. Be patient, the system will need some time to save the changes.
  6. Now we want to make some basic configurations
  7. Press the "A" key to enter the Retropie menu
  8. From here select "Raspi-Config" and hit the "A"-key. This will bring you to the setup section.
  9. Select Option 1 "Expand File System" and confirm your changes. This will increase the partition size on our SD card.
  10. Select Option 4 to setup your time zone and keyboard layout
  11. Select "Finish" in the root menu once you are done and confirm to reboot
  12. To enable Wifi go to the Retropie main menu and select "Retropie Setup"
  13. Select "Configuration / tools" scroll down and select "Wifi - configure Wifi"
  14. Select "Connect to Wifi network"
  15. Select your Network and confirm
  16. Enter your WLAN key and confirm
  17. You should now see your IP address
  18. Exit to the setup main menu

[Required] Installing "gamecondriver"

We need to install the "gamecondriver" in order to connect our SNES controller directly to the Pi Zero GPIO's. The GPIO's (General Purpose Input Output) are the pins on your Pi.

  1. Start the "Retropie Setup" (when you are not already in)
  2. Select "Manage package" in the setup main menu
  3. Select "Manage driver package" and "gamecondriver"
  4. Select "Install from binary" (Wifi required)
  5. Wait until the installation process is finished
  6. Back in the menu exit to the setup main menu and reboot
  7. Back in the Retropie application just hit F4 to exit to the console
  8. Type "cd /etc/modprobe.d" (without exclamation mark) this will change the directory
  9. Type "sudo nano gamecon.conf" - "nano" is a text editor and "gamecon.conf" is the configuration file we need to change. To access the file with administration rights we need additionally the "sudo" command.
  10. Change the string to "options gamecon_gpio_rpi map=0,0,0,0,0,1" - This is because of the wiring we will use.
  11. Press "Ctrl+X" to exit and "Y" to save.
  12. Press Enter to confirm the file name.

[Optional] Shutdown script for the soft On/Off switch

If you want to add the soft On/Off switch, you need to add something to tell the operating system to shutdown when you press the momentary switch. This 'Something' is a short python program. The program will listen to any changes on GPIO 23 and trigger the shutdown command.

  1. Start the Pi and press F4 to exit to the console (if you are not already there)
  2. Type "cd /home/pi" to change directory
  3. Type "mkdir GPIO" to create a new directory for our code
  4. Type "cd GPIO" to change to that directory
  5. Type "sudo nano pishutdown.py" to create a new file for our code called "pishutdown.py".
  6. Add the below-mentioned python code and save the file
  7. You can test the code using "sudo python pishutdown.py"
  8. Since we added an infinite loop, we have to terminate the program using "Ctrl+C"

pishutdown.py

import RPi.GPIO as gpio<br>import time
import os
gpio.setmode(gpio.BCM)
gpio.setup(23, gpio.IN, pull_up_down = gpio.PUD_UP)
def Int_shutdown(channel):
	os.system("sudo shutdown -h now")
gpio.add_event_detect(23, gpio.FALLING, callback = Int_shutdown, bouncetime = 2000)
while 1:
	time.sleep(1)
  1. We will use "crontab" to start the program every time the system starts or reboots - Crontab is a control file to schedule certain tasks
  2. Type "sudo nano /etc/crontab -e"
  3. Add as last line the code below
  4. Save and Exit
@reboot root /usr/bin/python /home/pi/GPIO/pishutdown.py<br>

[Recommended] Backup your SD Card using Win32Diskimager

Step 3: SNES Controller Preperation

Making Room

  1. Open the controller using a small screwdriver (make sure you keep the screws)
  2. Detach the cable from the controller board by pulling it out
  3. Remove all other loose parts like buttons and rubbers (yes... keep them)
  4. Use a side cutter to remove the connector and desolder the remaining pins from the other side using your desoldering braid (video tutorial 4:30min). We will later connect some wires from here to the Pi Zero.
  5. Solder new nice contact points for the 5 pads
  6. Use a side cutter and/or a rotary tool to remove the plastic parts shown in the first picture. Please wear some EYE PROTECTION when using a rotary tool.
  7. Flatten things with sandpaper.

Step 4: Power Supply

[Optional] Controller Board Fixation

Before we start wiring the power supply, we need to make sure that the controller board will sit tight next to the controller buttons. Since we removed the mount for the left screw we will simply add a new one:

  1. Drill a small 1,6mm hole at the position shown in the second picture
  2. Plug the screw in the controller board
  3. Put the controller board in the case and measure the required screw length
  4. Cut the screw with a rotary tool if necessary
  5. Take the controller board out and mix some Epoxy 2K adhesives and put some on the bottom of the case (where the screw will touch the case)
  6. Put the controller board with screw back in the case and align the screw
  7. Wait until the adhesive is hard enough to remove the board without the screw
  8. Add additional epoxy to fix the screw
  9. Remove the top of the small plastic pillar in the middle of controller board

Wiring The Power Supply

  1. Place the battery on the left side (see picture) and make sure that the battery is not covering the screw holes.
  2. Mark the position of the battery with a pencil
  3. Place the charger and the step-up converter to the right.
  4. [OPTIONAL] If you want to charge with the micro USB coming with the charger, place the charger right next to case wall.
  5. Solder some wires from the positive and negative battery pad to the corresponding pads on the charger board (How to solder wires). Don't change polarity!
  6. The charging board delivers only 3,7V. To boost the voltage to 5V (required for the PI) we need to connect the charger output to the step-up converter. We will later add the soft On/Off circuit between the charging board and the step up converter.
  7. Make a short test charging the battery. If you have a voltmeter, measure the voltage output coming from your converter. It should be around 5V+
  8. Use double sided tape to fix the battery, the charger, and the step up module

Basic Power Switch

I do not recommend a basic on / off switch because of possible SD card damages. But it's much easier to build.

  1. You need some sort of switch (e.g. a slide switch)
  2. Find a good place for your switch (see the last picture)
  3. Solder the switch between the positive output of the charger output and the boost converter (see scheme picture)
  4. Test it

Step 5: Optional - Advanced on / Off Switch

The soft On/Off switch will shut down the system and turn it on. Therefore we need a small circuit with two transistors. Here you can find a detailed explanation how the circuit works (credits to Othermod!).

I used eagle to design the PCB layout. There is a basic 'free to use' version.

Etching the PCB

There are a lot of Instructables out there with a detailed explanation (e.g. this one). Here is my own short version.

  1. Print out the PCB circuit template (see SoftOnOffSwitch.pdf) on glossy paper (e.g. magazine paper) with a laser printer (ink will not work)
  2. Measure and draw the PCB dimension on the conductor board (approx. 1,1cm x 1,8cm)
  3. Use your Dremel or a metal saw to cut the conductor board
  4. Get your flat iron and ironing board and put the template onto the PCB (printed side onto the copper side)
  5. Iron the PCB with the template (take your time)
  6. Peel off the paper with some water (slowly)
  7. NOTE: If it is not perfect use a water resist marker (like a black Edding) to fill gaps
  8. Get a plastic container, safety gloves and the etching solution (ferric chloride)
  9. Pour the etching solution in the container and leave the board for approx 45mins
  10. Take out the board with a tweezer and rinse with clear water
  11. Take some sanding paper and remove the ink

Soldering the components

  1. Look at the PCB layout and solder each of the components (BAT54C, 2 x 300k resistor, IRF7319)
  2. Attention: the dot on the housing indicates the correct orientation of the IRF7319.
  3. I used this technique to solder the SMD components. I can't explain it any better.
  4. Add wires to the pads like shown in the picture

Step 6: USB Connectors

In this section, we will add two USB ports. One for charging the battery (mini USB) and one for the USB OTG port.

MiniUSB Charging Port

  1. Mark the outlines of the mini USB connector on your controller case. I used an ink pad with the USB connector as a stamp in order to get exact outlines.
  2. Use your rotary tool and cut along the outlines. I used an engraving tool.
  3. Use a rasp to get a good finish (this set is pretty good)
  4. Solder a wire for ground and VCC at the USB connector (see picture)
  5. Mix some 2K adhesive and glue on top of the wired pins in order to get a strong connection.
  6. Put the USB connector in the case
  7. Use the 2K adhesive on all sides of the connector. Don't glue the bottom side directly on the controller. Otherwise, it's pretty hard to plug in the cable later on.
  8. Wait until the adhesive is hard enough
  9. Solder the ground and VCC wires to the corresponding pad on the charging board.

USB Type A Connector

  1. Solder the wires for ground, VCC, data- and data+ to connect the micro USB male connector to your USB Type A connector (see picture). The micro USB from the Pi Zero will sit later above the USB Type A connector. So keep the wires short.
  2. I highly recommend putting some 2K adhesive on top of the soldered connection.
  3. Mark the outlines of the USB connector on your controller case. Again, use an ink pad if possible.
  4. Cut the case along the outlines
  5. There are two small pressure pads on the top side of the USB connector. Since we will assemble the USB connector upside down we need to bend and cut the pads, so that ~1mm of pads will remain. If we don't cut the pads, it will be very hard to plug in the USB cable later on. If you use a longer USB connector (>10mm) you don't necessarily have to do this.
  6. Cut some small slots in the controller case. These slots will borrow the remaining 1mm pads.
  7. Cut and rasp until everything fits. Also, double check if the SNES controller board still fits.
  8. Glue the USB connector in place using the 2K adhesive.

Step 7: Wiring and Assembling

Wiring Everything Together

  1. Solder five wires on the bottom side of the controller board
  2. Glue the soft On/Off circuit board in the middle of the controller case
  3. Place all the buttons and rubbers
  4. Mount the controller board
  5. Plug in the miniUSB male adapter into the Raspberry Pi
  6. Attach the Raspberry Pi with double sided tape on top of the battery
  7. Start soldering the miniUSB power supply wires to the charger board (see schematic)
  8. Next solder all the wires for the on / off switch (see schematic)
  9. Finally, solder all the wires coming from the SNES controller board (see schematic)

HDMI Adapter

  1. Cut the mantle of the HDMI adapter in order to pass the battery
  2. Cut a hole, corresponding to the size of your HDMI adapter, in the SNES cass

Final Touch

  1. First, we need to fix the trigger buttons. There is not enough room for the bearings. Use sanding paper to flatten the bearings until they fit.
  2. Assemble the trigger buttons
  3. [Optional] Drill a hole in the middle of the case to reduce the heat coming from the Pi
  4. Close the case and turn in the screws

Step 8: First Start & Adding ROMs

First Start

  1. Plug in an HDMI cable and connect a keyboard
  2. Hold down the momentary switch for 2s. The Pi Zero should boot
  3. Once the menu is displayed press select on your keyboard and select "Configure input"
  4. Configure your SNES controller

Adding Game ROMs

You have to own the original game in order to use a game ROM on your Pi.

There are several ways to add game ROMs to your Pi. I will describe a simple method using a USB drive.

  1. Plug in a USB stick in your PC and create a folder called "retropie" in the root folder
  2. Plug in the USB stick in your Pi and wait until it boots up - This will automatically create a folder structure on your stick with all supported consoles
  3. Take out the stick and copy your gaming ROM's from PC in the corresponding folder
  4. Plug the stick back in the Pi and boot. The games should show up.
<p>That is Awesome! By far the best application of an Pi Zero that I have seen yet. I am going to try to do this with my old NES system.</p>

About This Instructable

3,799views

107favorites

License:

More by HolyIceCube:Raspberry Pi powered SNES Controller 
Add instructable to: