Create a retro game console with the Raspberry Pi
Play classic games like Super Mario Bros., Sonic the Hedgehog, Space Invaders, and more with this fun do-it-yourself project.
The projects people have created with the Raspberry Pi are truly incredible. The low-cost microcomputer has been used to power home automation projects, servers, media centers, and many other do-it-yourself projects. One of the coolest projects is called Retro Pie, which transforms the Raspberry Pi into a retro gaming console and gives you the ability to play classics like Super Mario Bros., Space Invaders, Sonic the Hedgehog, and many others.
The project is a little difficult and requires you to input various lines of code, but you should be fine if you follow these directions. If this is your first time with the Raspberry Pi, I suggest you check out my earlier article for more information about the device.
The Retro Pie can work with either the $25 (£18.65 in the UK, and AU$28.50 in Australia) Raspberry Pi Model A or the slightly more expensive Model B, I recommend the latter. The Model B -- which can be had for $35 in theUS, £27.44 in the UK, or AU$37.35 in Australia -- adds an additional USB port, an Ethernet port, and doubles the memory to 512MB.
Update: A newer model, known as the Raspberry Pi B+, was recently announced and made available for purchase. The device is the same price as the original Model B, however it includes a total of four USB ports, a microSD card slot rather than a full, better audio, and has lower power requirements.
Other items you will need include a monitor connected through either AV or HDMI, an Xbox 360 controller, an Ethernet cord or wireless USB adapter, a 4GB Class 4 SD card or better, a USB keyboard, and a USB flash drive. A Micro-USB power supply capable of outputting at least 850 milliamps at 5 volts is needed to power the device, while an SD card reader (unless the computer you are using has one) is needed to transfer the operating system to the card. I also picked up a USB Hub for connecting more components, but this is optional.
Preparing the SD card.
The team behind the project have created a ready-to-use SD card image that will automatically install the Retro Pie software. The file can be downloaded from the PetRockBlog Web site, it must then be extracted to your SD card using the program Wind32DiskImager on Windows or RPi SD card builder on OS X. If you are having trouble with the RPi SD card builder software, try Pi Filler.
In the Wind32DiskImager program make sure to select the Write option when extracting the image file to your SD card.
On OS X 10.8, you are unable to double-click to open apps that didn't come from a verified source or from the Mac App Store. To get around this simply right-click the icon, select Open, and hit the "OK" button.
Connect your monitor, keyboard, Ethernet cable, Xbox 360 controller, and SD card to the Raspberry Pi. Once all of these are plugged in, you can now connect the Micro-USB cable, at which point the Raspberry Pi will automatically turn on.
The device will boot into the Emulation Station (the Retro Pie's main interface). Before configuring your controller, we must change a few settings. Press the "F4" key to exit the Emulation Station and enter the command line.
After installing Retro Pie with the SD card image, the card must be expanded to ensure that you can access all available space. Once exiting the Emulation Station, type "sudo raspi-config" in the command line, choose to expand the filesystem, and hit Ok. Then scroll down and select the fourth option to set up language and regional settings. Choose your location, time zone, and keyboard layout -- it's set to U.K. by default. Once complete, scroll down to Finish and perform a system reboot.
Make sure to press the spacebar (not the Enter key) to deselect the U.K. keyboard layout and select U.S., then hit Ok to use the location as your default.
Configure the Xbox Controller
After the system powers back on, once again exit the Emulation Station by pressing the "F4" key. In the command line, type "sudo apt-get install xboxdrv" and hit Enter to download and install the driver for the Xbox 360 controller. Once the driver has installed, type "sudo nano /etc/rc.local" in the command line and hit Enter. Tap the down arrow until your cursor is between the "fi" and "exit 0" lines.
In between those two lines, type "xboxdrv --trigger-as-button --id 0 --led 2 --deadzone 4000 --silent & sleep 1". If you are going to use more than one controller, enter "xboxdrv --trigger-as-button --id 1 --led 3 --deadzone 4000 --silent & sleep 1" directly under the first command. For a wireless Xbox 360 controller you use Microsoft's special Xbox 360 Wireless Gaming Receiver for Windows, and replace "id" with "wid" in the command line.
Don't forget to save the selection. This can be done by pressing the "CTRL" and "X" key and pressing "Y" to confirm. Then, press Enter to return to the command line and type "sudo reboot" to restart the device.
When the system comes back online you will be asked to configure the controller in the Emulation Station, simply follow the onscreen directions to do so.
Exit the Emulation Station one last time by pressing the "F4" key, type "cd RetroPie/emulators/RetroArch/installdir/bin" in the command line, and press Enter. Then, type "./retroarch-joyconfig >> ~/RetroPie/configs/all/retroarch.cfg" in the command line and follow the onscreen directions for configuring your controller. Once complete, perform a system reboot with the command "sudo reboot".
If the "~" key is giving you a different symbol, try pressing the "shift" and "\" key at the same time.
The Retro Pie supports ROMs, which are essentially a digital copy of a game, for the Atari 2600, Game Boy Advance, Game Boy Color, Game Gear, MAME, NeoGeo, Sega Master System, Sega Megadrive, Nintendo, Super Nintendo, and PlayStation, among a few other systems.
The easiest way to transfer ROMs, in my opinion, is to use a USB flash drive. Power on the Raspberry Pi and once in the Emulation Station, connect the USB drive to the device. The operating system will automatically create a ROM directory on the flash drive. Once it has stopped flashing, remove the drive from the Raspberry Pi, connect it to your computer, and transfer the ROMs into their corresponding folders. For example, a Sega ROM should be placed in the Sega folder, a Super Nintendo game in the NES folder, and so on.
ROMs will automatically be transferred from your USB drive to the Raspberry Pi the next time you connect the flash drive.
If you ever need to redo the controller configuration inside of the Emulation Station, type "rm /home/pi/.emulationstation/es_input.cfg" in the command line to delete your original setup.
To return to the Emulation Station, type "emulationstation" in the command line. If you are playing a game, simply press the "ESC" key on your keyboard to return to the main menu.
Typing "sudo nano /home/pi/RetroPie/configs/all/retroarch.cfg" in the command line will open a window that allows you to view and edit specific buttons on the controller.