Do you remember the old classic 8bit games? Perhaps you enjoyed your leisure time in front of an early home computer or video game system. They were so nostalgic and every kid in that era loved them. Now they are replaced with modern high-end graphics and game dynamics. Yet many people still love to play those classic games. Nowadays the only way to play these games is through emulators. So, in this tutorial, we are looking at how to make such a device that can emulate those classic games. This console is based on the popular Odroid Go, with updated firmware and new IPS display. And the firmware used is a modified version of ducalex's retro-go firmware. We previously built similar kind of gaming console using Arduino and OLED.
Components Required
The components required to build the Retro Game Console are listed below. We designed this circuit with generic components or modules, making the replication process easy.
- ESP32 Wrover Kit with 16MB flash – 1
- Waveshare 2” 320x240 IPS display module with ST7789V driver – 1
- TP4056 module with protection – 1
- AO3401 SMD P-Channel MOSFET – 1
- SD Card Slot – 1
- SMD Slide switch 1P2T – 1
- 3.5mm Audio Jack SMD PJ-327-A -1
- 3.7V Lipo battery – 1
- 2Pin JST XH battery connector – 1
- 6x6x6xmm tactile switches – 10
- 3mm LED – 1
- 3.3v Active buzzer – 1
- 100k Resistor – 2
- 10k Resistor – 7
- 1k Resistor – 1
- 0.01uf Capacitor – 3
Retro Game Console Circuit Diagram
The complete circuit diagram of the ESP32 Based Retro Game Console is shown below.
The circuit is built around readily available off-the-shelf components. Connections are straightforward and easy to understand. The input supply is connected to the TP4056 module with built-in protection circuit. If your battery already has a protection circuit built-in, you can simply use the TP4056 module without the protection circuit. The battery is connected to the output of the TP4056 module. From there the supply is connected to a high-side P-Channel MOSFET. By default, the gate of this MOSFET is pulled up to the VBAT level. When the small slide switch is switched on the gate will be connected to the ground and the MOSFET will be turned on. This simple circuitry will allow us to turn on and off the entire device using a tiny slide switch.
The power from the MOSFET is distributed to other components. The display is connected to the ESP32 Wrover kit using the SPI pins. The backlight brightness is controlled using the PWM from GPIO14. SD card also conned using the same SPI line. The sound is taken out from the GPIO26 and connected to a 3.5mm audio jack. You can either use the audio jack to connect a headphone or you can use a buzzer with the audio jack switch terminal. An LED is connected to the GPIO2 to show the disk read status. Whenever the system is busy reading from the SD card the LED will light up. All the switches are connected to varies GPIO pins and the state of these pins are monitored to detect a key press.
PCB Design of the Retro Game Console
To make the whole project easier, we designed a PCB for the project. The below image shows the dimensions of the PCB. Its a homemade etched PCB, you can learn to make PCB at home here and the necessary files for PCB can be downloaded from GitHub link given at the end of this article.
The image below shows the 2D representation of the PCB.
And the below image shows the 3D illustration of the same PCB. In the 3D model, you can see the placement of all the components.
Firmware for the ESP32 Retro Game Console
As mentioned earlier, the firmware used is a modified version of ducalex's retro-go firmware. The original firmware is coded to use with the ILI9341 display. Since we are using an IPS display with an ST7789V driver, we can’t use the original firmware. Thankfully most of the display functions are somewhat similar for both the LCD driver chips. But we must change the display initialisation codes and the gamma settings. You can find the modified firmware source code in the following GitHub repo Retro-go-ST7789. To use the firmware, you can either use the prebuilt image or you can build it yourself. The prebuilt image file cam be found at the Circuit Digest Github Repo linked at the end of this tutorial.
Supported systems:
- Nintendo: NES, SNES (slow), Gameboy, Gameboy Color, Game & Watch
- Sega: SG-1000, Master System, Mega Drive / Genesis, Game Gear
- Coleco: Colecovision
- NEC: PC Engine
- Atari: Lynx
- Others: DOOM (including mods!)
Firmware features:
- In-game menu
- Favorites and recently played
- GB color palettes, RTC adjust and save
- NES color palettes, PAL roms, NSF support
- More emulators and applications
- Scaling and filtering options
- Better performance and compatibility
- Turbo Speed/Fast forward
- Customizable launcher
- Cover art and save state previews
- Multiple save slots per game
- Wifi file manager
- And more!
Building the Firmware
The firmware is written for the ESP32 IDF. The currently supported versions are 4.1 to 4.4 and the recommended version is 4.3.. With any other updated version of ESP32 IDF, the build may fail. Follow the following link to install and configure ESP32 IDF version 4.3.
Once installed and configured apply the following patches to the IDF. Patches are located in tools/patches and can be applied to your global ESP-IDF installation, they will not break your other projects/devices.
- sdcard-fix: This patch is mandatory for the ODROID-GO (and clones).
- panic-hook: This is to help users report bugs, see Capturing crash logs below for more details. The patch is optional but recommended.
- enable-exfat: Enable exFAT support. I don't recommend it, but it works if you need it.
To apply the patches, you need open a terminal in your ESP-IDF installation ($IDF_PATH) and run the command as per the template below. You should do the same for all the necessary patches.
- patch -p1 < "/path/to/retro-go/tools/patches/ sdcard-fix (esp-idf 4.2 and 4.3).diff "
Once the patches are applied run the following command from the root folder to build the firmware image.
- ./rg_tool.py release
Flashing the Firmware
To flash the firmware, you can either one of the following methods.
- Using the esptool
- To use the ESPtool , make sure you have installed the ESP IDF. You can find the instructions for that in the previous section. Once installed and configured open the terminal in the same folder as the firmware image and use the following command to flash the firmware.
esptool.py write_flash --flash_size detect 0x0 retro-go_*.img
- Using ESP32 Flash Download Tool
- First download the ESP32 Flash Download Tool
- Extract it to a folder and double-click on the exe file to run it. When prompted select ESP32 in the chip type field and click on OK
-
- Select the firmware file with the img extension and add the address as 0x00. Select the proper com port and click on erase. Once the flash erase is complete click on START to flash the firmware
-
- That it. You are ready to use the console. Insert the SD card and enjoy the game play.
Usage
To use the console format the SD card to FAT32 format. Copy the folders named roms and romart to the SD card. Keep in mind that the rom folder doesn’t contain any game roms. You must download the games you needed from other sources and place them in the corresponding rom folder within the roms folder(eg Nintendo roms in the nes folder). You can add missing cover art by creating a PNG image (160x168, 8bit) named according to the following scheme: /romart/nes/A/ABCDE123.png where nes is the same as the rom folder, and ABCDE123 is the CRC32 of the game (press A -> Properties in the launcher to find it).
To use wifi you will need to add your config to /retro-go/config/wifi.json file. It should look like this:
{ "ssid": "my-network", "password": "my-password" }
To use the file manager, find the IP of your device in the about menu. Then on your PC navigate to http://192.168.x.x/ to access the file manager.
The video below shows the OdroidGo based gameplay on the device we just made.
Supporting Files
You can download all the necessary files from the Circuit Digest GitHub repo, from the following link
Comments
is 16MB version really…
is 16MB version really required?.... as I can see the compiled .img firmware is 1.43MB and can be easily flashed on a 4MB module/devkit
You can use a 4MB version. I…
You can use a 4MB version. I just used the one that was available with me.
I built this, flashed the img from repo and... black screen :D Display backlight is turned on but doesnt show anything.