Celebrate the 25th anniversary of that classic gaming device by building your own with 3d printing and DIY electronics from adafruit. In this project we'll use a raspberry pi and TFT touch screen to make an epic DIY gamegirl.

Since it's a Raspberry Pi Linux computer, we can run differerent emulators on it. We happen to be partial to 8-bit NES but there's also MAME support and maybe you could even hack-in support for your favorite old console!

The 3d printed enclosure will house all the components and can be printed in your favorite color. We'll hack an SNES gaming controller and reuse the printed circuit board, buttons and elastomers.

This is for the Raspberry Pi Model B - Rev 2. The Rev 1 and Rev 2 have different indexes for the GPIO pins. There is a controller issue with the Rev 1, please follow this guide to fixing the problem. http://forums.adafruit.com/viewtopic.php?f=19&t=53557

Designed to Print

This project is just two pieces! They are optimized to print on any FDM 3d printer with a minim build area of 150mm x 150mm x 100mm. Perfect for printing your Printrbot, TAZ4, RepRap or makerbot. Check out info below for recommended slicer settings.

piboy-top.stl
piboy-bottom.stl
PLA @230
2 shells
10% Infil
0.2 layer height
90/120 speeds
No Raft 
No Support

Snap Fit

The two pieces snap together and are secured with philips screws. The Raspberry Pi, PowerBoost 500 and Micro Lipo charger are mounted to the piboy-bottom.stl part with #6-32 x 1/2' phillips screws.

Favorite Color

The tolerances are optimized for PLA filament but may work with ABS and other material types. Since the enclosure is only two pieces, it's easy to swap out cases for different colors!

No Support

This design is optimized to print with no support material.
The illustration below is a reference of the power circuit and the game controller buttons. The position of the components are not exact and not to scale.

Power Circuitry

We'll be using a large rechargeable battery to power the PiGrrl for a few hours! To keep the battery recharged, use a MicroLipo or MiniLipo board (they're the same basically, just one has a microB jack, the other has a miniB jack)
The good thing about this battery is it's fairly small and dense. But it doesn't have 5V output, it only has aboue 3.7V output. And you really need 5V. So we'll use a PowerBoost500 which can boost the 3.7V up to a nice clean 5V which the Pi likes very much.

When the battery dips too low, a red light on the PowerBoost will light up to warn you its time to recharge!

You can recharge and play at the same time

Keypad Circuitry

In order to make the control pad feel just like the original, we'll 'recycle' a SNES controller. By opening it up and cutting out the PCB we can reuse the rubber elastomers and buttons.

The way the keypad works is super-simple. Each elastomer has a piece of conductive material on the back. When it presses down onto the PCB, it shorts two golden pads together. One pad is ground, the other pad is the signal. We'll reuse the CupCade GPIO code so that each pad is one RasPi pin. When that pin is shorted to ground, we'll generate a keypress
Your keypad may be slightly different looking! Don't worry! Just trace out the copper to identify the common ground trace for each set of buttons!
Below is a list of Raspberry Pi connections that will be wired to the corresponding buttons. 1-26 are the number of wires in a Pi cable bundle, with 1 being the white (ground) colored wire. We dont connect to the last 6 pins because those are used for the PiTFT display!
  1. n/c - not connected (3v3)
  2. connect to output of PowerBoost500 (5v0)
  3. LEFT BUTTON (SDA)
  4. n/c (5v0)
  5. RIGHT BUTTON - (SCL)
  6. connect to ground of boost (GND)
  7. DOWN BUTTON (GPIO #4)
  8. n/c (TXD)
  9. connect to ground on Dpad (GND)
  10. n/c (RXD)
  11. UP BUTTON (GPIO #17)
  12. START BUTTON (GPIO #18)
  13. A BUTTON (GPIO #27)
  14. Select/start ground pad (GND)
  15. B BUTTON (GPIO #22)
  16. SELECT BUTTON (GPIO #23)
  17. n/c (3v3)
  18. n/c (GPIO #24)
  19. n/c (MOSI)
  20. AB BUTTON ground pad (GND)
  21. n/c
  22. n/c
  23. n/c
  24. n/c
  25. n/c
  26. n/c

2.8' PiTFT Mini Kit

Our 2.8' touch screen kit includes the goodies you'll need for assembling the screen. You just need to solder the extra tall male and female 2x13 headers to the PCB. Be sure to check out our step-by-step guide by clicking the link below!

Assembly Tip

Here's a quick tip on soldering those headers. If you have any fun-tac, place a bit of tac on sides of the headers to hold them in place while you solder and remove it when you're done.

Jump 500mAh Mini Lipo

Bridge the 500mAh connection on the micro lipo usb lipoly charger by applying a good amount of solder to the two golden pads.
This will make it so you charge the battery at 500mAh for a fast charge rate

Set JST Wire

Grab a set of wires with a JST male connector that's about 60mm in length (you probably have the one that came with the miniLipo charger!) Insert the positive and negative wires through the right mounting hole. Strip the wires and place the exposed wire into the GND and BAT pins.

Solder JST to MiniLipo

Flip the charger over and solder the black wire to GND pin and red wire to BAT
This cable will let you connect to the PowerBoost easily

Check 5V LED

Plug in the battery with a JST connector to the MiniLipo charger. Plug the JST from the charger to the PowerBoost 500. Check to see if the green LED lights up on the PowerBoost. If it does, it totally works and is Boosting fine!

On Off switch

The boost converter has true-disconnect capability so we can just tie the ENable pin low to do a complete power shutdown

Slide Switch

Secure the slide switch to a third-helping hand. Tin the two terminals of the slide switch. Solder two wires (about 80mm in length) to the slide switch. Solder one wire to an outer most terminal and the other to the middle terminal.

PowerBoost 500 Switch

Secure the PCB to a third-helping hand and position the two wires from the slide switch wire to GND and EN pins.

Solder Switch to PowerBoost 500

Flip the PCB over and bend the exposed wires down to secure them while you solder the EN and GND pins.

Enabled Switch

With the switch now soldered to the EN pin, it can safety power on and off! Try flipping the switch to see the green LED turn on and off

Power Circuit Setup

With the parts all wired up, you can insert the slide switch into the piboy-bottom.stl part through the switch hole on the side.
Feel free to take a break after completing this section and play some Mario Kart or have a refreshing drink

2200 Lithium Ion Rechargeable Battery

This battery may come with a set of two wires that have a male JST connector. You'll need to trim that wire down to about 6mm and solder it to the set of wires that are soldered to the end of the battery. Be sure to tin the wires and use heat shrink tubing!
We'll be recycling a GPIO cable for the Raspberry Pi to get to the many wires necessary!
Before chopping off the connector, check to ensure it's the right end.

Cut Connector

Use a pair of wire cutters to snip off the connector.

Pull-n-Peel

Separate the Pi cable wires and familiarize yourself with the wiring list outlined in the circuit diagram. Use a wire stripper to strip the ends of the individual wires.

Pulled Wires

The wires can be pulled all the way but peeling it half way ensures it stay neat and tidy once its connected to the Raspberry Pi.

Snip Set of Wires

Remove the last 6 wires from the bundle, we won't be needing them in this build. This is the OPPOSITE end from the one with the white wire!

Optimize Wires

Also remove wires #1, 4, 8, 10, 17, 18, 19. We won't be needed these also, so trim them down!

Install Pi Cable

If the PiTFT screen is attached to the Raspberry Pi, remove it and add the Pi Cable in the correct orientation, with the middle sockets lined up and the arrow pointing to the white wire.

Upcycling the SNES controller

You'll need to gut a SNES gamepad controller and use the buttons, elastomer gaskets and PCBs. Start off by disassembling the controller by removing the screws in the back of the controller.

Disassemble Gamepad

With the back plate removed, carefully remove the cable from the enclosure followed by the PCB, elastomer gaskets and buttons.

Unsolder main cable

Secure the gamepad PCB to a panavise jr. or third-helping hand. Heat up your soldering iron and unsolder the 5 small wires from the main cable.

Separate the PCB

We'll need to separate by PCB into three pieces - DPad, A+B , Pause + Select. You have the option to choose your preferred method. We found using a Dremel resulted in a higher quality than using super scissors.
Be extremely careful when using power tools and sharp tools. Wear protective eyewear. Only in an area with proper ventilation. Consider wearing a dust mask. Use a proper vise to secure PCB while cutting.

Etching Traces

Use an xacto knife or razor blade to expose the needed traces that will wire up to the Pi cable. Follow the photo above and the circuit diagram to reference solder points.

Tin PCBs

Now that your PCBs are cut and etched, you'll need to tin the pads with a bit of solder. Again, use a panavise jr. or third-helping hand for assisting while you solder. The SNES controllers tend to use phenolic PCBs which do not take extended heat as well as FR4 so work quickly and studiously!

Left DPad

Solder wire #3 to the left button on the exposed trace of the DPad PCB. There's a small hole you can thread the wire through.

Right DPad

Solder wire #5 to the right button of the DPad PCB.

Down DPad

Solder wire #7 to the down button of the DPad PCB. Tweezer are handy while soldering!

Common DPad

Solder wire #9 to the ground of the DPad.

Up DPad

Solder wire #11 to the up button of the DPad.

Start Button

Solder wire #12 to the start button on the start+select PCB.

A Button

Solder wire #13 to the A button on the A+B PCB.

Common Start + Select

Solder wire #14 to the ground of the start+select PCB.

Check your work

Put the soldering iron down and double check all the wires are soldered to the right buttons.

B Button

Solder wire #15 to the B button on the A+B PCB.

Select Button

Solder wire #16 to the Select button on the Start+Select PCB.

Common A+B

Solder wire #20 to the common ground of the A+B PCB.

Last Check

Take one last pass at the wiring and reference the list in the circuit diagram. If everything looks good, move onto the next page!

Setting Up SD Card

Since we're using the same controller setup at the CupCade we're also going to use the same SD card image! Download this image which has NES support
This is a big file (about 840 megabytes) and will take a while to transfer.

After downloading, the disk image needs to be installed on an SD card (4GB or larger). If you’re new to this, the process is explained in Adafruit’s Raspberry Pi Lesson 1.

Configuring Pi

Attach a keyboard to the PiTFT+Pi and insert the new CupCade SD card.
The Pi may boot and reboot to finish the configuration (such as expanding the image)
Once you boot the Cupcade you'll notice that the display is vertical. You'll have to rotate the screen!

Press Alt-F3 to drop out of the GAMERA software and to the shell. Log in with pi/raspberry and edit /etc/modprobe.d/adafruit.conf with sudo nano /etc/modprobe.d/adafruit.conf
and change the fbtft line to this:
options fbtft_device name=adafruitts frequency=80000000 fps=60 rotate=270
Then sudo reboot to have the new rotation activate!

You can always nicely shutdown with a keyboard attached by typing ESC which will quit the emulator/GAMERA

Upload ROMs

Your PiGrrl can run MAME ROMs as well as NES! We have documenation on how to install ROMs over on the cupcade tutorial page
For MAME ROMs, you'll only be able to play 'horizontal/landscape' style ones!
For NES ROMs, you need to use .nes file format (not .ZIP!) and place them in the following directory path.

~/BOOT/fceu/rom

All of your NES ROMs need to be in this folder in order for the emulator to run them!

Connect Pi Cable

Insert the Pi cable into the back of the Pi TFT in the correct orientation.

Keyboard + Power

Test the circuit with a USB micro cable connected to the micro USB port on the Raspberry Pi. Connect a USB keyboard to the side of the Pi for input.

Check Boot

The PiTFT should boot up into the Game ROM Aggregator

Remember you have to set up the screen rotation to be 270 so check the previous step if you haven't done that yet!

D-Pad Test

Lay the D-Pad elastomer gasket over the PCB and place the plastic part on top. Press the D-Pad up and down to test for a solid connection.

More Buttons!

Add the rest of the elastomer gaskets and select a game to play test.

Play Test

Run Mario or something similar to test out the latency. It may be a little difficult to play like this but will feel more natural with the top part on.

Mounting Raspberry Pi

The Raspberry Pi is mounted to the piboy-bottom.stl part with 2 #6-32 x 1/2' Phillips screws. Position the Pi into the bottom enclosure and hold it in place while you fasten the two screws.

The Last Two Wires

Solder wire #2 to the Positive+ pin and #6 to Negative- pin on the PowerBoost 500.

Solder Negative

Solder wire #6 to the negative- pin on the PowerBoost 500.

Mounting LiPoly Charger

The MiniLipo charger is mounted to the piboy-bottom.stl part with 2 #4 x 3/8' flat Phillips screws. Position the charger near the bottom right of the enclosure with the USB port facing the hole.

Mounting PowerBoost 500

PowerBoost 500 is mounted to the piboy-bottom.stl part with 2 #4 x 3/8' flat phillips screws. Lay the PCB in the center of the part, just below the Pi with the JST facing towards the bottom. Hold it place while you fasten the screws.

Mounting Battery

Position the 2200mAh lithium battery to the bottom of piboy-bottom.stl with the wires facing up. Press it into the clips to snap it into place.

Installing Gamepad PCBs

Grab a chunk of fun-tac or putty and separate it into three pieces. Roll these pieces into strands and carefully tac them to the surface of the three pillars in the center of the piboy-bottom.stl part.

Position the three PCB over the corresponding platform and press it down to hold it into place. Lay the piboy-top.stl part over and check to see if the traces line up with the button cut outs. Keep adjusting and checking the position of the races to get consistent alignment.

Once you have good alignment, hold the piboy-top.stl part with the inside face up. Place the buttons and elastomer gaskets into the enclosure. Still holding the top part, grab the piboy-bottom.stl (containing all ze electronics) and place it top of piboy-top.stl and snap them together.

Closing Enclosure

Use 4 #6-32 x 1/2' flat Phillips screws to secure the piboy-bottom to the piboy-top.stl
Buttons aren't working
Make sure the pads align up with the PCB
Buttons too hard to press
Elastomers might have slipped when closing the case. Make sure the wires aren't obstructing any of the pillars.
The D-Pad kinda works, like 2-3 of them do, but 1 or 2 don't
This is the toughest part of the project: you have to make sure that the d-pad is centered just right over the d-pad PCB and elastomers. Its not easy to get it lined up right but if it's off by a few mm you'll notice its hard to get the button to 'register'
Power randomly shuts down
Make sure the solder points on the charger and PowerBoost aren't loose.
Takes too long to fully charge battery
Make sure the lipo charger is shorted to charge at .5A
Enclosure won't close
Check that the wires aren't in the way of any of the pillars or buttons.
How do I quit a game?

Press both SELECT and START rubber buttons together for three seconds to quit back to the main menu

How do I shut down the PiGrrl?

From the main menu, press both SELECT and START rubber buttons together for three seconds to shutdown cleanly. Once you see that the screen says the Pi is 'halted' you can switch it off

This guide was first published on Jul 02, 2014. It was last updated on Jul 02, 2014.