MicroByte DIY Retro Console

by JuanF92 in Circuits > Microcontrollers

15509 Views, 140 Favorites, 0 Comments

MicroByte DIY Retro Console

_DSC3681 (2).JPG
_DSC3381.JPG
_DSC3329.JPG

Hello!

I want to introduce you to a project that I've been working on for the last months and of course, it's fully open source!
MicroByte is a portable console that is able to run NES, GameBoy, GameBoy Color, Game Gear, and Sega Master System games, all this in a very tiny package of 78x17x40 mm. But despite the little dimension, it has a SNES gamepad layout with buttons for human size. On the other hand, it has a crisp and sharp 1.3" IPS display which allows you to see all the details of the games.

But it's not only for retro gaming, I will release very soon a microPython and Arduino library to create your applications.

On the video and repo you can find all of the details of the project:

microByte Github

(Here you can find the firmware, PCB design, enclosure 3D files, and extra info)

But on this instructable, I want to show you the design process of the PCB, going into details of each module of the board which can be useful for you if you need to add to your project.

If, after reading this instructable you find interesting this project, you can do it by your self, which is not very difficult, you just need a 3D printer and a solder or if you just want to be focus on software development, you can buy on the next CrowSupply campaign:

CrowSupply microByte

Supplies

Here you can check the list of materials use on this project:

microByte Bill of Materials

Architecture of the Project

IMG_20200617_160427.jpg
_DSC3667.JPG

Normally, when you start an electronics project, first you create a box diagram where you set the required functionalities of the projects and how they interact with each other, then you continue with the schematics. On the schematics, you select the components that fit your requirements and set the electrical connections. Finally, we proceed with the PCB layout design. In this last step, we set the position of each component base, following some design rules and fitting in our physical design.

And I've almost forgotten the prototyping stage where our good friend the prototype board wildly raise. (You can see a very primitive photo of the first proto board prototype and on the second photo the final result)

Write all the process on this Instructable can be tedious and boring (for me and for you), so I will try to split the device development into blocks, mixing the schematics design and the PCB layout design.

I think this will make a more entertaining Instructable and possibly more useful if you want to use some of the blocks in your project.

The Schematics and PCB layout were designed with Kicad, you can download them from this repository:

microByte_PCB

(I don't know why it's not possible to upload as a .zip file)

To open you just need to install Kicad and double click on the file .pro.

The Brain of the Tiny Beast, the ESP32

MCU_module.png
MCU_module_pcb.png
PCB_MCU.jpg
PCB_MCU_FRONT.jpg

Usually, when you create an electronic device that involves some kind of computational power, you need to select the right microcontroller that fits your requirements.

For this project, I've chosen the ESP32 Wrover E module. This module/microcontroller it's gives an excellent performance for emulation with two core at 240MHZ, 16MB of flash, 8MB of RAM, ultra low power co-processor, Wi-Fi and Bluetooth support, and full of peripherals and GPIOS.

Also, thanks to our friends of Espressif, it's very easy to implement in any design because you don't have to worry about adding external clocks, or a lot of decoupling capacitors. (They don't pay me for the advertisement)

If you're very interested in this module, here you can see the datasheet:

ESP32-Wrover-E datasheet

On the first image, you can see the schematics of the module of the board.

  • In the middle, we have the ESP32 module with connections to the peripherals.
  • On pin number 25 we have the IO0 pin. This pin selects the boot status of the device, in other words, if you can flash new firmware or start the already flashed one. If the signal is high will start the already flashed firmware, otherwise, with low, it will start boot mode and it will be waiting for new firmware.
  • Have look at pin 3, this the Enable Pin (AKA reset). Basically, if this pin is high the microcontroller will work otherwise no.
    • As you can see there is an RC circuit(Resistor/Capacitor). The work of this circuit is to avoid bouncing signals this means, we want clean signals when the board boot or it's flashed to avoid an unexpected reset. To be honest, this circuit is not totally necessary on this circuit because it doesn't have a reset button, but it's better to be cautious.
  • Pin 2 is IO2, and we attached a simple blue LED with a resistor. This LED works to show notifications, so no big deal with the part.
  • Finally, have a look at pin2 or VDD3V3. This is pin is to give power supply to the chip, to be exactly 3.3V, but it's important to notice the capacitors in parallel. These capacitors are decoupled capacitors and work to clean the power signal from parasite interference. If you don't add these capacitors probably it will work the device, but it's a recommendation of the manufacturer, and probably they will know more than us.

On the last three photos, it's shown the PCB design layout and the real PCB with the part that we're studying in focus.

The last tip that can be useful, the components that are related between them must be has near as possible.

Add an USB, We Need a Connection With the PC!

schematics_usb.png
PCB_COM.jpg
layout_usb.png

Some microcontrollers have implemented USB connectivity which simplifies a lot the process, but unfortunately, the one which we have selected doesn't have, so we need to find a way to flash and see what's going on inside the ESP32.

To do so, we will use a USB transceiver, this is a chip which "transform" the USB signal to serial, RS232, or other similar protocol. On the market, there are a wide variety of models available, but we're going to use the CH340C.

The CH340C is an interesting driver because from one side it solves the connectivity issue, it has a simple usage it doesn't require an external clock like the CH340G and finally, the price is a fraction of the CP2102 or FT232. Have a look at the right side of the first image (The schematics partition). The design is pretty simple, just the chip with two decoupler capacitors (If you read the previous point you should know what it's a decoupler capacitor) and a resistor with 0 ohms. This kind of resistor is used as a bridge if you are not sure if the connection must be done.

On the right side, you will see the schematics of a fancy USB C connector. To be honest, the USB-C doesn't have any special functionality it just connects to a PC and charges the battery, but nowadays it looks like ancient technology uses a micro-USB, and I hate to use multiple wires.

On the other hand, use a USB-C is a little more challenging when you route the PCB because you need to add the double connection due to the possibility to use the wire in any direction.

TIP: The USB signals are parallel high-speed signals. So, you must try to route parallel to avoid crosstalk between the signals and route the signal close to digital logic chip.

Note: I know that my layout of the PCB connection is not very clean, but it's difficult in a two layers PCB.

A Portable Device Is Not Portable Without Battery. Power Management

battery_sch.png
pm_sch.png
battery_ctrl_sch.png
pm_brd.png
PCB_PM.jpg
PCB_PM_front.jpg

This is probably the most complex part of this project in terms of electrical design. To simplify the explanation, we are going to split this point into three parts:

  • Battery charge and protection circuit.
  • Power supply management.
  • Battery level control.

Battery charge and protection circuit (Schematics 1, block 1 of the PCB photo):

With Li-Po batteries, safety first, because they can be very dangerous with inappropriate use. So, we need to do a correct charging with constant current and control we don't charge over the 4.2V or discharge the battery under 2.8v to avoid damages to the battery.

We will start with the TP4056. This integrated circuit is a Li-Po battery charger, which provides constant linear voltage-current. One of the most interesting features is that you can set the charging current modifying the value of the resistor R2. Remember that the charging current should be around 25% battery capacity. This integrated circuit is connected to the LED D1, to show the charging status of the battery.

Then we go to the FS312F-G. This IC is a battery protection circuit, which "cut" the usage of the battery if detects overcharge or over-discharge on the battery. This will avoid damages to the battery.

Finally, we have FS8205. This is an IC that integrates two MOSFET transistors, to select the power of the circuit. I mean, if the battery is on a good range, it will get the energy from the battery, otherwise, if we connect the device to the USB port, it will work directly with the energy of the USB.

Power supply management(Schematics 2, block 2 of the PCB photo):

This block is a step-up with a voltage converter to provide a constant voltage of 3.3V. The Li-Po battery has an operative voltage of 4.2v at the maximum charge and 2.8v at the minimum safe voltage. So, we need to provide constant voltage to avoid instability with the microcontroller or brightness decrease on the display. To solve this issue, we use the MT3608, which is a configurable step-up voltage converter. At the output of this circuit, we will have always 4.2V. This is too much for the logic level of the device, which works with 3.3V, so we use the MCP1700 voltage converter. This integrated circuit transforms the voltage from 4.2v to 3.3v. The problem is solved!

I know that this is a little over-engineer or maybe inefficient solution because there are step-up/step-down solutions that will simplify a lot the circuit, but this was the cheapest solution, and the result is good.

Battery level control(Schematics 3, block 3 of the PCB photo):

As simple as a voltage divider before the step-up circuit. We know that the voltage at this point will be at the maximum point 4.2v, so it's just necessary to calculate a divider that drops to 3.3v to respect the logic level of the ESP32 and connect it to an ADC GPIO to measure the analog level of the signal.

The Place Where the Games Lives, the SD Card

sch_usb.png
pcb_usb.png
PCB_SD.jpg

This module is pretty simple. The SD card work with SPI protocol, this a bidirectional communication that allows high-speed communications. With peripheral, you don't have to worry about crosstalk because it's not enough speed to create a magnetic field(Or at least I didn't have any problem)

The circuit is pretty simple, connect each line to the SPI GPIO of the MCU and add a pull-up resistor. This resistor is important to maintain a constant high level on the line and avoid middle-level signals which can corrupt the data transaction.

And also our old friend the decoupling capacitor.

Games Without Sound Is Very Boring

sound_sch.png
sound_board.png
PCB_SONIDO.jpg
PCB__FRONTSONIDO.jpg

With the ESP32 we have two different options to output audio. If we check the datasheet, we can use the integrated I2S to DAC converter or directly the I2S peripheral.

The simplest way to obtain an audio output is to use the I2S to DAC converter because you can directly connect a speaker to the GPIO and if you think that the audio volume is low, you can always use an analog audio amplifier, which is pretty easy to implement. But this solution has inconvenient, the DAC only uses 8bits of the 16bits that provide the I2S. This means, we will lose a lot of audio information, which translates into very poor audio quality.

So, let's have a look over to the I2S output. The I2S is a digital audio protocol that warranty high fidelity audio without any significant loss of quality or noise introduction. The issue is that we require a converter analog converter and amplifier to hear something.

No problem, we have our popular and expensive friend the MAX98357 audio amplifier. This driver transforms the I2S signal to analog and amplifies it to directly use on a speaker or headphone. This amplifier/converter give us 6.4w of output power, with configurable output selection, this means, you can choose between mono or stereo audio, and select the impedance.

Finally, we connect the output to the speaker, and voila! We have sound!

Disclaimer about this point: My knowledge about audio is not very deep, so some audio data might be wrong. The manufacture recommends two ferrites at the output, but I've tested without the ferrite, and no noise audible.

Add Some Buttons, Please

sch_btn.png
board_btn.png
PCB_BTN.jpg
IMG_20210125_123041.jpg

The ESP32 is a nice module, but it has a very little quantity of GPIO ports. But don't worry we have the solution, the TCA9555.


The TCA9555 is an I2C GPIO multiplexer. This device allows the use of up to 18 extra GPIO. These GPIOs can be used as input or output and can be controlled or check via I2C. So, with just using two GPIO (I2C SDA and I2C SCLK) you have 18 extra GPIO! The delay is not a problem because you can read or write up to 400Khz, which means 400000 times per second!

Let's have a look at the schematics. This multiplexer works with I2C as we already said, so we need to pull-up each signal to avoid noise on the line. It also has an interruption pin, but it's not used. The I2C signals are SCL and SDA pins(19 and 20). On the other hand, you need to configure via hardware the direction of the device, this configuration is done by setting the logic level of the pins A0, A1, and A2. We only have one I2C device, so, we will give the direction 0x00.

Finally, all the switch buttons are connected directly to the integrated circuit, the reason is we set the pull-up or pull-down resistor through the software configuration because this multiplexer has a configurable internal resistor.

One of the interesting points of this device is the inductive buttons, these are PCB routes that didn't have silkscreen so, with a rubber button with carbon film you can use it as a switch button. This is a regular method on any gamepad. If you want to use on your design, you can find on the libraries attached to the project. (I know that it's difficult to find a library of inductive buttons)

To Enjoy It, We Need a Nice Display

scr_sch.png
scr_pcb_back.png
PCB_Backlight.jpg

The display is an IPS 1.3" screen with a resolution of 240x240px which gives very nice colors and sharp images. The communication protocol is SPI, this allows to achieve a frame rate of up to 70FPS (At least it says the datasheet). I won't very deeply with the display because basically, the manufacturer doesn't recommend using any kind of pull-up resistor or decoupler capacitor, I leave it as it's.

On the other hand, the backlight of the display can be controlled to select a brightness level. To do so, we will control the current of the LED embedded on the display, this control will be done with a BS138 MOSFET transistor.

The End.

I hope you interesting in this instructable, the firmware and case are available on the repository shown at the first point. It's impossible to give all the detail on the design process of this board, but If you have any questions or something is not clear, please feel free to ask.

I must apologize for my English, because is not my native language, and some phrases might sound weird.

If you want to build by your self this board, it's easy on any of the available PCB manufacturing services, you can buy 5 PCBs for $2. The components are a little bit expensive for this quantity, but if you want a soldering challenge, it's a very good exercise.

Maybe you are not sure if it's possible to solder by hand but I did, with patience is possible.