Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

ILI9341 Arduino: 2.4″ TFT Display Tutorial

If you’ve ever wanted to add a colorful graphical interface to your Arduino project without breaking the bank, the ILI9341 Arduino display combo is probably your best bet. I’ve worked with dozens of TFT displays over the years, and this particular module keeps showing up on my bench for good reason: it’s affordable, well-documented, and the community support is excellent.

The 2.4″ TFT display with the ILI9341 driver has become something of a standard in the hobbyist and prototyping world. Whether you’re building a weather station, a sensor dashboard, or even a simple game, this display delivers 240×320 pixels of vivid 65K color graphics through a straightforward SPI interface. Let me walk you through everything you need to know to get one working with your Arduino.

What is the ILI9341 Display Controller?

The ILI9341 is a 262,144-color single-chip SOC driver manufactured by ILI Technology Corp. It’s designed specifically for a-Si TFT liquid crystal displays with a resolution of 240×320 pixels. The chip handles all the heavy lifting of driving the LCD panel, including the 720-channel source driver, 320-channel gate driver, and 172,800 bytes of GRAM for storing pixel data.

What makes this controller popular among Arduino users is its support for the SPI (Serial Peripheral Interface) protocol. SPI requires only a handful of wires to communicate, which is a massive advantage when you’re already juggling sensors, buttons, and other peripherals on your microcontroller.

ILI9341 Arduino Display Specifications

SpecificationValue
Display Size2.4 inches (diagonal)
Resolution240 x 320 pixels
Color Depth16-bit (65K colors) / 18-bit (262K colors)
InterfaceSPI (4-wire)
Operating Voltage3.3V logic (module accepts 5V via onboard regulator)
Driver ICILI9341
Touch ControllerXPT2046 (on most modules)
Viewing Angle12 o’clock direction
BacklightLED
Current Consumption~60-80mA
Operating Temperature-20°C to 70°C

Most breakout boards you’ll find on the market include an onboard 3.3V LDO regulator (typically the XC6206P332MR), which means you can power the module from 5V even though the ILI9341 chip itself runs at 3.3V. However, the data lines are a different story, and that’s where many beginners run into trouble.

Hardware Requirements for ILI9341 Arduino Projects

Before you start wiring things up, make sure you have the following components on hand:

Essential Components:

  • Arduino UNO, Nano, Mega, or compatible board
  • 2.4″ ILI9341 TFT LCD module (SPI version)
  • Jumper wires (male-to-female recommended)
  • Breadboard for prototyping

Recommended Additions:

  • Logic level converter (3.3V to 5V bidirectional) OR resistors for voltage dividers
  • Stylus pen (if your module has touch capability)
  • External 5V power supply (for projects requiring stable power)

The logic level converter deserves special attention. The ILI9341 controller operates at 3.3V logic levels, but Arduino UNO pins output 5V. Connecting 5V signals directly to the display can damage the controller. You have two options: use a proper bidirectional logic level converter, or build simple voltage dividers using resistors. I’ll cover both approaches in the wiring section.

ILI9341 Arduino Pinout and Wiring Diagram

The 2.4″ ILI9341 module typically has 14 pins arranged in a single row. Understanding each pin’s function is critical before making any connections.

ILI9341 Display Pin Functions

Pin NameFunctionConnect To (Arduino UNO)
VCCPower Supply (5V/3.3V)5V
GNDGroundGND
CSChip SelectD10 (via level shifter)
RESETDisplay ResetD9 (via level shifter)
DC (D/C)Data/Command SelectD8 (via level shifter)
SDI (MOSI)SPI Data InD11 (via level shifter)
SCKSPI ClockD13 (via level shifter)
LEDBacklight Anode3.3V or 5V
SDO (MISO)SPI Data OutD12 (direct connection OK)

The touch controller (XPT2046) uses separate pins:

Pin NameFunctionConnect To (Arduino UNO)
T_CLKTouch SPI ClockD13 (shared with display)
T_CSTouch Chip SelectD4 (via level shifter)
T_DINTouch Data InD11 (shared with display)
T_DOTouch Data OutD12 (direct connection OK)
T_IRQTouch InterruptD2

Voltage Level Shifting Options

Option 1: Resistor Voltage Divider

For each signal line going from Arduino to the display (CS, RESET, DC, MOSI, SCK), you can use a simple voltage divider:

  • 2.2kΩ resistor between Arduino pin and display pin
  • 3.3kΩ resistor between display pin and GND

This drops the 5V signal to approximately 3V, which is within the ILI9341’s acceptable range.

Option 2: Logic Level Converter

A dedicated bidirectional logic level converter (like the BSS138-based modules) provides cleaner signal conversion and is recommended for production projects or when you need reliable high-speed SPI communication.

Option 3: 3.3V Arduino

If you’re using an Arduino Pro Mini (3.3V version) or an ESP32/ESP8266, you can connect directly without any level shifting. This is the cleanest solution if your project allows for it.

Installing ILI9341 Arduino Libraries

Getting the software side ready involves installing two essential libraries through the Arduino IDE’s Library Manager.

Required Libraries

Adafruit ILI9341 Library

This is the primary driver library that handles communication with the ILI9341 controller. It provides functions for drawing pixels, shapes, text, and images.

Installation steps:

  1. Open Arduino IDE
  2. Navigate to Sketch → Include Library → Manage Libraries
  3. Search for “Adafruit ILI9341”
  4. Click Install on “Adafruit ILI9341” by Adafruit

Adafruit GFX Library

This is the core graphics library that works alongside the ILI9341 driver. It provides common drawing functions that are shared across all Adafruit display libraries.

Installation steps:

  1. In Library Manager, search for “Adafruit GFX”
  2. Install “Adafruit GFX Library” by Adafruit
  3. The BusIO dependency should install automatically

XPT2046_Touchscreen Library (for touch functionality)

If your module includes a touchscreen, you’ll need Paul Stoffregen’s touch library:

  1. Search for “XPT2046” in Library Manager
  2. Install “XPT2046_Touchscreen” by Paul Stoffregen

Alternative Libraries

While the Adafruit libraries are excellent for beginners, you might want to explore alternatives for better performance:

LibraryProsCons
Adafruit_ILI9341Well documented, beginner-friendlySlower than alternatives
TFT_eSPI by BodmerMuch faster, more featuresComplex configuration
TFT_ILI9341 by BodmerOptimized for AVR processorsLimited to specific boards
LCDWIKI librariesGood examples includedLess community support

The TFT_eSPI library by Bodmer is particularly popular for ESP32 projects due to its DMA support and significantly faster refresh rates.

Basic ILI9341 Arduino Code Example

Let’s start with a simple example that initializes the display and shows some basic graphics. This code assumes you’re using the standard wiring described earlier.

#include <SPI.h>

#include <Adafruit_GFX.h>

#include <Adafruit_ILI9341.h>

// Pin definitions

#define TFT_CS   10

#define TFT_DC    8

#define TFT_RST   9

// Create display object

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

void setup() {

  Serial.begin(9600);

  Serial.println(“ILI9341 Arduino Test”);

  // Initialize display

  tft.begin();

  // Set rotation (0-3)

  tft.setRotation(1);

  // Fill screen with black

  tft.fillScreen(ILI9341_BLACK);

  // Draw some text

  tft.setCursor(10, 10);

  tft.setTextColor(ILI9341_WHITE);

  tft.setTextSize(2);

  tft.println(“Hello World!”);

  // Draw a filled rectangle

  tft.fillRect(50, 50, 100, 60, ILI9341_BLUE);

  // Draw a circle

  tft.drawCircle(200, 120, 40, ILI9341_RED);

  // Draw a line

  tft.drawLine(0, 200, 320, 200, ILI9341_GREEN);

}

void loop() {

  // Your main code here

}

Understanding the Graphics Functions

The Adafruit GFX library provides a comprehensive set of drawing functions:

Text Functions:

  • setCursor(x, y) – Position the text cursor
  • setTextColor(color) – Set text color
  • setTextSize(size) – Set text size multiplier (1-6)
  • print() / println() – Output text

Shape Functions:

  • drawPixel(x, y, color) – Draw a single pixel
  • drawLine(x0, y0, x1, y1, color) – Draw a line
  • drawRect(x, y, w, h, color) – Draw rectangle outline
  • fillRect(x, y, w, h, color) – Draw filled rectangle
  • drawCircle(x, y, r, color) – Draw circle outline
  • fillCircle(x, y, r, color) – Draw filled circle
  • drawTriangle(x0, y0, x1, y1, x2, y2, color) – Draw triangle outline
  • fillTriangle(x0, y0, x1, y1, x2, y2, color) – Draw filled triangle

Screen Functions:

  • fillScreen(color) – Fill entire screen with color
  • setRotation(r) – Set display rotation (0-3)
  • width() / height() – Get current screen dimensions

Color Definitions

The ILI9341 uses 16-bit RGB565 color format. The Adafruit library includes predefined colors:

Color ConstantHex Value
ILI9341_BLACK0x0000
ILI9341_WHITE0xFFFF
ILI9341_RED0xF800
ILI9341_GREEN0x07E0
ILI9341_BLUE0x001F
ILI9341_CYAN0x07FF
ILI9341_MAGENTA0xF81F
ILI9341_YELLOW0xFFE0
ILI9341_ORANGE0xFD20

To create custom colors, use the color565() function:

uint16_t customColor = tft.color565(255, 128, 64); // RGB values 0-255

Adding Touch Functionality with XPT2046

Most 2.4″ ILI9341 modules come with a resistive touchscreen and the XPT2046 touch controller. Here’s how to read touch input and create interactive buttons.

#include <SPI.h>

#include <Adafruit_GFX.h>

#include <Adafruit_ILI9341.h>

#include <XPT2046_Touchscreen.h>

#define TFT_CS   10

#define TFT_DC    8

#define TFT_RST   9

#define TOUCH_CS  4

#define TOUCH_IRQ 2

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

XPT2046_Touchscreen ts(TOUCH_CS, TOUCH_IRQ);

// Button coordinates

#define BTN_X 100

#define BTN_Y 100

#define BTN_W 120

#define BTN_H 50

void setup() {

  Serial.begin(9600);

  tft.begin();

  ts.begin();

  ts.setRotation(1);

  tft.setRotation(1);

  tft.fillScreen(ILI9341_BLACK);

  drawButton(ILI9341_BLUE);

}

void drawButton(uint16_t color) {

  tft.fillRect(BTN_X, BTN_Y, BTN_W, BTN_H, color);

  tft.setCursor(BTN_X + 20, BTN_Y + 15);

  tft.setTextColor(ILI9341_WHITE);

  tft.setTextSize(2);

  tft.print(“PRESS ME”);

}

void loop() {

  if (ts.touched()) {

    TS_Point p = ts.getPoint();

    // Map touch coordinates to screen coordinates

    int16_t x = map(p.x, 200, 3700, 0, 320);

    int16_t y = map(p.y, 300, 3800, 0, 240);

    // Check if touch is within button bounds

    if (x >= BTN_X && x <= (BTN_X + BTN_W) &&

        y >= BTN_Y && y <= (BTN_Y + BTN_H)) {

      drawButton(ILI9341_GREEN);

      delay(200);

      drawButton(ILI9341_BLUE);

    }

  }

}

The touch coordinates from the XPT2046 don’t directly correspond to screen pixels. You’ll need to calibrate by mapping the raw values to your display dimensions. The map() values in the example above are approximate and may need adjustment for your specific module.

Troubleshooting Common ILI9341 Arduino Problems

Over the years, I’ve seen the same issues crop up repeatedly when people work with these displays. Here’s how to diagnose and fix them.

White Screen Problem

This is by far the most common issue. If your display stays white after uploading code:

  1. Check SPI connections – Verify that MOSI, SCK, CS, DC, and RST are connected to the correct pins
  2. Verify voltage levels – Ensure you’re using level shifters or voltage dividers for 5V Arduinos
  3. Check power supply – The display needs adequate current; try an external 5V supply
  4. Test with example code – Use the Adafruit graphicstest example first
  5. Verify library installation – Make sure both Adafruit_ILI9341 and Adafruit_GFX are installed
  6. Check pin definitions – Ensure your code matches your actual wiring

Display Shows Garbled Graphics

  • SPI clock might be too fast – some modules struggle with high speeds
  • Try adding tft.begin(10000000) to specify a slower SPI clock
  • Check for loose connections on the breadboard
  • Verify that MISO isn’t shorting to other pins

Touch Not Responding

  • Confirm T_CS is connected to a different pin than the display CS
  • Check that T_IRQ is properly connected
  • Verify the touch library is using the correct pins
  • Touch coordinates may need calibration – print raw values to Serial first

Display Works Initially Then Fails

  • Power supply issue – the backlight draws significant current
  • Try a more robust power source
  • Add a 100µF capacitor across VCC and GND

Practical ILI9341 Arduino Project Ideas

Now that you understand the basics, here are some project ideas to put your display to work:

Sensor Dashboard Create a real-time display showing temperature, humidity, and pressure from sensors like the BME280. The color display makes it easy to add visual indicators and graphs.

Weather Station Interface Combine the display with an ESP8266 or ESP32 to pull weather data from the internet and display forecasts with icons.

Game Console Build a simple handheld game console with the touch screen for controls. Snake, Tetris, and Pong are all achievable with the Arduino’s limited resources.

Audio Spectrum Analyzer Connect a microphone module and display audio frequencies as a colorful bar graph visualization.

Smart Home Controller Create a touch-based interface for controlling smart home devices, with buttons for lights, temperature, and scenes.

Data Logger Display Add a graphical interface to your data logging projects, showing real-time sensor values and historical trends.

Useful Resources and Downloads

To help you get started with your ILI9341 Arduino project, here are the most valuable resources:

Libraries and Code

ResourceLink
Adafruit ILI9341 Librarygithub.com/adafruit/Adafruit_ILI9341
Adafruit GFX Librarygithub.com/adafruit/Adafruit-GFX-Library
XPT2046 Touch Librarygithub.com/PaulStoffregen/XPT2046_Touchscreen
TFT_eSPI Librarygithub.com/Bodmer/TFT_eSPI
LCDWIKI Resourceslcdwiki.com

Documentation

DocumentDescription
ILI9341 DatasheetComplete technical specifications from ILI Technology Corp
Adafruit GFX GuideComprehensive graphics library documentation
Arduino SPI ReferenceOfficial SPI library documentation

Community Forums

  • Arduino Forum (forum.arduino.cc) – Active community for troubleshooting
  • Reddit r/arduino – Project sharing and help
  • ESP32 Forum – For ESP32-specific implementations

Frequently Asked Questions

Can I use the ILI9341 display with Arduino Nano?

Yes, the Arduino Nano works perfectly with the ILI9341. The SPI pins are in the same positions as the UNO (D11 for MOSI, D12 for MISO, D13 for SCK). Just remember that you still need level shifting since the Nano also operates at 5V logic.

Why does my ILI9341 display show only a white screen?

A white screen typically indicates that the display isn’t receiving valid SPI data. Check your wiring carefully, especially the CS, DC, and RST connections. Verify that you’re using proper level shifting for 5V Arduinos. Also confirm that your code has the correct pin definitions matching your physical wiring.

What’s the difference between SPI and parallel interface ILI9341 modules?

SPI modules use fewer pins (typically 5-7) and are easier to wire but have slower refresh rates. Parallel modules (8-bit or 16-bit) use more pins but can update the screen much faster. For most Arduino projects, SPI modules are preferred due to the limited I/O pins available.

Can I display images on the ILI9341 with Arduino?

Yes, but with limitations. The Arduino UNO has only 32KB of flash memory, so storing large images isn’t practical. You can display small icons or use an SD card to load images. The Adafruit_ImageReader library supports loading BMP images from SD cards.

How do I increase the display refresh speed?

Several options exist: use hardware SPI instead of software SPI, increase the SPI clock speed (though some modules max out around 40MHz), use a faster microcontroller like ESP32, or switch to the TFT_eSPI library which is optimized for speed. Also, updating only changed portions of the screen rather than redrawing everything helps significantly.

Conclusion

The ILI9341 Arduino combination opens up a world of possibilities for your embedded projects. While there’s a learning curve with the wiring and voltage level considerations, once you get past that initial hurdle, you’ll have a reliable and capable display platform to work with.

Start with the basic examples, make sure your wiring is correct (especially the level shifting), and don’t be afraid to experiment. The community around these displays is extensive, and chances are someone has already solved whatever problem you might encounter.

Whether you’re building a simple sensor readout or a complex touchscreen interface, the 2.4″ ILI9341 TFT display provides an excellent balance of features, cost, and ease of use that’s hard to beat in the Arduino ecosystem.


This tutorial covers the fundamentals of working with ILI9341 displays and Arduino. For more advanced topics like DMA transfers, custom fonts, or integration with specific sensors, check out the linked resources and community forums.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.