An icon representing a D-pad of a gamepad

How to build a handheld game console

by

I compiled all the information that I gathered designing and building this handheld game console so anyone can build it. This step-by-step guide contains the explanation of all the choices that I made, and the options that I left out of the table.

Feel free to challenge anything that doesn't make sense to you, since I'm no expert in any of these topics and I've just built this prototype to learn. Also, make sure to check the list of original sources for more detail documentation.

Contents

Context + Decisions:
  1. 01. CPU
  2. 02. Screen
  3. 03. Gamepad
  4. 04. Power supply
  5. 05. Circuitry
  6. 06. Case
Building Steps:
  1. Step 1. Install RetroPie on a Raspberry Pi.
  2. Step 2. Connect it to a TV and keyboard.
  3. Step 3. Add your own custom buttons.
  4. Step 4. Install the PiSugar hardware.
  5. Step 5. Wire and assemble.
  6. Step 6. Build an enclosure.

Results

Anyone should be able to build a fully-working handheld console following this guide.

However, I'm currently working on fixing some structural issues on the enclusure, like the way the shoulder buttons interact with their respective tactile push buttons, or the way in which the different pieces join together. This means that the farthest this guide will take you for now will be to have these results:

Check out this post with the details of what needs to be fixed.

Do you want me to e-mail you when I have news about the console? Drop your address here:

Philosophy

I wanted the person building this console to be able to play games as early as the first step. That means having a proper game console from day one, and adding improvements in layers whenever the person can afford to work on it.

For example, I started playing games with just the Raspberry Pi connected to my PC monitor, an old keyboard, and a phone charger to power it. Later, I added a portable screen, then buttons, then a battery. And I was always able to play games regardless of which step of the process I was in.

I believe building your own things make you enjoy them the most. And, using them with no need to wait until you finish building them, can make the process even more enjoyable.

There is a chance that you have to buy only few materials to start playing games. The subsequent improvements will be upgrading those areas one by one, taking your time and spending money only when you can. That's exactly how I built mine in this video:

Affordability

Even though I understand that not everyone can access the components that I've used for this build, you'll find that most of the decisions I made are ultimately defined by having more than one option available. For example, you can use a 10 years-old Raspberry Pi that you might have laying around collecting dust or buy one for cheap (they all have the same footprint).

I have plans, though, of building the same console but using the ultimate top-of-the-line components like an x86-based SBC capable of running SteamOS (like Latte Panda or anything with an AMD Ryzen embedded APU), an AMOLED screen, and a body carved from a single piece of aluminum.

Materials

I hope you've read the philosophy behind this project first and understand that you don't need to spend money in buying all the components at once. You can enjoy the console since day one with components that you potentially may have at home already.

These are the materials for the exact same final version I built. All of the listed items contain affiliate links. This means that without any cost to you, I might receive a small commision for sales:

01. CPU

In order to run games or, like in my case, emulators the main thing needed is any kind of computer. Since I wanted this to be a handheld game console, my main priority was to get a small yet powerful computer. That's why I chose to work with a Single Board Computer (SBC). I've used one of them before to build an arcade cabinet so I know that SBCs can run games smoothly.

A single-board computer is a complete computer built on a single circuit board, with microprocessor, memory, input/output and other features required of a functional computer.

There are plenty of options in the market for SBCs. In my case I went for a Raspberry Pi 4 Model B. Note that at the time of building the console the model 4 was the latest on the market.

I like the Raspberry Pi for many reasons: it has a massive community, meaning that if you have a problem it is most likely that someone already found a solution for it. Also, all the models have the exact same footprint, meaning that you can build a project using a board from 2012 up until the most recent one, and the physical constraints to build a case around it are gonna be the same. This also makes it even more budget friendly.

Other option that I think it was worth it considering was the Orange Pi 5, but it has a completely different footprint, and also it's too expensive.

Operating Systems

I tried different projects that turn the Pi into an emulation powerhouse. The main 3 were Lakka, RetroPie and Recalbox. In my opinion, RetroPie is the most beginner friendly and it has a massive community behind. Feel free to explore the other ones by yourself if you're interested.

Overclocking

I covered this topic in another blog post about setting up RetroPie. In my opinion, only overclock it if you have an old Raspberry Pi model and you want to run very specific games. Also, keep in mind that doing it the wrong way voids the guarantee, so do it the right way as I described here.

The trade off on a handheld console is being conscious about heat dissipation. I added passive and active cooling to the case in case I wanted to overclock the Raspberry Pi, but I think it was unnecessary.

Slimming down

At some point, my idea was to slim down the Raspberry Pi board to save some space. The idea of slimming down the board is simple: get rid of the tallest ports. The thing is, it would've been an interesting-to-watch video but I would force people to follow the exact same process to build the console.

Source: Diet Raspberry Pi by Adafruit.

Compute Module

Another option would've been to use the Raspberry Pi Compute Module (CM3 or CM4) which features the same components of a normal Pi but in a reduced space.

The main con was that I've never worked with it. I wanted to make this first iteration of the console with the things that I know the most, and then I could make it slimmer and faster adding another layer of enhacement.

Also, using the Compute Module would narrow down the options people have to build this console. I guess it's way more people who have a Pi laying around than those who have a CM.

Step 1. Install RetroPie on a Raspberry Pi.

  1. Identify which model of Raspberry Pi you have.
  2. Connect a compatible SD card to your computer.
  3. Download and install the official Raspberry Pi Imager.
  4. On the Raspberry Pi Imager, click Choose device and select your Raspberry Pi model.
  5. Click Choose OS. Select "Emulation and game OS", then "RetroPie".
  6. Choose the version of RetroPie that corresponds to your specific board.
  7. Click Choose storage and select your SD card on the list to install RetroPie into it.
  8. Click Next and install RetroPie on the SD card.
  9. Now you can install games. I wrote an in-depth guide about installing games in RetroPie. You can always check RetroPie's official documentation for more details.

02. Screen

I've chosen a 5-inch screen because, in my opinion, the size went better with the case that I wanted to design. I knew that I wanted to use a normal console controller as a reference, and add a screen that fell like it was part of the design.

A counterexample for me was the PlayStation Portal, which is literally a PS5 controller cut in half and glued to the sides of a tablet. I didn't want that.

Aspect ratio: For this project I went for a screen with 4:3 ratio which is the same aspect ratio in old TVs. I wanted this console to be mostly a retro game machine. The 4:3 ratio is still good for running the newest games in 16:9 with horizontal black bars.

Resolution: 800x480 looks great for the size, although I wouldn't accept less than that resolution and I would definitely go higher if the price doesn't jump abruptly on a better model.

Audio

For projects like this I always think about audio as part of the display because HDMI is a standard for audio/video interface. The display that I've used came with an integrated speaker that made this build easier.

Source: Elecrow

That was the approach I chose for my implementation. In case you want to adapt the design to have speakers, the second best option that I recommend to you is to consider speakers that were designed for portable screens. For example this one, although you will need to make sure you have the space needed inside your case.

Step 2. Connect it to a TV or monitor and plug in a keyboard.

  1. Using HDMI, connect the board to any TV, computer monitor, or the display I specified.
  2. Connect a keyboard.
  3. Connect the Raspberry Pi to a power supply.
  4. Turn on the Raspberry Pi.
  5. The first time you enter RetroPie it will ask you to set up all your buttons. Use your keyboard to map the keys you want. Important: take note of which keys you're assigning to which functionality.

These are the keys and the functionalities that I picked up for my prototype:

  • W key: D-pad up
  • S key: D-pad down
  • A key: D-pad left
  • D key: D-pad right
  • H key: A
  • G key: B
  • F key: X
  • T key: Y
  • Q key: L1 (Left-top shoulder)
  • E key: L2 (Left-bottom shoulder)
  • Z key: R1 (Right-top shoulder)
  • C key: R2 (Right-bottom shoulder)
  • Right Shift key: Select
  • Enter key: Start

03. Gamepad

The best way to prototype a gamepad and tinker until it works as expected is using a breadboard. In case you don't know what a breadboard is and how to use them, there are plenty of guides that talk about them like this tutorial on Sparkfun.

Buttons: For any project that need buttons, there is this standard 6mm tactile switch buttons that are everywhere. The only problem is that they feel super clicky. I found 2 variants that improve how they feel to the touch. These made out of silicone (still clicky but not so much):

And these ones are very squishy buttons (perfect for emulating that gamepad feeling):

GPIO pins: The Raspberry Pi has 40 pins (except for early models) that can be used for many different things. Any pin in green and yellow here is available to be used as a digital input. That means that you can connect any push button to them to be readed by the board.

Source: Adafruit

Analog joysticks: For this first prototype I decided not to include analog sticks. The Raspberry Pi doesn't have any analog inputs, so it needs an entire implementation for that. I'm currently working on adding thumb sticks to the next version of the console by adding an Arduino Pro Micro connected via USB.

The idea that's currently in the works.

When I started the project, I had the idea to use some "fake" analog sticks. By simply using an 8-way navigation switch I could have read the 8 directions as digital inputs, but I couldn't find any model to buy. I bought a 5-way switch to test it, but as the name implies, it doesn't support moving in diagonal:

Step 3. Add your own custom buttons.

  1. Add all the tactile buttons to the breadboard and wire one of the legs to the ground row (-) of the board.
  2. Connect the other leg of the buttons (+) to a pin on the Rasbperry Pi using jumper wires. You can connect any button to any available pin but it's important to take note of which buttons you connect to which pins.

    These are the pins I used:

  3. Connect to wi-fi and enable SSH to be able to connect remotely to the Raspberry Pi. Consider assigning a static IP to make your workflow easier.
  4. Connect remotely to the Raspberry Pi:
    $ ssh [email protected]
  5. Once connected, download retrogame.sh from Raspberry-Pi-Installer-Scripts and execute it. It will install the Adafruit-Retrogame utility. This will allow you to map the GPIO pins to a virtual keyboard.
    $ curl https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/retrogame.sh > retrogame.sh
    $ sudo bash retrogame.sh
    You will be prompted to select a configuration. Choose any option and follow the steps to reboot.
  6. Edit the retrogame.cfg file to link the GPIO pins to the keys you setted on step 2:
    $ sudo nano /boot/retrogame.cfg
    For a list of all the possible key IDs take a look at Retrogame's keyTable.h file. Here's an example of my retrogame.cfg file where I map my keyboard keys to the pins I've chosen:
    # Key      Pin           Button
    
    W           19           # Up
    S            5           # Down
    A           13           # Left
    D            6           # Right
    
    H           20           # A
    G           21           # B
    F           12           # X
    T           16           # Y
    
    Q            9           # L1
    E           11           # L2
    Z            8           # R1
    C            7           # R2
    
    RIGHTSHIFT  10           # Select
    ENTER       26           # Start
  7. Save the changes and exit Nano. You can do both by pressing ctrl + X.
  8. Reboot the console and check that everything works as expected.
    $ sudo reboot
    You should be able to navigate the interface, start games, and play them using your custom gamepad.

04. Power supply

There are plenty of ways to power a Raspberry Pi without pluging it into a wall. The model 4 that I used has a USB-C port that needs 5V 3A to work (older boards need less amperage). This means that you could power this project with, for example, a simple power bank. There is also plenty of hats that allow you to add power from an external battery.

I decided to go with the PiSugar 2 Pro specifically for its features. There were many version of that same model after I got it, like the PiSugar 2 Plus, S Plus, and 3 Plus. All of them have the same footprint, therefore they should be compatible with this build. The important thing is to get the one with the 5000 mAh battery since this console needs a lot of power.

The PiSugar is a UPS (Uninterruptible Power Supply). It's a device that provides near-instantaneous backup electric power to the board when the input power source or main power "fails". It maintains the operation uninterrupted, and safely shut down when the power is too low.

The PiSugar connects via pogo pins. Unlike other hats, it sits on the back of the Rasbperry Pi, making it almost imperceptible. The sad thing was that I needed to transform the PiSugar into a normal hat because the connectors that hold the Raspberry Pi attached to the display (HDMI and USB) don't allow to have anything between them.

Raspberry Pi and PiSugar connected via pogo pins.

Batteries: Any lithium-ion battery with at least 2500mAh should be enough to power a Raspberry Pi handheld console. The PiSugar came with 5000mAh, and they claim the battery life is 8-10 hours. For me it's been around half that time in total when making the Rasbperry Pi work at its maximum, emulating console games, and with the fan turned on 100% of the time.

Step 4. Install the PiSugar hardware.

  1. Remove the pogo pins (the golden cylindrical connectors) with great care from the PiSugar. They should come out easily by gently pulling them straight out, with little or no resistance. If you find yourself applying force, stop and watch a video tutorial. If done correctly, this mod is completely reversible.
  2. Solder a 2x20 pins female GPIO header to the PiSugar. Note: there are solderless headers that require no soldering.
    Source: Adafruit
  3. Solder wires to the GPIO pins you will use for the buttons (the ones you set up in step 3).
  4. Connect the battery to the PiSugar.
  5. Attach the PiSugar to the Raspberry Pi for a quick first test.
  6. Turn on the Rasbperry Pi and disconnect it from power to make sure it works wirelessly.

05. Circuitry

When it comes to take a prototype from the breadboard to the next level, there are plenty of options. The one that would make more sense for this project is designing a custom PCB. However there are other methods that allow for quicker prototyping.

Printed Circuit Board

A PCB is a board that holds all the electronic components needed for a device to work. For example, the Raspberry Pi's green board is a PCB. Same with PiSugar's black board. Every electronic device has one inside, and you can design your own to suit your own needs. There are services that print the board for you like JLCPCB or PCBWay among others. The quality is great for a low price.

Source: RasterWeb

For me the only problem with this approach is that the process of iterating is slow. I needed to remove as much bottlenecks as possible for a first prototype. I'll eventually design my own custom PCB, but I needed to understand the place for each component first. For example, I'm currently working on fixing some flaws in the shoulder buttons and it means that I potentially need to move the battery around.

Perfboard

Perfboards are boards that are pre-drilled in a grid disposition. It allows you to insert the electronic components on the designated places, as in a breadboard, and solder them to the board. This is like a step in the middle between a breadboard and a custom PCB. The problem for me is that I'm forced to place each push button on a very specific spot. I wanted to have 100% freedom of placing the buttons wherever the design would make it more visually attractive. I've seen plenty of consoles using perfboards, and the thing I don't like is how the design adapts to where the components need to be placed. I wanted that to be the exact opposite. The desing must dictate where the components will be placed, not the other way around.

Source: Retired electrician, CC0, via Wikimedia Commons

3D-printed board

I wouldn't recommend using a 3D printed board to hold electronics that can raise temperature or that need to do things with electric currents. Since I only needed to hold tactile push buttons, I decided give this technique a try. The main advantage of doing it this way is that it's an ultra fast way of prototyping a board.

There is another advantage: you can work with crazy shapes, like I did with the parts that hold the shoulder buttons or where I inserted the fan. The problem is, I'm limiting the people who build this console to 3D print the board just because of those unique shapes. What I learned in the process is that by using the right components for the right circumstances I'll be able to design a proper standard PCB. For example, I'm working on using 90-degrees tactile buttons for the shoulder.

Step 5. Wire and assemble.

  1. Download the file pcb-prototype-v0.stl (147 KB) and print it in PLA with 0.15mm layers and 15% infill. You don't need supports, skirt, or brim for this.
  2. Glue the shoulder pieces to the main piece with super glue. The end result should look like this:
    Important: This is a terrible way of having push buttons at 90 degrees. I'm currently redesigning this piece to use proper 90-degrees push-buttons, so in the future this can be a custom PCB.
  3. Insert the push buttons into the frame. Put the squishy buttons on the d-pad and ABXY buttons. Put the non-squishy buttons on the rest. The buttons should stay tight in place. Play around with the layers thickness on the slicer if that's not the case.
  4. Solder the buttons to the PiSugar header. As a recommendation, wire all the GND connections in series (black wires in the picture). That way you will only use 1 or 2 GND pins on the Raspberry Pi:
  5. Add an aluminum heatsink to the Raspberry Pi. Although this step is entirely optional, for more demanding tasks such as gaming, it's recommended to have some form of cooling.
  6. Attach the Raspberry Pi to the PCB-prototype using (2x) screws on the pins side and (2x) 10mm spacers on the other side.
    (A) and (B) are the 10mm spacers. (C) and (D) are the screws.
  7. Connect the PiSugar to the Raspberry Pi and secure it to the spacers using 2 screws. Make sure you connect the battery to the PiSugar first.
    The screws fasten the PiSugar to the spacers.

06. Case

Designing my own case took me a very long time. It wasn't time spent only on planning and execution, but also the compound results of uncountable years of dissasembling gamepads to repair them noting how every piece works. I'll try to point the main things I had in mind while designing this console.

I started drawing 4 different versions with slightly different dimensions on Procreate for iPad. I already had all the components in hand so I already knew that the size of the screen and the depth of all the things were a constant. I made tiny changes in the position of the d-pad, the other buttons, and the length of the handles. The idea was to see which one looked more natural.

I modeled the console out of a rectangular box using t-splines. I basically defined one of the halves as a mirror of the other one (the green line on the screenshot) and started pulling its vectors until I got the shape I was looking for.

It took several iterations to get it right. One thing is drawing something on the screen and another different thing is to have it in its physical form. Also, 3d printing has its own set of constraints that you need to respect.

I printed all the prototypes in PLA to be able to iterate fast, but I used PETG to print the final product. This was actually a mistake. PETG ended up being an extremely soft material, so sanding it didn't result on a smooth surface. The reason I printed it in PETG was because I feared that the console could reach temperatures high enough to soften PLA. It turns out that that's not the case and I'm even working on the posibility of removing the active cooling system.

Since 3d printing is a different manufacture process than, for example, mold casting, it allows for different ways of assembly. Instead of the tradicional cut in half of any game console or gamepad, I made 3 different parts. The main reason was to being able to print it on my Prusa Mini (28cm3).

I like that the components are assembled from the sides instead of from the back.

Step 6. Build an enclosure.

The case that I designed is not available yet. I'm fixing some big flaws in the design before releasing it.

The mechanism that joins the main parts is weak:

And the shoulder buttons are mounted on 90-degrees 3D-printed pieces, which makes them very unstable:

Check out this post with more details:

An icon representing the ABXY buttons of a gamepad What's next for the handheld game console

In the meantime, try making your own case! Use cardboard, or a metal tin box. If you have a 3d printer, try designing one yourself on Thinkercad. It can be as simple as a rectangle. You can also modify existing enclosures to fit your components.

Do you want me to e-mail you when I have news about the console? Drop your address here:

Wrapup

Let me know how it goes! If you build it, send some pictures. Tell me what problems you found in the process, what you had to improve, what I can improve.

Sources