Introduction: Homemade Handheld Console
Welcome
to my step by step guide on how to create your own DIY GameBoy with a Raspberry Pi 3 and the Retropie emulation software.
Before starting this project, I did not have any experience with raspberry pi, retropie, soldering, 3d printing or electronics, therefor this project is designed to be as simple as possible for beginners and above and a great project to start if you've just picked up a Raspberry Pi.
This project is designed for the Raspberry Pi 3. You may be able to create the same project using a Raspberry Pi 2, however I have not tried this and cannot guarantee it will work.
Step 1: What You Will Need
The following is a list of tools and equipment you will need for this project. The prices of these items is in Australian dollars and the links provided are for what I used in my project. If you do not live in Australia, you may find better sellers/prices for these items.
Equipment:
Raspberry Pi 3 $70 [LINK]
3.2 Inch TFT LCD $17 [LINK]
3.7V 2200mAh Lipo Battery $15 [LINK]
16GB Micro SD Card $10 [LINK]
M3 Standoffs and Screws Set $7 [LINK]
Zero Delay USB Encoder $5 [LINK]
Tactile Buttons $4 [LINK]
2x 90 by 150mm Proto Board $2 [LINK]
Short Micro USB Cable $2 [LINK]
5V Micro USB Charging Board $1 [LINK]
3.5mm Mini Speaker $1 [LINK]
Rocker Switch $1 [LINK]
TOTAL ~$135
Tools:
Soldering Iron and thin solder
Heat shrink tubing
Hot glue gun
Stanley Knife (Box Cutter)
A pencil
Small Phillips head screwdriver
SD Card reader
Wire cutters/strippers
HDMI Cable
USB Wall Charger
Spare micro USB cable
Computer Monitor with HDMI input
A USB keyboard [I recommend this one]
(Optional) 3D printer
Software:
Retropie 4.4: [LINK]
SD Formatter: [LINK]
Win32 Disk Imager: [LINK]
WinSCP: [LINK]
PuTTY: [LINK]
(Optional) Case 3D Model:
Step 2: Installing Software
Download all of the software using the links in the software section. Once you have downloaded and unzipped all of the software, insert the micro SD card into your computer using a card reader.
Once the SD card has been recognised run SD Formatter.
Double check that the Drive selected is definitely your SD card and that it does not contain anything important. This step will erase everything on the SD card perminently.
Select options and change the format type to FULL (Erase) and turn on format size adjustment, then click ok and Format.
Once the SD card has been formatted, run Win32diskimager. Select the Retropie image file, make sure the device is set to the SD card and click Write and then Yes. This will take a few minutes.
Once the image has been written to the SD card, insert the SD card into your raspberry pi. Attach the 3.2 Inch LCD Screen to the raspberry pi by lining up the far right pins on the console with the mount on the back of the screen. Connect a moniter to the pi using an HDMI cable and power in using a USB wall charger and micro USB cable. Also be sure to connect a USB keyboard to one of the pi's USB slots.
The software will take a couple of minutes to initialize and reboot. Once this process is done you should see the device configuration screen. If not, try unplugging your keyboard and plugging it in again.
Enter in the inputs you would like to control the software. Keep in mind that 'A' is to select items in the menu, 'B' is to go back, start is to open up the menu and the hotkey will be used with a combination of other keys to save, load, restart and exit out of games that are running.
Once you have configured your controls, navigate to the configuration menu and then to the RASPI-CONFIG option.
Once in this menu, select 'Localization Options', then select 'Change Wi-Fi Country' and select your country.
Then back in RASPI-CONFIG menu, select 'Interfacing Options', then SSH. Press tab to select 'YES' then hit enter to enable SSH.
Once again back in the RASPI-CONFIG menu, navigate to 'Advanced Options' and select 'Expand Filesystem. This will take a few seconds.
Once you have completed these steps, exit the RASPI-CONFIG menu and reboot the pi when prompted.
After the device has rebooted, enter the 'Configuration' menu again and select 'WIFI'. Select 'Connect to WiFi Network' and select the network you would like to connect to. Enter your password and the pi should connect to your Wi-Fi network.
Exit back to the 'Configuration' menu and select 'SHOW IP.
The screen should now display the IP address of your raspberry pi that you can use to remotely access your pi from your computer.
Step 3: Installing Drivers and Boot Config
Run PuTTY on your computer and enter in the raspberry pi IP address into the Host Name section. Click yes to acknowledge that you trust the IP address entered.
You will then be prompted to login. The default login credentials will be
Username: pi
Password: raspberry
Once these credentials have been entered, you can now start modifying the pi. The first step is to download the drivers that will allow the 3.2 inch screen work.
Type the following commands; I recommend copying and pasting them into PuTTY using ctrl+C and right click.
git clone https://github.com/swkim01/waveshare-dtoverlays.git
sudo cp waveshare-dtoverlays/waveshare32b.dtbo /boot/overlays/
Now to edit the boot config file:
sudo nano /boot/config.txt
Delete the # before disable_overscan=1 and set it to
disable_overscan=0
Then delete all the #'s before the overscan values and set them all to -20
overscan_left=-20
overscan_right=-20
overscan_top=-20
overscan_bottom=-20
Delete the # before hdmi_force_hotplug=1
hdmi_force_hotplug=1
Navigate down to hdmi_mode=1 and delete the # before it. Underneath this line type hdmi_mode=87:
hdmi_mode=1
hdmi_mode=87
Next we will overclock the pi and adjust the settings to maximize performance.
WARNING: Changing some of these settings may void warranty and may cause your raspberry pi to overheat. I have used the following settings for a long time now and haven't had any issues but I can't guarantee the safety of your raspberry pi.
Navigate down to the arm_freq=800 line, remove the # and change the value to 1200. Add the following lines so it looks like this:
arm_freq=1200
core_freq=500
gpu_freq=500
sdram_freq=500
over_voltage=2
temp_limit=85
Next remove the # in front of
dtparam=spi=on
Navigate down to the bottom of the file and add the following two lines:
dtoverlay=waveshare32b:rotate=270,speed=92000000,fps=60
avoid_warnings=1
Hit CTRL+X to exit the config file and hit 'Y' when prompted to save the changes. Hit Enter when prompted for what file name to write.
Now reboot the raspberry pi by typing the command:
sudo reboot
Once the pi has rebooted, run PuTTY again (the last session will disconnect) and enter in the IP address again. This IP might change, so double check it by navigating back to the 'SHOW IP' screen in the retropie configuration settings.
Once PuTTY is connected again, login using pi/raspberry and enter the following command:
ls /dev/fb*
you should see dev/fb0 /dev/fb1
if you don't see /dev/fb1 , something has gone wrong and you will need to format the SD card and start again
If you do see dev/fb0 /dev/fb1, enter the following commands one at a time, giving sufficient time for each step to complete:
sudo apt-get install cmake
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp
Now we need to edit one more file. Enter:
sudo nano /etc/rc.local
Navigate down to the line above “exit 0” and enter the following:
/usr/local/bin/fbcp &
Save the file by hitting CTRL+X, Y, then Enter.
Now reboot the device using:
sudo reboot
When the pi reboots, the touchscreen should now be displaying Retropie. No need for an HDMI monitor anymore!
Step 4: Installing ROMS
Before building the enclosure for your raspberry pi, it is worth testing out the software by installing ROMS.
I won't go into detail as to how and where to get game ROMS as there are many ways of obtaining them which vary in legality. Once you have sources some game ROMS, here is how to remotely install them onto your raspberry pi.
Turn the pi on by plugging it into the USB wall charger and wait for it to boot up.
Next run WinSCP
Type in the IP address into the Host name section
Enter 'pi' for the username and 'raspberry' for the password. It's worth saving this configuration so you don't have to type it in every time.
Click on 'Login' and click 'Yes' if the software askes you to remember this key
The ROMS are kept in /home/pi/RetroPie/roms
There needs to be a folder here for each system you want to emulate. There should be some folders already here by default.
Some systems like the PSX require BIOS files, which need to be sourced and placed in the BIOS folder.
Now you need to copy your game ROM files into their respective folders by either dragging them in or via Ctrl+C and Ctrl+V.
Click OK to begin the transfer.
This may take a while depending on what ROMS you are transferring and how many. I recommend transferring ROMS in batches. This way if the connection drops out you don't have to start all over again and if you reboot after uploading a couple of ROMS you can actually play them while doing another transfer without interrupting it.
Once the transfer has successfully completed, click the terminal option on the toolbar and enter the command:
sudo reboot
Once the pi has rebooted you will now be able to test games using the keyboard or by connecting a USB controller and configuring its inputs. At this point you can use your raspberry pi as a miniature retro games console, either by propping it up somewhere or connecting it to your TV.
Step 5: Building the Enclosure: Buttons!
Next we will start to build the enclosure for the raspberry pi to sit in and connect the buttons, speaker and power supply to turn it into a portable gaming device.
First we need to cut a hole in one of the proto boards to pass the LCD mount through and hold the screen in place.
Line up the screen in the center of the proto board and as close to the top without obstructing the holes in the corners which you will need to screw in the spacers for holding the back piece on. If you've purchased the boards in the equipment list of this tutorial, the lcd mount will line up with rows 19 to 22 and rows C to P.
Using a pencil, trace around where the mount touches the board and mark the lines clearly.
Using a stanley knife, cut out the marked area. This make take a while and could blunt your stanley blade, so if you think you have a more appropriate tool, feel free to use it, just be careful not to crack or snap the board. Do not cut any further than you need to.
Once you've but out the hole, pass the LCD mount through it to see if it fits. It should be as snug as possible to avoid the screen moving around.
Next mark out where the bottom of the screen lines up on the board so that you know how much space you have to place the buttons
Open up your tactile switch set and start placing the switches on the board. You will need 4 on the upper left for up, down, left and right, 4 on the upper right for A, B, X and Y and 3 along the bottom for START, SELECT and your Hotkey/Home Button. I had to space the vertical buttons slightly farther apart than the horizontal buttons which wasn't ideal but after using the console for a while I'm used to it and it isn't as unusual as I thought it would be.
If you would like to have shoulder buttons like R1, R2, L1 and L2, add 4 more switches to the other proto board. This step is optional if you want to keep the console size small and only want to play games that don't require shoulder buttons (remember that the super nintendo has shoulder buttons!)
These buttons need to also be below the bottom of the screen as this is where the bottom of the raspberry pi will sit on the other side. How far in from the sides you place these buttons is up to you depending on what is most comfortable.
Now to flip the board over to start soldering. Make sure all the buttons are pushed down, flat on the board and that their pins are all protruding through and not bent underneath them. Once the iron is hot, add a little bit of solder to two vertically aligned pins on every button. This will help hold the buttons in place and make it easier to connect the wires.
With the main 8 buttons on the front board, add solder to the pins that are furthest from the center. This is to allow space for the speaker.
Next, grab the wire connectors that came with the Zero Delay USB encoder and solder each of the wires on a connector to each of the pins on a button. Repeat this until you have soldered a connector for every button on both boards.
Step 6: Speaker Installation
Once all of the connectors are in place, you can now place the speaker. This step is optional if you do not want a speaker and are happy to connect earphones to the audio jack.
Pop open the white plastic case on the speaker and place it face down on the back of the proto board that has the main face buttons. Using a hot glue gun, glue the speaker down insuring that none of the soldered wires are touching any metal parts of the speaker.
Step 7: Connect the USB Encoder
Next we need to connect all the buttons to the USB encoder. The encoder has 4 specific slots for up, down, left and right and a slot for the USB cable. The rest of the buttons can be connected to any of the slots on the bottom row. The connectors should click in place with a little push.
Once all the buttons and USB cable are connected, glue the USB encoder onto the bottom board, just bellow the connections to the shoulder buttons and just above the holes in the bottom corners of the proto board.
Now place the LCD screen through the hole in the top board and connect the raspberry pi to it from underneath. Feed the 3.5mm audio cable over the top of the pi so that it can access the audio jack.
Fold the two boards together so that all the wires are contained between the two boards and connect the USB cable to the raspberry pi.
Connect the raspberry pi to the USB wall charger to turn it on and wait for it to boot up. Connect your keyboard again so you can navigate to the controller configuration screen. You may find it easier to read the screen if you connect your monitor to the pi via HDMI again.
Configure the buttons you've installed to test that they are all working. If a button is not detected while trying to configure, you may have to re-solder that particular button.
If all the buttons are detected, maybe try out a game for a bit to fully test the buttons.
Step 8: Battery Power
Next we need to set up the battery recharge circuit to make the console portable and re-chargeable.
Solder the red wire from the battery to the B+ terminal on the recharge circuit board and the black wire to the B- terminal.
WARNING: Double check before soldering or you could short out the recharge board or zap yourself.
After the battery is connected to the recharge board, we need to connect the micro usb cable. To do this we must cut the large USB end of the cable off with wire cutters. Feel free to shorten the cable if needed but keep in mind that it must reach from the bottom of the proto board all the way up to the top to connect to the raspberry pi power input. Strip back the rubber on the cable to reveal the two wires inside.
Solder the red wire to the OUT+ terminal on the circuit board and the black cable to the OUT- terminal. Again be very cautious when doing this.
You can solder the power directly to the raspberry pi board but I was not comfortable doing this so I instead opted to just have a usb cable plugged in. This is where a 90 degree angled, micro USB cable is nice (link in the equipment section) as it hides under the proto board nicely.
To test the connection, plug the micro USB cable into the raspberry pi. If the battery has charge, the pi should boot up. Connect your USB wall charger to a spare micro USB cable and connect this to the micro USB slot on the recharge circuit. The LED on the chip should light up red while charging and blue when at full charge.
If the pi powers up and the led on the circuit lights up to show that it is charging, you're ready to move onto the next step.
Step 9: Soldering the Encoder Directly to the Pi (Optional)
The next step is optional as it requires you to semi-permanently connect the controls to your raspberry pi. If you're thinking of using the pi for other projects and swapping it in and out of the gameboy configuration, skip this step.
First, you need to cut the USB connector off using wire cutters and strip the rubber back to reveal 4 wires; black, green, white and red. These wires are for Ground, Data +, Data – and VCC respectively.
Next you need to solder each wire to the configuration in the attached image.
WARNING: This action will definitely void warranty and runs the risk of killing your raspberry pi.
Step 10: On/Off Switch
The console should now work perfectly fine, to turn it on however, you'll need to plug the micro USB into the power socket of the pi and unplug it to turn it off. An on/off rocker switch makes this process a bit nicer. Attaching one is fairly simple if done carefully.
We need to cut a section of the thick rubber casing off the cable close to the micro USB end. If done carefully we can expose all 4 of the USB wires without cutting any of them. If you do cut them, no stress, you'll just have to solder them back together. The only wire we need to cut is the red one. Once the red wire is cut and stripped back, solder one end to one of the metal pins on the rocker switch and the other end onto the other pin.
Step 11: Gluing and Screwing It All Together
Glue the battery down on the bottom board between the USB encoder and where the pi will sit. Next, glue the recharge circuit to the under side of the top board. I found the bottom left side to be the best spot for this. Make sure it is close enough to the edge to easily attach a cable.
Glue the on off switch to the underside of the top board. I found that the top right corner is a good spot.
Before screwing everything together, run the 3.5mm audio cable and the micro USB cable coming from the recharge circuit over the top of the pi, on the left side of the IO pins.
Screw in the 20mm spacers to the bottom using the nuts found in the spacer kit, then line up the top board and screw the top board to the spacers using the M3 screws. Be sure to fold as many of the cables in between the two boards as you can, without damaging anything.
Step 12: (Optional) 3D Printed Case
Congratulations!
Assuming everything went well with your build, you now have a working, portable, rechargeable retro console. Not only can you now play your favourite old-school games on the go but you can also plug the console into your TV and connect a wireless controller to use it as a mini console.
As well as creating this tutorial, I have designed a case for this console that can be 3D printed and put together to give it a much more professional and comfortable look and feel.
Download the models at the top of this tutorial to 3D print yourself or send to a 3D printing vendor.
The case should clip together over the console and still leave space to connect power, controllers and an HDMI cable.
To secure the case even more, replace the female to male spacers with female to female and connect 10mm female to male spacers on the top board, and female to male 5mm spacers on the bottom board. Now you can use the M3 screws to attach the case to the spacers through the holes in the corners of the case.