ILI9341 problems

I've recently bought two sizes of ILI9341 TFT LCD touch screens for use in a project. Both are identical to the pictures presented.

2.8" TFT ILI9341

2.2" TFT ILI9341

However, I'm having trouble getting them working (both just display a blank, white screen). I've tried running various examples out of the box under the Adafruit ILI9341 and MCUfriend_kbv libraries, with no progress. So far, for the 2.8" screen, the MCUfriend_kbv diagnose_TFT_support file thinks the address is 0xD3D3 according to tft.readID() and lists the following as a possible fix:

"Probably a write-only Mega2560 Shield
Try to force ID = 0x9481"

Neither of these ID's appears to work as expected when substituting in the graphicstest file.

I'm thinking my pinout might be wrong - I currently have the following for pinout (copied from another source):

CS - D10
RST - D9
DC/RS - D8
MOSI - D11
SCK - D13
MISO - D12

Each except for VCC, GND and LED has a 470 ohm resistor (which I assumed to be a pulldown resistor, as it was a generic 1k in the pinout I followed) between the TFT and the Arduino pin.

Anyone have any advice? I feel like I missed something obvious.

MCUFRIEND_kbv is intended for Mcufriend Uno Shields that contain an 8-bit parallel display controller.

Your first link says: 2.2"/2.8" TFT LCD Display Panel SPI Serial 240*320 5V/3.3V ILI9341
The second link says: 2.2" 2.2 inch SPI TFT LCD Display module ILI9341 240x320 51/AVR/STM32/ARM/PIC

They contain an onboard 3.3V regulator that means you can connect the VCC pin to 5V.
Note that these Red displays require 3.3V logic. Every logic signal needs a level shifter if you want to use a 5V Arduino like Uno, Mega, …

Install Adafruit_ILI9341 and Adafruit_GFX libraries via the IDE Library Manager.
Use level shifters. Always connect the RST pin. Always use the full-fat constructor i.e. uses the RST argument.

All the boards in your links seem to have transistors to switch the backlight LED. i.e. the LED pin is a 3.3V logic signal which requires a level shifter or series resistor.

If you have a problem, post a clear photo of your wiring.


All libraries were installed via the Library Manager from downloaded .zip files.
I put in simple voltage dividers for level shifting from 5V USB to 3.3 (actually ~3.5)V output, not having anything better on hand. This made the screen dimmer, but otherwise provided no visible difference.

I rechecked my wiring compared to the sketch, and found that RST and DC/RS were swapped from the Adafruit library. However, compiling this sketch (whether default or changed to include the define call for RST) gives 'Error compiling for Arduino - Exit status 1'. From what I found online, this usually means there is a typo somewhere in the sketch - but this is an official sketch straight from the library. It should at least compile, whether or not the wiring is correct... am I missing a library or something? Using a different one than I should?

Here are the libraries Arduino is currently pulling from:

Using library SPI at version 1.0 in folder: C:\Program Files

Using library Adafruit_GFX_Library at version 1.2.2 in folder: C:\Users\XXXXX\Documents\Arduino\libraries\Adafruit_GFX_Library

Using library Adafruit_ILI9341-master at version 1.2.0 in folder: C:\Users\XXXXX\Documents\Arduino\libraries\Adafruit_ILI9341-master

Using library Adafruit_GFX_Library-1.5.3 at version 1.5.3 in folder: C:\Users\XXXXX\Documents\Arduino\libraries\Adafruit_GFX_Library-1.5.3

All libraries were installed via the Library Manager from downloaded .zip files.

  1. leave the IDE

  2. delete the quoted library directories

  3. start the IDE

  4. Tools->Manage Libraries :

  5. Install Adafruit_ILI9341 and Adafruit_GFX libraries via the IDE Library Manager.

  6. Post a photo of your wiring. Quote the values of any resistors. Potential dividers should be fine.

  7. Run the Examples from Adafruit_ILI9341

  8. Quote example by name. Quote any problems.

The same advice applies to all "official third party libraries" i.e. delete any directories that you installed from ZIP and install properly.

Of course some libraries are only available from ZIP. In which case you have no choice.
But most of these have "better" equivalent libraries that are supported by the Library Manager.


I deleted all custom libraries associated with this project from both Documents/Arduino/libraries and User/Downloads, and then reinstalled them via the Library Manager in Tools in the Arduino app. It looks like there was an extra library the ILI9341 needed to install that I never found - however, upon installing everything, the graphicstest.ino example compiled correctly, which is a step in the right direction.

The 2.8" TFT now runs the graphicstest example perfectly! However, the breakouttouchpaint and touchpaint examples still default to the white screen. I've attached pictures of my wiring below:

(This is the wiring tutorial I followed.)

The group of resistors at the Arduino pins are all 200 ohms and the group of resistors all leading to GND are all 470 ohms.

200R and 470R are pretty low value resistors. Your Uno will have to drive 7mA through them for every HIGH logic signal. The Uno has sufficient drive current but it is rather wasteful.

The Adafruit Touch examples are designed for an unintelligent Resistive Touch Screen:

#include <Adafruit_GFX.h>    // Core graphics library
#include <SPI.h>
#include <Adafruit_ILI9341.h>
#include "TouchScreen.h"

Your display has an intelligent XPT2046 SPI Touch controller chip.
e.g. XPT2046_Touchscreen.h if you share the hardware SPI bus.
e.g. URTouch.h if you bit-bang the XPT2046 on completely separate GPIO pins

I am sure you will find libraries are better handled by the Library Manager. You have the screen working now!


I installed the XPT2046_Touchscreen library from the Library Manager, but there’s a problem with the code in the TouchCalibration sketch in the associated XPT2046_Calibrated library, which it appears I need to install and calibrate the screen first before being able to use it.

Multiple instances of Serial.printf (as opposed to just Serial.print) do not compile correctly, as well as other instances of ‘snprintf’ instead of ‘sprintf’. The exact error for the former is quoted as follows:

‘class HardwareSerial’ has no member named ‘printf’; did you mean ‘print’?

The code has been attached, since it exceeds the character limit (pin number for TFT_DC was edited to reflect my setup).

TouchCalibrationbroken.txt (10.5 KB)

I switched over to the 2.2" board, which actually does not contain the 'smart' XPT2046 driver. I was able to get graphicstest.ino to run with little difficulty (forgot to include TFT_RST at first).

However, I'm running into an unusual error when moving on to the breakouttouchpaint.ino example. The screen will turn on, and the graphics for the touch paint (with color selection/black paint area') will come in from the right side of the screen, which I presume is what they're meant to do. However, a half-second after this, the screen will go white once again, and occasionally attempt to run that same animation again.

I'm unsure what's going wrong here, but I have a feeling it's either due to a shaky connection somewhere or not enough power driving the TFT. Any thoughts? I've attached a short video to demonstrate this happening.

XPT2046_Calibrated does not seem to be part of official XPT2046_Touchscreen library.
It is very naughty to use Serial.printf() in examples. But it is easy enough for you to change into regular brain-dead print() statements.

I suggest that you run the XPT2046_Touchscreen examples. (note any changes for Adafruit_ILI9341)
Then do the same for XPT2046_Calibrated.

As I explained in #1. Your 2.8 inch display has a XPT2046. Your 2.2 inch does not even have a Touch Panel.

The breakouttouchpaint.ino example from Adafruit_ILI9341 is designed for unintelligent resistive Touch panels. You will crash the Adafruit_ILI9341 if you use shared pins.

Your video shows the backlight turning on at 0.02. Showing a CYAN screen until 0.08.
My motor car is blue-grey. What are you going to do about it?