Arduino TFT (Serial SPI - 2.2" ILI9341) Display

Having bought lots of cheap components from China and Hong Kong, via eBay, with no real problems in either delivery or quality,  I couldn't resist trying a '2.2" Serial 240x320 Chip SPI TFT LCD Module Display ILI9340C PCB Adapter SD Card' for only £3.50 (including postage).  The unit arrived well packed in about a week and a half (pretty good from Hong Kong).

2.2" Serial SPI TFT Display Module
The difficulty with buying components like this is normally the complete lack of documentation. So now the fun begins.......

Connecting up

SPI (Serial Peripheral Interface) is a synchronous master/slave serial data bus used to connect peripherals to micro-controllers.
The board has a row of pins to connect up to the microcontroller SPI pins; additionally it has some solder points for the included SD card reader (also SPI).  I haven't tried the SD card reader, but it looks like one I have used previously so I'll get around to that next.
    • Master Input, Slave Output (Input to master)
  • LED
    • Back-light
  • SCK
    • Serial Clock (output from master).
    • Master Output, Slave Input (output from master)
  • D/C
    •  Data /Command Selection pin
    •  Reset
  • CS
    •  Slave Select (active low, output from master)
  • GND
    • Ground connection
  • VCC
    • 3.3v power connection
Back of TFT board

The first thing to note is that these boards are 3.3v NOT 5v, so if you are using a standard Arduino, I am using an UNO, you will need to drop the voltage for all of the connections.

Level Shifting 5v to 3.3v

To convert the 5v data lines to 3.3v I decided to use a CD4050 Hex Buffer/Converter. 
CD4050 Hex Buffer/Converter
These are very simple to use, by providing 3.3v power on pin 1 of the CD4050 the output pins will be 3.3v, even if the input voltages are higher (i.e. 5v).

Software Libraries

 To drive the display I tried two libraries:
  1. UTFT ( )
  2. TFTv2 by Seeed Technology (
Both worked fine and used the same pin definitions; UTFT was the largest, but also the most capable.

Connecting to an UNO

Both of the libraries used the same pin out, via the CD4050 (except the LED - D7):
  • D4  : RESET
  • D5  : CS
  • D6  : D/C
  • D7  : LED (Via 2222 transistor)
  • D11 : MOSI
  • D12 : MISO
  • D13 : SCK
 The LED pin can can be connected to 5v using a 100Ohms resistor directly if you don't need to turn the back-light on and off.  To enable the library on/off functionality I used a 2222 transistor via pin 7 of the Arduino.  This is lucky as the CD4050 only has 6 channels and the LED would have made 7 (phew).
Annotated circuit

Connected up on prototype board (with 2222)

Connected up on prototype board (without 2222)

All done

Once wired up there are several example programs bundled with both of the Arduino libraries that can be used to test out the display.  I have modified one of them to get a "24"style countdown (not real-time), where's Jack Bauer when you need him ?

I can see my next project is going to have a nice colour TFT display :)

Update : 15 April 2014

Here is the circuit to test the screen with a CD6050.


  1. Hello, You Might help me with UTFT library? I have this screen and it works perfect with the TFTv2 library, the pins are connected like yours, but not UTFT in the order they are defined not understand this line:
    UTFT myGLCD(TFT01_22SP,9,8,12,11,10);

    1. Hi, I used the same circuit/code for both libraries. I used the default constructor with no parameters and let the library detect the display. I used the standard pins. Hope this helps.

  2. // Here is the code - Hope it helps


    // Declare which fonts we will be using
    extern uint8_t SmallFont[];
    extern uint8_t BigFont[];
    extern uint8_t SevenSegNumFont[];

    int hours = 24;
    int minutes = 0;

    int count=0;

    UTFT myGLCD;

    void setup()
    // initialize the serial communication:
    Serial.println("Starting 24 countdown");


    void displayDigits( int value , int x , int y ) {
    String strValue = (value<10 ? "0" + String(value): String(value));
    myGLCD.print(strValue , x, y );


    void loop()
    myGLCD.print("Text rotation", 0, 0);
    myGLCD.setColor(0, 0, 255);
    myGLCD.print("Arduino", 0, 16, 0);
    myGLCD.print("Arduino", 319, 0, 90);
    myGLCD.print("Arduino", 319, 239, 180);
    myGLCD.print("Arduino", 0, 239, 270);

    myGLCD.setColor( 255 , 0 , 0 );
    myGLCD.print("Hello World", 80 , 160 , 0);

    myGLCD.setColor(0, 255, 0);
    myGLCD.print(String(hours) , 100, 90 );
    myGLCD.print(String(minutes) , 180 , 90);

    while( true ) {

    if( count%10000==0 ) {

    if (--minutes<0) {
    if(--hours<0) {

    displayDigits( hours , 100, 90);
    displayDigits( minutes, 180 , 90);

  3. Thanks for the article, I have all the components and I have followed the instructions but does not work, does not turn on the screen, I have tried with the TFTv2 library and Yes work me but sources I don't like... any help?

  4. Hi, I have exactly the same team, yes it works with the TFTv2 library but not with the UTFT, I make the same connections as your but does not work, any ideas that you can bring?, thanks and greetings.

    1. Hi Mario, I will try over the next few days and let you know

  5. Hi, thanks for reply, I have already solved, I put it here if vale of help, my problem was that the library was not well located, I use the Arduino UNO and the full Sketch weighs 34 Kb and the Arduino UNO has only 32 Kb, I deleted the UTFT.cpp and the UTFT.h all drivers screen leaving only the ILI9341_S5P and under the weight of the Sketch running well on the Arduino UNO now it works very well. Thanks and greetings.

    1. Hi Mario, good to know thanks for the update.

  6. Another note, I've used the configuration UTFT myGLCD(ILI9341_S5P,9,8,12,11,10); and the following connections:

    TFT Arduino
    1.VCC 3.3 V
    2.GND GND
    3.CS D12
    4.Reset D11
    5.DC/RS D10
    6.MOSI D9
    7.SCK D8
    8.Led 3.3V
    9.MISO N/C

    Best regards.

  7. How could i implement the screen rotation fuction

  8. This comment has been removed by a blog administrator.

  9. Hi to every one.
    I have tested the TFT before reading this post. Unfortunately I tested it without using a CD4050 Hex Buffer/Converter. So my question is, did I fired the TFT?
    I also want to add an information aboutUTFT usage on UNO. Yes its too big to fit in UNO. But there is a memorysaver.c file which helps to reduce the usage as small as 18kbyte. Open the memorysaver.c fileunder UTFT folder and follow the instructions in it.

    1. Hi, UTFT fits fine on an UNO ? Have you fried your screen......maybe, but probably not. The boards are fairly resilient, the risk is yours. You will have probably shortened its life it it's not dead.

  10. Hello Gordon,
    Thank you for circuit diagram.
    Compile Error gave.
    Arduino New version with ;
    Arduino Old version with ;

    Memory is not enough.
    Can your upload the libraries files? Mediafire or 4Shared pls.

  11. Thank you, great documentation, inspired me to build something using this TFT myself.
    Pingback from

  12. Hi everyone,

    Can I know how to clear TFT screen?
    I'm doing a countdown timer. Everytime the timer counts, the screen will keep fill with a blank screen and write (display) again.

  13. Hi everyone ....

    #define TFTcs 10
    #define TFTsclk 13 //HW SPI
    #define TFTmosi 11 //HW SPI
    #define TFTdc 9
    #define TFTrst NOTINUSE //4


Post a Comment

Popular Posts