portable emulator using a raspberry pi zero inside a Gameboy advance.

This is my attempt at making a portable emulator using a raspberry pi zero inside a Gameboy advance.

Original

This has probably been done to death but this is my take on creating a portable emulator gaming system based on the Raspberry Pi Zero and RetroPi software.
I went for the Gameboy Advance mod because:
1. The two extra shoulder buttons is useful for many games and systems.
2. The smaller space created more of a challenge and a nice compact finished product.

I started with an old Gameboy Advance. My design intent was to take advantage of a Raspberry Pi Zero for the main backend of the system. I also wanted to minimise 'hacking' of the plastic casing by using all the existing ports/buttons/switches etc. where I could so that the unit looked somewhat 'factory' after the mods.

Case open

This shows the back side of the PCB. I wanted to design a replacement PCB to fit in place of this. To have identical fit and feel externally I decided to use the same headphone jack, volume adjust, shoulder buttons and power switch as the original. Some de-soldering was required!
Other side of original PCB.

Showing the other side of the original PCB. I wanted to re-use the link port from the original and the battery contacts. It's a bit crusty with water damage so I had to clean up the components after removal.
The speaker was in poor condition so I ended up sourcing a replacement of the same size.
De-soldered parts

All the parts de-soldered, removed and cleaned. Also, here are the button pads which I will be re-using, and of course, all the screws.
Beginning the custom PCB design.

I wanted to design a custom PCB which would fit nicely into the existing case. To do this I started by scanning the PCB and tracing an outline in a CAD package (Draftsight if you're curious. Free trial) including all the holes and position of components I planned to re-use.
The dimensions were all checked, re-checked and verified with a vernier. It was important to get this right!
PCB outline

Import in Eagle PCB software

Once I finished the outline of the PCB I imported it into Cadsoft Eagle. I created custom footprints for all the components I wanted to re-use and their placements shown here to match Nintendo's layout exactly.
As you can see, I created my own conductive pads for the buttons and the following components are positoned as per the Nintendo layout:
1. Power switch
2. Headphone jack
3. Volume pot
4. Link connector
5. Shoulder buttons
6. Battery pos and neg terminals
7. All buttons
I then started laying out a schematic for my design. Some notable 'features':
1. Boost converter for battery pack to output a constant voltage regardless of battery level.
2. Audio amplifier with hardware change-over for headphones. Adjustable by volume pot.
3. The link port on top of the GBA, typically used for linking to eachother is re-purposed as a serial port and connected to Tx and Rx on the RPi for configuration over command line. A FTDI chip handles the USB enumeration etc. and power will be supplied by USB if connected instead of the batteries. I modified a gameboy link cable and added a USB connector for this.
4. Custom TFT display with PWM adjustable brightness.
5. Power LED will shine green, and change to red on low battery using a comparator circuit.
6. All buttons are connected via internal pull-ups in the RPi. Debouncing is performed in software.
PCB layout

Using Eagle, I finished laying out the board. You can see the positioning of the RPi Zero and the TFT display which will connect to the board via a flat flex connector.
Due to size, most of my components are surface mount, and 0805 packages for passives for a balance of size and 'solderability'.
PCB Fabricated! (Top)

I sent the PCB to Elecrow to get made. PCB thickness is 1.0mm as per Nintendo's boards and I chose a cool blue :). I am happy with the results. Finish is lead free HASL for those interested purely because it was the cheapest.
PCB Fabricated! (Bottom)

Components Soldered! (Top)

I ordered my components from Digi-key. Here they are all hand soldered.
1. Bottom right is audio amp circuit.
2. Top right is power indication LED circuit with comparator and trimmer for low battery indication.
3. Top centre is USB interface driver going to RPI Tx and Rx for serial access.
4. Centre is the flat flex connector for the TFT display.
Components Soldered! (Bottom)

1. Bottom left (Bottom right on previous picture) shows the volume pot and headphone jack.
2. Bottom right is the input power boost converter and power switch. Around there is also the 'OR'ing to use USB power over batteries if available.
3. Centre is obviously the RPi Zero in all its glory. Power is provided direct to the GPIO pins instead of the micro USB port normally used. (Yes this bypasses the input fuse.. but watcha gonna do).
The screen!

So the screen is a 3.2" TFT display from Ali Express. It has an 18pin 0.8mm pitch flat flex connector and is controlled over SPI. To help connect this to my board I needed to create a small PCB as an 'adapter'.
The small PCB does two things:
1. Convert the 0.8mm pitch to a more common 1mm pitch because the cable and connector was easier to source.
2. Re-align the cable to match my PCB connector.

PCB was made using OHSPark.

No comment on this

My finest hour :/
The shortest off-the-shelf flat flex I could buy was too long so I cut it to size and used the soldering iron to melt the plastic back to solder to my adapter. This was the result…
It does the business!.
Where the screen needs to go.

This shows the inside of the GBA case with the factory screen removed. There's a plastic protector cover that was over the original screen which I plan to keep in place,
Screen placement in case.

Screen placed in the case!. It was actually quite a good fit (All planned obviously :P). I did have to remove some plastic on the left side and bottom of the screen. It tucks in nicely otherwise.
Some blue electrical tape to reduce the risk of any contact with the metal case.

Also the new speaker has been installed here.

Powered up

A bunch of testing and configuring later.. and it's alive!
The Pi is running RetroPi which boots into EmulatorStation at power up. Power is being supplied via USB here, but testing showed that the DC boost converter was functioning as expected.
Case assembly

Started placing components into the case. The screen can be seen under the PCB here and is connected via the flat flex cable. Space is tight!
Case assembly

Case assembly

Alignment of link port on the top. The USB ports are accessible through the old cartidge slot which is a nice touch. So it's possible to add a Wifi dongle to tranfer ROMS or, a keyboard or even a controller for 2 players games.
Case assembly

Bottom alignment of volume adjust pot, headphone jack and power switch.
Battery installation

The unit takes 2 AA's batteries like the original Gameboy Advance. The unit does not support charging over the USB cable or anything like that. I decided against this because it's not how I plan on using it.
Boot up in its case!

Boot up after being fully assembled.
The screen is slightly larger than the window view so the left and bottom of the screen are cut off slightly. This can be adjusted in RetroArch so that the games don't have this issue.
Emulation Station

Working!

and we're in!
So credit where it's due:

Notros Frame buffer mirroring for the TFT display.
github.com/notro/fbtft/wiki
ADAFruit Retrogame for RPI GPIO to virtual keypress (I modified source code to suit my own needs)
github.com/adafruit/Adafruit-Retrogame
Drogon WiringPi (Configuration of audio PWM output and software PWM control for screen brightness)

About


RetroPi (Made all this within the realm of possibility for me)
retropie.org.uk/

I utilize button combos to control some emulator features such as speed up, rewind, auto save/load and exit rom. Button combos also allow adjustment of screen brightness. This removed the need to drill out and install new buttons 'ruining' the look of the case.
These are all features of RetroArch but required a bit of configuring. Perfect use of the USB serial port.

Money shot 1

Money shot 2

Money shot 3

Power consumption

If you want to know…

The average consumption for my 'nominal' use would be around 330mA out of batteries at 3.0V.

Source : Ryzee from Reddit