Source: https://mokxi.com/learn/ttgo-t-display-pinout
Updated: 2026-10-26

Learn

# TTGO T-Display pinout: every pin, the screen and the two buttons

Beginner

Written by the Mokxi team, updated October 26, 2026

Start building free Open the editor

Or see every lesson.

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

Click to open it in the editor

TFT_eSPI writes on the 135x240 screen with LilyGO’s setup. Press BUTTON2 (GPIO 0) or BUTTON1 (GPIO 35) to count.

The LilyGO TTGO T-Display is a classic ESP32 on a board 51.5 by 25 mm with a 1.14 inch 135x240 ST7789 screen, two buttons, a USB-C socket and a battery connector. Its two rows of twelve pins are 0.9 inch apart, and the silkscreen prints the chip’s GPIO numbers, so the pin marked 21 is GPIO 21 in code. This page lists every pin on the header, then the GPIOs the board uses inside for the screen, the buttons and the battery.

The circuit above is the board in Mokxi: TFT_eSPI writes on the screen and counts presses of the two buttons. Everything in the tables is checked against the board model the simulator runs, and where Mokxi does less than the board, the row says so.

## Every pin on the header

With the screen facing you and the USB-C socket at the bottom, as Mokxi draws it, the left row reads GND, GND, 21, 22, 17, 2, 15, 13, 12, GND, GND and 3V3, and the right row reads 3V3, 36, 37, 38, 39, 32, 33, 25, 26, 27, GND and 5V. The table lists each name once, so the five GND pins and the two 3V3 pins are one row each.

There are no TX, RX or EN pins: GPIO 1 and 3 go only to the USB chip, and reset is the button. Touch, the DAC and ADC2 are in the table because tutorials use them; Mokxi does not model them, and each row says so.

TTGO T-Display: the left row, then the right
Pin | GPIO | What it can do | Watch out for

GND | - | Ground. Four on the left row and one on the right. | -

21 | 21 | PWM. I2C SDA (default). | -

22 | 22 | PWM. I2C SCL (default). | -

17 | 17 | PWM. | A safe all-rounder.

2 | 2 | PWM. ADC2_CH2 and touch T2 on the chip (not modeled). | Strapping pin: must be low or floating to upload.

15 | 15 | PWM. ADC2_CH3 and touch T3 on the chip (not modeled). | Strapping pin: low at reset silences the boot messages.

13 | 13 | PWM. ADC2_CH4 and touch T4 on the chip (not modeled). | ADC2 stops working while WiFi is on.

12 | 12 | PWM. ADC2_CH5 and touch T5 on the chip (not modeled). | Strapping pin: high at reset and the board does not boot.

3V3 | - | The regulator’s 3.3 V output. One at the end of each row. | Not a GPIO.

36 | 36 | ADC1_CH0. Input only. | No output driver and no internal pull-up or pull-down.

37 | 37 | ADC1_CH1. Input only. | No output driver and no internal pull-up or pull-down.

38 | 38 | ADC1_CH2. Input only. | No output driver and no internal pull-up or pull-down.

39 | 39 | ADC1_CH3. Input only. | No output driver and no internal pull-up or pull-down.

32 | 32 | ADC1_CH4. PWM. Touch T9 (not modeled). | A safe all-rounder.

33 | 33 | ADC1_CH5. PWM. Touch T8 (not modeled). | A safe all-rounder.

25 | 25 | PWM. DAC1 and ADC2_CH8 on the chip (not modeled). | ADC2 stops working while WiFi is on.

26 | 26 | PWM. DAC2 and ADC2_CH9 on the chip (not modeled). | ADC2 stops working while WiFi is on.

27 | 27 | PWM. ADC2_CH7 and touch T7 on the chip (not modeled). | ADC2 stops working while WiFi is on.

5V | - | The 5 V rail from USB. Put 5 V here to run the board without a cable. | Not a GPIO.

## The GPIOs the board uses inside

These are wired to the screen, the buttons and the battery, and the header does not bring them out. In Mokxi no wire can reach them. The screen’s pins are LilyGO’s own table, and the runtime names the buttons as arduino-esp32’s lilygo_t_display variant does: LEFT_BUTTON is 0 and RIGHT_BUTTON is 35.

TTGO T-Display: the GPIOs inside the board
GPIO | Wired to | TFT_eSPI or variant name | Notes

19 | Screen MOSI | TFT_MOSI | -

18 | Screen SCLK | TFT_SCLK | -

5 | Screen CS | TFT_CS | Strapping pin.

16 | Screen DC | TFT_DC | -

23 | Screen reset | TFT_RST | -

4 | Screen backlight | TFT_BL | TFT_eSPI’s init() drives it HIGH. LOW turns the picture off.

35 | BUTTON1, the right one | RIGHT_BUTTON | Input only. Pulled up on the board, modeled as 100 k. Reads LOW while pressed.

0 | BUTTON2, the left one, which is BOOT | LEFT_BUTTON | Strapping pin: low at reset waits for an upload. Use INPUT_PULLUP.

34 | The battery voltage divider | - | Not modeled. Input only.

14 | Switches the battery divider on | - | Not modeled.

## Power: 5V, 3V3 and GND

5V is the USB rail when a cable is plugged in, and an input when one is not. 3V3 is the regulator’s output, which also runs the screen, so it is fine for a sensor and not for a motor. The battery connector feeds a charger on the real board; Mokxi does not model either, and the board runs from USB as long as the simulation does.

Every GPIO is 3.3 V and none is 5 V tolerant. A 5 V module’s output needs a divider or a level shifter before it reaches a pin.

## The screen and the TFT_eSPI setup

The screen is an ST7789, 135 by 240, on MOSI 19, SCLK 18, CS 5, DC 16 and RST 23, with the backlight on GPIO 4. LilyGO ships a TFT_eSPI setup for it, Setup25_TTGO_T_Display.h. On a real board you install that setup in the TFT_eSPI library folder: in User_Setup_Select.h, comment out the default and include Setup25_TTGO_T_Display.h.

In Mokxi a sketch for this board needs no User_Setup.h. If it names no TFT pins, TFT_eSPI gets the board’s setup: ST7789_DRIVER at 135x240, MOSI 19, SCLK 18, CS 5, DC 16, RST 23 and BL 4.

Two things catch a hand-written driver. The ST7789 has 240 by 320 pixels of memory, and this glass is a window into it from column 52 and row 40, so a driver without those offsets draws where nobody can see. And the glass is IPS, so it shows colors inverted until the driver sends INVON. TFT_eSPI handles both, and Mokxi models both, so a driver that is wrong on the board is wrong here too.

## The two buttons

Both buttons pull their pin LOW while pressed. BUTTON1, on the right, is GPIO 35. GPIO 35 is input only and has no pull of its own, so the board carries a pull-up, and pinMode(35, INPUT) is enough. BUTTON2, on the left, is GPIO 0, the BOOT button, so use pinMode(0, INPUT_PULLUP) and do not hold it at power-on.

In Mokxi you press either button on the drawing while the circuit runs. The board has no user LED, so there is no LED_BUILTIN, as in arduino-esp32’s variant for it.

## Analog, PWM, I2C and SPI

Only ADC1 is safe in a project with WiFi: on a real ESP32 the radio uses ADC2. ADC1 is on six pins here: 36, 37, 38, 39, 32 and 33. Mokxi models ADC1 only, twelve bits, with a real part’s curve at the default 11 dB. GPIO 34, which is ADC1 as well, is the battery divider on this board and is not on the header.

PWM is LEDC, on any pin with an output driver. Wire.begin() uses 21 for SDA and 22 for SCL. SPI.begin() with no pins uses 18, 19, 23 and 5, which on this board are the screen’s lines, so for a second SPI device name free pins, such as SPI.begin(25, 27, 26, 33) for SCK, MISO, MOSI and SS. In Mokxi both buses run in software, because the chip’s I2C and SPI controllers are not modeled.

## Questions

Which pins is the T-Display’s screen on?

MOSI 19, SCLK 18, CS 5, DC 16 and RST 23, with the backlight on 4. None of them is on the header.

Which pins are the T-Display’s buttons?

BUTTON1, the right one, is GPIO 35, with a pull-up on the board. BUTTON2, the left one, is GPIO 0, which is BOOT. Both read LOW while pressed.

Which pins are I2C on the TTGO T-Display?

SDA is 21 and SCL is 22, the pins `Wire.begin()` uses. Both are on the left row.

Which T-Display pins are analog?

ADC1 is on 32, 33, 36, 37, 38 and 39, and those keep working with WiFi on. Keep the signal under 3.3 V.

Which T-Display pin should I use for a button?

17, 21, 22, 25 to 27, 32 or 33, with `INPUT_PULLUP` and the button to ground. 36 to 39 need a 10 k pull-up of your own, and 2, 12 and 15 are strapping pins.

How do I read the T-Display’s battery voltage?

On the real board, set GPIO 14 HIGH to switch the divider on and read GPIO 34. Mokxi does not model the battery, its charger or the divider.

Related

## Keep going

ESP32 DevKit V1 Pinout: Every Pin and Which to Avoid ESP32 analogRead: 12 Bits, Attenuation and ADC2 ESP32 I2C Pins: Custom Pins and Two I2C Buses SPI Explained: Clock, Data and Chip Select Arduino Button Debounce: See the Bounce, Then Fix It Run the TTGO T-Display in the simulator Help: the TTGO T-Display model The project page, with the full sketch Beginner

Sources

## Where the facts on this page come from

- Espressif: ESP32 Series datasheet (pins, strapping, ADC, input-only pins)
- LilyGO: the TTGO-T-Display repository (pin table and examples)
- arduino-esp32: the lilygo_t_display variant’s pins_arduino.h
- TFT_eSPI: Setup25_TTGO_T_Display.h

## Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.

Start building free Open the editor
