ElectronicZoologyfield notes from the garage
Display • ESP32 • TFT_eSPI

How to use the
ST7735 128x128 display
with ESP32

Display: ST7735 - 128x128 TFT
Board: ESP32 Dev Board (38-pin)
✓ Confirmed Working

Overview

The ST7735 is a 128x128 TFT display driven over SPI. It is one of the most common small TFT displays for ESP32 projects. Several colour tab variants exist - if colours look wrong after setup, see the Notes section.

This page covers the User_Setup_Select.h config to drive it with TFT_eSPI. Once configured, use the How to set up TFT_eSPI with ESP32 - test sketch to confirm it is working.

Wiring

Display PinESP32 PinNotes
VCC3.3V or 5V5V tolerant on tested module - confirm with your board's datasheet
GNDGND
SCL / SCLKGPIO 18SPI clock
SDA / MOSIGPIO 23SPI data
DC / A0GPIO 2Data / command select
CSGPIO 15Chip select
RSTGPIO 4Reset
MISOGPIO 19Optional

If your module has a BL (backlight) pin, tie it to 3.3V.

Config

1. Open User_Setup_Select.h

Open ~/Arduino/libraries/TFT_eSPI/User_Setup_Select.h. Comment out the default line and uncomment Setup47:

//#include <User_Setup.h>           // comment this out
#include <User_Setups/Setup47_ST7735.h>  // uncomment this
User_Setup_Select.h with Setup47_ST7735.h uncommented

User_Setup_Select.h - Setup47 uncommented

2. Add CS pin to Setup47

Open ~/Arduino/libraries/TFT_eSPI/User_Setups/Setup47_ST7735.h. CS is commented out by default - uncomment it and set it to GPIO 15:

#define TFT_CS  15  // uncomment and set to GPIO 15

MOSI (23), SCLK (18), MISO (19), DC (2), and RST (4) are already correct - leave them as is.

Setup47 - uncomment the TFT_CS line

Uncomment the TFT_CS line

Setup47 - change value from 21 to 15

Change value from 21 to 15

Only one line uncommented in User_Setup_Select.h at a time. When switching displays, comment this line out and uncomment your next display. Close and reopen Arduino IDE after saving either file.

Notes

Wrong colours - red and blue swapped

The ST7735 comes in several tab variants with different colour orders. If colours look inverted, try uncommenting #define TFT_RGB_ORDER TFT_BGR or TFT_RGB in the setup file.

ST7735 tab variants

The setup file includes defines like ST7735_REDTAB, ST7735_GREENTAB, ST7735_BLACKTAB. If the display initialises but the image is offset or scrambled, try a different tab define. Your module's product listing usually states which variant it is.

Take a look at some of our other guides

Add audio to your display project How to wire the MAX98357A I2S amp with ESP32 → - pair your TFT with digital audio.
Display images from flash How ESP32 flash memory works → - understand your storage budget for images and sketches.
Check your ESP32 before you start How to check a new ESP32 → - confirm flash, RAM, and chip before wiring a display.