Firmware for ESP32 TFT displays

Our primary goal with this Web-Service is to make an Epaper Firmware so this TFT branch is just an example to guide our users in implementing their own solutions
This example Firmware provides just 3 things:

  • A way to download a JPG image from an external URL into ESP32
  • An interpreter that reads this jpeg image and prepares a Buffer for the display (based on JPEGDecoder library examples)
  • An authorization Token to make sure you don't need to leave your Calendar events open to the world (Bearer token)

The open source Firmware is here:

https://github.com/martinberlin/eink-calendar - cale_tft branch





How to compile and upload to your board

We assume that you are familiar with the installation of Platformio that is a great IDE to upload firmware to your boards and also to keep your dependencies contained in your project. The configuration is not complicated. After downloading just rename:
lib/Config/Config.h.dist to
Config.h

and fill it with your WiFi name and password.

The most important part of the configuration is to copy the image URL from CALE "Render Screen" section into the configuration. Just click on the Bitmap URL for the ESP32 to select all and copy it into the screenUrl and do the same with the Bearer token if you are using a private Screen:
    // Keep in mind this screens need a JPG image response so make sure to select a TFT display in CALE.es
    char screenUrl[] = "http://img.cale.es/jpg/USERNAME/SCREEN_ID";

    // Security setting, leave empty *only* if your screen is public (Not recommended)
    String bearer = "";




Logging of the internal ESP32 IP Address

By default CALE is logging the internal IP Address since it may be useful for statistics and to identify your device image requests from the administration image requests. If for any reason you want to disable this just comment this line on the Config file:
#define ENABLE_INTERNAL_IP_LOG



Selecting the right driver for your display

To select the right Driver for the display you are using, first of all would be great to get familiar with the Bodmer TFT_SPI library and to browse descriptions and examples. I mention that since not all the TFTs need the same pins connected and they are sufficient examples but I cannot cover all configurations since I do not have all the displays to test.
Please check the Bodmer TFT drivers list to select your driver. In the example below I will be using a ILI9341_DRIVER
GPIOs for the TFT SPI interface
For this firmware we did both the display driver and the SPI pins configuration using build_flags so this goes in the platformio.ini file:
    ; DISPLAY_ROTATION: 0 & 2 Portrait. 1 & 3 landscape
build_flags =
  -DUSER_SETUP_LOADED=1
  -DILI9341_DRIVER=1
  -DTFT_WIDTH=240
  -DTFT_HEIGHT=320
  -DTFT_MOSI=23
  -DTFT_SCLK=18
  -DTFT_CS=32
  -DTFT_DC=27
  -DTFT_RST=5
  -DSPI_FREQUENCY=40000000
  -DDISPLAY_ROTATION=1
    
Please keep in mind that USER_SETUP_LOADED tells the Bodmer TFT library to use this configuration and not a file based one. Check what voltage needs your display in the VCC pin, some like the ILI9341 need 5 volts, and won't work if you use a 3.7 v. battery in the VCC pin.