PiBoy SP


Ever since high school in 2012, I’ve wanted to create a portable emulation console based on the venerable Raspberry Pi. This is not an uncommon project, many people have created portable emulation consoles with a number of different designs. The problem with many of these designs is that they’re often bulky and fragile. They won’t fit comfortably in your pocket next to your wallet and keys and can’t take any heavy abuse. I wanted to mimic the size durability of the Nintendo Game Boy Advance SP.

Designing a Custom Board

The only way I saw to do this was with a custom designed circuit board designed to fit within a GBASP shell. This would allow me to durably fit all the components together in a very small space. The board includes:

  • A header for a Raspberry Pi Zero W
  • A Li-Po battery charging circuit based on the MCP73871
  • A 3.3v – 5.0v voltage converter circuit based on the TPS61090 to step up the voltage to something useable
  • An audio circuit including a headphone jack, speaker, volume knob, and PAM8302 audio amp
  • Pinouts for the SPI bus on the Raspberry pi to allow me to wire up a small LCD screen
  • Buttons

Adafruit graciously released schematics for their Powerboost 1000c and Mono Class D Audio Amplifier, so I integrated these circuits into the design of my board.

The board layout in Eagle

Getting the Board Manufactured

This board way too complex for a homebrew job, so I sent away to OSHPark to manufacture the board for me. After a couple weeks, I had a fully printed, blank board ready to be populated with parts.

The first run of the board from the fab

Populating the Board

I didn’t want to build a reflow station out of a toaster oven (that WILL be a future project though) so instead I soldered everything by hand.

First order of business was the voltage regulator and battery charger. These were both QFN packages, so they could not be bodge soldered with a traditional iron. Instead I tinned everything and soldered them on with my heat gun.

I melted a hole through my cutting mat and had to insulate it with a pickle jar lid

After that, all the tiny components were tinned, held in place with tweezers, and soldered in place.

Finicky soldering

Results of Board Revision 1.0

Did it work? Kind of! All the power management worked perfectly. This is the most complex part of the board, and I’m amazed it didn’t go up in smoke when I plugged in the battery. The Raspberry Pi also boots up and posts properly when soldered in place.

Smoke test

Tons of noise on the SPI screen

The screen initially had some problems, there was a huge amount of noise. This was caused by interference from the audio circuit and from the length of the wires connecting the screen to the Pi.

I managed to fix the interference by decreasing the SPI communication frequency in config.txt from 80MHz to 60MHz. The audio circuit will be fixed in a later board revision, but for the time being I just removed it.

Like all things, it must run Doom

The Audio Circuit

Audio sounds fine out of the speaker, but when headphones are plugged in, there is a noticeable high pitched whine. I have a feeling this is present on the speaker too, but the speaker just isn’t good enough to put out that high frequency.

The amp also gets incredibly hot to the touch. Upon touching any part of the epoxy package, the constant whining gets much quieter. I have a feeling that the overheating amp is causing the whine. When I touch it, the heat sinks to my finger and cools off the chip.

I also just forgot to wire the GND lead of the volume knob to ground. This was fixed with a bodge wire, but it will be done with a proper trace in later board revisions.

The Control Buttons

I drew the PCB footprint for the surface mount buttons myself in Eagle, and I did not include enough exposed pad to properly solder the buttons on. The buttons are not heat resistant, and using the heat gun just melts them. I got some of the buttons to adhere correctly, but they’re finicky and won’t stand up to years of abuse.

General Layout

There’s a lot of traces that are too close together for my liking and are likely causing interference. I also overlooked how I’m going to route the screen wires out of the lower half of the GBA SP shell, through the hinge, and into the upper half of the shell. There’s a small hole in the shell that the original GBA SP used to route a small ribbon cable to manage the screen, but it’s blocked by my board. I’ll have to move the screen pinouts to a place that’s closer to that hole. I might even just solder on a ZIF connector and use my own ribbon cable.

Next order of business is a redesign of the PCB and audio circuit.

Revising the Board: V1.1

I made a couple changes in board revision 1.1. First off, all the components are more organized and positioned better. Second, I took the time to properly route the traces carrying the video signal away from any parts of the circuit that could cause interference. Third, I completely redid the audio circuit and used a completely different chip. This time, I made sure to verify the schematic on a breadboard before blindly throwing it onto the PCB.

Board Revision 1.1. Note the better laid out components and hand-laid traces. I’ve learned that the auto-router is to be used sparingly.

I’ve sent this board off to a board house for fabrication. I’ve chosen Elecrow this time instead of OSHPark. They quoted me at a much cheaper price, and I’d like to try out as many board houses as I can to see if I can find a favorite.

Board revision 1.1

Board revision 1.1

I’m very happy with the board I got back from Elecrow, I can see them being my goto board house in the future. The power circuit is laid out much more compactly, the audio circuit is far away from the finicky SPI bus, and the screen pinouts have been moved to a much more convenient place.

Smoke test success!

The power circuit still works on this one, as indicated by the shining blue light.

The new audio circuit can be seen here. It’s much simpler compared to the old one, only a few filter components are needed with the TPA2005D1.

Audio circuit finally works! Well, mostly.

I was so anxious to try out my new audio circuit that I wired up a Raspberry Pi Model B+ to test it with. Just like the Pi Zero I’ll use in the final product, this one is configured to output audio through PWM on the GPIO pins.

The good news is that it successfully amplified the audio signal and it sounds great! What’s the bad news? Well, it’s a bit complicated.

The TPA2005D1 was built to be used with a speaker, not a headphone jack. Why does this matter? Well, it all comes down to this pesky little circuit inside the TPA2005D1.

TPA2005D1 Functional Block Diagram

The part of the block diagram that I’ve outlined in red is the Short Circuit Detect circuit. It detects when there’s a short across the speaker output lines and shuts the amp off. This is totally fine and very useful when you have a speaker soldered to the TPA2005D1, but it becomes problematic when you introduce a headphone jack. As you plug headphones into the headphone jack, it very momentarily shorts the speaker output lines while the jack clicks into place. It’s not long enough to cause instant damage, but it’s enough to trigger the Short Circuit Detect and turn the amp off. An amplifier built for headphones would have an auto recover feature and reboot itself, but the TPA2005D1 does not have that.

So it works, kind of. You just can’t plug or unplug headphones will the device is on. I’m willing to live with that at this point, I just want to get some revision of this device finished.

I’m still waiting for a Pi Zero and some other parts to come in the mail, once I get those I’ll do some more work on this.