Skip to content

kreier/t-display

Repository files navigation

TTGO T-Display ESP32 board

GitHub release MIT license

This board is chosen as the default board for students to learn programming because it has a display for output, a USB-C connector for data transfer and charging, build-in WiFi and Bluetooth and it is inexpensive. These are major advantages to Arduino Uno, ESP8266 or other ESP32 boards.

Circuitpython

In early 2023 we finally got support for Circuitpython! This eases so much of the student project work, since the libraries are easily available. And adafruit has great learning resources with good documentation!

Pinmap for the 3 editions of this board

Lilygo or TTGO has 3 different version of the same form factor in their repository, and the pins are slightly different between the versions. Look here for comparison:

pinmap T-Display

Statement from November 2020 (deprecated)

We are going to program these both in MicroPython and Arduino C. Installation and power measurements are found at the bottom of this document.

Micropython

Examples

With the TFT display in /tft folder

  • Mandelbrot
  • Scrolling
  • Matrix
  • Starfield

Starfield simulation

Setup

Description ...

Arduino C

Examples

Setup

Hardware

Many pins of the ESP32 that are related to the ADC converter are exposed on the T-Display. This makes this board suitable for a variety of measurement applications. The pins are:

PIN ADC T-Display L/R
36 ADC1_CH0 R
37 ADC1_CH1 R
38 ADC1_CH2 R
39 ADC1_CH3 R
32 ADC1_CH4 R
33 ADC1_CH5 R
34 ADC1_CH6 battery/2
35 ADC1_CH7 button
4 ADC2_CH0 backlight on/off
0 ADC2_CH1 button
2 ADC2_CH2 L
15 ADC2_CH3 L
13 ADC2_CH4 L
12 ADC2_CH5 L
14 ADC2_CH6
27 ADC2_CH7 R
25 ADC2_CH8 R
26 ADC2_CH9 R
21 SDA
22 SCL

Power consumption

  • Running 66 mA
  • WiFi 80-140 mA
  • CPU 80 MHz 48 mA
  • Light Sleep 9 mA

Installation of MicroPython

Simplified Installation

You need 2 programs and 1 file to get started with MicroPython on the T-Display. I downloaded the most recent in November 2020 and put them in the first v0.1 release. They include:

Connect your T-Display to a USB port of your computer and determine the port. You can do this by right-click on the Windows symbol > Device Manager > ports (COM & LPT) and there you'll find Silicon Labs CP210x USB to UART Bridge (COM6). Here COM6 would be your serial port. Open cmd or powershell and navigate to the folder with the esptool.exe and firmware.bin.

  • Check your board with esptool.exe --port COM6 flash_id
  • Erase the flash esptool --port COM6 erase_flash
  • Flash the new firmware with esptool --chip esp32 --port COM6 --baud 460800 write_flash -z 0x1000 firmware.bin

MicroPython should now be running on your T-Display. To see this we need to upload a program. Install Thonny. After opening Thonny change the settings to Tools > Options... > Interpreter. Here you select MicroPython (ESP32) and the correct Port or WebREPL Silicon Labs CP210x USB to UART Bridge (COM6). You might have to press STOP once and then will be greeted with

  MicroPython v1.12-464-gcae77daf0-dirty on 2020-06-28; ESP32 module with ESP32
  Type "help()" for more information.
>>> 

Here you can directly try your first hello_world.

>>> print("Hello world!")
Hello world.

Original sources with updates

First he have to obtain the two programs and the firmware.

esptool.py

The esptool.py is the software provided by esp to upload the firmware to their SoCs. I got mine from the Arduino installation at the path C:\Users\You\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1\ . You can download the latest version from github:

https://github.com/espressif/esptool

firmware

The latest MicroPython firmware for the ESP32 can be found on micropython.org. This firmware does not include a driver for the ST7789 display. You have several options to include the display library.

IDE - integrated development environment

To edit, upload and download your python programs to your ESP32 you need a program on your laptop. Some options include:

If you have already Arduino IDE you can directly connect to the REPL interface:

>>> print("Hello world!")
Hello world.

Power consumption

As measured in April 2020 the board needs 68 mA for running. With a battery of 1000 mAh you can use it for 9 hours.

Further measurement has been conducted in November 2020. The results.

You can directly measure the voltage of the LiPo battery on Pin 34. This can be seen in the provided schematics from TTGO for the T-Display:

The pins on the T-Display are

Pinmap T-Display

I2C connector

2020/07/09

Following the inspiration of SparkFun with their QWIIC connector I tried to replicate the pin order. But instead of SMD 1.0 mm connector I just use the regular 2.54mm raster with XH connector on the board and respective 4 pin connector wire.

QWIIC system

Following the same order the pins are assigned:

  1. black - GND
  2. red - 3.3 V
  3. blue - SDA
  4. yellow - SCL

XH 2.54 connector

The order does not match several OLED displays, but the ZS-042 rtc clock, the 1602 display adapter and many more.

2020/11/27

With the new T-Display project I included the I2C connector as well. The pins look like this:

I2C on T-Display

At the ESP32 SCL (SCK) is on GPIO 22 and SDA (SDI) is on GPIO 21.