Software

Installing RetroPie

RetroPie is an awesome project that provides a ready to go disk image for the Pi that is already running all the emulators, and depending on the nature of your build it may require no further configuration. The following steps will show you how to setup an SD Card running the latest RetroPie.

Download RetroPie Image from the website https://retropie.org.uk Download Win32DiskImager from https://sourceforge.net/projects/win32diskimager/ Insert the SD card into the computer, open Win32DiskImager and select the image file and the SD card, then hit write. Put the SD Card into the Pi, plug in Ethernet, HDMI, LCD Screen, and a USB Keyboard if you like. Plug in the power and the Pi should boot up, do some automatic setup and then launch into RetroPie. The LCD screen won’t be displaying but the HDMI output should be. If you plugged in a keyboard it should have detected it and you can follow the onscreen instructions to configure it. You can now start configuring the Pi, the easiest way is through downloading a tool called Putty from http://www.putty.org/ and using it to SSH into your Pi from another computer on the network. It is basically just a way to configure the Pi remotely through the command line. You can find out the IP address of the Pi through the interface on RetroPie.

Configuring the LCD

I chose an LCD screen that plugs straight into the GPIO pins on the Raspberry Pi. I initially tried a 3.5” screen but the refresh speed was terrible to the point most games we unplayable. I then moved down to the 3.2” which worked perfectly at full speed. Your results may vary and this method is only relevant if doing the same. If you are using a screen that uses one of the other display ports then you will need to find another guide for this part, there are plenty online. To do all configuration I used a free tool called Putty which enabled me to SSH into the Pi from my PC. The following will show you how to get the image outputting to the LCD screen. Big thanks to the RetroPie forums for instructions on how to do this (original forum post is here: https://retropie.org.uk/forum/topic/295/retropie-and-waveshare-32b).

1. SSH into the Pi using the default username pi and the default password raspberry.

2. Download the LCD overlays with the following command:

git clone https://github.com/swkim01/waveshare-dtoverlays.git

copy the overlay to the boot directory

sudo cp waveshare-dtoverlays/waveshare32b-overlay.dtb /boot/overlays/waveshare32b.dtbo

3. You now need to edit the config file using a command line text editor called nano. Do this with the following command:

sudo nano /boot/config.txt

This will have opened the config file for editing, scroll down in the file and add these 2 lines to the very bottom of the file:

dtparam=spi=on dtoverlay=waveshare32b:speed=82000000,fps=60

Hit Ctrl+X to exit, and confirm save by pressing Y then Enter

4. You now need to reboot the Pi to put the new boot settings into effect. Do this with the following command:

sudo reboot

This will kill your connection in Putty, so once the Pi has rebooted you will need to reconnect.

5. Once rebooted we need to check our LCD screen has been detected. Cross your fingers and run the following command:

ls /dev/fb*

If it worked you should see:

/dev/fb0/dev/fb1

With fb0 being the HDMI and fb1 being the LCD. If this didn’t work you may need to find an overlay for your specific LCD screen.

6. Now that the LCD is detected we need to output to it. To do this we will use a tool called rpi-fbcp which will mirror the framebuffer from the HDMI to the LCD screen. To install this enter the following commands, some may take a while:

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

Once installed we need to configure rpi-fbcp to launch on boot. This can be done by entering the following command to edit the rc.local file:

sudo nano /etc/rc.local

and adding the following just above the line with exit 0 on it

/usr/local/bin/fbcp &

Hit Ctrl+X to exit, and confim save by pressing Y then Enter

7. It’s now time to reboot and hope the LCD comes to life:

sudo reboot

Display Settings

Once the LCD is up and running we’ll need to change where the screen actually renders out on the LCD to line up with the Gameboy case. I’m using the sizing of the original Gameboy screen on mine but you may wish to modify the case to take advantage of having the bigger LCD in there. We’ll also need to make a slight change to enable video output on our composite AV port.

1. To change the viewport we need to head back and edit the boot config again. Do this with the following command

sudo nano /boot/config.txt

2. Once in here we need to adjust the overscan numbers. The numbers below are what worked for my original size screen. The lines should already be in the config, you will just need to uncomment them by removing the # at the start of the line, and then changing the numbers.

overscan_left=60 overscan_right=60 overscan_top=40 overscan_bottom=0

3. To enable the video output on the composite port, add the following line anywhere in the boot config:

sdtv_mode=2

4. Hit Ctrl+X to exit, and confirm save by pressing Y then Enter

Setting Up The Buttons

To setup the buttons we need to use a little utility called Retrogame. This uses the GPIO pins as a virtual keyboard input, and enables us to map the GPIO pins connected to our buttons. More information can be found at https://learn.adafruit.com/retro-gaming-with-raspberry-pi/adding-controls-software

To setup Retrogame, enter the following commands.

cd curl -O https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/retrogame.sh sudo bash retrogame.sh

This will launch the setup utility. Select 1 and press enter, then press Y to reboot. The option you select here doesn’t matter too much as we will manually update the button mapping anyway.

Once rebooted enter the following command to edit the Retrogame config, where we can manually map out buttons.

sudo nano /boot/retrogame.cfg

Map the keys to the GPIO pins by comparing your GPIO pin numbers (which can be found here: https://www.raspberrypi.org/documentation/usage/gpio/) to the buttons they are connected to.

Further Configuration

If you’ve got this far then you’re doing pretty well. Depending how you want to use your Gameboy you might want to plug in some USB controller pads. There are plenty of guides already online that will show you how to do this so I won’t bother repeating that here. You may also want to tweak the resolutions of individual emulators, and the font sizes in EmulationStation. Again, Google is your friend here.

Parts

Raspberry Pi 3b (US $37.88)

https://www.aliexpress.com/item/In-stock-original-RS-made-in-the-uk-raspberry-pi-3-model-B-board-with-wifi/32691965709.html

3.2” LCD Display (US $12.36)

https://www.aliexpress.com/item/3-2-Inch-TFT-LCD-Display-Module-Touch-Screen-For-Raspberry-Pi-B-B-A/32628482115.html

Reproduction Gameboy Case (US $14.66)

https://www.aliexpress.com/item/grey-color-New-Full-Housing-Shell-for-Nintendo-For-Gameboy-classic-OEM-Repair/32237607753.html

Micro SD Card 64GB (US $25.70)

https://www.aliexpress.com/item/sandisk-micro-sd-card-TF-card-32gb-class-10-Real-capacity-8GB-16-GB-32-GB/32691887707.html

DMG Common Ground Control Panel (US $11.75 + Shipping)

http://store.kitsch-bent.com/product/common-ground-dmg-button-pcb

Gameboy Game Cart (US $5.99 for 6)

https://www.aliexpress.com/item/Game-Cartridge-Replacement-Plastic-Shell-For-GB/32676191136.html

3.5mm 10cm extender (US $2.99)

https://www.aliexpress.com/item/90-degree-right-angled-3-5mm-4-poles-Audio-Stereo-Male-to-Female-Extension-Cable-10cm/32291933745.html

5V 2.1A Power Bank Charger Module (US $2.95)

https://www.aliexpress.com/item/Dual-Micro-USB-3-7v-to-5V-2A-Mobile-Power-Bank-DIY-18650-Lithium-Battery-Charger/32785934070.html

4x 2500mAh Li-ion 14500 Batteries (US $10.21)

https://www.aliexpress.com/item/New-2pcs-Original-TR-2500mAh-14500-3-7V-Rechargeable-Li-ion-Batteries-14500-Battery-Lithium-Ion/32676135013.html

10pin 20cm ribbon cable (US $1.16)

https://www.aliexpress.com/item/F-F-IDC-Connector-10-Pins-Flat-Ribbon-Cable-2-54mm-Pitch-20cm-2pcs/32731413794.html

Power Switch (US $2.47 for 10)

https://www.aliexpress.com/item/10-Pcs-Pcb-Mount-4-Pin-3-Position-Sp3t-1P3t-Slide-Switch-Side-Knob-0-1A/32747100906.html

Battery Terminals (US $3.92 for 18)

https://www.aliexpress.com/item/Metal-Aa-Battery-Spring-Contact-Lamination-Plate-Terminal-Silver-Tone-18Pcs/32766010654.html

Sugru (UK £15.54)

https://sugru.com/buy

Wiring (US $2.37 for 20 sets)

https://www.aliexpress.com/item/20-SETS-Micro-JST-1-25-2-Pin-Male-and-Female-Connector-plug-with-Wires-Cables/32652583971.html