Skip to content

Software Setup

Rafael Zenaro edited this page Jun 6, 2022 · 14 revisions

Software Setup

To install the ESP32 board for the Arduino IDE, follow the instructions here. I highly recommended following the instructions to install via Boards Manager. (If you're having trouble with the most recent version via Board Manager, especially with the SD card module, use version 1.0.6 of the board. Thanks @6d64 for the tip.)

If you want to use the OLED Display, you need to install some Libraries from the Arduino Library Manager - Tools > Manage Libraries...

SD Card Content

Format any size SD card in FAT32 and copy all content of the 'SD' folder to your SD card root, so that <SD CARD>/www/ and <SD CARD>/E_paper/ directories are at the root.

  • <SD CARD>/www contains the files for the webserver.
  • <SD CARD>/E_paper/ contains a GNU Octave/Matlab script to transform your printer images into printings simulating the output of an actual Game Boy Printer (aka e-paper).

During use of the NeoGB Printer, new files will appear on the card.

  • <SD CARD>/ID_storage.bin generates an unique ID for each print so avoid to delete it (if deleted, the image count will restart from 1 with a risk of overwriting existing images).
  • Your images will be placed at <SD CARD>/output/bmp/ and <SD CARD>/output/png/ and can be deleted as you wish.

If you are using the OLED display, the IP address will shows on it to easily connect to you printer.

config.h Configuration File

First of all, rename the config.h.txt to just config.h to import the pinout settings. This file contains all the to make the hardware works properly (pinout, OLED and LEDs features, enable webserver, default scaling factor for images, etc.). Customize it according to the board and modules you are using.

Inside the folder neogb_printer/config.h presets/ you can find some ready to use configs for some boards/builds

Gameboy Link Cable Definitions

  • #define ESP_MOSI_PIN - Define the MOSI pin of your ESP board (see the Pinout map of your board)
  • #define ESP_MISO_PIN - Define the MISO pin of your ESP board (see the Pinout map of your board)
  • #define ESP_CLK_PIN - Define the CLK pin of your ESP board (see the Pinout map of your board)
  • #define INVERT_SERIAL_PINS - Invert the Gameboy cable pin 2(SO) and 3(SI) order, since the pin 2 goes on 3 in the other side of the cable, and 3 goes to 2. This is useful if you are using a breakout board for the link cable.

SD Card Module Definitons

  • #define SD_CS - Define the CS pin used by the SD module
  • #define SD_SCK - Define the SCK pin used by the SD module
  • #define SD_MOSI - Define the MOSI pin used by the SD module
  • #define SD_MISO - Define the MISO pin used by the SD module

PushButton and Image Output Definitons

  • #define BTN_PUSH - Define the pin used by the PushButton
  • #define BTN_INVERT - Invert the button logic, to use the LOW state instead the HIGH state (useful for PullUp button settings and LilyGo TTGO T2 board)
  • #define BMP_UPSCALE_FACTOR - Set the Upscale factor for the BMP output (Set 0 to disable). This value will be replaced by the conf.json value
  • #define PNG_UPSCALE_FACTOR - Set the Upscale factor for the PNG output (Set 0 to disable). This value will be replaced by the conf.json value

OLED Display Definitions

Before you change any settings in this section, make sure to know what display you are using. Choose only one driver listed below: SSD1306 or SSD1331

  • #define USE_OLED - Enable the display functions

  • #define USE_SSD1306 - Uncomment this line and the following three lines below if you are using an I2C display that uses the SSD1306 driver.

  • #define OLED_SDA - Define the SDA pin for the display

  • #define OLED_SCL - Define the SCL pin for the display

  • #define OLED_COMPINS - Let the default value. If you have some issue with the display (like an squeezed image) try to change this value between 1 and 4 (only integer numbers)

  • #define USE_SSD1331 - Uncomment this line and the following three lines below if you are using an SPI monitor that uses the SSD1331 driver.

  • #define OLED_SCLK - Define the SCLK pin for the display

  • #define OLED_MOSI - Define the MOSI pin for the display

  • #define OLED_MISO - Define the MISO pin for the display

  • #define OLED_CS - Define the CS pin for the display

  • #define OLED_DC - Define the DC pin for the display

  • #define OLED_RST - Define the RST pin for the display

  • #define SCREEN_WIDTH - Set your display width

  • #define SCREEN_HEIGHT - Set your display height

  • #define OLED_ROTATE - Rotate the display by 180°

LED Status Definitons

  • #define LED_STATUS_PIN - Define the LED pin to shows the status (use this option ONLY if you want to use a common LED)

  • #define LED_STATUS_BLUE - Define the Blue LED pin to shows the status (use this option ONLY if you want to use a RGB LED)

  • #define LED_STATUS_RED - Define the Red LED pin to shows the status (use this option ONLY if you want to use a RGB LED)

  • #define LED_STATUS_GREEN - Define the Green LED pin to shows the status (use this option ONLY if you want to use a RGB LED)

  • #define COMMON_ANODE - Define if your RGB LED is Common Anode (use this option ONLY if you want to use a RGB LED)

  • #define COMMON_CATHODE - Define if your RGB LED is Common Cathode (use this option ONLY if you want to use a RGB LED)

WebServer interface (optional)

The NeoGB Printer has an integrated WebServer to easily download your photos and delete them too. The printer will alternate between Printer Mode (to print and generate the image files) and Server Mode (to access the Web interface and manage your pictures) on each boot.

  • #define ENABLE_WEBSERVER : Enable the WebServer Interface
  • #define WIFI_CONNECT_TIMEOUT : Wifi timeout connection in ms

RTC Definitions

  • #define RTC_TIMEZONE - Set your TimeZone UTC offset (In my case, is -3)
  • #define RTC_TIMEDIFF - Since the included RTC in the ESP is not so accurate, it could be necessary to add this little "time adjust" to match with your actual Date/Time (in ms). Each board will have his own value

conf.json Configuration File

This file will store all customizable configurations, like the mDNS, AccessPoint settings (if the NeoGBP can't connect to a valid network), WiFi settings (useful to access the Web Interface in any device and retrieve the current Date/Time information via NTP during each boot) and Image Scale Factor for both formats (BMP and PNG). Any information in this file will replace the default value in the Arduino IDE code.

The file is located in <SD CARD>\www\conf.json.

This the file schema:

{
  "mdns": "gbprinter",
  "ap": {
    "ssid":"gbprinter",
    "psk":"gbprinter"
  },    
  "network": {
    "ssid":"Your SSID",
    "psk":"Your wifi password"
  },
  "bmpimage": {
    "scale":1
  },
  "pngimage": {
    "scale":1
  }
}
  • mdns - Change the name by which the printer will be accessible
  • ap - AccessPoint settings. Enter your own SSID/Password to access the printer when the NeoGBP can't connect to a valid WiFi network.
  • network - Your WiFi Network settings. Enter your WiFi SSID/Password make the printer connects to your Local Network and access the NeoGBP through any device
  • bmpimage - Set a new upscale value for your BMP images (Set 0 to disable the BMP output)
  • pngimage - Set a new upscale value for your PNG images (Set 0 to disable the PNG output)