In reality, the image quality is better, but this is difficult to convey in photographs.
Introduction
In February of this year, the ST7789 display module arrived to me; the quality of the picture and colors, despite the small size, was impressive, so one idea came to my mind …
Maybe develop a keychain that you can play Pokemon on?
At this point, the primitive idea of microByte was born. More than seven months later, the key fob idea has evolved into a fully functional handheld console capable of emulating:
NES
Gameboy
Gameboy color
Sega Master System
GameGear
And all this in the tiny cartridge size of the first GameBoy. The most important thing is that the texts in the game are readable, you only need a magnifying glass. Device dimensions: 78x17x40 mm
On the other hand, you may be wondering why add an SNES gamepad layout (directional buttons, 4 action buttons, Start, Select, L and R) when the device can only emulate 8-bit games?
Well, yes, so far it is only capable of running 8-bit games, but after doing a thorough search, I found out that the first ports of the SNES and SCRUMV emulator already exist for ESP32. Therefore, it became obvious that the device requires a full layout of the SNES gamepad with the prospect of further updates.
In addition, I believe that apart from games, the device can be a very useful tool in developing projects with ESP32, because it is possible to run Arduino sketches and / or binary files of ESP-IDF projects from an SD card as an application without removing the main firmware. … Below I will tell you more about this.
Here’s a quick video overview:
Specifications
I will split the device specifications into hardware and software for more details.
Equipment
We’ll start with a general list of hardware specifications:
ESP32 WROVER E (16MB)
8 MB RAM
16MB flash memory
1.3-inch IPS display ST7789 with 240×240 pixels
Micro-SD card slot.
Built-in speaker with audio amplifier MAX98357AETE + T I2S.
13 built-in buttons connected to TCA9555RTWR multiplexer.
8 inductive buttons with rubber membrane (direction and action buttons)
3 toggle buttons (Start, Select and Menu)
2 horizontal toggle buttons (left and right triggers).
Battery circuit with charging protection.
500mAh battery (enough for 6-7 hours of battery life).
USB-C connector.
In this repository you can find a KiCad project with the schematic and PCB design of the microByte project: firmware / pcb design
Photos of the board:
View from above
Bottom view
I thought about adding headphone support via the USB-C connector, but I dropped that idea because I didn’t find enough information about the implementation standard. It looks like every manufacturer implements USB-C sound differently. Therefore, in this version of the PCB, the connector is used only for charging the device and connecting to the serial console to view the debug log.
As you can see in the second photo, I used a standard PH 2.0 connector to connect the battery. This allows a larger battery capacity to be used. If you want to use less capacitance, then it is important to replace the resistor R2 so that the value is correct. This resistor sets the charging configuration for the TP4056 chip. If you do not change the value of the resistor R2, it will damage the lithium polymer battery. It also contains a boost converter that guarantees a stable 3.3V output; this solution avoids lower screen brightness and unstable battery drain behavior.
Used audio amplifier MAX98357AETE + T. This driver converts from I2S to ADC, it can be configured to work with mono / stereo signal and the gain is configurable. By default, I set the gain to 9 dB. I think this is enough to avoid damaging the speaker. Speaking of speaker, it’s very difficult to find a cheap SMD speaker that has enough room on the board, so I found a sounder with a good frequency range that fits on a PCB.
The sound quality leaves much to be desired, some sounds are lost, but overall the sound is quite decent. The speaker can be seen in the first photo of the PCB.
Finally, I must say it again – the screen is amazing in terms of price and size. The picture quality is excellent. I was also impressed with the ability to get a stable connection speed at 60 MHz when using simple SPI (i.e. not quad-SPI).
Software
The software was developed using the ESP-IDF framework and freeRTOS as an RTOS.
When designing, I aimed for a modular architecture. This modularity provides the ability to add and / or modify new software functions, such as new emulators.
The entire architecture is managed by a task manager, this task checks the battery level, LED notifications, checks for updates and monitors GUI and emulator tasks, suspending and continuing their work depending on the events that occur.
On the bottom layer of the software there is a HAL (Hardware abstraction layer), which simplifies access to hardware resources for emulators, task manager and GUI. Finally, at the very bottom, there are drivers that interact with the HAL.
All emulators and GUIs work in one ESP32 application, this provides very good loading times for games and the system as a whole. Games smaller than 4MB can load in less than two seconds!
GUI designed using LVGL library. It is an open source library that allows you to create a very nice and modern looking graphical user interface. I aimed to keep the GUI of this project simple but with a lot of options. Added a nice configuration menu to customize the behavior of each emulator and device options.
At the moment it only contains the following options:
Change in brightness.
Change the volume level.
Change of interface color.
Turn on dark mode.
Getting device data.
Retrieving SD card information.
Get battery data.
Another important aspect of the device is emulators. They have been improved and adapted to the device. GameBoy / GameBoy Color and Game Gear emulation produces very good results at full frame rate.
The work of external applications is similar to the “trick”, but has led to very good results. The device has two OTA sections and any of them can be the main section. That is, if version 1.0 of the firmware is written to the OTA 0 section and you want to update the device to version 1.1 via the SD card, then in case of a successful update, at the next restart, the main section for applications will be OTA 1 with version 1.1, and the OTA 0 section will be erased.
That is, to download external binaries without losing the main microByte firmware, we flash the binary file to a free OTA partition without sending a confirmation signal to the device, because otherwise, when the device is reset, the OTA section with the application will be erased, because the device will consider that the update cannot succeeded.
This is a fairly fast process, but it is highly dependent on the size of the binary. For example, a simple Blink sample will take 5-10 seconds to load, and a Doom 1 game will take up to 20 seconds.
Device case
The case is designed to be easy to 3D print while still being playable. All files can be found in this repository: stl microByte files…
On the other hand, after spending many hours thinking about which type of buttons would work best, I realized that I had to add a rubber membrane to create a distinct “click” feel. On the other hand, I tested some of the newest handheld consoles and found my device was the perfect size for a small modular gamepad.
As mentioned above, the package is very easy to print, I have printed with PLA and PTEG on the Ender 3 and the results came out very good. In addition, I have printed several cases on different SLA printers like the Eleegoo Mars and the results were amazing too.
I will update the repository shortly with instructions for printing.
The assembly process is very simple, I am recording a short video demonstrating the assembly. A simplified diagram is shown in the image:
Here are some renders of the case in different colors:
Future improvements
At this stage, performance is generally stable and good, with the device delivering full frame rates for GameBoy / GameBoy Color and GameGear games.
However, I believe the following important issues need to be addressed in the future:
Improve NES performance. Most games run well, but have some glitches and speed fluctuations.
Reducing the effect of tearing (tearing). In some games, the teasing effect is noticeable, although this is a small problem, it can be frustrating to observe.
Small GUI improvement. The game has an in-game menu where you can control the screen brightness, sound volume, save the game … This menu sometimes causes problems and can block the pause system, which is launched by pressing the menu button.
I also planned to add the following in future updates:
Support for SNES emulation. I am at the very beginning of the process, but it seems to me that it can be made to work.
Add a repository with external applications, like this:
Bluetooth gamepad.
Wi-Fi network analyzer.
Doom.
Create an Arduino library for easy sketching for this device.
Application Authors
The GameBoy / GameBoy Color emulator is a port of the GNUBoy emulator.
The NES emulator is a port of the Nofrendo emulator that was originally developed by Espressif.
The Sega Master System and Game Gear emulator is a port implemented by Espressif.
It’s also worth mentioning that I was inspired by the amazing ESPlay micro and Odroid GO devices.
Advertising
Embody any ideas and projects with the help of our servers with instant activation on Linux or Windows… The server is ready to work in a minute after payment!