Build a handheld console

By K.G. Orphanides. Posted

This month, we’re going to build handheld consoles powered by two different Raspberry Pi computers, in two different cases. The Retroflag GPi Case for Raspberry Pi Zero, supplied by The Pi Hut, has a total of eight buttons plus a digital pad and a 2.8-inch 320×240 colour screen. It’ll run for hours on three AA batteries and is small enough to carry in a generously sized coat pocket.

The PiBoy DMG is more expensive, chunkier, and much more powerful. It has a 3.5-inch 640×480 display, both digital and analogue controls, and a total of ten buttons. You can access all Raspberry Pi 4’s USB ports and there’s an optional mini HDMI pass-through. It won’t run off AAs, so the full kit ships with a 4500mAh rechargeable battery.

Build 1: Raspberry Pi Zero

Step 01: Install RetroPie

Use Raspberry Pi Imager for Windows, Linux and macOS to download and write RetroPie (RPI 1/ZERO) on a microSD card. 8GB capacity should be fine for our purposes, as none of the systems we’ll be emulating involve large files. Before you install Raspberry Pi Zero in the GPi Case, you connect it to a monitor, a keyboard, and the internet to install RetroFlag’s safe shutdown script. Insert your microSD card and connect your peripherals. Allow RetroPie to boot, then press F4 to quit to the command prompt.

Step 02: Basic config & safe shutdown


sudo raspi-config
. Now go to Network Options. Go to Wi-Fi and set your country, network name (SSID), and password. In Localization options, Change Keyboard to make sure your keyboard is properly configured. TAB to Finish on the main menu, press ENTER and reboot. At the command prompt, type ifconfig to confirm that your wireless network is connected Finally, on a single line, type:
wget -O - "
picase/master/" | sudo bash
This will download and run the safe shutdown installer before restarting Raspberry Pi Zero. Power down and unplug the system.

Step 03: Add display support

Return the microSD card to the system you’re using to prepare the OS for use. Download this patch zip file and unzip it. The readme file includes instructions for Windows and macOS – the latter also applies to Linux operating systems including Raspberry Pi OS. From the boot partition of your RetroPie disk, copy config.txt to the original_files directory in the patch’s folder and replace it with the one that you’ll find in the patch_files subdirectory. Similarly, back up dpi24.dtbo from RetroPie’s /boot/overlays folder to the supplied overlays directory, then copy over dpi24.dtbo and pwm-audio-pi-zero.dtbo from the patch_files subdirectory to RetroPie’s overlays folder.

Step 04: Prepare the case

The RetroFlag GPi Case comes with a helpful illustrated installation guide, a USB power cable, plus the screwdriver and four screws you’ll need to assemble your handheld. Open the battery compartment at the back and flip the Safe Shutdown switch to the ‘on’ position. Make sure the main console power switch is in the off position. Remove the ‘cartridge’ – actually a Raspberry Pi Zero case – from the slot at the top of the console; turn it so that the sticker’s facing you and gently but firmly pull it apart. Remove the microSD card from Raspberry Pi and the microSD cover from the case.

Step 05: Install Raspberry Pi

Place Raspberry Pi loosely into position on the four mounting posts in the shell, with the SD slot facing the gap you removed the cover from. Connect the micro USB extension ribbon cable from the I/O conversion board that comes installed in shell 2 to Raspberry Pi’s USB port (the rightmost – the other one is only for power). Now seat Raspberry Pi into shell 1 and position the I/O board on top of it. Make sure both the posts and GPIO pogo pins are lined up. Reinsert the microSD cover, clip the cartridge halves back together, and install the supplied screws into the holes on the back to secure it. Open the SD card cover, insert your card, close it, and slide the cartridge back into the main body of the case. Insert three AA batteries.

A micro USB port under the GPi's battery cover can provide USB peripheral connectivity via a powered hub

Step 06: Power up and configure

Flip the power switch at the top right and RetroPie will boot. The GPi Case registers as an Xbox 360 pad, less a few buttons, though left and right buttons are hidden on the back of the case. Hold any button to start configuration. When you get to a button that doesn’t exist, press and hold any button. Skip hotkey configuration and allow RetroPie to auto-configure it as Select when prompted. You’ll be able to exit to the menu from games by pressing Start and Select at the same time. In the front end, tap A to enter the RetroPie menu, scroll to RetroPie Setup, and tap A. Go to Configuration / tools, select Samba, and Install RetroPie Samba share to create a network share so you can easily copy game files over to the console’s ~/RetroPie/roms directory. RetroPie Setup also allows you to install new emulators.

Build 2: Raspberry Pi 4

Step 01: Image your microSD card

Experimental Pi has its own fork of RetroPie, tweaked to fully support the handheld’s features. Download and extract the PiBoy DMG Official Image operating system image and flash it to your microSD card using the Raspberry Pi Imager tool. Alternatively, you can install RetroPie – or any other Raspberry Pi OS/Raspbian-based operating system – but will have to add Experimental Pi’s safe shutdown and on-screen display scripts, available here.

The cartridge that slots into the GPi Case is really a swappable Raspberry Pi Zero case, so you could keep different game collections on separate systems

Step 02: Chassis preparation

Experimental Pi’s illustrated online assembly instructions for the PiBoy DMG are among the best we’ve seen, so keep them on hand during this build. The PiBoy DMG Full Kit comes with the battery, screws, screwdriver, buttons, and blanking plates that you’ll need to build it. It’s worth adding the HDMI adapter to your order, too. Unscrew the back of the case, and then unscrew and lift off the fan assembly that’ll keep Raspberry Pi cool in situ.

Step 03: Install Raspberry Pi

Slip the supplied faceplate over Raspberry Pi’s ports – and, if you’re using it, fit the PiBoy HDMI adapter to the rightmost micro-HDMI port and slide its faceplate on. Gently push the SD card adapter ribbon cable into Raspberry Pi’s microSD slot, then lower the computer and HDMI adapter onto the standoffs. Screw the HDMI adapter into position. If you’re not going to use this adapter, fit a blanking plate in its place.

Step 04: Fit the fan

Add the fan board: making sure that it’s lined up with the GPIO, gently seat it into place – a rocking motion works well for this. Make sure all cables are correctly lined up and screw the board down. Line up and gently press into the place the IPS screen cable. Place the supplied power switch onto the switch on the top right of the board and screw the rear of the case back on. Fit the rechargeable battery – it’ll only connect one way round, but there are also polarity markings to help.

The PiBoy DMG case has a built-in fan, which makes it a little noisy but also means you can overclock it to run demanding games

Step 05: Go wireless

Slide the microSD card you imaged earlier into position and power up. To add wireless networking to our handheld build, mount its microSD hard disk on any other computer. In the top-level /boot directory, create a file called wifikeyfile.txt. It should contain the following lines:

Save the file, unmount the card, return it to your handheld, and boot. From the RetroPie menu, select ‘Wifi’, then import WiFi credentials from /boot/wifikeyfile.txt. As with the RetroFlag build, it’s worth enabling Samba for ease of transferring software to the console (see Build 1, Step 6). Transfer your games and you’re ready to play on the move.

From The MagPi store


Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.