GameBoy Pi

by rjunior5 in Circuits > Raspberry Pi

6017 Views, 16 Favorites, 0 Comments

GameBoy Pi

IMG-0923.jpg

In 2019 the Game Boy celebrated 30 years old, this propelled me to put a project into practice that I already was think about. The basic idea was uses a 3D printed case that looks like a Game Boy Classic and put a Pi Zero inside running Retropie.

Parts:

B1RxTrj.jpg

FAQ

HtiVOH8.jpg

I did a FAQ for my self about some questions of project:

Which case print?
I was in doubt between the famous PiGRRL by Adafruit and another that is very close to original. I chose the original because the ABXY are bigger and more distance.
Adafruit: https://www.thingiverse.com/thing:1277483
Original: https://www.thingiverse.com/thing:1277483

Which display to use?
I already had two, one of 2,8” that use the ILI9341 controller and another with composite video in of 3.5”. I chose the 3.5” because it is more simple to plug and It fit perfectly in case.

Does the Pi Zero have a composite video out?
Yes, but doesn’t have the pins. https://www.raspberrypi.org/magpi/rca-pi-zero

Does the Pi Zero have a analog audio output?
No. Is necessary build the output as show by Adafruit: https://learn.adafruit.com/adding-basic-audio-oup...

Which controller to use?
I used tactic switch plugged in GPIO where it simulate a keyboard. Again I used a Adafruit solution but the board was built for me: https://learn.adafruit.com/pigrrl-2/gamepad

Which size of micro SD card use?
I used a 4GB that is enough for me. I don’t want have 5000 games to only play a dozen. Remember that Pi Zero can only run 8 or 16bits games well and these roms have a small size. The Retropie use about 2.2GB of space.

How to power up the 12V display if Raspberry Pi works with 5V?
I found a 5V point inside of board of display. The display have one 5V regulator and another of 3.3V connected each other. I connected 5v to the input of 3.3v regulator.

Which battery to use?
I used two lithium cells of 1000mA. With this cells the device worked for about 1:40 hour. I think that the best solution is use three cells of 1000mA.

How to recharge the battery?
I used a board charge TP4056

Printing Case

01.png
printing (1).jpg
printing3 (1).jpg
printing4 (1).jpg
02.png

As I told in FAQ I chose print this case:
https://www.thingiverse.com/thing:2676949

The display 3.5" fit perfect inside the case, I printed too the display support (orange piece) where the controller display board fit and the back cover is screwed on top.

Installing the Retropie

gamepad.jpg

The Retropie is the software that will run, it already have a bunch of emulators installed and is very easy to use, in internet you can find a lot of "how to" install it. The only detail is, after installation the first time that you will asked to configure a controller, configure a keyboard as controller and note the keys in a paper or something else. This information is necessary for config a GPIO controller explained soon.

To download the Retropie go to:
https://retropie.org.uk/download/

GPIO Controller

IMG-0922.jpg
gpio.png
IMG-0924.jpg
Pi Zero controller GPIO test

For the controller I chose use the Adafruit solution:
https://learn.adafruit.com/pigrrl-2/software#insta...

I made a board with a PCB universal solder tactile switch and wired they to GPIO.

To install the Adafruit driver use the commands:

cd

curl https://raw.githubusercontent.com/adafruit/Raspbe...> > retrogame.sh

sudo chmod +x retrogame.sh

sudo bash retrogame.sh

The first command download the script, the second give execution permission and the third run the script. After run choose "1. PiGRRL 2 controls" and reboot. It will create a file "/boot/retrogame.cfg", edit this file according your keyboard configuration. Do you remember the note of "Installing the Retropie"?

The pattern of file is:

LEFT 4 # Joypad left

RIGHT 19 # Joypad right

UP 16 # Joypad up

DOWN 26 # Joypad down

LEFTCTRL 14 # 'A' button

LEFTALT 15 # 'B' button

Z 20 # 'X' button

X 18 # 'Y' button

SPACE 5 # 'Select' button

ENTER 6 # 'Start' button

A 12 # Left shoulder button

S 13 # Right shoulder button

Where the first column is the keyboard keys, the second is a GPIO pins and the third is a comment. For example, in the file above the GPIO 20 trigger a Z key of keyboard and X button based of SNES controller pattern.

GPIO Audio Out

sound.png
audio.png
Pi Zero GPIO audio

The Pi Zero doesn't have audio out, but the Adafruit was able to put audio out with some resistores and capacitores wired of two pins of GPIO and put a line of code in /boot/config.cfg file. For board I used a PCB universal and only resistors and capacitors, the diodes are to protection GPIO for some high voltage and I do not used.

The GPIO pin used are:
GPIO #13 (pin #33) como PWM1
GPIO #18 (pin #12) como PWM0

You cannot use these pins for keyboad controller.

Adding the line below in /boot/config.cfg and wired the circuit you already have audio.

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4

The audio out isn't amplified and you can use a PAM8403 amplifier to do this.

Finish the Build and Testing

IMG-0949.jpg
IMG-0969.jpg
IMG-0950.jpg
IMG-0951 (1).jpg
IMG-0954.jpg
IMG_0979.jpg
IMG_0975.JPG
IMG_0976.JPG
IMG_0977.JPG
IMG_0978.JPG

The finish build was not easy because a lot of parts and wired is difficult to fit inside the case. With patience and care everything work well. Follow some pictures and a video of final result.