LilyGO TTGO T-display ESP32
The LilyGO TTGO T-display ESP32 is a nice little Arduino development board with color display, battery charging interface, 2 onboard GPIO buttons and USB C connector.
Warning: Everything on these pages are provided "as is". I can not guarantee the correctness and effectiveness of the provided information and sketches. I can not be held responsible for any damage to your dev board and accessories caused by using my information and sketches.
Subpages:
Sections on this page:
Hardware specifications
Source of hardware specifications: http://www.lilygo.cn/claprod_view.aspx?TypeId=21&Id=1128
Hardware Specifications
Chipset
ESPRESSIF-ESP32 240MHz Xtensa® single-/dual-core 32-bit LX6 microprocessor
FLASH
QSPI flash 4MB
SRAM
520 kB SRAM
Button
Reset
USB to TTL
CP2104
Modular interface
UART、SPI、SDIO、I2C、LED PWM、TV PWM、I2S、IRGPIO、ADC、capacitor touch sensor、DACLNA pre-amplifier
Display
IPS ST7789V 1.14 Inch
Working voltage
2.7V-4.2V
Working current
About 60MA
Sleep current
About 120uA
Working temperature range
-40℃ ~ +85℃
Size & Weight
51.52 * 25.04 * 8.54mm (7.81 g)
Power Supply Specifications
Power Supply
USB 5V/1A
Charging current
500mA
Battery
3.7V lithium battery
JST Connector
2Pin 1.25mm
USB
Type-C
Wi-Fi
Standard
FCC/CE-RED/IC/TELEC/KCC/SRRC/NCC
Protocol
802.11 b/g/n(802.11n,speed up to150Mbps)A-MPDU and A-MSDU polymerization,support 0.4μS Protection interval
Frequency range
2.4GHz~2.5GHz(2400M~2483.5M)
Transmit Power
22dBm
Communication distance
300m
Bluetooth
Protocol
Meet bluetooth v4.2BR/EDR and BLE standard
Radio frequency
With -97dBm sensitivity NZIF receiver Class-1,Class-2&Class-3 emitter AFH
Audio frequency
CVSD & SBC audio frequency
Software specification
Wi-Fi Mode
Station / SoftAP / SoftAP + Station / P2P
Security mechanism
WPA / WPA2 / WPA2-Enterprise / WPS
Encryption Type
AES / RSA / ECC / SHA
Firmware upgrade
UART download / OTA(Through network / host to download and write firmware)
Software Development
Support cloud server development / SDK for user firmware development
Networking protocol
IPv4、IPv6、SSL、TCP/UDP/HTTP/FTP/MQTT
User Configuration
AT + Instruction set, cloud server, Android / iOSapp
OS
FreeRTOS
PIN diagram
Source of image and additional pinout: http://www.lilygo.cn/claprod_view.aspx?TypeId=21&Id=1128
Additional pinout not on the picture
ADC IN: 34
ADC Power: 14
Arduino Installation instructions
Source of parts of the instructions: https://github.com/Xinyuan-LilyGO/TTGO-T-Display
Adding board to Arduino
The LilyGO TTGO T-display ESP32 is basically an ESP32 development board with some added hardware features. To be able to program the board you need to add the board to and with the Boards Manager of the Arduino IDE. Instructions can be found on the documentation pages of Espressif: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-arduino-ide
Then in the Tools menu you need to setup some parameters to be able to program the LilyGO TTGO T-display ESP32. I don't whether my settings are the best but these are the settings I use:
Board: ESP32 Dev Module
Upload Speed: 921600
CPU Frequency: 240Mhz (WiFi/BT)
Flash Frequency: 80Mhz
Flash Mode: QIO
Flash Size: 4MB (32Mb)
Partition Scheme: Default 4MB with spiffs (1.2MB APP/1.5 SPIFFS)
Core Debug Level: None
PSRAM: Disabled
Port: [the COM port your board has connected to, see below]
To determine on which COM port your board connects, do the following steps:
Unplug the board.
Have a look at Tools > Port and remember which ports you do see.
Plug in the board to the USB port.
Look again at Tools > Port.
The newly added COM port is the COM port of your board and the one you can select.
Dependency library files: TFT_eSPI
To get the screen on the LilyGO TTGO T-display ESP32 running need the TFT_eSPI library. This is a "graphics and fonts library for ESP8266 and ESP32 processors with drivers for ILI9341, ILI9163, ST7735, S6D02A1, ILI9481, ILI9486, ILI9488, HX8357D and ST7789 based TFT displays that support SPI".
Whilst you can install the library with the Library manager of Arduino I would advise you to install the version from Github. In that way you can be sure you get the newest version. You will be able to update the library within the Library manager or overwrite the old files manually. Be sure to check whether the manual changes you have to made are still there after an update (see below at "Configure the TFT_eSPI library to use the ST7789V in the correct way")!
Installing with the Library manager
Go to Tools > Library manager...
In the searchbar you can type TFT_eSPI.
Install the version of author Bodmer.
Manually install
Go to https://github.com/Bodmer/TFT_eSPI/releases and download the Source code (ZIP) of the newest release or if you want even a newer unreleased version you can download the library by clicking on Clone or download on the upper right corner on https://github.com/Bodmer/TFT_eSPI.
Extract the top level folder of the ZIP-file to your libraries folder. When you haven't changed your Arduino settings this folder is mostly located at C:\Users\[username]\Documents\Arduino\libraries.
Configure the library to use the ST7789V driver. See the instructions at Configure the TFT_eSPI library to use the ST7789V in the correct way below.
Configure the TFT_eSPI library to use the ST7789V in the correct way
Go to https://github.com/Xinyuan-LilyGO/TTGO-T-Display/blob/master/TTGO_T_Display.h
Click on the button Raw in the upper right corner.
Download the file or copy the content into a good text editor like Notepad++.
Save the file TTGO_T_Display.h to the folder User_setups of the TFT_eSPI library you just installed. Most likely this will be C:\Users\[username]\Documents\Arduino\libraries\TFT_eSPI-master\User_Setups
Now go to the root of the TFT_eSPI. Most likely this will be C:\Users\Jeroen\Documents\Arduino\libraries\TFT_eSPI-master
Open the file User_Setup_select.h in a good text editor. For example Notepad++.
Comment the line #include <User_Setup.h>
Below the line you just commented you need to put this text: #include <User_Setups/TTGO_T_Display.h>
Save the file.
Restart the Arduino IDE.
Remark July 2nd, 2023:
It seems there is now a ready to use configuration at User_Setups/Setup18_ST7789.h. You might want to try that one to include. I haven't verified whether this works or not.
Dependency library files: Button2
This library is only needed for the demo sketch of LilyGO. If you prefer another library for handling the button presses you are free to use so. I personally like the Button 2 library. It does fit my needs quite well.
If you want to use the Button2 library you have to install it by hand: it is not present in the Library manager.
Manually install
Download the library by clicking on Clone or download on the upper right corner. Choose Download ZIP.
Extract the top level folder of the ZIP-file to your libraries folder. When you haven't changed your Arduino settings this folder is mostly located at C:\Users\[username]\Documents\Arduino\libraries.
Restart the Arduino IDE.
Downloading and running the original LilyGO TTGO T-display ESP32 demo sketch
LilyGO does provide a demo sketch so that you can see what the device is capable of. This exactly the same sketch as the one which comes pre-programmed on your board as you received the board.
To download the original LilyGO TTGO T-display ESP32 demo sketch there are 2 ways to do that:
Download 4 individual files
Download the whole Github project of LiliGO TTGO T-display
Download the individual files
Go to https://github.com/Xinyuan-LilyGO/TTGO-T-Display/tree/master/TFT_eSPI/examples/FactoryTest
Click one of the 4 displayed files.
Click on the button Raw in the upper right corner.
Download the file or copy the content into a good text editor like Notepad++.
Save the file with the same filename as you copied it from at Github to a folder of your choice. You can decide to use the default sketchfolder. That would be C:\Users\[username]\Documents\Arduino
Repeat steps 2 to 5 for the other 3 files on https://github.com/Xinyuan-LilyGO/TTGO-T-Display/tree/master/TFT_eSPI/examples/FactoryTest
Download LilyGo's Github project
Download the library by clicking on Clone or download on the upper right corner. Choose Download ZIP.
Extract the top level folder of the ZIP-file to a folder of your choice. You can decide to use the default sketchfolder at C:\Users\[username]\Documents\Arduino.
Compile and upload the original LilyGO TTGO T-display ESP32 demo sketch
Be asured that you have connected the board on the USB port of your PC or laptop.
Open the downloaded FactoryTest.ino. You might get a warning telling you that the INO file has to be in a folder with the same name. You can either click OK to let Arduino automatically create a folder with same name FactoryTest or cancel it, create the folder with the same name by your self and place the file in it.
Click the Upload button (second button on the toolbaar with an arrow pointing to the right. As an alternative you can use the menu Sketch > Upload or press the keys CTRL + U together.
After compiling and uploading the sketch will automatically run on the board.
When the screen stays green after the boot sequence you can press the upper button (GPIO 35) to see the current voltage delivered to the board. You can press the lower button (GPIO 0) to scan for wireless networks and showing a list of the wireless networks found.
Long pressing the upper button will set the board into sleep mode.Press the button again to wake. After waking up again the board starts the boot sequence again.
After the demo sketch is uploaded to the board it will automaically run the sketch and start with the TTGO bootlogo.
When the screen stays green you can press the buttons as described above.
Pressing the upper button (on this image on the right) leads you to the voltage measurement.