ESP32 TTGO-T Display

specs might change

About the TTGO T ESP32 board

  • ESP32

  • 135x240 pixels OLED color

    • On image below upper left is 0,0 and lower right is 134,239

  • Uses ST7789V chip as OLED driver

    • important to knwo when we are going to configure graphichal driver

  • docu

  • 16MB flash(for filesystem) 512 kB RAM etc

  • Please note not so many pins are available:

    • GPIO 21,22,17,1,15,13,12,36,37,38,39,32,33,25,26

    • GPI=O00 and 35 are available on buttons

    • THERE IS NO default LED (like pin 13 on an old Arduino). Pin 17 might be available for LED usage.

    • Only one I2C available, no SPI for you

    • se image below

  • More pin info here and …

  • usage of pins here

 

Schematics

Kan findes her

github

Pin info

pin overview

TFT Driver ST7789 GPIO
TFT_MISO N/A
TFT_MOSI 19
TFT_SCLK 18
TFT_CS 5
TFT_DC 16
TFT_RST N/A
TFT_BL 4
I2C_SDA 21
I2C_SCL 22
ADC_IN 34
BUTTON1 35
BUTTON2 0
ADC Power 14


  • BUTTON1: GPIO35 lower right on image (close to reset button)

    • BUTTON1 has pullup resistor on pcb

  • BUTTON2: GPIO00 lower left on image

    • BUTTON1 has NO pullup resistor on pcb

Select board in Arduino IDE

Choose: Tools->Board-> ESP32 Arduino-> TTGO T1


TFT_eSPI graphics library

TFT_eSPI is part of the Arduino libraries so …

as usual

  1. Sketch->Include Library-> Manage Libraries

  2. Search for TFT_eSPI

  3. Install

  4. QED

 

Configuration of TFT_eSPI library

The library supports really many graphical devices.

On the TTGO T is a ST7789V graphic chip and it is interfaced by SPI.

So we need to modify a few files in the library to acivate support for it.

So the files located in sketchbook/libraries/TFT_eSPI/ is …

  1. User_Setup.h

  2. User_Setup_Select.h

Modify User_Setup.h

We have to edit in file User_Setup.h
which is located in sketchbook/libraris/TFT_eSPI/

  1. Go to our sketchbook location …/sketchbook

  2. Go down in folder libraries

  3. Go down in folder TFT_eSPI - this is the driver SW

Open file User_Setup.h file in an editor

All lines in the file are from beginning commented out. We do only need to uncomment and correct af few lines

So

  1. We need to activate support for ST7789V chip

  2. approx line 58 uncomment line //#define ST7789_DRIVER/ (just remove the two //)

    1. #define ST7789_DRIVER

  3. And set resolution of display 135x240

  4. approx lines 90 you shall have two lines (you have to correct resolution

    1. #define TFT_WIDTH 135 //

    2. #define TFT_HEIGHT 240 //

(click for see my User_Setup.h file - look for JDN)

Open raw file

Modify User_Setup_Select.h

We need to have correct include file path. This is given in User_Setup_Select.h

All lines are commented out (as you can see support fore weird many displays)
You need to uncomment one line:

So open the file in your texteditor and uncomment so you will have driver no 25 active…

(click for see the file - look for JDN)

Open raw file

Examples

See examples -> TFT_eSPI -> etc

Be aware some examples are for larger displays then 135x240

I have - with succes - tested examples ->TFT-eSPI->320x240->TFTMeters

(see the code)

the raw code

The display shows

 

Looks weird - its because it thinks itas 320x240 display

A hack - rotate it - this will not solve the problem but looks better

I think the chip just dont draw stuff outside the display :-)

In the setup function just change tft.setRotation(0); to tft.setRotation(1);

Happy hacking

 

END OF DOCU

Some notes

(click for notes)