Introduction: Piulator Portable Game System Via Raspberry Pi
This project was a lot of fun to put together. I was looking for a good Christmas present for my nephew, and decided that a Raspberry Pi influenced project would be cool. He likes gaming and computers, so this made sense. I made an identical version for my other nephews that is stuck in a Raspberry Pi case. Why not make it portable? There are a lot of projects out there with people making portable game systems, so this isn't original in any capacity, but I am happy with how this came together and thought I would share the project! This project took me one month from conception to delivery.
Step 1: Materials
- Raspberry Pi B+
- Heat sinks for the Pi
- Anker Astro E7 Ultra-High Capacity 25600mAh 3-Port 4A Portable Charger
- HDMI 4 Pi 5" Display
- USB SNES Controllers (can use any USB controller)
- oak planks
- oak floor trim
- box hinges
- small wood screws
- finishing nails
- paper towels
- circular saw
Step 2: The Backend
First things first - get the backend working. This has to function properly before putting everything together, yes?
RetroPie is a precompiled SD card Pi image that has all of the emulators installed already, as well as the EmulationStation frontend installed with autobooting configuration setup. You can do this by yourself, installing the emulators one at a time and manually installing EmulationStation, but that takes forever. Work smarter, not harder!
EmulationStation is a GUI frontend to navigate your game lists. It's pretty basic by itself, but you can skin the frontend relatively easily with a bit of graphic design and some light XML editing.
This could get lengthy, so I will try and keep this concise and provide basic instructions with links. Additionally, my knowledge came from a culmination of several online resources Check these all out for more information, extra details, forums with people asking every question that you think hasn't been asked yet, etc.
- Create your SD Card image
- Update and configure your Pi
- Expand your SD card disk size with
- sudo raspi-config
- Select expand disk option
- Expand your SD card disk size with
- sudo apt-get update; sudo apt-get upgrade;
- sudo passwd
- Input your new password(don't lose this)
- Install heatsinks on the GPU and CPU of the Pi
- Overclock your Pi
- You can do this without voiding your warranty through raspi-config, but if you want to push it a bit...and you will for decent sound/performance on SNES and higher games...check out this thread on the PetRockBlog forums. I ran the settings from the first poster and my temp never went above 51°C during SNES gameplay.
- Change directory to where the configuration program lives
- cd /opt/retropie/emulators/RetroArch/installdir/bin
- Run the configuration program
- ./retroarch-joyconfig -o /opt/retropie/configs/all/retroarch.cfg
- Hit the appropriate buttons when prompted. When you get to buttons that don't exist on your controller, just keep hitting any button, but make sure it's the same button for ease of finding later. You will remove them next.
- Alter the CFG file to include player 2 controller, tidy up player 1 and put in a "quit emulator" button configuration
- sudo nano /opt/retropie/configs/all/retroarch.cfg
- Remove the values for all the buttons that don't exist on your controller. You should be able to decipher the erroneous buttons relatively easy.
- Copy and paste the Player 1 configuration under the Player 1 config
- Change the new set to say Player 2 in all instances
- Change the index from 0 to 1 in the new set
- Add in the exit emulator config by adding the following 2 lines under everything
- input_enable_hotkey_btn = "1"
- input_exit_emulator_btn = "2"
- Change the values of "1" and "2" to match the buttons you want to use. I use Select as the hotkey and Start as the exit. That way you have to hold Select and hit Start to exit a game. Sweeeeeet.
- It's important to note that this CFG file affects the system on a Global level. If you want different button configurations in specific emulators, you will need to alter the retroarch.cfg file in the individual emulator's configs directory (i.e. /opt/retropie/configs/snes/retroarch.cfg for SNES configurations). Individual CFG files will override the Global config.
- There are a few ways to do this. SSH is the way to go, IMO, because you will want to get familiar with SSH'ing into your Pi. You can auto-copy ROMs over with a USB stick as well. Both processes are documented here.
- From your home directory, type
- You must have at least one ROM copied over to your directory for this to work.
- Check it out! Are you able to navigate the frontend? Sweet! Can you open a game and properly control said game? Allllright. Wait, it doesn't work right? Look back through the steps, scope the forums, ask a question or two, but get it right before moving forward!
- So EmulationStation is pretty bland. Aloshi admits that it is pretty basic and encourages people to create their own skins. I went ahead and did that.
- EmulationStation is comprised of a chunk of elements used for navigation in a few different screens. It looks at XML files to know what to do with these elements. So basically, you can either alter pre-existing XML theme files or write your own. Aloshi has documentation on a GitHub page here. I went full bore into learn-mode when doing all this and felt the need to document everything I was putting together. I wrote the attached guide on creating themes for Emulation Station 2.x.
Step 3: The Build
The Pi requires a 5v power supply and the monitor I chose needs anywhere from 5-12v. My friend recommended the Anker Astro E7 battery pack. It claims to adjust it's voltage off of the device attached to it, so that sounded promising. I had zero issues with power, and I let it run the Final Fantasy III intro movie for 19 hours before I had to package the final gift up. There was still 1 bar left on the battery, so it probably could have went a while longer! I would have settled for 5-8 hours, so that made me really happy.
The box was built around the power supply dimensions, but deep enough to accommodate the Pi's length. I knew that I wanted the supply accessible from the outside, as well as the Pi and monitor control board. I also knew I wanted the screen incorporated into the lid.
So first we built the walls and base for the box. The corner was removed from one side and one wall to provide access to the battery pack. I secured the pack in position with L-brackets screwed into the base. With wanting to keep this as small as possible, I put rails on the side walls that could hold tracks to mount the boards to. The walls were wood-glued together and clamped until dry. Then finishing nails were added to secure the walls a little more.
After this, the tracks were installed for the boards. First the Pi was positioned in and holes were marked for access to the power, HDMI, composite, USB and Ethernet areas. It made sense to just cut a large hole in the front of the box for the USB and Ethernet, but make individual holes for the power, HDMI and composite. I think the side access could have been a single hole at this point, but it is what it is. These holes were made with a combination of a drill, a jigsaw and a dremmel. After the Pi fit nicely into it's space, the monitor control board was positioned next to it and an access hole was cut into the front.
Side note: I think that the routing of the video signal from the Pi to the monitor control board could have been done internally, but I didn't look into that close enough. Remember, this was a one-month project, start to finish.
The lid to the box was to hold the monitor as well as enclose the internals, but I wanted it to flip up during use so the screen could be viewed at an angle. A small slit was cut in the lid to provide a channel for the monitor cabling.
At this point, the tracks were removed and everything was sanded and stained. I wanted a little flair on the box, so we made trim for the base, as well as trim for a frame of the monitor. This was achieved with oak trim for the base and cutting a groove in small strips of wood with the circular saw for the monitor trim. These were all sanded and stained a lighter color for aesthetic accent.
After everything was dry, the trim was attached to the base with wood glue and clamped until dry. While that was drying, I attached the monitor trim to the lid. Not only did it make it look framed, but it also provided a way to secure the monitor to the lid. It helped to set the bottom trim piece first and then clamp the rest of the trim after that piece was dry. It made it easier to judge how straight everything was.
Step 4: Assembly
Now that the box was finished, it was time to assemble everything. The battery was placed in the bottom of the box, the tracks were laid and the boards were screwed into the tracks. The driver board between the monitor and the control board was affixed to the back of the lid with double sided adhesive tape. The lid was attached to the box with a standard set of hinges and the FCP cable attached to the control board. (Last minute I taped the FCP cable up to the lid so it wouldn't scrape the GPIO pins on the Pi.)
As far as connections go:
- A USB > Mini USB goes from the power supply to the Pi
- A USB > 2.1mm center-positive cable goes from the power supply to the monitor control board
- An HDMI cable goes from the Pi to the monitor control board
- Headphones or external speakers go into the 1/8" jack on the Pi
- USB controllers are attached to the USB inputs on the Pi
Voila! Pretty sweet if I do say so myself! If I were to do this again, I would try harder to get as many connections happening inside the box instead of outside. I.e. power connections and video signals. As previously mentioned, I think there is a way to get the video from the Pi to the monitor from board-to-board instead of output-to-input. I also think it would be nice to have all the power connections already made and have the circuit complete with a switch. But it works as-is and I was pleased with this as a one-month project!
Step 5: Random Issues
- Video resolution needed adjusted to fit the monitor. This info was found here.
- Static in audio in certain games.
- Overclocking the Pi and changing the audio sample rate to 44.1 in retroarch.cfg fixed that.
- GPSP emulator doesn't accept the RetroArch global configuration
- you must run /opt/retropie/emulators/gpsp/raspberrypi/gpsp to run a config program for button mapping
- exiting a game is Select+R instead of Select+Start. This opens a new menu and you select exit from there.
- Make your own PNG or JPG at 1920x1080 and save it to /home/pi/RetroPie-Setup/supplementary/splashscreens
- Change your screen with RetroPie_Setup
We have a be nice policy.
Please be positive and constructive.