Skip to main content

2.4" TFT LCD Breakout with Touch - getting started

This page provides the essential information for getting started, including board and library installation.


Arduino library

To install the Arduino library, you can use the Arduino library manager or download it from the GitHub repository:

Soldered TFT LCD Arduino Library

TFT LCD Arduino library by Soldered

ℹ️

First-time Arduino user? For a detailed tutorial on how to get started with Arduino, see this section of our docs:

Getting started with Arduino

A full, comprehensive tutorial on how to fully set up and upload code for the first time on an Arduino board, from scratch!


How to Connect the TFT LCD Breakout 2.4"

The TFT LCD Breakout 2.4" with Touch display can be connected to any ESP32 or other microcontroller with SPI support. It uses standard SPI for display data and an additional SPI chip select pin for touch input. Below is a general guide for wiring and initializing the display and touchscreen using user-defined GPIO pins.


Pin Connection Table

TFT LCD PinFunctionMicrocontroller Role / Pin TypeNotes
VCCPower3.3V or 5V power outputPowers the display and backlight.
GNDGroundGNDCommon ground connection.
CLKSPI ClockSPI Clock (SCK)Shared with other SPI devices if needed.
DISPI Data (MOSI)SPI MOSISends data to the display.
D0SPI Data (MISO)SPI MISORequired for touchscreen functionality.
CSLTFT Chip SelectAny free digital GPIOUsed in display constructor as TFT_CSL.
DCData/Command SelectAny free digital GPIOUsed in display constructor as TFT_DC.
RSTReset (optional)Any GPIO or -1Set to -1 in code if not connected. Optional hardware reset.
CSTTouch Chip SelectAny free digital GPIOUsed in touchscreen constructor: TFTTouch ts(<pin>).
BLBacklightVCC or PWM-capable GPIOConnect to 3.3V or 5V for always-on, or a PWM pin for dimming.

Example Code

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "TFT-LCD-Breakout-2.4-With-Touch-SOLDERED.h"

// User-defined pins
#define TFT_CSL 25 // TFT Chip Select
#define TFT_DC 33 // TFT Data/Command
#define TFT_RST -1 // Use -1 if RST not connected
#define TOUCH_CS 5 // Touchscreen Chip Select

// Use VSPI on ESP32
SPIClass vspi(VSPI);

// Initialize display and touchscreen
TFTDisplay tft(TFT_CSL, TFT_DC, TFT_RST);
TFTTouch ts(TOUCH_CS);

void setup() {
Serial.begin(115200);

// Initialize VSPI with SCK, MISO, MOSI
vspi.begin(18, 19, 23);

// Optionally set SPI speed (e.g., 40 MHz)
vspi.setFrequency(40000000);

// Begin display and touch
tft.begin();
ts.begin();

// Optional touchscreen calibration
ts.calibrate(540, 1000, 34, 460); // Adjust values as needed

// Clear screen
tft.fillScreen(ILI9341_BLACK);
}

void loop() {
// Your code here: draw shapes, detect touch, etc.
}


Tips

  • The D0/MISO pin must be connected for the touchscreen to function properly.
  • Use vspi.setFrequency(40000000); to manually adjust SPI speed if necessary.
  • Ensure your board has stable power—some displays may require up to 100mA during full backlight and drawing operations.