Introduction: GamePi - the Handheld Emulator Console

Intro:

This instructable describes the build of a Raspberry Pi 3 powered handheld emulation console - I've baptized it GamePi.

There are a lot of similar instructables for such devices but for my taste most of them are either too big, too small, too complicated or I just do not like the look.

This is the second version of my GamePi device (I did not write an instructable for the first one). The main difference between the old one and this are the analog joysticks and some minor improvements.

If you like the GamePi check out my page AraymBox for other versions and the upcoming devices. You can also post ideas on how to improve the design - just let me know

Other Versions:

  • There is an updated version of this GamePi - Version 2.1. It combines all the good stuff of my other device.
  • Check out my new alternation of this GamePi - the GamePi Zero. It's cheaper, smaller and lighter.
  • If you like it super affordable and simple you should take a look at the GamePi XS - a console in a controller.

Note:

Please note that English is not my first language. If you find any mistakes or something is not clear feel free to tell me and I'll try to fix it. Same goes for general mistakes.

This is my very first instructable so if you have any suggestions for improvements please let me know.

Step 1: Tools & Materials

Make sure you have everything you need for the build. There is nothing more annoying than stopping your project because you have to wait for some small part being delivered.

You do not have to buy the listed parts and material from the amazon links. These are examples and show the required properties of the parts.

Parts:

Consumables:

Tools:

Step 2: 3D Printing the Case

I've designed the case to be as simple and small as possible. There is only the bare minimum of single parts: case front and back and buttons.

The case front and back fit perfectly on a 20x20cm 3D printer bed if you rotate it 45 degrees.

I've printed my case with black ABS filament. I like printing with ABS because I love the post processing possibilities. You can sand, cut, paint and most important you can glue or fix it using acetone.

If you have a 3D printer with a smaller bed or no printer at all you can use a 3D printing service like 3D Hubs, Thingiverse, Pinshape, etc. to print the parts for you for some money. Or PM me - maybe I'm in the mood to print it for you.

Download:

You'll find the 3D files on this page (I'll keep it there to avoid redundancy):

https://www.prusaprinters.org/prints/149804-gamepi-2

Step 3: 3D Print Post-processing (Case)

Depending on your taste this step is optional.

3D printed parts are not perfect - they have small cracks, holes, bubbles, visible layers, etc. If you want a decent smooth glossy look you have to take an extra step and post process the parts.

Here are the steps I've done:

1. Clean drill the screw holes:

Use the M2 and M3 drill bits and clean the holes for the screws.

2. Clean holes and edges:

Use the appropriate file to clean all holes and edges.

3. Sand the case front and back:

  • run 1: use 120 grit sanding paper
  • run 2: use 240 grit sanding paper
  • run 3: use 600 grit sanding paper
  • run 4: use the wet extra fine sanding sponge

4. Clean the parts:

Wash the parts with clear water and let them dry

5. Paint:

  1. Spray a thin layer of paint primer. Let it dry for 24 hours.
  2. Check the surface.
  3. Spray a thin layer of paint. Let it dry for 24 hours.
  4. Soft sand the surface with a dry extra fine sanding sponge
  5. Spray a thin layer of paint. Let it dry for 24 hours.

Step 4: 3D Print Post-processing (Buttons)

Depending on your taste this step is optional.

Here are the steps I've done to make the printed buttons look like they do on the pictures:

Sanding:

  • Sand all buttons using 240 grit sanding paper.
  • Sand all buttons using 600 grit sanding paper.

Labels:

  • Fill the "engraved" labels with the white wood filler using your fingers.
  • Let the filler dry for 24 hours.
  • Remove the excess filler using 240 and 600 grit sanding paper.

Finish:

  • Clean the Parts with a wet cloth.
  • Spray a thin layer of clear varnish on the buttons.
  • Let the clear varnish dry for 24 hours.

Step 5: Buttons (Software)

In this step we want to write the button control code to the Teensy LC. The Teensy will register the button clicks and joystick movement and send the signals to the Raspberry Pi via USB.

Install the Framework

  • In order to compile the code and write it to the Teensy you'll need the Arduino Framework and the Teensyduino support files.
  • Follow this tutorial to install both.

Load and write the code

  • Connect the Teensy LC to your PC (it should be detected automatically if you are using Windows).
  • Download the attached code file.
  • Double click the downloaded file. The arduino IDE should start.
  • Select the Teensy LC board (in the menu bar: Tools > Board > Teensy LC)
  • Select the correct port the Teensy is attached to (in the menu bar: Tools > Serial Port > COM x)
  • If you connect the buttons like shown in the picture you can use the attached code.
  • If you connect the buttons in any other way you'll need to modify the attached code.
  • Write the code to the Teensy LC (in the menu bar: Sketch > Upload).

Step 6: Buttons (Hardware)

Now we want to build the controls and connect them to the Teensy.

Cut the PCB

  • Use some kind of saw (I used a bread knife) to cut the double-sided PCB.
  • You can see the size of the needed pieces in the pictures (count the holes).
  • You need 2 pieces of every PCB (cross-, button-, Start/Select-PCB).
  • Carefully drill the 3mm mounting holes (see pictures for location) in each PCB.

Solder the switches to the PCBs

  • Use the hard click tactile switches for the Start and Select button PCBs and the soft tactile switches for all other PCBs.
  • Insert the legs of the switches into the correct holes of the PCB (see pictures).
  • Double check the correct position.
  • Solder the legs to the backside of the PCBs.

Step 7: Assembly

After finishing all PCBs you can now assemble the device.

After this step your build should look like the one in the picture.

Threading the screw sockets:

  1. Use the M2 drill bit to clean the screw holes.
  2. Use the M2.5 thread tap and slowly cut the thread into the holes. (You can skip this step if you do not have the thread tap but be careful when screwing in the screws as the plastic sockets could break when too much force is applied.)

Display:

  1. Connect the display to the raspberry pi according to the display manual (connect GPIO bar, attach the HDMI connector).
  2. Slide the two top "nipples" (see picture) of the display into the two holes in the case top side.
  3. Secure the display by screwing to lower two "nipples" of the display to the case.

Button PCBs and Joysticks:

  1. Put the buttons into their holes.
  2. Put the PCBs on the sockets according to the picture and screw in the M2.5x8 torx screws.
  3. Be careful as the plastic sockets could break if to much force is applied.

Step 8: Wiring

The following steps describe how the single parts are being connected.

After all wiring steps your device should like the one on the picture.

  • I like to use the single wires inside LPT cables (or parallel cables). There are 25 wires in such a cable - they are color coded and they are very cheap.
  • When soldering I like to apply solder on the wire and on the PCB first. This way it take a little bit more time but it's easier when working in smaller cases/enclosures.

Step 9: Wiring: Teensy LC

We're going to start with the component most of the wires are connected to. In this step you'll need to solder 27+ wires - hurray.

Always double (and triple) check your soldering.

Connect the Buttons and Joysticks:

  • The pictures in this step and in Step 6: Buttons (Hardware) show all wiring points.
  • Start off with the ground line. The ground line is connected to all of the buttons and joysticks.
  • Now you can connect all signal wires to the buttons.
  • When connecting the joysticks check the labeling of the pins and make sure you use the correct ones.
  • Each joystick uses two potentiometers - so they have to be connected to the 3.3V power output of the Teensy LC.
  • If you want to test the controls first, do not connect the Tennsy LC to the Rasperry Pi yet.

Testing the controls (optional):

  • After writing the code on the Teensy LC and soldering all buttons and joysticks you can test the controls.
  • !!! Make sure you did not connect the Teensy LC to the Raspberry Pi yet. If you already did disconnect it. !!!
  1. Connect the Teensy LC to your Windows PC using a USB cable.
  2. Windows should detect the Teensy LC and install it as a joypad/gamepad.
  3. Press the WindowsKey+R to open the Run dialog.
  4. Enter "joy.cpl" and press Enter.
  5. Select the Teensy and click Properties.
  6. Press any of your buttons and see if something happens in the Test tab.
  7. Check all buttons. If some of them are not working check you wiring. If none of them work check the code. If the Teensy LC is not recognized by Windows rewrite the code to Teensy.
  8. If the tests were successful disconnect the Teensy LC from the PC.

Connect Teensy LC to the Raspberry Pi:

  • I've soldered the Teensy directly to the Raspberry Pi USB pins. This way a lot of space is saved which would have been wasted by USB cables.
  • Use the picture to connect the Teensy and the Pi.

Step 10: Wiring: Sound

In this step we will wire the amplifier PAM8403, the volume control, the switched audio jack and the speaker.

With this setup you have the possibility to control the volume with the hardware wheel and redirect the sound from the speaker to headphones if plugged in.

Or -if you want- you can omit the volume wheel and the audio jack. This way you have to control the volume using a software solution on the Pi. But for now we stick with the full feature setup.

Soldering:

  • Solder the wires according to the picture.
  • This setup does not use the audio jack of the Pi in order to save space. Solder the audio wires directly to the Pi test pads:
    • audio ground (black line in the picture) is soldered to PP6
    • left channel (green line in the picture) is soldered to PP25
    • right channel (blue line in the picture) is soldered to PP26
  • The amplifier needs 5V power. Solder it to the 5V GPIO pin and the ground pin of the Raspberry Pi (see picture).
  • !!! Double check polarity !!!

Install the sound components:

  • Put the switched audio jack into its mounting hole and secure it with the nut.
  • Use hot glue to glue the volume wheel to the wall of the case so a part of the wheel sticks out of the case front. Do not use to much glue the wheel must turn.
  • Put duct tape all over the amplifier to isolate it and fit it between the display and the Raspberry Pi.
  • Fit the speaker wherever some space is left.

Step 11: Wiring: External USB Port

For the easiest part of wiring we're going to add the external USB jack.

This external USB port in the case is quite useful if you want to add additional peripherals such as a keyboard, a second controller for player two or something else running via USB.

Soldering:

  • Well ... connect the USB jack according to the picture.

Install the component:

  • Insert the USB jack into its hole in the GamePi case.
  • Plug in some USB device (should be a consumer, e.g. a keyboard or thumb drive) so the glue does not run into the port.
  • Use hot glue to secure the USB jack. Do not use to much glue since it can clog the jack.

Step 12: Wiring: Power

Now we are going to add some power to the system.

In this step you should as often as possible check the polarity of your soldered wires.

Disassemble the PowerBank:

  • Disassembling the powerbank is easy as the case is quite thin.
  • Use a screwdriver or smash the case against the floor to open it.
  • Remove the battery and the electronics.
  • Unsolder the battery from the electronics.

Soldering:

  • Connect all components but the battery according to the picture.
  • Again this setup does not use the micro USB jack of the Pi in order to save space. Solder the wires from the slide switch directly to the Pi test pads. There are several solder points where we could feed the Pi with 5V, e.g. the GPIO pins - but we're going to use the first possible point after the Pi's power USB jack. This way the incoming 5 Volts have to pass a fuse and the Pi is protected if something bad happens:
    • the positive 5V wire (red line in the picture) is soldered to PP2.
    • the negative GND wire (black line in the picture) is soldered to PP5.
  • !! Before adding the battery double check polarity on every component. !!
  • Add the battery.

Install the power components:

  • The powerbank electronics should already be mounted to the back piece of the GamePi case.
  • Insert the micro USB jack into its hole in the GamePi case.
  • Use hot glue to secure the micro USB jack. Do not use to much glue since it can clog the jack.
  • Insert the slide switch into its hole in the GamePi case.
  • Use hot glue to secure the slide switch. Do not use to much glue.
  • Use hot glue to stick the battery to the back of the display. Do not use to much glue.

Step 13: Installing RetroPie

Since the hardware part of this project has been finished we can now take a look on the software.

In this step we're going to download all needed software, write the RetroPie image to the SD card, start and configure emulationstation.

Required Software:

  • Download the pre-made RetroPie image for the Raspberry Pi (the red "Raspberry Pi 2/3" button). This is basically the operating system of this console. Of course you can use whatever you want on the Pi - there are dozens of other solutions.
  • Download and install 7-zip - a free file de/archiver. We need it to unpack the RetroPie image archive.
  • Download and install SD Memory Card Formatter. As the name says this tool formats SD memory cards.
  • Download Win32 Disk Imager. We need this tool to write the unpacked RetroPie image to the SD card.

Preparing the SD Card:

  1. Plug the SD card into your Windows PC.
  2. Make sure Windows detects the card.
  3. Open "My Computer" or "This Computer" or the Windows Explorer and remember the drive letter of the SD card. In my case it was F:\ (differs from systems to system). Make sure it's really the letter of the card and not some of your harddrives.
  4. Start SDFormatter.exe, select your drive letter from the "Drive:" dropdown menu and hit the Format button.
  5. When formatting has finished close SDFormatter with the Exit button and unplug the SD card.

Write the RetroPie image to the SD card:

  1. The downloaded RetroPie archive should be called something like "retropie*.img.gz".
  2. After installing 7-zip right click the RetroPie archive and select 7-Zip from the context menu. Select "Extract Here" and wait for the unpacking to finish.
  3. Plug the SD card into your Windows PC. Make sure Windows detects the card and again remember the drive letter of the SD card.
  4. Start Win32 Disk Imager.
  5. Select the unpacked RetroPie image from the field "Image File".
  6. Select the drive letter of the SD card from the "Device" dropdown menu.
  7. Click the "Write" button and wait until the writing finished.

Configure the Display:

  1. With the SD card plugged in your PC navigate to the content of the card.
  2. Open the file "config.txt".
  3. Append the following lines at the end of the file, save the file and unplug the SD card:
max_usb_current=1 
hdmi_group=2 
hdmi_mode=87 
hdmi_cvt 800 480 60 6 0 0 0 
hdmi_drive=1 
display_rotate=2 
lcd_rotate=2 

Step 14: Configuring RetroPie

Time to boot up the whole thing!

  1. Insert the SD card into the Raspberry Pi and slide the power switch.
  2. Wait until emulationstation shows up and asks you to "Configure Input".
  3. Follow the onscreen instructions and map your buttons.
  4. Now we are going to configure some basic settings.

Configure WiFi:

  1. Connect a keyboard to the external USB port of the GamePi.
  2. In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
  3. Select WiFi and press the A button.
  4. In the new menu select "Connect to WiFi network" and press the A button.
  5. Select you SSID (WiFi network name).
  6. Enter your WiFi password using the attached keyboard.
  7. Welcome to the internet.

Update RetroPie:

This step take a while - make sure the battery of the GamePi is fully loaded or it could die while updating (happened to me - not cool).

The updates will be loaded from the internet so make sure you configured the GamePis WiFi.

  1. In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
  2. Select "RETROPIE SETUP" and press the A button.
  3. In the new menu select "Update RetroPie-Script" and press the A button.
  4. Select OK a couple of times and press the A button.
  5. Select "Update" and press the A button.
  6. When the update asks you if you want to "[...] update the underlying OS [...]" select Yes and press the A button.
  7. Wait for the update to finish - it takes some time 20 minutes in my case.
  8. After the update has finished select OK and press the A button.
  9. Select Exit and press the A button. Wait for emulationstation to reboot.

Step 15: Adding Games

To play emulated games we need those games first.

Getting Roms (the games ... as files):

  • I won't describe where to get the roms for the emulators because from what I understand this is kind of a legal grey zone.
  • Use google to find your favourite rom - there are a lot of websites offering them. Just search for something like "Mario Kart Super Nintendo Rom".

Transfer Roms to the GamePi:

  1. Turn on the GamePi and wait until it boots up completely.
  2. Make sure you have connected the GamePi to your WiFi.
  3. Open a Windows Explorer (a folder not the Internet Explorer).
  4. Enter "\\RETROPIE\roms" in the address field of the folder and press Enter. You are now in a shared folder of the GamePi.
  5. Copy your downloaded rom into the correct emulator directory. For example: if you downloaded the "Super Mario Kart" rom for the Super Nintendo copy the rom into the SNES folder.
  6. Restart emulationstation (press the Start button in the main menu, select QUIT, select RESTART EMULATIONSTATION).
  7. After the reboot the new system and game should be visible in the main menu.

Step 16: The Final Step

If everything went fine you can now close the GamePi case and secure it with 4 M3x18 hex screws.

Congratulations:

  • Congratulations you've build your own GamePi.
  • Have fun playing some all time classics.
  • Show some love and have a nice day.

Step 17: Change History

02-MAR-2018:

  • Corrected some links in the "Tools & Materials" step.

02-MAR-2018:

  • Added Demo Video.

20-MAR-2018:

  • Corrected slide switch link in "Step 1: Tools & Materials".

28-MAR-2018:

  • Added offer to 3D print the case in "Step 2: 3D Printing the Case".

20-APR-2018:

  • Added links to GamePi XS and GampePi Zero.
  • Added new title picture.

15-MAY-2018:

  • Added (in first step INTRO) thingiverse link to updated version - GamePi 2.1