Building a DIY ESP32 Gameboy Emulator from Scratch
Summary: This article details the creation of a custom Gameboy emulator using an ESP32 Devkit V1 and a ST7735 LCD. Starting from a simple desire to utilize a spare screen, the project evolved into a functional retro gaming handheld, demonstrating the power of embedded systems for DIY electronics and emulation.
Key Takeaways
- ESP32 as a Retro Gaming Platform: An ESP32 can be effectively leveraged to build a custom, portable Gameboy emulator, showcasing its versatility beyond typical IoT applications.
- Hardware Integration Challenges: Integrating components like an ST7735 LCD, analog joystick, and push buttons on a perfboard requires careful planning and execution, especially without a dedicated PCB.
- Emulation Software & Memory Management: The Peanut-GB emulator, written in C99, provides the core emulation, but managing game ROMs and saving states on the ESP32's flash memory presents challenges, particularly with larger games and SD card integration.
Detailed Overview
What started as a simple idea to utilize a spare ST7735 (160x128) LCD quickly evolved into an ambitious project: building a fully functional Gameboy emulator powered by an ESP32. Initially, the creator considered a music controller, but the allure of a retro gaming handheld proved too strong to resist, promising a much "cooler" outcome. This project highlights the ingenuity involved in transforming readily available components into a personalized gaming device.

The Core Components
The heart of this DIY Gameboy lies in its carefully selected, yet humble, hardware. The project was assembled on a perfboard, emphasizing a hands-on, component-level approach.
The essential hardware list includes:
- PerfBoard: A 7 cm x 9 cm perfboard served as the foundation for soldering all components.
- Analog Joystick: For directional input, crucial for gameplay.
- Push Buttons: Standard buttons for game controls.
- ESP32 (Devkit V1): The powerful microcontroller responsible for running the emulator and managing hardware.
- ST7735 LCD: A 160x128 pixel display, providing the visual interface for the games.
- No Battery: For simplicity, the current iteration is USB powered, indicating a potential future enhancement.

Deep Dive & Technical Insights
The software side of this project is where the magic truly happens. The creator opted for the Peanut-GB emulator, a lightweight and efficient Gameboy emulator written in C99. The firmware for the ESP32 was developed using the Arduino framework in C, allowing for relatively straightforward hardware interaction and program logic.
Emulation and Game Loading
A significant challenge encountered was managing game ROMs. While an initial attempt was made to use an SD card for storing multiple games, it proved unreliable for larger titles. The current, successful approach involves loading one game at a time directly into the ESP32's flash memory. This method has proven effective, allowing larger Gameboy games like Pokémon, Zelda, Tetris, and Contra to run at full speed.

It's important to note that while some images might show Game Boy Advance (GBA) games, the device strictly supports classic Gameboy games, with the GBA visuals serving purely aesthetic purposes in the original post.

Ongoing Development
The project is still under active development, with several enhancements planned:
- Game State Saving: Efforts are underway to implement functionality for saving game states, a crucial feature for any portable gaming device.
- Splash Screen: Replacing the immediate game launch with a custom splash screen for a more polished user experience.
- SD Card Reliability: Further investigation into improving SD card support for multi-game storage.
These ongoing efforts demonstrate the iterative nature of maker projects and the continuous pursuit of improvement.
![]()
Conclusion & Resources
This DIY ESP32-powered Gameboy emulator is a fantastic example of how creative problem-solving and readily available components can bring a retro gaming experience to life. From its humble beginnings with a spare LCD to running classic Gameboy titles at full speed, the project showcases the potential of the ESP32 in custom hardware builds. While challenges like SD card integration and game state saving remain, the current iteration is a testament to the maker's skill and dedication.
- Blog Source URL: Made an ESP32 powered Gameboy from scratch.