My first Retro Pi project, which involved gutting an original nintendo system and turning it into a NES/Super Nintendo/Gameboy/Sega Genesis console, was a ton of fun. After building 3 consoles, our itch for nostalgia and electronics project had been scratched. Two years later the itch was back. My friend, who pitched me the idea for the first project, was getting restless and wanted to try a more challenging build. Instead of converting a console, he wanted to convert an original gameboy into a Retro Pi handheld using a Raspberry Pi Zero! I loved the idea and we quickly got down to planning and ordering parts.
An invaluable resource for this project was the sudomod community. Their guides and community are top notch!
|Gameboy Button Board PCB||1||$14.76|
|Micro USB Interface Port||1||$1.24|
|3.7V Li-ion Battery Mini USB to USB A Power Supply||1||$4.09|
|5V USB Powered Mini USB Sound Card DAC||1||$6.34|
|4 Port USB Hub||1||$3.93|
|Mono 2W Class D Audio Amplifier PAM8302||1||$4.89|
|Mini Metal Speaker 8 ohm 0.5W||1||$1.84|
|3.7V 2000mAh Lithium Ion Battery||1||$10.99|
|Raspberry Pi Zero||1||$9.78|
|Original Gameboy (bought on Kijiji)||1||$25.00|
|10 USB Connectors||1||$0.72|
|Total Cost (USD):||$114.33|
I spent about two weeks choosing the parts for the build. Sudomod provides a lot of information on parts that generally work together but there are tradeoffs with all of them, and we had to decide what features we wanted in our Gameboy Zero (the name of this type of build). For example, there are a plethora of compatible screens you can buy, but the majority of them require 9V to operate. These 9V screens require you to do some soldering to convert it so that it uses 5V which is what the the rest of the Gameboy Zero uses. Instead I found one on Alibaba that met our size requirements but was also 5V out of the box.
The first thing we wanted to check was that the screen wasn't damaged during shipping and that this particular screen would work for our purposes.
The screen came with an RCA connector cable that we cut off and soldered directly to the RCA composite video output pins on the Zero. This picture shows the RCA composite video output pins in the top right:
We loaded a copy of RetroPie for the Pi Zero onto an SD card, soldered the yellow and red cables from the screen to the RCA pins, and the black cable to the 5V power contact on the back of the Zero. Since the Zero is already 5V there was no voltage conversion necessary. Here's a gif of our first screen test:
The PCB for the screen folds up nicely underneath the screen for when we install it later:
Now that we had the screen working, it was time to proceed with ripping out the guts of the original gameboy. The only pieces we kept were the case, buttons, power switch, and parts of the main PCB. We cut out the volume wheel and the headphone jack off of the PCB to be used later in the build:
As you can see, the case of the gameboy isn't exactly well suited to our plans. This system will need to be able to play nintendo, super nintendo, sega genesis, gameboy, and more; the two A and B buttons won't cut it. Additionally, our new screen is about twice the surface area of the original. The solution was to drill two new holes for more controls, dremmel out a larger hole for the screen, dremmel out many of the support posts, and cut out the back plate that the batteries rest against because the battery cover will hide that area anyway.
New button holes:
Screen widened (this was a rough first pass):
Back cut out:
Now that the case was prepared, I glued the screen in place.
I 3d printed two parts to help with the structure of the case. The first was the white spacer along the top to secure the screen in place by pressing against the back part of the case when it's closed up. The second piece were two little cylindrical shells to help keep the buttons in place in the new upper button holes I drilled.:
The next step was to solder wires from the button board to GPIO pins on the Pi Zero. Each pin hole is labelled on the button board describing which button it represents, making it very simple to create a map of buttons to GPIO pins. This map is used later to configure RetroArch to know which pins to watch for input. I used a strip a solid coper wires since they seemed conveniently; this caused major problems later on when I tried to fit everything in the case. The wires had very little flex and would easily snap off.
Not pictured here are two buttons that were mounted on the rear of the case. These acted as L and R buttons for super nintendo and required two holes drilled into the case. They are located in a spot that's perfect for your index fingers to reach and were connected to the GPIO pins as well.
At this point in the build we now have video and controls taken care of. All that remains is audio, charging, and power management. This was by far the most complex part of the build for me as I'm not all that great with electronics. To get these last three working we need to wire together seven components:
3.7V Li-ion Battery Mini USB to USB A Power Supply
The power supply connects to three things: 1.) the external micro USB port mounted on the side of the case, 2.) the 3.7V 2000 mAh battery, and 3.) the Pi Zero. The power supply converts the 3.7V from the battery up to 5V for the Pi Zero and can charge the battery when the external micro USB port is connected to power.
4 Port USB Hub
The USB hub provides extra USB ports, specifically for wifi, the USB DAC (although you could easily just desolder the USB male port) and a keyboard if necessary to debug wifi problems.
5V USB Powered Mini USB Sound Card DAC (Digital to Analog Converter)
The DAC convers the digital audio signal from the Pi Zero to analog output that is fed to the speaker and headphone jack.
Mono 2W Class D Audio Amplifier PAM8302
The analog signal from the DAC is pretty weak, so an audio amplifier is added before the speaker to increase the volumne output. Without this you can barely hear the speaker.
Gameboy Volume Wheel (potentiometer)
This potentiometer controls the volume/amplitude of the analog audio signal.
Gameboy Headphone Jack
3.5mm audio jack from the original gameboy.
Mini Metal Speaker 8 ohm 0.5W
A little speaker that mathces the size of the original gameboy one.
The diagram looks a bit complicated, but isn't that bad. Here are the key connections:
1.) The battery is wired to the PowerBoost to supply power and be recharged.
2.) The power switch is wired to the PowerBoost contacts to turn the Pi Zero on and off.
3.) The PowerBoost is wired to the Pi Zero.
4.) The Power Boost is wired to the USB hub and headphone jack.
5.) The Pi Zero is wired to the USB Hub so that it has access to anything plugged into the hub.
6.) The USB DAC (labelled USB Sound Card) is wired to the USB Hub which in effect connects it to the Pi Zero.
7.) The USB DAC is wired to the volume wheel, which is wired in series with the headphone jack and the audio amplifier.
8.) The Audio amplifier is wired to the speaker.
This required a great deal of trial and error on my part as I wasn't entirely sure what each contact on the volume wheel, headphone jack, and USB DAC were for. Some pictures of the wiring:
Headphone jack with the power switch blurred out on the right:
First successful sound test:
With the power, sound, and charging working, all the main components were now complete! In the picture below you can see the two buttons glued into the back of the case with a green wire running between them, the DAC hanging out on the left, the Pi Zero and battery at the top, the screen, button board, speaker, audio amplifier and headphone jack glued into the case, and the USB hub, PowerBoost, power switch, and a little custom pcb I made on the right:
Only one hurdle remained...closing up this gigantic tire fire, and then configuring the controls for each emulator.
Closing it up turned out to be a bit of an insurmountable problem for me. I turned to my friend who was doing a similar build to help with cable management and part positioning to make it all fit together. The finished product is a bit rough around the edges, but I'm extremely happy with the result:
We flashed RetroPie (version 4.X) onto the SD card that is then inserted into the Pi. RetroPie itself is composed of many pieces of software: the Raspbian operating system, EmulationStation (a GUI for selecting emulators and games) and RetroArch (an emulation management platform). RetroPie has an enormous community supporting it and is the defacto standard for projects like this.
Raspbian is a free open source operation system based on Debian. It has everything you need to manage your Pi right out of the box, including all sorts of drivers and configuration specific to Pi hardware. You can overclock your Pi, upgrade your OS, and tweak tons of settings from their simple menu.
EmulationStation provides a nice front end for setting up controls and launching various ROMs.
RetroArch is the core emulator management system within the RetroPie project. It contains the configuration and BIOS's of dozens of different emulation systems. It supports anything from Atari 2600 and ColecoVision up to Sega, Playstation, and N64. In many cases you will still need to go download the BIOS yourself as it would be illegal for them to provide that as part of their package. It comes preconfigured to know what inputs are required for each of these systems and can recognize many controllers as soon as they are plugged in.
The software side of this project was relatively simple. Download retrogame from this github repo, compile it, and make sure it's added to rc.local so it runs on boot. Edit the retrogame.cfg file and enter your mapping of which control is wired to which GPIO pin:
LEFT 4 # Joypad left RIGHT 19 # Joypad right UP 16 # Joypad up DOWN 26 # Joypad down LEFTCTRL 14 # 'A' button LEFTALT 15 # 'B' button Z 20 # 'X' button X 18 # 'Y' button SPACE 5 # 'Select' button ENTER 6 # 'Start' button A 12 # Left shoulder button S 13 # Right shoulder button ESC 17 # Exit ROM; PiTFT Button 1 1 22 # PiTFT Button 2 2 23 # PiTFT Button 3 3 27 # PiTFT Button 4
Restart the Pi and then configure each emulator accordingly and you're set!
Once the controls were operating fine it was just a matter of setting up save/load button combo and the exit game button combo's.
This build took around 16 hours in total, most of which was spent trying to figure out how to wire everything together and how to make sure it fit. Another 8 hours were probably spent reading about it, choosing parts, etc. Overall the project surpassed my wildest expectations. I now have a handheld gaming device that can play all the classics from my childhood consoles, and can run for hours on end without a charge. Although it boots up slowly, and the emulators I'm using cause a bit of screen flicker on some games, I ended up with really kickass device. It was far more difficult than my NES RetroPie project, but far more rewarding.
If this feels at all daunting, don't worry. The community has come a long way since I built mine, and there are all sorts of resources available to help you. There are even all-in-one boards that have everything you need built into them; no need to mess around with complicated audio wiring or USB ports. I highly recommend looking into building one yourself!