Skip to content

Hardware Setup

Rafael Zenaro edited this page Sep 11, 2022 · 7 revisions

Hardware Setup

This code has been created for a "DOIT ESP32 DEVKIT V1" ESP32 based board. All my tests was executed using this chinese board. You can use any other board available in the market. Just make sure of few points:

  • The number of total pins available in the board doesn't matter (Could be with 30 pins, 36 pins, 38 pins, whatever)
  • It's a Dual Core module (some ESP32 modules are single core, like the ESP32-S2 and ESP32-C3)
  • Have, at least, 2 SPI pins groups like this example (normally it's called HSPI and VSPI, or sometimes have one called SPI and the other called VSPI or HSPI), make sure to check the pinout before buy one;

Some boards already have a SD Card slot built in. We've never tested this kind of board, but in theory it should work fine (as long as it has SPI pins available). If you choose to use this type of board, we however won't be able to provide any support in case of bug...But feel free to experiment.

Another thing about ESP boards is that some boards may be required to hold the "BOOT" button to flash the board, when the "Connecting..." message shows in the Arduino IDE log.

Gameboy Link Cable

Gameboy Original/Color Link Cable Pinout. If you don't want to sacrifice a Link Cable, you can use this Gameboy Link Cable Breakout PCB to connect the pins and keep your Link Cable safely ! You can buy this board here, from OSH Park. A bit of do-it-yourself is necessary at this step if you do not use a breakout board.

Different from Arduino that operates in 5V like the GameBoy, the ESP32 operate is in 3.3V on its pins by default. You will need a tiny bidirectionnal Level Shifter like this to handle the communication protocol and prevent any overvoltage/undervoltage from any side. Direct connection between Game Boy and ESP pins without level shifter may work but we do not recommend this for long term reliability reasons.

Connect the Game Boy serial pins to the ESP pins following this scheme:

Link Cable view

 __________
|  6  4  2 |
 \_5__3__1_/ (at cable, front view, Game boy side)

Link Cable Level Shifter ESP32 Notes
Pin 1 N/A 5v from Game Boy (unnecessary)
Pin 2 HV1<->LV1 G19 Serial Out (Game Boy side)
Pin 3 HV2<->LV2 G23 Serial In (Game Boy side)
Pin 4 N/A Serial Data (unnecessary)
Pin 5 HV3<->LV3 G18 Clock Out
Pin 6 GND<->GND GND GND
LV +3.3V +3.3 volts from ESP32
HV +5V +5 volts from ESP32 or USB

⚠If the connection does not work, uncomment the line #define INVERT_SERIAL_PINS in config.h !⚠

SD Card Reader

You need to use a Micro SD Card Module or a SD Card Module to save the data. I highly recommend to get one, especially the SD Card Module, It's more stable than Micro SD Card Module, at least during my tests. To use it, connect the pins following this scheme:

SD module ESP32 Notes
CS G15
SCK G14
MISO G26 DON'T USE THE G12! YOU CAN USE ANY OTHER PIN AVAILABLE
MOSI G13
GND GND
VCC/5v VIN
3v3 N/A

PS: If you experience some kind of issue involving the SD card (corrupted image dumps or some random values on Oled Display) try to use a faster SD card, for example, a Class 10 SD card. This kind of issue affects especially the LilyGo TTGO Board users. Issue #22

Push Button

You will need to add a little Push Button like this to convert all RAW data to BMP and/or PNG. To use it, just set the #define BTN_PUSH in config.h to any pin you want.

The function is simple:

  • Single short press: Force to refresh the image ID after printing (only two games require this action: E.T.: Digital Companion and Mary-Kate and Ashley Pocket Planner).
  • Long Press: Convert all RAW data to BMP/PNG images.
PushButton Schematic
     __________
    |          |
1 --|----------|-- 2
    |          |
3 --|----------|-- 4
    |__________|
Button ESP32 Notes
1 or 2 3v3
3 or 4 G34 I recommend to connect a 5K to 10K resistor to the GND together, to act as a Pull Down

LED Status (optional)

You can add a simple RGB LED like this and/or a standard one. This LED will be very useful to display the printer status, like Idle, Converting, Receiving Data, etc.

To use it, you need to uncomment #define COMMON_ANODE or #define COMMON_CATHODE for RGB LED (based on your LED) or #define LED_STATUS_PIN to use the standard one. Edit the pins in the config.h based on your setup. If your RGB LED uses a Common Anode, connect it to the 3.3v Pin. If it's Common Cathode, connect it to the GND. For the other legs, you need to use at least a 220 Ohm Resistor on each RGB leg. Connect them following the example scheme below (always based on your config.h file)

RGB LED ESP32 Notes
R G16 YOU CAN USE ANY GPIO AVAILABLE. Connect at least a 220 Ohm Resistor with it.
G G17 YOU CAN USE ANY GPIO AVAILABLE. Connect at least a 220 Ohm Resistor with it.
B G4 YOU CAN USE ANY GPIO AVAILABLE. Connect at least a 220 Ohm Resistor with it.

If you are using a standard single color LED, connect it by following the example scheme below (always based on your config.h file). Using a single color LED in combination with OLED display is an interesting setup.

LED ESP32 Motes
+ G5 ANODE LED (the long one) - YOU CAN USE ANY GPIO AVAILABLE. Connect at least a 220 Ohm Resistor with it.
- GND CATHODE LED (the short one)

OLED Display (optional)

You can add a tiny oled display like this. To use it, you need to uncomment #define USE_OLED and the following lines. The display will show the current status of the printer.

OLED DISPLAY ESP32 Notes
GND GND
VIN 5v or 3v3
SCL G22 YOU CAN USE ANY GPIO AVAILABLE
SDA G21 YOU CAN USE ANY GPIO AVAILABLE

About Power Sources

Any 5 Volts source available will do the job as the device consumes less than 1 W: powerbank with USB cable, mobile phone with OTG cable, lithium battery with charger circuit, regular AA batteries with 5 volts regulator like the DD1205UA, etc.