TFT_eSPI
V2.5.43Features
-
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 (65)
View All 65 Projects →
E-OS — ESP32-S3 Handheld Console
A custom-built handheld gaming console powered by the ESP32-S3 and a dual-screen setup (TFT and OLED). It runs E-OS, a custom operating system built on FreeRTOS that features a dual-core architecture for dedicated rendering and logic. The project includes 15 custom-coded games and several applications, utilizing libraries like TFT_eSPI and U8g2 for high-performance graphics.
ESP32-S3 MJPEG Video Player
A high-performance media player for the ESP32-S3 capable of playing MJPEG video with synchronized I2S audio. It features a menu-driven interface, utilizes an SD card for storage, and leverages PSRAM to ensure smooth playback on ST7789 displays.
K3NG CW Keyer for ESP32 and Pico 2W
An advanced Morse code keyer based on the K3NG project, ported to ESP32 and Raspberry Pi Pico 2W hardware. It features integrated Bluetooth keyboard support, high-resolution TFT touch displays, and GPS-based location tracking, utilizing dual-core processing to maintain precise keying timing.
CYD Tactical Weather Station
An ESP32-based monitoring hub for the 'Cheap Yellow Display' (CYD) that tracks weather, space events, wildfires, and geological activity. It features a custom power management system called Somnus for instant-wake deep sleep and includes a robust calibration system to support various hardware revisions.
GeekMagic SmallTV ESP8266 Firmware
A custom ESP8266-based firmware for the GeekMagic SmallTV smart weather clock, featuring a 240x240 ST7789 display. It utilizes the TFT_eSPI library for rendering and LittleFS for persistent storage of configurations and authentication data. The system provides a comprehensive web dashboard for managing WiFi, OTA updates, and various data feeds including weather, markets, and Home Assistant integrations.
Codelight
Codelight is a multi-platform monitoring and remote control system for AI coding agents such as Claude Code, GitHub Copilot, and Cursor. It utilizes a Python companion daemon to broadcast agent status and manage interactive prompts across ESP8266-based desk screens, Android devices, and desktop environments via WebSockets and D-Bus.
ESP32 Flight Tracker
A real-time aircraft tracking system built for the ESP32-S3 that visualizes live flight data from the OpenSky Network API. It utilizes a dual-core FreeRTOS architecture to handle concurrent networking and high-speed rendering across a dual-display setup, featuring a hybrid map system optimized for hardware with limited PSRAM.
Noodle Neural Network Inference Engine
Noodle is a lightweight neural network inference engine designed to bring machine learning to resource-constrained microcontrollers like the Arduino Uno, Mega, and ESP32. By streaming activations and weights from external storage such as SD cards or flash memory, Noodle bypasses the typical RAM limitations that often prevent low-tier MCUs from running complex models.