TFT_eSPI

V2.5.43
TFT_eSPI is a high-performance graphics and font library optimized for 32-bit microcontrollers, providing hardware-accelerated rendering via DMA and PIO. It features a robust Sprite system for flicker-free updates and advanced anti-aliasing for both vector graphics and typography across multiple display interfaces.

Features

  • Optimized drivers for ESP32, ESP8266, RP2040, and STM32 series processors.

  • Direct Memory Access (DMA) support for SPI displays on ESP32, RP2040, and STM32.

  • Sprite class for off-screen buffering and flicker-free updates in 1, 8, or 16-bit color depths.

  • Anti-aliased (smooth) font rendering from .vlw files or FLASH arrays with Unicode support.

  • Vector graphics functions for smooth arcs, circles, and rounded rectangles using optimized fixed-point math.

  • Support for 4-wire SPI, 8-bit parallel, and 16-bit parallel display interfaces.

  • RP2040 PIO integration to offload screen fills and manage high-speed SPI/parallel timing.

  • Unicode and UTF-8 string support for multi-language text rendering.

  • Built-in XPT2046 touch screen controller driver for SPI-based displays.

  • PNG image decoding and rendering capability requiring approximately 40KB of RAM.

  • Horizontal and vertical color gradient fills for rectangular areas.

  • Compatibility with Adafruit GFX and Adafruit driver library APIs for easy migration.

  • PSRAM support on ESP32 for large full-screen frame buffers.

  • SPI overlap mode for ESP8266 to share pins with program FLASH memory.

  • Support for over 20 display controllers including ILI9341, ST7789, and GC9A01.

  • Line-by-line and block-by-block smooth font rendering to minimize flicker during updates.

Architecture

TFT_eSPI is designed with a driver-abstraction layer that allows it to interface with a wide variety of display controllers while maintaining a consistent API. The architecture prioritizes performance by utilizing processor-specific optimizations such as Direct Memory Access (DMA) for SPI transfers and Programmable I/O (PIO) on the RP2040 to offload bus timing and block fills. This design ensures that the main CPU is released for other tasks while the hardware handles data transmission to the display.

A central configuration model is used where hardware-specific parameters—such as pins, clock speeds, and controller types—are defined in header files within the library rather than the application sketch. This approach keeps user code clean and portable across different hardware setups. The library also supports PSRAM on ESP32 devices, allowing for large, high-resolution frame buffers that would otherwise exceed internal RAM limits.

Core Components

  • TFT_eSPI Core: The primary class handling low-level driver initialization and basic drawing primitives.
  • TFT_eSprite: A RAM-based graphics canvas that acts as a frame buffer for flicker-free rendering and complex rotations.
  • Font Engine: Supports both legacy bitmapped fonts and modern anti-aliased (smooth) fonts with Unicode and UTF-8 support.
  • Driver Layer: Optimized low-level drivers for over 20 different display controllers (e.g., ILI9341, ST7789, GC9A01).

Use Cases

This library is ideal for:

  • Industrial Dashboards: Creating high-resolution, flicker-free meters and gauges using anti-aliased arcs and sprites.
  • Multi-language Interfaces: Rendering complex scripts such as Japanese or Greek using Unicode-compatible smooth fonts.
  • Portable Gaming: Developing responsive UI and sprites for handheld devices using 8-bit or 16-bit parallel interfaces for high frame rates.
  • IoT Monitoring: Displaying compressed PNG images and real-time graphs on low-power ESP32 or ESP8266 modules.
  • Automotive Displays: Utilizing hardware-accelerated gradients and smooth graphics for modern instrument clusters.

Getting Started

To begin, install the library via the Arduino Library Manager. Unlike most Arduino libraries, hardware configuration is performed by editing the User_Setup.h file or selecting a predefined configuration in User_Setup_Select.h located within the library folder. This setup includes defining the display driver, pin assignments, and SPI frequency.

Once configured, any example sketch provided with the library can be run without further modification. For PlatformIO users, these settings can be defined on a per-project basis within the platformio.ini file. Developers are encouraged to explore the examples folder, which contains specialized demonstrations for DMA transfers, Sprite-based animation, and smooth font rendering from SPIFFS or LittleFS.

Related Projects (37)

View All 37 Projects →
Three IPS Displays with ST7789

Three IPS Displays with ST7789

This project provides optimized configurations and benchmarking tools for three common ST7789-based IPS displays with resolutions of 170x320, 240x280, and 240x320. It leverages the TFT_eSPI library to achieve high frame rates on ESP32 and RP2040 microcontrollers, including detailed wiring and setup files for various hardware platforms.

tft-espi
EleksTube IPS Custom Firmware

EleksTube IPS Custom Firmware

This project provides a feature-rich custom firmware for ESP32-based EleksTube IPS digital clocks, enabling internet time synchronization and weather updates. It utilizes the TFT_eSPI library for high-quality display management and LittleFS for asset storage, while offering a web-based configuration portal and MQTT integration for smart home ecosystems.

freertos littlefstft-espi
Gaggimate

Gaggimate

Gaggimate is an ESP32-based smart control upgrade for Gaggia espresso machines, providing a custom UI for temperature monitoring and pump control. It leverages the FreeRTOS-based ESP32 platform using LVGL and TFT_eSPI for its display interface, and NimBLE-Arduino for wireless connectivity.

freertos h2zero-esp-nimble-cpplvgltft-espi
Anemoia-ESP32 NES Emulator

Anemoia-ESP32 NES Emulator

An optimized Nintendo Entertainment System (NES) emulator rewritten for the ESP32 platform. It supports full audio emulation and achieves native speeds on dual-core ESP32 hardware using the Arduino framework and TFT_eSPI library.

freertos littlefstft-espi
273
Minigotchi-ESP32

Minigotchi-ESP32

A security-focused firmware for ESP32 microcontrollers that replicates Pwnagotchi-style peer detection and network interaction. It supports Wi-Fi scanning, deauthing, and BLE functions while providing an emotional interface through various display modules.

freertos tft-espiu8g2
255
TamaFi: WiFi-Powered Virtual Pet

TamaFi: WiFi-Powered Virtual Pet

An autonomous virtual pet application for the ESP32-S3 that 'feeds' on nearby WiFi networks. It features a full-color UI on an ST7789 display, persistent state management via Preferences, and a custom behavior engine that evolves the pet based on environmental factors.

freertos tft-espi
272
Giulia TFT

Giulia TFT

An ESP32-based telemetry display for Alfa Romeo Giulia and Stelvio JTDm vehicles. It interfaces with a Bluetooth OBD2 adapter to monitor engine parameters, DPF regeneration cycles, and battery health using the LVGL graphics library on a touchscreen TFT display.

lvgltft-espi
15
esp-lvgl

esp-lvgl

A comprehensive collection of LVGL (Light and Versatile Graphics Library) examples and tutorials for ESP32 and ESP8266 platforms. It supports multiple development frameworks including Arduino, ESP-IDF, and MicroPython, providing drivers and UI templates for various display types.

freertos lvgltft-espimicropython
11