Introduction: GamePi - the Handheld Emulator Console
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.
- On thingiverse you can find 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.
- 1x Display - 5" Touch-LCD
- 1x Raspberry Pi 3 Model B
- 1x micro SD Card - 16GB (size is up to you)
- 1x Teensy LC
- 1x PowerBank
- 12x Soft Tactile Button
- 2x Tactile Button
- 1x Digital Amplifier - PAM8403
- 1x Audio Jack with switch
- 1x Speaker 1.5W
- 1x Slide switch
- 1x USB Female Jack Type A
- 1x micro USB Female Jack Type B
- 2x Joystick Breakout Module
- 1x Potentiometer B103 10K 16x2mm
- 1x Prototyping PCB
- Hex Screws & Nuts (M3)
- Torx Screws (M2.5 x 8)
- Wires (e.g. LPT)
- Primer Spray
- Spray Paint
- Wood filler (white)
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.
You'll find all needed 3D parts on this thingiverse design page. I'll keep them on thingiverse to avoid redundancy.
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
- Spray a thin layer of paint primer. Let it dry for 24 hours.
- Check the surface.
- Spray a thin layer of paint. Let it dry for 24 hours.
- Soft sand the surface with a dry extra fine sanding sponge
- 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:
- Sand all buttons using 240 grit sanding paper.
- Sand all buttons using 600 grit sanding paper.
- 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.
- 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:
- Use the M2 drill bit to clean the screw holes.
- 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.)
- Connect the display to the raspberry pi according to the display manual (connect GPIO bar, attach the HDMI connector).
- Slide the two top "nipples" (see picture) of the display into the two holes in the case top side.
- Secure the display by screwing to lower two "nipples" of the display to the case.
Button PCBs and Joysticks:
- Put the buttons into their holes.
- Put the PCBs on the sockets according to the picture and screw in the M2.5x8 torx screws.
- 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. !!!
- Connect the Teensy LC to your Windows PC using a USB cable.
- Windows should detect the Teensy LC and install it as a joypad/gamepad.
- Press the WindowsKey+R to open the Run dialog.
- Enter "joy.cpl" and press Enter.
- Select the Teensy and click Properties.
- Press any of your buttons and see if something happens in the Test tab.
- 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.
- 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.
- 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
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.
- 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.
- 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.
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.
- 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:
- Plug the SD card into your Windows PC.
- Make sure Windows detects the card.
- 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.
- Start SDFormatter.exe, select your drive letter from the "Drive:" dropdown menu and hit the Format button.
- When formatting has finished close SDFormatter with the Exit button and unplug the SD card.
Write the RetroPie image to the SD card:
- The downloaded RetroPie archive should be called something like "retropie*.img.gz".
- 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.
- Plug the SD card into your Windows PC. Make sure Windows detects the card and again remember the drive letter of the SD card.
- Start Win32 Disk Imager.
- Select the unpacked RetroPie image from the field "Image File".
- Select the drive letter of the SD card from the "Device" dropdown menu.
- Click the "Write" button and wait until the writing finished.
Configure the Display:
- With the SD card plugged in your PC navigate to the content of the card.
- Open the file "config.txt".
- 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!
- Insert the SD card into the Raspberry Pi and slide the power switch.
- Wait until emulationstation shows up and asks you to "Configure Input".
- Follow the onscreen instructions and map your buttons.
- Now we are going to configure some basic settings.
- Connect a keyboard to the external USB port of the GamePi.
- In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
- Select WiFi and press the A button.
- In the new menu select "Connect to WiFi network" and press the A button.
- Select you SSID (WiFi network name).
- Enter your WiFi password using the attached keyboard.
- Welcome to the internet.
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.
- In the main menu of emulationstation (where you select the systems) select RETROPIE and press the A button.
- Select "RETROPIE SETUP" and press the A button.
- In the new menu select "Update RetroPie-Script" and press the A button.
- Select OK a couple of times and press the A button.
- Select "Update" and press the A button.
- When the update asks you if you want to "[...] update the underlying OS [...]" select Yes and press the A button.
- Wait for the update to finish - it takes some time 20 minutes in my case.
- After the update has finished select OK and press the A button.
- 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:
- There are three main methods of transferring roms.
- We are sticking with the easiest one: Samba-Shares:
- Turn on the GamePi and wait until it boots up completely.
- Make sure you have connected the GamePi to your WiFi.
- Open a Windows Explorer (a folder not the Internet Explorer).
- Enter "\\RETROPIE\roms" in the address field of the folder and press Enter. You are now in a shared folder of the GamePi.
- 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.
- Restart emulationstation (press the Start button in the main menu, select QUIT, select RESTART EMULATIONSTATION).
- 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 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
- Corrected some links in the "Tools & Materials" step.
- Added Demo Video.
- Corrected slide switch link in "Step 1: Tools & Materials".
- Added offer to 3D print the case in "Step 2: 3D Printing the Case".
- Added links to GamePi XS and GampePi Zero.
- Added new title picture.
- Added (in first step INTRO) thingiverse link to updated version - GamePi 2.1
We have a be nice policy.
Please be positive and constructive.
Hello and thank you for the great work.
I'm interested with it and will do something based upon it (i'll keep you in touch).
As i am a pro developer i give you this little optimization remix of your code for the teensy module :
It saves 1% of program memory (it is not very important) but it is easier to maintain and make use of less code lines.
Also as enhancement it use Bounce2 instead of Bounce which is deprecated.
In the same github I'll publish another sketch with state leds on the residual unused pins of the teensy LC (when all my buyed stuff will be delivered ;) ).
Also in my remix I will be using pro PCB designs for the buttons and housing the teensy (with Fritzing and Aisler service) and I'll provide you the source for it.
Have a great day,
Hi again Araymbox. I'm sourcing parts from Australia and the powerbank is proving difficult to get at a reasonable price. Do you know if there are any alternative brands/models of powerbank that will fit? Is it possible that something like a Xiaomi Mi slim 5000mah powerbank might fit?
Also, with the modified case design for the Intenso Slim s5000, do you still disassemble the powerbank, or does the entire thing fit inside the case?
Thanks mate. That looks perfect. Thanks again for your work.
Check out the updated version of this GamePi. it's designed for separate powerbank-electronics and batteries (link in thingiverse description)
Anyone have an issue with the audio? Mine is massively crackly and almost entirely overpowers the actual music with the noise. If I go into settings and the mixer and massively increase the gain, it improves it but by that point it's so loud that my earbuds are now loudspeakers (even with the potentiometer turned right down).
The issue is the same plugged into the soldered on 3.5mm jack or the actual raspberry pi 3 3.5mm jack. Could this be wiring? or is this a Raspberry Pi issue? Have read that their analog output has issues, but doubt it's a bad as what I'm experiencing.
Ok so with a lot of testing, i have partially correct the problem !
You need to use stronger wire to power up the amplifier with the GPIO of the PI ! No more speaker problem with that.
But, i don't why but when i connect headphone there is a lot of crack sound, for this problem i actually don't know what to do, my wire seems to be well done...
@araymbox an idea ?
@JonasG31 I didn't find a solution unfortunately. I would follow Araymbox's advice below.
I've read that the Pi's analog audio isn't well insulated or is just low quality, so not sure there is much else that can be done.
For my problem, as it's one of the last steps I did and therefore quite small areas left in the case to work in, I think my soldering/wiring quality is terrible. I did my best to get these into the case without a hot glue gun so the idea of ripping it all out and starting again is too much for me!
Hey i have the exact same problem... the sound is mostly crackly and not even really loud...
Did you find a solution ??
I just check, using an external (not wire to the pi) 5V and GND, there is no problem, but i guess we all need to connect it to the pi.
@Araymbox i think we need your help here :)
- make sure all audio wires are kept as short as possible
- make sure all points are soldered correctly
- make sure you do not set audio to 100% within emulationstation (80% should be enough)
- try setting disable_audio_dither=1 in the config.txt
same problem as you i'm searching a solution but don't find and i have no problem with the sound when i use another powersource
hello why the toutchscreen dont rotate
Araymbox, it is not dangerous to not cooling the PI with heatsink or a fan ?
it's not overclocked. it's getting warm but nothing near dangerous.
Hey I was wondering if I am able to buy it pre-made? But if not can someone please at least make me the 3D printed part because I don't have access to one
Hi, really nice work, i'll use a lot from your GamePi to create mine !
I'm not an expert, can i have a picture of this in real (in a good quality if you can) ? I'm not sure about what to do with the Ground. Thaaanks
Thank you very much, i'll try it in a week or so
@JonasG31 here it is in all it's first attempt glory. Brown is ground wire, so you can see it just connects all 3 other buttons. Then signal wires are on the other side/corner of each button. Thanks to @araymbox obviously but hope this pic helps show it too
Have you managed to figure this one out? If not I can upload a detailed photo of mine tonight. Tested and working through my Teensy/Computer.
I used 2 pieces of wire (with no insulation) and soldered A-C & B-D. Where these wires cross (E) I then just made sure the wires were touching and added solder there. Not sure if this is a terrible method, but it looked like what was in the picture and it's definitely working.
@Millionaar I haven't done it yet, but your photo could be useful Yes ! Thanks
@Millionaar: that's the way I did it too.
So, if i connect A to C, B to C and D to C, should be good ?