In today’s episode, we’re building
a Game Boy emulator on a breadboard! All you need is a Raspberry Pi Pico
micro-controller, an ILI9225 LCD display, an SD card and a couple of
micro-push buttons to get started! The Game Boy emulator used is Peanut-GB
by deltabeard. Peanut-GB has been specially optimized to run at full speed on low
specs computers or microcontrollers. It runs at 60 frames per second on the
Pico, at the expense of some emulation accuracy. It can play most of the
1000+ original Game Boy DMG games! It’s easier to flash the firmware
before starting the assembly so you can test that everything is working
as expected at every stage of the build: Download the latest .UF2
file from the release page. Push and hold the BOOTSEL button on the Pico, then
connect to your computer using a micro USB cable. Drag and drop the UF2 file onto
the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator. In order to run the emulator, you will also
need a Micro SD card with roms you legally own. Insert your SD card in a Windows
computer and format it as FAT 32. Copy your .GB files to the SD card root folder Insert the SD card into the LCD
display using a Micro SD adapter. We will start the assembly by connecting the
screen and the SD card to the Pico. To make the connections, we use Dupont wires. Pico has 2 Serial Peripheral Interfaces
to communicate with digital peripherals. We use SPI0 for the LCD display
and SPI1 for the SD card reader. If everything works correctly, you
should see the game selection menu. Now let’s add some buttons. There are 8 micro-push buttons in total:
4 for the Dpad + 4 action buttons. They are connected to ground on one side
and to GPIO pins 2 to 9 on the other side. The buttons are positioned on the breadboard
to mimic their positions on the Game Boy. When a button is pressed, the
associated pin will be grounded, and Pico will read a logical zero. We’re now ready to play our first game!
When you select a game with the Dpad and press A or B, the emulator copies the selected ROM file
to Pico’s flash memory and starts the game. Start + select returns to the game selection menu. It's great but we miss the sound. The sound is provided by a MAX98357 amplifier
and a small 2 watts speaker. Pico sends a 44.1kHz stereo digital audio stream
to the amplifier using the I2S protocol. First connect the speaker to the amplifier. Then connect the amplifier to GPIO pins 26 to 28. This completes the assembly… In the next episode, we will use 3d
printing to build a fully functional handheld Game Boy console.
Thanks for watching!