When I first stumbled upon the various Handheld Raspberry Pi Retro Gaming Consoles, I knew I needed to build one. I didn't want to simply copy someone else's design though; I wanted the challenge of designing and building my own custom game console. There are great examples out there and I wanted to combine all of their strengths into one design. The initial cost of these can be $200+, so I also wanted to make it affordable while not skimping on the functionality. It was also a perfect opportunity to become more familiar with 3D design software, 3D printing, and the Raspberry Pi. The main goal was to minimize hardware and cost and maximize the features.
The main capabilities I designed this console to were:
- HDMI Out - For Hooking up the Console to a Monitor or TV
- Internal Rechargeable Battery Pack Utilizing a Common Micro USB Charging Port
- USB Port - To Hook up a WiFi Adapter, Keyboard, USB Flash Drive, or even a USB Controller for 2 Player Games
- Audio Out - Speaker and Headphone Jack Options. (Who wants to play all those retro games with all that fantastic music muted?!)
Based on other designs, I knew the basic core components of a Handheld Raspberry Pi Retro Gaming System - Raspberry Pi, Screen, Power Management, User Interface (Buttons and Switches), and an Audio Amplifier. There are a lot of plug and play options available for these functions but I wanted to try to keep things simple and reduce costs. I researched for a few days and I found that I could make this whole project for right around $100. Even less ($80) if you have some random parts on hand like tactile switches, a rocker switches, a slide switch, and/or a USB port.
I used a Raspberry Pi 2 Model B with a 32GB Micro SD card. No reason behind it other than Amazon.com had them in stock with free 2 day shipping. I used this list to make sure the micro SD card I was buying would work with the Raspberry Pi.
For the screen, I didn't feel I needed a high definition touchscreen. This is going to be a retro game console and when I played these games as a kid, they definitely weren't HD. We can also save up to $35 on the build cost by going with a cheap backup camera LCD screen. Ben Heck used one of these screens in his Retro MAME handheld and it worked perfectly for this project as well. Amazon.com has various models ranging from $15 and up. The screens typically run on 12V (the same as a car's electrical system) but with a little multimeter probing, you'll most likely find that most can operate off of 5V.
A few designs I stumbled upon had the battery, charging circuit, and step-up converter as separate PCB units or modules. I found Instructables user sonicase's idea of cell phone battery rechargers to be a perfect fit. For $15 you get a decent size LiPo battery cell, a charging circuit, a step-up converter, a 5V regulator, and a battery life meter all in one tiny package. Re-purposing one of the chargers saves quite a bit on build costs and the space savings help when it comes time to 3D design. With a quick hook up of two wires, you can power up your Pi for testing without the need of an external power supply as well.
Originally I had planned on using a cheap USB gamepad I had on hand, hacking up the PCB, and soldering wires to it. During the original prototyping stage, it worked perfectly. Once I tried to minimize the PCB (Cut it up into a smaller piece) the Raspberry Pi would no longer recognize it as a USB device. After scrapping that idea, I looked into using the Pi's GPIO as an alternative controls interface. Even though I spent a day messing around with the USB controller, I was very happy to have found the GPIO option. It eliminates an extra PCB, saving space, and it works great after a short installation of Digital Lumberjack's Raspberry Pi Joystick Driver. I cover this in more detail in the wiring step.
For A, B, X, Y, Start, Select, and the directions buttons, I used some prototyping board, cut to size with a dremel, and 10 tactile switches. For the shoulder buttons I used two 90 degree through hole tactile switches. For the mute button and power button, I re-purposed some random switches I salvaged from some old electronics. I've put some equivalents in the BOM below. I also used a 26-Pin right angle connector to make the wiring to the GPIO a bit easier. This piece is optional but it helped out quite a bit. Especially if you plan to re-purpose the Raspberry Pi at a later date.
For the USB out, I desoldered a through hole USB port from an old USB device. I've also included a link in the BOM to alternatively buy one if you don't have any old hardware laying around.
The audio out of the Raspberry Pi is at pre-amplified headphone levels. To power a small speaker, I found a small LM386 module on eBay for less than $3 and it works off of 5V. For the speaker, I used a loud speaker I salvaged from a broken Nook. Most, if not all, cell phones, tablets, and eBooks have these loud speakers in them as they are incredibly small and still sound good at audible volumes. For testing purposes I used a battery powered speaker similar to this one. This won't be completely necessary as it was used for concept testing.
Here's a list of the links to the parts in the BOM:
Once I had the parts in hand I made a few sketches of how I wanted to design the handheld console. After a few iterations, I had my general idea and layout. I also sketched up a very general wiring diagram to help sort things out - Power, Audio, Video, USB, etc.
Next I formatted the micro SD card and burned the RetroPie image to it. I won't go into any detail on that as the RetroPie wiki does a wonderful job of explaining it. With the flashed micro SD card finished, I connected the LCD screen power cable up to an unconditioned 12 Volts from an AC/DC adapter. I then wired up a quick 5 Volt regulator for the Raspberry Pi using a LM7805 (You aren't required to follow this step - I did this solely to determine the pin outs). I probed around and found the audio out, video out, and Raspberry Pi input voltage polarities. When I confirmed that the micro SD card/RetroPie image was working, I hooked up a cheap 6 button USB controller and mapped the buttons (Tip: If you don't want to or can't assign any of the buttons, hold down a button that is already assigned to skip the current button asking for input.) Lastly I hooked up a small battery-powered mini speaker and transferred over some ROMs with the USB transfer method (also summarized nicely on the RetroPie Wiki). I then was able to successfully test the full system, play ROMs, and hear the audio.
The next step was to determine if the LCD screen could run off of 5 volts. I carefully unscrewed and opened up the LCD screen housing, used an Exacto knife to cut through the glue holding the screen in place, hooked it back up to 12 volt power, and probed around on the PCB until I found a spot with 5 volts. I searched near the larger capacitors since those are typically placed near regulators to help with power conditioning. With the 5 volt pin out determined, I hooked the entire system up to the portable phone charger battery and confirmed the system could run off of the battery pack. At this point I also hooked up my multimeter to check the current draw of the whole system. With a game running, it appeared to draw slightly over 0.50 Amps. With the battery pack I chose, factoring in extra tolerance, I should get around 5 hours of game play. Of course, other things can affect this time, such as the type of game being played, using WiFi, or playing with HDMI out.
Lastly, I started the task of cracking open the rechargeable battery pack. This was quite a task but as long as you take it slow, it should be fine. You want to be extremely careful when opening these battery packs. If you nick the LiPo, it can cause serious damage and/or fire. I used an Exacto knife to pull off the front face plate and then to scrape around the seam. I then used some small flathead screw drivers to slowly pry and pop it open. I carefully desoldered the battery from the circuit board (Be very careful with this as well, excess heat can cause damage to the LiPo Cells!) and used a pair of wire clippers to pry up the metal conductors and separate the two batteries. Since these are not going to be mounted and wired immediately, it is a good idea to put some tape over the top and bottom contacts to prevent accidental shorting while storing. Be sure to save the lightpipe piece from the case for the battery indicator in the final product.
With the hardware tested, I moved on to the controls portion of the handheld console. For the directional, start, stop, A, B, X, and Y buttons, I used through hole tactile switches. For the shoulder buttons, I used through hole, 90 degree mounted, tactile switches. I've attached the PCB size to cut (based on grid size) for each control. I used a Dremel tool with a cutting disc to do these cuts. Don't forget to wear eye protection and consider respiratory protection; this process produces a lot of dust! The main idea is to wire all grounds together and leave a single wire for each control. For the USB port, I cut and stripped the wires from an old cable to test and determine which wire get soldered to which pins. I used the same stripped cable on the Raspberry Pi to determine the pin outs as well.
For the 3D design portion of this project I used the free AutoDesk 123D software. After watching a few videos and modeling components for a few hours, I got the hang of it. This is super nice software available for free at http://www.123dapp.com/ The process of designing the enclosure starts by sketching and modeling all of the parts that will be mounted in the handheld gaming device. This will assist in the initial case dimensions as well as digitally fit all the components together to ensure a proper fit and form. After the parts are modeled, they can be arranged on the grid and an enclosure can be constructed around it. From there all supports and holes can be constructed. Again, the process of 3D designing with 123D is Sketch(2D) > Extrude(3D) > Manipulate (Supports and Holes). The .STL files can be located on Thingiverse. I used Slic3r to generate the gcode and Pronterface to connect up to my Folgertech Prusa i3. While the case was being printed, I quickly sketched up some decals for the buttons and a Gameπ logo. I printed these out in the same color as the buttons and super glued them into place after everything was completed. Once the case finished printing, I carefully pre-tapped the case mount screws to make the final construction easier. Another good suggestion is to strengthen the case screw mounts with some super glue. Not all printers have the best adhesion, especially my cheap hobby model, and the screw mounts can easily crack off when tightening the case.
I tried my best to make a coherent wiring diagram. There's a lot going on and wiring can get pretty messy. I started off using hot glue to mount the components but quickly found out that wasn't durable enough. I switched to super glue. I glued everything in place that I did not have plans to use in the future. Things I may want to salvage, such as the Raspberry Pi, were held in place with screws or hot glue only.
For the bottom half, I soldered 4 wires to the USB PCB and glued it in place. The power switch was then mounted and glued in place. I separated the batteries to prevent an unbalanced handheld device, soldered them in parallel, and glued those in place with some hot glue. The power leads from the batteries have to be pretty long to reach the top of the case, so keep that in mind. Then I soldered color coded wires to the shoulder switch PCBs and then glued in place, checking to make sure there was also enough room for the 3D printed shoulder buttons. I waited to mount the Raspberry Pi until I had the top completely wired.
I cut the battery life meter light pipe from the rechargeable battery case in half and glued the two pieces in place. This will transmit the light from the power management PCB to the front of the case. I then aligned the PCB over the light pipes and glued it in place, checking the Micro USB out for fit with a micro USB cable. The LCD screen and Speaker were fixed in place with a bit of hot glue. Next I placed the buttons through the top case and super glued the button PCBs to their mounts, making sure all buttons were functional and clicked. I then soldered color coded ribbon cable to each of the button PCBs and took note of which buttons were which colors. This speeds up wiring to the GPIO. I also was able to eliminate 2 extra ground wires that need to go to the Raspberry Pi by soldering the direction buttons, A, B, X, Y Buttons, and Start/Select button ground connections in series with only 1 wire requiring a ground connection to the Raspberry Pi (I did the same thing with the shoulder buttons on the bottom half). I mounted the mute slide switch and the audio amplifier next, and wired the mute switch to turn on and off the power to the amplifier. I soldered and combined the Ground and 5V wire from the screen and the audio amplifier and set those aside.
With the top and bottom half taken care of, I began wiring the two together. From the bottom half, I brought over the 5V, Ground, Composite +, Audio +, and Audio - from the Raspberry Pi and soldered those to the respective components. I brought over the unconditioned 3.7V from the parallel battery cells and connected that to the power management PCB on the top. I used a slightly larger gauge wire for power transmission lines. I also soldered the shoulder buttons to the GPIO and the USB wires to one of the Pi's USB ports. I confirmed polarity with the stripped plug used to find the polarity of the external USB port. From the top I brought down the button control wires and wired those to the GPIO. The USB out +5V connection on the power management PCB is wired to the power switch. The power management PCB monitors the USB power out for a change. When it senses a device (in this case our whole handheld system) it will turn the boost circuit/regulator on. With the wiring done, I carefully folded the two halves together, careful not to pinch any wires, and screwed the case together with the 4 #6 1-1/2 screws.
Mapping GPIO Buttons
Once you have all your buttons wired to your GPIO pins, follow this process to install the GPIO Joystick Button Driver
I've attached a list of Hotkeys from the RetroPie wiki. They come in very handy when you would like to exit, save, or resume a game.
Minimizing Emulation Station Home Screen
EmulationStation will automatically detect which emulator folder has ROMs in them and update your system list on the home screen. A few games are pre-loaded. If you do not want those to show up on home screen you can drag those Rom folders into a "Archive" or "Un Used" folder. I completed this task using a WiFi adapter. I followed the RetroPie wiki site to connect up to my wireless router, logged into my wireless router setup address on my main computer, and found "RetroPie" as an active device on my network. I copied down the IP address, pasted that into a file explorer window, and navigated to the ROMs folder. I cleaned up the systems I did not want, rebooted the handheld console, and verified they were removed.
Cover Art for ROMs
Once you have your ROMs loaded onto your SD card, you will have the ability to "scrape" cover art and game descriptions for your games. I had some trouble using the built in scraper that is included in EmulationStation. I could scrape the games, check and see the cover art, but after restarting the system, they would be deleted. I then used sselph's scraper with success. To use sselph's scraper follow these steps:
- Exit Emulation station by hitting F4
- Type sudo /home/pi/RetroPie-Setup/retropie_setup.sh
- Select option 3 "Setup/Configuration (To be used post install)"
- Select Option 820 "Scraper for EmulationStation by Steven Selph" and allow it to install and start up
- I selected scrape all systems but you can select individual systems if you would like
Audio Out Distortion
There is a known audio out static issue with RetroPie. When game music is playing it isn't to bad. To minimize this I followed this guide of suggestions and adjusted the audio sampling rate and audio driver. To do that I followed these steps:
- Plug in a USB Keyboard and hit F4
- Type in command sudo nano /etc/retroarch.cfg
- add in these two lines of code
- Hit control + o and then hit enter to save the changes. Hit control + x to exit
- Type in command sudo reboot
I then turned the audio amplifier volume all the way up and hit the Start button in EmulationStation and adjusted the volume setting until the in game volume was acceptable. Hit F4 again and type command sudo reboot to save the settings. I used 65%. Note: This only occurs with the analog audio out. The HDMI auto is crystal clear
When you would like to play your games on a HDMI monitor or TV, make sure the The Gameπ is powered off, plug it in to a TV or monitor with an HDMI cord, and power it on. The Raspberry Pi will automatically switch to HDMI Audio and Video out.
Two Player Mode
To play any games in 2 player mode, simply hook up a USB controller to the USB jack of the Handheld console. RetroPie/EmulationStation should detect a new controller and allow you to set up the button mappings.
All in all this was a completely satisfying project. It had all the aspects I enjoy working on. I've become very familiar with 3D design with Autodesk 123D and I've continued to develop my 3D printing skills. After playing some old games for a few hours I decided to make one slight change to the case. The bottom left and bottom right 90 degree edges kind of dug into my palms. I've rounded those out for better comfort. As a whole, I feel like the case provides a fairly ergonomic feel suitable for hours of game play! Another improvement for future modules would be another small switch that would allow the micro USB charge port to be switched from charge to AC power. Currently, when power is connected to the micro USB port, the system with shut down while it charges. It would be nice to have the option to charge or play on adapter power. I hope that this guide serves as a good resource to others looking to build a RetroPie handheld gaming system and if any clarifications are needed, please do not hesitate to comment!