Saturday, 20 February 2016

1.8" Serial SPI 128x160 Color TFT LCD Module Display

TFT LCD Screens (Thin-film-transistor liquid crystal display) are great graphical displays to display information.  They are a variant of a liquid crystal display (LCD) which uses TFT technology to improve image qualities such as addressability and contrast.  They are used often in video games, smart phones, cell phones, and sometimes even TV's.  Now, with the technology and accessibility today, you can use one with your Arduino!

Features



  • Size: 1.8 inch
  • Dot Matrix: 128*160
  • Size: 54mm(length)*34mm(width)
  • Input Voltage: 5V/3.3V
  • Driver IC: S6D02A1 / ST7735
  • Pin Definition: 1-RST 2-CE 3-D/C 4-DIN 5-CLK 6-UCC 7-BL 8-GND
  • It has PCB backplane with power IC, SD card socket
  • It need 4 IO port at least to drive.


Hardware Setup


Pinouts of the TFT are shown in the picture above. Connect the TFT pin to Arduino as shown in the table below. also connect 1KΩ resistors to all the data lines of TFT pins 1 , 2, 3, 4, 5. I have also connected  a 100 Ω resistor between pin 7. BL and +5V.


TFT                                    UNO
5. Clk        >1KΩ>               13
4. DIN       >1KΩ>               11
3. D/C        >1KΩ>              9
2. CE         >1KΩ>               10
1. RST       >1KΩ>              8
6. VCC                                 +5V
7. BL         >100Ω>             +5V
8. GND                                GND

The full setup is shown in picture below.






Software Setup:

Open the Arduino IDE and from Menu "Manage libraries " Install the "Ucglib by oliver"  library.



Now upload the following code to Arduino.

Arduino Code:


#include <SPI.h>
#include "Ucglib.h"

Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);

void setup(void)
{  
  delay(1000);
  ucg.begin(UCG_FONT_MODE_TRANSPARENT);
  ucg.clearScreen();
}

void loop(void)
  ucg.setFont(ucg_font_ncenR12_tr);
  ucg.setColor(255, 0, 0);
  ucg.setPrintPos(10,25);
  ucg.print("Hello World!");

  ucg.setColor(0, 0, 255);
  ucg.setPrintPos(50,60);
  ucg.print("By");

  ucg.setColor(20, 255, 20);
  ucg.setPrintPos(10,100);
  ucg.print("ALICTRONIX");
  delay(500); 
}

Results: