Categories

2.8 Inch TFT LCD Shield Touch Display Screen Module For Arduino

I recently started looking through various shields I had no articles, code or tutorials for and came across a 2.8 Inch TFT LCD Shield Touch Display Screen Module For Arduino

Its a cracking display, here are some pictures of it


Features:

2.8 inch LCD TFT display
Bright, 4 white-LED backlight
Colorful, 18-bit 262,000 different shades
4-wire resistive touchscreen 240 x 320 pixels with individual pixel control
No wiring, no soldering.
Simply plug it in and load library
On-board 3.3V 300mA LDO regulator
5V compatible, use with 3.3V or 5V logic
Support 2GB micro SD TF card
Size: 7.8 x 5.3cm

 

Parts List

NameLink
Arduino MegaMEGA 2560 R3 (ATmega2560-16AU CH340G) AVR USB board Development board
2.8 LCD shieldWAVGAT 2.8 Inch 3.3V 300mA TFT LCD Shield Touch Display Module For Arduino UNO With Resistive Touch Panel DIY Kit

 

Code

I connected the shield to an Arduino Mega

4 libraries are required with the code example that I tested with – I uploaded these to my github site

  1. // IMPORTANT: Adafruit_TFTLCD LIBRARY MUST BE SPECIFICALLY
  2. // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
  3. // SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h FOR SETUP.
  4. //Technical support:goodtft@163.com
  5.  
  6. #include <Adafruit_GFX.h> // Core graphics library
  7. #include <Adafruit_TFTLCD.h> // Hardware-specific library
  8.  
  9. // The control pins for the LCD can be assigned to any digital or
  10. // analog pins...but we'll use the analog pins as this allows us to
  11. // double up the pins with the touch screen (see the TFT paint example).
  12. #define LCD_CS A3 // Chip Select goes to Analog 3
  13. #define LCD_CD A2 // Command/Data goes to Analog 2
  14. #define LCD_WR A1 // LCD Write goes to Analog 1
  15. #define LCD_RD A0 // LCD Read goes to Analog 0
  16.  
  17. #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
  18.  
  19. // When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
  20. // For the Arduino Uno, Duemilanove, Diecimila, etc.:
  21. // D0 connects to digital pin 8 (Notice these are
  22. // D1 connects to digital pin 9 NOT in order!)
  23. // D2 connects to digital pin 2
  24. // D3 connects to digital pin 3
  25. // D4 connects to digital pin 4
  26. // D5 connects to digital pin 5
  27. // D6 connects to digital pin 6
  28. // D7 connects to digital pin 7
  29. // For the Arduino Mega, use digital pins 22 through 29
  30. // (on the 2-row header at the end of the board).
  31.  
  32. // Assign human-readable names to some common 16-bit color values:
  33. #define BLACK 0x0000
  34. #define BLUE 0x001F
  35. #define RED 0xF800
  36. #define GREEN 0x07E0
  37. #define CYAN 0x07FF
  38. #define MAGENTA 0xF81F
  39. #define YELLOW 0xFFE0
  40. #define WHITE 0xFFFF
  41.  
  42. #include <MCUFRIEND_kbv.h>
  43. MCUFRIEND_kbv tft;
  44. // If using the shield, all control and data lines are fixed, and
  45. // a simpler declaration can optionally be used:
  46. // Adafruit_TFTLCD tft;
  47.  
  48. void setup(void) {
  49. Serial.begin(9600);
  50. Serial.println(F("TFT LCD test"));
  51.  
  52. #ifdef USE_ADAFRUIT_SHIELD_PINOUT
  53. Serial.println(F("Using Adafruit 2.4\" TFT Arduino Shield Pinout"));
  54. #else
  55. Serial.println(F("Using Adafruit 2.4\" TFT Breakout Board Pinout"));
  56. #endif
  57.  
  58. Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());
  59.  
  60. tft.reset();
  61.  
  62. uint16_t identifier = tft.readID();
  63. if(identifier == 0x9325) {
  64. Serial.println(F("Found ILI9325 LCD driver"));
  65. } else if(identifier == 0x9328) {
  66. Serial.println(F("Found ILI9328 LCD driver"));
  67. } else if(identifier == 0x4535) {
  68. Serial.println(F("Found LGDP4535 LCD driver"));
  69. }else if(identifier == 0x7575) {
  70. Serial.println(F("Found HX8347G LCD driver"));
  71. } else if(identifier == 0x9341) {
  72. Serial.println(F("Found ILI9341 LCD driver"));
  73. }else if(identifier == 0x7783) {
  74. Serial.println(F("Found ST7781 LCD driver"));
  75. }else if(identifier == 0x8230) {
  76. Serial.println(F("Found UC8230 LCD driver"));
  77. }
  78. else if(identifier == 0x8357) {
  79. Serial.println(F("Found HX8357D LCD driver"));
  80. } else if(identifier==0x0101)
  81. {
  82. identifier=0x9341;
  83. Serial.println(F("Found 0x9341 LCD driver"));
  84. }else {
  85. Serial.print(F("Unknown LCD driver chip: "));
  86. Serial.println(identifier, HEX);
  87. Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
  88. Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT"));
  89. Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
  90. Serial.println(F("If using the breakout board, it should NOT be #defined!"));
  91. Serial.println(F("Also if using the breakout, double-check that all wiring"));
  92. Serial.println(F("matches the tutorial."));
  93. identifier=0x9341;
  94.  
  95. }
  96.  
  97. tft.begin(identifier);
  98.  
  99.  
  100. }
  101.  
  102. void loop(void) {
  103. tft.fillScreen(BLACK);
  104. unsigned long start = micros();
  105. tft.setCursor(0, 0);
  106.  
  107. tft.setTextColor(RED); tft.setTextSize(1);
  108. tft.println("Hello World!");
  109. tft.println(01234.56789);
  110. tft.println(0xDEADBEEF, HEX);
  111. tft.println();
  112. tft.println();
  113. tft.setTextColor(GREEN); tft.setTextSize(2);
  114. tft.println("Hello World!");
  115. tft.println(01234.56789);
  116. tft.println(0xDEADBEEF, HEX);
  117. tft.println();
  118. tft.println();
  119.  
  120. tft.setTextColor(BLUE); tft.setTextSize(3);
  121. tft.println("Hello World!");
  122. tft.println(01234.56789);
  123. tft.println(0xDEADBEEF, HEX);
  124.  
  125. tft.setTextColor(WHITE); tft.setTextSize(4);
  126. tft.println("Hello!");
  127. tft.setTextColor(YELLOW); tft.setTextSize(5);
  128. tft.println("Hello!");
  129. tft.setTextColor(RED); tft.setTextSize(6);
  130. tft.println("Hello!");
  131. tft.println();
  132. tft.println();
  133. /*
  134.   tft.println();
  135.   tft.setTextColor(GREEN);
  136.   tft.setTextSize(5);
  137.   tft.println("Groop");
  138.   tft.setTextSize(2);
  139.   tft.println("I implore thee,");
  140.   tft.setTextSize(1);
  141.   tft.println("my foonting turlingdromes.");
  142.   tft.println("And hooptiously drangle me");
  143.   tft.println("with crinkly bindlewurdles,");
  144.   tft.println("Or I will rend thee");
  145.   tft.println("in the gobberwarts");
  146.   tft.println("with my blurglecruncheon,");
  147.   tft.println("see if I don't!");*/
  148. delay(1000);delay(1000);delay(1000);delay(1000);delay(1000);
  149. }
Share

Leave a Reply