Introduction: GamePi Zero - the Favorable Emulation Station

Intro:

This instructable describes the build of a Raspberry Pi Zero W powered handheld emulation console.

It's an alteration of my first GamePi handheld which features a lot suggestions some users had:

  • Cheaper: around $40 (the first one was $160).
  • Even smaller
  • Powered by a Raspberry Pi Zero W instead of a Pi 3 (one third of the price).
  • Input is handled by an Arduino Micro Pro instead of a Teensy LC (even cheaper).
  • Stereo speakers (the first one is mono).
  • More battery time.
  • Shoulder buttons.
  • PSP joystick instead of big playstation-like jocksticks.
  • Better button ducts.

If you like it super affordable and simple you should take a look at the GamePi XS - a console in a controller.

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.

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. If you have any suggestions for improvements please let me know.

Step 1: Materials & Tools

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 given links. These are examples and show the required properties of the parts.

Parts:

Tools:

Step 2: 3D Printing the Case

I've printed my case with infinity blue PLA filament and the buttons and the PCB mount plate in golden PLA filament. PLA comes off the printer in a decent quality - so post-processing is not required (imho) - but possible.

If you have a 3D printer with a smaller bed or no printer at all you can use a 3D printing service or message 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/149801-gamepi-zero

Step 3: Prepare the Display

In this step we're going to prepare the display for the assembly.

Keep these parts:

  • Display panel
  • Display controller
  • Display case screws

Follow these steps to disassemble the display:

  1. Remove the 4 screws on the back of the case. Keep the 4 screws.
  2. Open the case.
  3. Unplug the cables for the buttons.
  4. Unsolder the wires for signal and power from the display controller.
  5. Unlock and remove the ribbon cable from the display controller.
  6. Carefully remove the display controller from the display panel. It kept in place by double sided tape.

Step 4: Prepare the Battery

In this step we're going to prepare the battery for the assembly.

Keep these parts:

  • Battery and electronics
  • 2 screws which kept the electronics in place

Follow these steps to disassemble the battery:

  1. Remove the faceplate using a flat screwdriver.
  2. Remove the 4 screws under the faceplate.
  3. Open second plate.
  4. Slide off the metal housing.
  5. Remove the 2 screws (under the glue) which keep the electronics in place.
  6. Push the battery out of the plastic case. It's kept in place by double sided tape.

Step 5: Prepare the USB Hub

In this step we're going to prepare the USB hub for the assembly.

Keep these parts:

  • PCB
  • All cables

Follow these steps to disassemble the USB hub:

  1. Remove the plastics cases from all parts.
  2. Unsolder all wires.

Step 6: Prepare the Sound Card

In this step we're going to prepare the sound card for the assembly.

Keep these parts:

  • PCB
  • USB jack

Follow these steps to disassemble the sound card:

  1. Remove the plastic case.
  2. Unsolder the USB jack.
  3. Unsolder the mic and audio jack.

Step 7: Buttons (Software)

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

Installing the Library:

I found a good instructable by GAMELASTER that shows how to install the required arduino libs:

Go through Step 1: Installing the Library

Load and write the Code:

  • 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.
  1. Connect the Arduino to your PC (it should be detected automatically if you are using Windows).
  2. Download the attached code file.
  3. Double click the downloaded file. The Arduino IDE should start.
  4. Select the Arduino board (in the menu bar: Tools > Board > Arduino Leonardo).
  5. Select the correct port the Arduino is attached to (in the menu bar: Tools > Serial Port > COM x).
  6. Write the code to the Arduino (in the menu bar: Sketch > Upload).
  7. When finished disconnect the Arduino board from the PC.

Step 8: Buttons (Hardware)

Now we want to build the controls (PCB board + switches).

Cut the PCB board:

  • 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 the 3rd picture (action butons & direction buttons).
  • You need 2 pieces of the 4th picture (shoulder buttons).
  • You need 1 piece of the 5th picture (start/select buttons).
  • 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 9: Assembly Case - Back

There is not much to do on the back side if the case. After this step your back case should look like the one on the picture.

Battery:

  1. Click the battery into the brackets.
  2. Secure the battery PCB with the screws from its former case (use the same holes).

Shoulder buttons (R2 & L2):

  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 10: Assembly Case - Front

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 and Component Mount:

  1. Put the display into its place (check orientation).
  2. Place the component mount on the display (check orientation).
  3. Secure the display and component mount by screwing the screws you took from the display into the holes on the corners of the component mount.

Button PCBs and Joystick:

  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.
  4. Remove the cap of the joystick.
  5. Put the joystick into its place.
  6. Secure the joystick with some hot glue.
  7. Attache the cap back on the joystick.

Shoulder Buttons (R1 & L1):

  1. Put the shoulder buttons into their holes (check orientation).
  2. Secure the shoulder buttons with a M3x14 hex screw.
  3. Place a single soft switch onto the its socket.
  4. Secure the switch with hot glue (do not cover the pins too much).

Step 11: Wiring

We're going to spit the wiring on multiple steps - part by part.

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

  • 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 12: Wiring: the Arduino Micro Pro

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

When you have finished this step your device should look like the one on the second picture.

Make sure you have finished "Step 3: Buttons (Software)" and wrote the code to the Arduino.

Always double (and triple) check your soldering.

Connect the Buttons and Joysticks:

  • The pictures in this step and in "Step 4: Buttons (Hardware)" show all wiring points.
  • Start off with the ground line. The ground line is connected to all of the buttons and the joystick.
  • Now you can connect all signal wires to the buttons.
  • When connecting the joystick check the labeling of the pins and make sure you use the correct ones.
  • The joystick uses two potentiometers - so they have to be connected to the 5V power output of the Arduino.

Testing the controls (optional):

  • After writing the code on the Arduino and soldering all buttons and the joystick you can test the controls.
  1. Connect the Arduino to your Windows PC using a USB cable.
  2. Windows should detect the Arduino board automatically.
  3. Press the WindowsKey+R to open the Run dialog.
  4. Enter "joy.cpl" and press Enter.
  5. Select the Arduino board 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 your wiring. If none of them work check the code. If the Arduino board itself is not recognized by Windows rewrite the code to the Arduino.
  8. If the tests were successful disconnect the Arduino from the PC.

Step 13: Wiring: USB Hub

Since most of the next components are going to be connected to the USB hub we're going to connect it now.

When you have finished this step your device should look like the one on the second picture.

Always double (and triple) check your soldering.

Mounting:

  1. Place the USB hub into its labeled slot.
  2. Secure it using double sided tape.

Soldering:

  1. Connect the female micro USB jack for the Arduino (scevenged from the USB hub in "Step 5: Prepare the USB Hub") as seen in the first picture.
  2. Connect the female USB jack for external connections (scevenged from the USB hub in "Step 5: Prepare the USB Hub")as seen in the first picture.

Step 14: Wiring: Sound Components

Continue with the sound components.

When you have finished this step your device should look like the one on the second picture.

Always double (and triple) check your soldering.

Mounting:

  1. Place the sound card and the amplifier into their labeled slots.
  2. Secure the components using double sided tape.

Soldering:

  1. Connect the sound card to the USB hub as seen in the first picture.
  2. Connect the amplifier to the sound card as seen in the first picture.
  3. Connect the stereo audio jack to the amplifier as seen in the first picture.
  4. Connect the speakers to the stereo audio jack as seen in the first picture.

Mounting:

  1. Put the stereo audio jack through its dedicated hole in the printed case.
  2. Secure the stereo audio jack with its nut.
  3. Slide the the speakers into their slots.

Step 15: Wiring: Power Circuit

Now we're going to connect all power lines.

When you have finished this step your device should look like the one on the last picture.

Especially in this step it's important to double (and triple) check your soldering.

Soldering:

  1. Connect the male USB jack (scevenged from the sound card in "Step 6: Prepare the Sound Card") to the slide switch as seen in the first picture.
  2. Connect the slide switch to the display controller board as seen in the first picture.
  3. Connect the display controller board to the Raspberry Pi as seen in the first picture.
  4. Connect the female micro USB jack (scevenged from the sound card in "Step 5: Prepare the USB Hub") to the male micro USB jack as seen in the second picture. (Secure the female micro USB jack using hot glue).

Step 16: Wiring: USB Hub to Raspberry Pi

In this step we're going to connect the USB Hub to the Raspberry Pi so all components can communicate with each other.

Always double (and triple) check your soldering.

Soldering:

  1. Connect the USB Hub to the Raspberry Pi as seen in the picture.

Step 17: Wiring: Display to Raspberry Pi

... one single wire ...

Soldering:

Connect the display controller board to the Raspberry Pi as seen in the picture.

Step 18: Wiring: Finalize

In this step we want to finalize the wiring.

The picture shows what the inside of the device will look like when we have finished.

  1. Put the Raspberry Pi into place (see picture) and secure it using 4 M2,5x8 torx screws.
  2. Plug the male USB jack into the battery electronics.
  3. Plug the male micro USB jack into the battery electronics.

Close the Case:

When closing both case pieces be careful that:

  • no wires are squished
  • the Pi and the battery electronics do not touch
  • there is no force needed to close it.

Seal the case with 4 M3x14 hex screws.

Step 19: Installing the Software

Before putting everything together we want to take care of the software part first.

In this step we're going to download all needed software and prepare the SD card using the RetroPie image.

Required Software:

  • Download the pre-made RetroPie image for the Raspberry Pi (the red "Raspberry Pi 0/1" 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". Select the drive letter of the SD card from the "Device" dropdown menu.
  6. Click the "Write" button and wait until the writing finished.

Add your WiFi credentials:

  • There are several ways to connect the Raspberry Pi Zero W to you wireless network.
  • We are going to use the one without any additional peripherals:
  1. With the SD card still in your PC navigate to the SD card.
  2. Create a new file on the SD card called "wifikeyfile.txt".
  3. Open the file and add the following code to the file where "NETWORK_NAME" is the name of your wireless network (case-sensitive) and "NETWORK_PASSWORD" is the password for this network (case-sensitive).
  4. Save and close the file.
ssid="NETWORK_NAME"
psk="NETWORK_PASSWORD"

Configuring the Video Ouput:

Because the display is connected to the Pi via composite we need to adjust the video output.

  1. With the SD card still in your PC navigate to the SD card.
  2. Open the file "config.txt" and add the following code at the end of the file.
#====================================================================
# GamePi Zero Video Config 
#====================================================================
#
# ----------+--------------------------------------------------------
# sdtv_mode | result
# ----------+--------------------------------------------------------
# 0         |  Normal NTSC
# 1         |  Japanese version of NTSC – no pedestal
# 2         |  Normal PAL
# 3         |  Brazilian version of PAL – 525/60 rather than 625/50

# ----------+--------------------------------------------------------
sdtv_aspect	| result
# ----------+--------------------------------------------------------
# 1         | 4:3
# 2         | 14:9
# 3         | 16:9

sdtv_mode=2
sdtv_aspect=3

framebuffer_width=320
framebuffer_height=240

overscan_scale=1

overscan_left=4
overscan_right=-14
overscan_top=-24
overscan_bottom=-18

Now you can remove the SD card from your PC.

Step 20: Configure RetroPie

Time to boot up the whole thing!

The first boot up takes a while because RetroPie has to handle some first start tasks (looks like the first 2 pictures of this step).

Configuring the Input:

  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" (see third picture).
  3. Follow the onscreen instructions and map your buttons.
  4. Now we are going to configure some basic settings.

Configure WiFi:

  1. In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
  2. Select WiFi and press the A button.
  3. In the new menu select "Import wifi credentials from /boot/wifikeyfile.txt" and press the A button.
  4. Wait for emulationstation to establish a connection to your WLAN.
  5. Welcome to the internet.

Configure Sound:

  1. In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
  2. Select Audio and press the A button.
  3. .....

Step 21: 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 22: Final Step

Congratulations:

  • Congratulations you've build your own GamePi Zero.
  • Have fun playing some all time classics.
  • Show some love and have a nice day.
  • You can also tip me on thingiverse if you feel to.

Step 23: Change History

19-APR-2018:

  • Published.

20-APR-2018:

  • Add describtion how to install arduino libs in "Step 7: Buttons (Software)".
Pocket-Sized Contest

First Prize in the
Pocket-Sized Contest

Microcontroller Contest

Participated in the
Microcontroller Contest