Home

Awesome

WiFi GBP Emulator

A GameBoy printer emulator which provides the received data over a WiFi connection
This code has been created for a "LOLIN(WEMOS) D1 R2 & mini" ESP8266 based board

If you are proficient in soldering, there is now a PCB/Shield to hold the ESP and the optional display
The required (recommended) gameboy printer web interface can be found on github as well

Setup

It's a good idea to follow the detailed beginners guide
For uploading the Filesystem to the ESP you require the SPIFFS Arduino IDE Plugin. Follow the installation instructions here
Before compiling the project you need to create a config.h inside the project folder
(config.h.sample.txt should be used as a reference)
If you run the default setup (similar to the WiFi-Printer) that file can be left empty
If your (hardware-)setup is different you can adjust the parameters there

Bootmode

The code is designed to check pin D0 for high to boot in printer mode
Through this it is possible to use the +5v provided by the GameBoy to switch the mode
The default will alternate the bootmode automatically between printer and server on each boot, so you can use the reset-button to switch modes
If you have the possibility to sense the 5V signal, from the GameBoy, you can uncomment #define SENSE_BOOT_MODE in your config.h

Configuration

If the device is not configured the default settings (AP only) will be used

Default config

If not present the ESP will set up an accesspoint with ssid/password gameboyprinter
It will output it's IP adress over the serial monitor and on an optionally connected display
(usually the device should be accessible via http://192.168.4.1)
It will also be discoverable via Bonjour/mDNS via http://gameboyprinter.local

Manual Setup via conf.json

Wifi setup can be done via a file conf.json in the /data/ folder
The basic format are as follows:

{
  "mdns": "gameboyprinter",
  "ap": {
    "ssid":"gameboyprinter",
    "psk":"gameboyprinter"
  },
  "networks": [
    {
      "ssid":"Your SSID",
      "psk":"Your wifi password"
    }
  ]
}

All config options are optional

"mdns"

Change the name by which the printer will be accessible via Bonjour/mDNS

"ap"

AccessPoint config
Enter ssid/psk to open an accesspoint different to the default one.

"networks"

Array of objects with keys ssid/psk
The first reachable network in that list will be used to conect to
⚠ Do not use more than 10 elements. Otherwise you might see an "Out of Memory" error in the serial monitor

Manual Setup via web interface

The following will describe the "raw" interface for updating ther configuration. You will only need this if you decide not to use the existing web-interface

Reading

calls to /wificonfig/get delivers the actual config (passwords are omitted)

Writing

calls to /wificonfig/set will update the sent properties
make sure to send the data as a JSON string in the POST-Body

Updating existing networks

Automatic update of the webserver content

Hardware Setup

Gameboy Original/Color Link Cable Pinout

 __________
|  6  4  2 |
 \_5__3__1_/ (at cable)

| Link Cable | ESP8266 |
|------------|---------|
| Pin 1      | D8      |
| Pin 2      | D7      |
| Pin 3      | D6      |
| Pin 5      | D5      |
| Pin 6      | G       |

Additionally an OLED Display can be added via D1 -> Display SCL / D2 -> Display SDA

ToDos

Enhance performance while saving (maybe by constantly writing all data to a single file instead of buffering and flushing it)

Links / Research

OLED Display

You can add a tiny oled display like this or (probably) this
To use it, you need to uncomment #define USE_OLED and the following lines
The display will show the current wifi-config while in server mode, as well as the number of printed images when in printer mode
Please note the image count in printer mode only regularly updates while idle, and not while printing a batch of images

Demo Video

An earlier version of this code did stream the received image-data to a browser via websockets. This is shown in this older video.

⚠ Take care ⚠

You should not power the ESP from the GameBoy, as this might damage the GameBoy itself. What you see in the video was meant as a proof of concept which is basically not implemented anymore