GamePi Zero - the Favorable Emulation Station

20,029

319

14

Posted in PlayVideo-games

Introduction: GamePi Zero - the Favorable Emulation Station

About: Simplicity is natures first step, and the last of art. ~ Philip James Bailey

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.

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. You'll find my case on this thingiverse design page. I'll keep it on thingiverse to avoid redundancy.

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

This is an entry in the
Microcontroller Contest

Share

    Recommendations

    • Slow Cooker Challenge

      Slow Cooker Challenge
    • Spotless Contest

      Spotless Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    14 Questions

    0

    The error message is not gamepad.h

    Where can I get gamepad.h?

    you know what, I have tons of questions so I'll use the actual section for it

    1) Is there any noticeable input lag?

    2) how many games could you fit on there?

    3) is the case brittle / is it fragile?

    4) will it fit in a normal pocket, or a cargo pocket?

    5) is it comfortable to play?

    1) Nope. The Arduion Pro Mini does a good job.

    2) As much as the size of your micro SD card. (thousands of games on a 64 GB card )

    3) Nope. All walls have are 4mm thick.

    4) It fits in the butt-pocket of some jeans. Size is: 20cm x 8cm x 3cm

    5) As ergonomic as a thicker SNES controller (or a PSP). It's OK I guess.

    Hey there,

    What sort of battery life are you getting out of the GamePi on average?

    And being a complete beginner with Pi's, are there any issues caused if the GamePi battery dies in the middle of emulating? Such as corrupted game files etc.

    Many thanks.

    I did not measure the battery life time yet. My other device runs 4.5 hours on one charge - but it has a Raspberry Pi 3 build it. This one here runs a Raspberry Pi Zero which draws less current - so I think it should run around 6 hours on one charge.

    Let's say I found a way (and the space) to add a full size HDMI port in there, how would you go about it to switch between video outputs?

    0

    To close the case, I see that you use 4 M3x14 hex screws. It looks like you also "slid in" 3mm nuts as well to secure it...right? Also, do you think it would be helpful to use 3mm washers along with the screws to spreadload pressure, especially across the PCB corners. It looks like there should be room. Thanks!

    Yes, you're right about the slid-in nuts. I used M3s squared nuts.

    It's up to you using washers - I didn't need them.

    Hey, is there any way that I could buy a pre-built GamePi Zero? Contact me at legoninjaarj@gmail.com under the subject GamePi Zero.

    0



    1. Your instructions call for "secure the shoulder buttons with a M3x14 hex screw". However, I don't see a 14mm screw in the recommended kit to buy. Is that specific length required? Will 12mm work? Thanks!
    2. I actually have quite a few M3x15 screws...getting closer :) Will those cause damage by being a bit too long? Is there another M3 size required besides M3x14 (or M3x15 in my case)? Trying not to buy a whole kit unless it's necessary.

    I've updated the link. M3x12 is too short. M3x16 should work.

    1 more answer

    0

    Thanks! That's perfect. I went ahead and 3d printed all housing and button components...hope the rest works out for me!

    I have a question about the battery. Do you have approximate dimensions for the battery once removed from the casing or other options for the battery pack? I am based in NZ and cannot get the battery you have recommended shipped from Amazon. Hoping to avoid buying several different battery packs and disassembling them to find one that fits.

    there you go:

    Battery.png

    0

    I love your instructables ! It is actually buildable for people who read this !

    Nice work on this one again, can you try to do a 7inch screen model with HDMI port to connect with the TV ( hdmi who actually transmits the sound to the TV aswell) ?

    but the nintendo switch is way thinner than a raspberry pi hooked on a display ;)
    you do not need a splitter if you you use the official Pi 7" display.
    it's connect via DSI - so the HDMI port on the Pi remains free for further use (e.g. a TV)

    2 more answers

    Thanks for the tip !

    Yeah i just checked your 7" display, it is quite big, but the Nintendo Switch is actually 7" too so it's i guess playable :)

    About the HDMI port, do you have an idea ? I can try a Hdmi splitter but i don't think it will bring the sound to the TV...

    14 Comments

    One more question from me, when you are playing do you notice any input lag?

    most emulators have a large amount of it

    this looks great, will make if I can.

    Are there and upgrades I can add to it, like a sound wheels, or bigger battery?

    1 reply

    well, no one's gonna stop you from re-configuring the setup - go for it.

    Currently looking at getting a 3d pronter and this is one of the projects I'm wanting to try. Just wondering what size 3d printer would be required for this? The one im looking at is 6"x6"x6"

    1 reply

    the size of case is 20cm x 9cm

    wow this is awesome. i think the only thing i would add is a volume control wheel. if i were to build this, how should i go about adding one of those?

    1 reply

    I skipped the volume control wheel because you can control it within emulation station and use button shortcuts (and there wasn't much space left).

    If you want to add one you should check Step 10 of my other instructable on the bigger GamePi 2.

    I'm impressed with how quickly you make, document and publish quality projects. The golden inlay to keep everthing in place is a clever adition, I don't think I've seen that before. Glad I'm subscribed :D

    2 replies

    not as quick as it looks like :P
    these are all projects I started with a while ago but then lost interest or got frustrated with (e.g. the sound part on this build). Right now I just want to finish all of them and enjoy the upcoming summer weather.
    but yeah - glad that so many folks like the stuff.

    thanks again, btw :D

    You definitly earned a breack after finishing long put-up projects. Enjoy the summer :D

    wonderful project. Only thing is, that in english we typically use periods instead of commas for decimal notation. The way you put the costs, looks like 85 dollars instead of 85 cents.

    Other than that, this is an incredible project that is praiseworthy

    keep making

    1 reply

    haha, talking about "favorable emulation station".

    thanks for the hint. I'll update the values.