The ILI9341 is the most widely used TFT controller in the TFT_eSPI ecosystem and is the recommended starting point for anyone new to the library. Manufactured by ILI Technology Corp. (Ilitek), it drives a 240×320 pixel a-Si TFT LCD panel with 262,144 colours and is available on 2.2”, 2.4”, and 2.8” display modules at low cost from many suppliers. Its native 4-wire SPI interface makes it straightforward to connect to any of the supported microcontroller platforms, and the library includes a fully optimised driver with DMA support on RP2040, ESP32, ESP32-S3, and STM32Fxxx.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Marcussacapuces91/doc-TFT_eSPI/llms.txt
Use this file to discover all available pages before exploring further.
Controller Overview
The ILI9341 is a 262,144-colour single-chip SoC driver for a-TFT liquid crystal displays with a resolution of 240 RGB × 320 dots. It incorporates a 720-channel source driver, a 320-channel gate driver, 172,800 bytes of on-chip GRAM, and an integrated power-supply circuit. This makes it a self-contained solution requiring only a microcontroller, decoupling capacitors, and a backlight circuit to operate.Key Specifications
| Parameter | Value |
|---|---|
| Resolution | 240 (RGB) × 320 dots |
| Colour depth | 262,144 (18-bit) / 65,536 (16-bit) |
| On-chip GRAM | 172,800 bytes |
| Interface options | SPI (3-/4-wire), 8/9/16/18-bit MCU parallel, RGB |
| Logic supply (VDDI) | 1.65 V – 3.3 V |
| Analog supply (VCI) | 2.5 V – 3.3 V |
| Operating temperature | −40 °C to +85 °C |
| Common module sizes | 2.2”, 2.4”, 2.8” |
Interface Modes
The ILI9341 supports multiple interface modes selectable by hardware pins on the module:- 4-wire SPI —
MOSI,SCLK,CS, andDC(also labelledRSorA0). This is the mode used by TFT_eSPI. - 3-wire SPI — no dedicated DC line; command/data distinguished by an extra bit.
- 8/9/16/18-bit parallel MCU (8080-I/II) — higher throughput at the cost of more GPIO pins.
- RGB interface — for framebuffer-driven graphic controllers.
DC pin is required — without it the controller cannot distinguish commands from pixel data.
Wiring
The following table shows the standard SPI wiring between a typical ILI9341 module and an ESP32. AdaptGPIO numbers to match your own board.
The
MISO pin is optional if you only need to write to the display and do not read pixel data back. Many modules omit the MISO pad entirely.ESP32 Wiring
| ILI9341 Pin | Signal | ESP32 GPIO | Notes |
|---|---|---|---|
| VCC | 3.3 V power | 3V3 | Do not connect to 5 V |
| GND | Ground | GND | |
| CS | Chip Select | GPIO 15 | Active low; define as TFT_CS |
| RESET | Reset | GPIO 4 | Define as TFT_RST; tie to 3V3 if unused |
| DC / RS | Data/Command | GPIO 2 | Define as TFT_DC |
| MOSI / SDI | SPI Data In | GPIO 23 | VSPI MOSI |
| SCLK / SCK | SPI Clock | GPIO 18 | VSPI SCLK |
| LED / BL | Backlight | 3V3 or PWM | 3V3 for full brightness; PWM for dimming |
| MISO / SDO | SPI Data Out | GPIO 19 | Optional; needed for pixel readback |
RP2040 (Raspberry Pi Pico) Wiring
| ILI9341 Pin | Signal | Pico GPIO | Notes |
|---|---|---|---|
| VCC | 3.3 V power | 3V3(OUT) | |
| GND | Ground | GND | |
| CS | Chip Select | GP17 | Define as TFT_CS |
| RESET | Reset | GP15 | Define as TFT_RST |
| DC / RS | Data/Command | GP16 | Define as TFT_DC |
| MOSI | SPI TX | GP19 | SPI0 TX |
| SCLK | SPI Clock | GP18 | SPI0 SCK |
| LED / BL | Backlight | 3V3(OUT) | |
| MISO | SPI RX | GP16 | SPI0 RX (optional) |
Configuration
TFT_eSPI is configured entirely inside the library’sUser_Setup.h file (or via a platformio.ini build flag). No configuration should be placed in the Arduino sketch itself.
Open User_Setup.h
Locate On macOS/Linux it is in
User_Setup.h in the TFT_eSPI library folder. On Windows this is typically:~/Arduino/libraries/TFT_eSPI/User_Setup.h.Define the pin assignments
Match these to your actual wiring. The example below uses ESP32 VSPI defaults:
Complete User_Setup.h Example for ESP32 + ILI9341
DMA Support
The ILI9341 fully supports DMA on ESP32, ESP32-S3, RP2040, and STM32Fxxx when operated over SPI. DMA allows large pixel transfers to proceed in the background while the CPU executes other code — a significant throughput advantage for animations and sprite rendering. To enable DMA, no extraUser_Setup.h setting is required; the library automatically uses DMA-capable transfer functions when called via pushImageDMA() or the sprite pushSprite() methods on supported platforms.