MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

MAKER: JuanF92/Translated by: Fun Endless Meeting is a First Encounter

MicroByte is a micro console that can run games from NES, GameBoy, GameBoy Color, Game Gear, and Sega Master System, all components designed within this 78 x 17 x 40 mm package. Despite its small size, it adheres to the layout of SNES game boards and features operational buttons. It also comes with a clear 1.3-inch IPS display that shows all the details of the games.

MicroByte: DIY Retro Game Console Based on ESP32

Subsequently, Python and Arduino libraries will be updated for development work beyond gaming.

The firmware, PCB design, casing 3D files, etc., can be downloaded from this project repository: https://make.quwj.com/project/359

BOM list: https://github.com/jfm92/microByte_PCB/blob/main/microByte_BOM.xlsx

MicroByte: DIY Retro Game Console Based on ESP32

Project Structure

When starting an electronic project, a block diagram is usually created first, outlining the required functions and interactions of the project, followed by drawing the schematic diagram. In the schematic, select components that meet the requirements and make electrical connections, then proceed with the PCB layout design. Finally, set the position of each component’s footprint according to the design rules and physical design guidelines.

MicroByte: DIY Retro Game Console Based on ESP32

The above is the original version based on the breadboard, and below is the final version.

MicroByte: DIY Retro Game Console Based on ESP32

This project will be developed with a modular approach, supplemented by schematic design and PCB layout design.

The project schematic and PCB layout were designed using Kicad, download link: https://github.com/jfm92/microByte_PCB/tree/5cb0fcf7a9658e331d677588a7f35327a7d491d7

To open it, simply install Kicad and double-click the .pro file.

ESP32 Microcontroller

First, select a suitable microcontroller. For this project, the ESP32 Wrover E module is chosen. This module/microcontroller features: 240 MHz dual-core, 16 MB flash, 8 MB RAM, ultra-low power co-processor, supports Wi-Fi and Bluetooth, and a full set of peripherals and GPIO, providing excellent emulation performance.

For design reference, check Espressif, the datasheet is as follows: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf

The schematic of the circuit board module:

MicroByte: DIY Retro Game Console Based on ESP32

In the middle is the ESP32 module connected to peripherals.

Pin 25 is the IO 0 pin. This pin is for selecting the boot state of the device, allowing it to flash new firmware or boot the already flashed firmware. A high signal boots the flashed firmware; a low signal starts the boot mode and waits for new firmware.

Pin 3 is the enable pin (also known as reset). If this pin is high, the microcontroller will work; otherwise, it will not. To avoid signal bouncing, there is an RC circuit (resistor/capacitor) here that generates a clean signal during board startup or transitions to prevent accidental resets. Since there is no reset button in this circuit, this is not completely necessary, but it’s better to be cautious.

Pin 24 is the IO 2 pin, connected to a blue LED with a resistor for notification display. Let’s look at pin 2 or VDD 3V3. This pin powers the chip with a voltage of 3.3 V. Note the parallel capacitors, which are decoupling capacitors used to remove parasitic interference.

Below are the PCB design layout and key areas of research within the PCB board.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Additionally, related components should be placed as close as possible.

Adding USB Module

The USB transceiver is a chip that converts USB signals into serial, RS232, or other similar protocols. There are various models available on the market, and here we use CH340C.

CH340C does not require an external clock like CH340G, is easy to use, and costs only a small fraction of CP2102 or FT232.

MicroByte: DIY Retro Game Console Based on ESP32

As shown on the right side of the image. Its design is very simple, with only one chip, two decoupling capacitors, and a 0-ohm resistor. If unsure whether a connection is necessary, use this resistor as a bridge.

On the right is a schematic of the USB-C connector, which connects to a PC and charges the battery. When routing the PCB, using USB-C is more challenging as a dual connection must be added, allowing wires to be used in any direction.

Tip: USB signals are parallel high-speed signals, so they must be routed as parallel as possible to avoid crosstalk between signals and should be routed close to digital logic chips.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Battery and Power Management

This is divided into three parts: battery charging and protection circuit, power management, and battery level control. Battery charging and protection circuit:

MicroByte: DIY Retro Game Console Based on ESP32

When using a Li-Po battery, safety is paramount. A proper constant current charging controller should be made so that it does not charge above 4.2 V or discharge below 2.8 V to avoid damaging the battery.

TP4056 is a lithium polymer battery charger chip that provides constant linear voltage current and can set the charging current by modifying the resistance value of R2. Remember that the charging current should be about 25% of the battery capacity. This chip connects to LED D1 to indicate the battery’s charging status.

FS312F-G is a battery protection circuit chip that will cut off battery usage if it detects overcharging or over-discharging. This helps prevent battery damage.

FS8205 is a chip that integrates two MOSFET transistors to select circuit power. If the battery is within an acceptable range, it will draw energy from the battery; if the device is connected to a USB port, it will work directly using USB power.

Power management:

MicroByte: DIY Retro Game Console Based on ESP32

This module is a boost circuit for voltage conversion, providing a constant voltage of 3.3 V. The maximum charging voltage for lithium batteries is 4.2 V, and the minimum safe voltage is 2.8 V. Therefore, a constant voltage is needed to avoid instability in the microcontroller or low brightness on the display. To address this, MT3608 is used, which is a configurable boost voltage converter. The output voltage of this circuit is 4.2 V, higher than the required 3.3 V, so the MCP1700 voltage converter is used to convert the voltage from 4.2 V to 3.3 V.

This solution may have over-design or inefficiency issues, but it is the cheapest and most effective solution.

Battery level control:

MicroByte: DIY Retro Game Console Based on ESP32

Like the voltage divider before the boost circuit, this point’s voltage will reach a maximum of 4.2 V, so only a voltage divider needs to be designed to reduce it to 3.3 V to comply with the ESP32’s logic level and connect it to the ADC GPIO to measure the analog level signal.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Designing the SD Card Module

The SD card uses the SPI protocol, which is a bidirectional communication method allowing for high-speed communication. When using peripherals, there is no need to worry about crosstalk since its speed is not sufficient to generate a magnetic field (at least not a problem here).

The circuit is also very simple; connect each line to the MCU’s SPI GPIO ports and add a pull-up resistor. This resistor is important for maintaining a constant high level on the line and avoiding intermediate level signals that could disrupt data transmission.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Here we also have our old friend decoupling capacitors.

Audio Output

Using ESP32, there are two ways to output audio. By checking the datasheet, we can use the integrated I2S to DAC converter or directly use the I2S peripheral.

MicroByte: DIY Retro Game Console Based on ESP32

The simplest way to obtain audio output is to use the I2S to DAC converter, as speakers can be directly connected to GPIO. If the audio volume is very low, an analog audio amplifier can be used, which is very easy to implement. However, this solution also brings some inconveniences. The DAC only uses 8 bits of the 16 bits in I2S, meaning a lot of audio information will be lost, resulting in very poor audio quality.

I2S is a digital audio protocol that guarantees high-fidelity audio without quality loss or noise. But it requires a converter to convert the analog signals received by the amplifier. Here we use the MAX98357 audio amplifier. This amplifier converts I2S signals into analog signals and amplifies them for direct use with speakers or headphones. This amplifier/converter can provide us with 6.4W of output power and has configurable output options—choosing between mono or stereo audio and impedance selection.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Disclaimer: My understanding of audio is not very deep, so some audio data may be incorrect, for reference only.

Adding Buttons

ESP32 is a nice module, but it has a limited number of GPIO ports. But don’t worry, we have the TCA9555 solution.

TCA9555 is an I2C GPIO multiplexer. This device allows for up to 18 additional GPIOs. These GPIOs can be used as inputs or outputs and can be controlled or checked via I2C. Therefore, with only two GPIOs (I2C SDA and I2C SCLK), we have 18 extra GPIOs! Latency is not an issue, as it can read or write data at up to 400 Khz, meaning 400,000 times per second!

MicroByte: DIY Retro Game Console Based on ESP32

Let’s look at the schematic. This multiplexer is used with I2C, so each signal needs to be pulled up to avoid noise on the lines. It also has an interrupt pin, but it is not used. The I2C signals are SCL and SDA pins (19 and 20). The device’s address must be configured through hardware by setting the logic levels of pins A0, A1, and A2. Here, there is only one I2C device, so the address is given as 0x00.

Finally, all switch buttons are directly connected to the chip, and we set the pull-up or pull-down resistors through software configuration since this multiplexer has configurable internal resistors.

MicroByte: DIY Retro Game Console Based on ESP32

One interesting aspect of this device is the capacitive buttons, which are PCB traces without silk screen layers, allowing rubber buttons with carbon film to act as switch buttons. This is the standard configuration for game controllers. If you want to use it in your design, you can find it in the libraries accompanying the project.

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

Pairing with a Beautiful Display

MicroByte: DIY Retro Game Console Based on ESP32

MicroByte: DIY Retro Game Console Based on ESP32

The display uses a 1.3-inch IPS screen with a resolution of 240 x 240 px, providing very nice colors and clear images. The communication protocol is SPI, allowing for a frame rate of up to 70 FPS (as noted in the datasheet). On the other hand, the backlight of the display can be controlled to select brightness levels. This is done by controlling the current of the embedded LED on the display through a BS138 MOSFET transistor.

MicroByte: DIY Retro Game Console Based on ESP32

Completion

You can now run this retro game console and embark on your journey of retro gaming memories!

The code used in the project can be downloaded from this project repository: https://make.quwj.com/project/359

via instructables.com/MicroByte-DIY-Retro-Console/

Links in the text can be clicked to read the original article at the end

MicroByte: DIY Retro Game Console Based on ESP32

More exciting content

Make a Motorcycle Dashboard with Raspberry Pi

Make a Smart Pet Feeder with Raspberry Pi

Make a Smart Planetary Observer Based on Raspberry Pi

Handmade Metal Wireframe Craft X Wing Clock

Arduino + 280 LEDs DIY Music Spectrum Light

DIY Stanford Pupper 12 DOF Quadruped Robot Dog

Barrier: PC and Raspberry Pi Keyboard and Mouse Sharing Solution

MicroByte: DIY Retro Game Console Based on ESP32

Leave a Comment

Your email address will not be published. Required fields are marked *