explaingit

bodmer/tft_espi

4,750CAudience · developerComplexity · 3/5Setup · moderate

TLDR

Graphics library for microcontrollers (ESP32, Pi Pico, STM32) that draws text, shapes, and images on TFT color LCD screens, with sprite buffering, touch input, and DMA support for flicker-free animations.

Mindmap

mindmap
  root((TFT eSPI))
    What it does
      Draw shapes
      Show text
      Display images
      Touch input
    Supported boards
      ESP32 and ESP8266
      Raspberry Pi Pico
      STM32
    Tech stack
      C library
      Arduino IDE
      PlatformIO
    Use cases
      Weather station
      Game device
      Custom UI
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a weather station with live temperature readings displayed on a color TFT screen connected to an ESP32.

USE CASE 2

Create a portable game device with smooth animated graphics by drawing to an off-screen sprite buffer before pushing to the display.

USE CASE 3

Display custom scalable fonts on a homemade electronics project using TrueType font rendering.

USE CASE 4

Add a touchscreen interface to a microcontroller project that detects taps and responds with on-screen feedback.

Tech stack

CArduinoPlatformIOESP32ESP8266RP2040STM32

Getting it running

Difficulty · moderate Time to first run · 30min

Requires editing User_Setup.h to match your display driver and pin wiring before any example sketch will run correctly.

In plain English

TFT_eSPI is a graphics library for small microcontrollers that lets you draw text, shapes, and images on a connected TFT LCD screen. TFT screens are the kind of color displays you see on small electronics projects, like a homemade weather station or a portable game device. The library targets popular hobbyist boards: the Raspberry Pi Pico (RP2040), ESP32, ESP8266, and STM32. You install it through the Arduino IDE library manager or via PlatformIO. The library handles the low-level communication between the microcontroller and the display, and it is tuned for speed on each supported chip. It supports a wide range of display driver chips, meaning it works with many different physical screens you might buy. Configuration such as which display driver to use and which pins to connect is set inside a setup header file rather than inside your code, so once you have that set up correctly any example sketch runs without changes. On certain processors and display types, the library can use Direct Memory Access to push pixels to the screen without tying up the main processor. For drawing, the library provides functions for filled shapes, lines, circles, and rounded rectangles, as well as anti-aliased versions of those shapes that produce smoother edges on screen. Fonts are supported in several forms: standard bitmap fonts bundled with the library, smooth fonts you can generate from standard font files on your computer, and compatibility with a separate library called OpenFontRender that can display fully scalable TrueType fonts. There are also sprite functions for drawing to an off-screen buffer before sending the result to the display, which reduces flicker. Support for touch screens is included, and PNG image display is available with a note in the README that it requires around 40 kilobytes of RAM on the device, which rules it out for more memory-constrained boards. The repository includes a large set of example sketches covering basic drawing, fonts, PNG images, smooth graphics, and simple UI widgets. A companion library called TFT_eWidget adds sliders, buttons, graphs, and meters as ready-made components. The project has been around long enough that many independent tutorials exist online, which the README points out as a resource for getting started.

Copy-paste prompts

Prompt 1
I'm using TFT_eSPI with an ESP32 and an ILI9341 2.4" display. Show me how to configure User_Setup.h for my pin wiring and draw a filled circle with a text label centered inside it.
Prompt 2
Using TFT_eSPI on a Raspberry Pi Pico RP2040, write code that creates a sprite buffer, draws an animated bouncing ball each frame, then pushes the sprite to the screen to avoid flicker.
Prompt 3
Show me how to load a smooth font generated from a TTF file and render it at two different sizes using TFT_eSPI on an ESP8266.
Prompt 4
I want touch input on my TFT_eSPI ESP32 project. Write code that reads a touch coordinate each loop and draws a small dot at that position on screen.
Open on GitHub → Explain another repo

← bodmer on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.