Source: https://mokxi.com/parts/ili9341touch
Updated: 2026-11-10

Part

# Touch TFT, 2.8 inch ILI9341 with XPT2046

The 2.8 inch TFT with a resistive touch panel on its own SPI bus. Press on the picture to touch it.

See every part

- 14 pins
- In 2 projects

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Touch TFT, 2.8 inch ILI9341 with XPT2046 in brief

What it is, and where it sits on the bench.

The red 2.8 inch 240x320 TFT with a resistive touch panel is an ILI9341 display and an XPT2046 touch controller on one board. Both halves are SPI devices. The display takes CS, RST, DC, MOSI, SCK and LED, with MOSI on 11 and SCK on 13 of an Uno; the touch half has T_CLK, T_CS, T_DIN, T_DO and T_IRQ, and most sketches share the bus by wiring T_CLK to SCK, T_DIN to MOSI and T_DO to MISO, with each chip select on a pin of its own. In Mokxi you press on the picture and drag to move. Each reading is a real XPT2046 conversation, a twelve-bit result in bits 14 to 3 of sixteen clocks, with X, Y and the Z1 and Z2 pressure channels worked out from the plate resistances, and T_IRQ low while pressed. The edges read about 200 and 3900 rather than 0 and 4095, so a sketch maps them to pixels, and a rotated display needs its touch readings rotated too. The usual mistakes are T_DO left off MISO, which reads 0, and T_CS left floating. Noise and jitter are not modeled.

Family

Displays

Pins

14

Pins

## 14 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

Role

What it does

VCC

Input or output

Supply and ground.

GND

Input or output

Ground.

CS

Input

The display's chip select, active low.

RST

Input

The display's reset, active low.

DC

Input

The display's command or data line.

MOSI

Input

The display's SPI data in and clock.

SCK

Input

The display's SPI data in and clock.

LED

Input or output

The backlight.

MISO

Output

The display's data out, never driven: nothing is read back from it.

T_CLK

Input

The touch controller's SPI clock.

T_CS

Input

The touch controller's chip select, active low.

T_DIN

Input

The touch controller's data in.

T_DO

Output

The touch controller's data out: the readings.

T_IRQ

Output

Low while the panel is pressed.

How to use it

## How to use an ILI9341 touch screen with an Arduino

The display goes on the hardware SPI pins: MOSI to 11, SCK to 13, CS to 10, DC to 9 and RST to 8, with LED on 5 V. The touch controller here has a bus of its own, T_CLK on A2, T_DIN on A0 and T_DO on A1, built as an SPIClass and handed to ts.begin(), with T_CS on pin 7.

Check ts.touched(), read ts.getPoint(), and map() the raw x and y from about 200 and 3900 to the screen’s width and height. Give the display and the touch the same setRotation(), or the dots land in the wrong place. If every reading is 0, check that T_DO really reaches the pin the touch bus reads from.

Part pin

Board pin

CS

Pin 10

DC

Pin 9

RST

Pin 8

MOSI

Pin 11

SCK

Pin 13

LED

5 V

T_CS

Pin 7

T_CLK

A2

T_DIN

A0

T_DO

A1

VCC

5 V

GND

GND

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

How it is modeled

## What is true about the Touch TFT, 2.8 inch ILI9341 with XPT2046, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

The touch controller. Each reading is a real conversation with the XPT2046: a
control byte with its start bit and channel, then sixteen clocks with the twelve-bit
result in bits 14 to 3 (the >> 3 in every driver). X, Y and the two pressure
channels Z1 and Z2 are computed from the resistance of the two plates and of the
contact between them, so the libraries' own pressure sum, 4095 + Z1 - Z2, is large
for a press and near 0 for none. T_IRQ goes low while the panel is pressed, as long
as the last command left the interrupt enabled.

The film is on the glass. Readings come from where your finger is on the glass,
not on the picture. Rotate the display and a sketch has to turn its touch readings the
same way, as on the bench; the X reading runs along the 240-pixel edge and Y along the
320 whatever the rotation. The edges of the picture read about 200 and 3900, not 0 and
4095, because the film is a little bigger than the picture; map() them to pixels.

The display half is the ILI9341 part exactly.

### Not modeled

Noise and jitter, which real panels have plenty of, so averaging does nothing here.
Conversion time and the busy pin. The temperature, battery and auxiliary inputs, which
read 0. The pressure of a press does not change with how hard you click.

From ILI9341 touch TFT, in full.

Projects

## See the Touch TFT, 2.8 inch ILI9341 with XPT2046 in a project

2 built-in projects use it. Each opens in the editor, already wired.

Boards

## The boards it is shown on

Each of these 2 boards has a built-in project with the Touch TFT, 2.8 inch ILI9341 with XPT2046 in it.

- ESP32-C3-DevKitM-1
- Arduino Uno R3

Libraries

## Arduino libraries for the Touch TFT, 2.8 inch ILI9341 with XPT2046

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

- XPT2046_Touchscreen
- TFT_eSPI

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Touch TFT, 2.8 inch ILI9341 with XPT2046

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
