Arduino Shield – 2.4″ TFT LCD Touch

Er zijn verschillende 2.4″ shields TFT LCD Shields in omloop van MCUfriend.com met diverse aansturende chips, er moet veel uitgeprobeerd worden om te achterhalen welke driver ID er gebruikt wordt.

Deze zien er zo uit:

MCUFriend 2.4 inch LCD Shield - bovenkant

BESTELLEN

Arduino Library / Driver lijst:

Chip ID:LCD driver:Bibliotheek
0x0154S6D0154Samuraijap "TFTLCD-Library"
0x4535LGDP4535Onbekend
0x4747Himax HX8347-DMCUFRIEND_kbd
0x7575HX8347GADAfruit "TFTLCD"
Samuraijap "TFTLCD-Library"
Joao Lopes SPFD5408
0x7781ST7781Smoke and Wires "SWTFT-Library"
0x7783ST7783Smoke and Wires "SWTFT-Library"
TFTLCD-ST7783 bibliotheek
0x8357HX8357DADAfruit "TFTLCD"
Samuraijap "TFTLCD-Library"
Joao Lopes SPFD5408
0x9325ILI9325ADAfruit "TFTLCD"
Samuraijap "TFTLCD-Library"
Joao Lopes SPFD5408
0x9327ILI9327Samuraijap "TFTLCD-Library"
0x9328ILI9328ADAfruit "TFTLCD"
Samuraijap "TFTLCD-Library"
Joao Lopes SPFD5408
0x9341ILI9341ADAfruit "TFTLCD"
Samuraijap "TFTLCD-Library"
Joao Lopes SPFD5408

Fix mirrored text (example MCU friend library)

Sometimes you may wind up with mirorred text:

To correct this, you need to flip the axis and rotate the screen 180 degrees, the steps:

edit file MCUFRIEND_kbv.cpp , search for case 0x9341:  add the INVERT_GS command to the _lcd_capable  instruction:

Save the file, and you are ready, next to rotate 180 degrees enter the rotation command in your code to 2

tft.setRotation(2);

this will fix your mirror view ;-)

Touchscreen issues and calibration

One thing that you should note when using this library is that when you upload the code and start your touchscreen module. You might notice that your touchscreen is not working. Don’t panic it is probably because the pins are not correct. The pins were changed around a little so in my case. In your Arduino touchscreen sketch change the pins as below:
#define YP A3
#define XM A2
#define YM 9
#define XP 8

you can also look at the schematic (if provided) for the pinout on the module that you bought.

The next problem I ran into is that the coordinates are messed up for my module. Luckily, you can change the configuration by editing this file : SPDF5408_Touchscreen.cpp. In there locate this line of code: return TSPoint(1023 – x, 1023 – y, z);
for me it got it working with this settings: return TSPoint(x,y-50,z); you can play around with these values to get your desired result.

Bron: http://au0516.blogspot.com/


MCUFriend 2.4 inch LCD Shield – SPFD5408 (0x9341)


MCUFriend 2.4 inch LCD Shield – Himax HX8347-D driver (0x4747)

Attention: need to activate: #define SUPPORT_8347D  in file MCUFRIEND_kbv.cpp


MCUFriend 2.4 inch LCD Shield – ILI9328 driver (0x9328)

MCUFriend 2.4 inch LCD Shield - ILI9328 driver (0x9328) - bovenkantMCUFriend 2.4 inch LCD Shield - ILI9328 driver (0x9328) - binnenkant  MCUFriend 2.4 inch LCD Shield - ILI9328 driver (0x9328) - onderkant
Bron: forum.arduino.cc

Arduino Library / Driver: ADAfruit “TFTLCD” library


MCUFriend 2.4 inch LCD Shield – UNKNOWN driver (0x7777)

MCUFriend 2.4 inch LCD Shield - ST77xx driver (0x7777) - bovenkantMCUFriend 2.4 inch LCD Shield - ST77xx driver (0x7777) - binnenkant  MCUFriend 2.4 inch LCD Shield - ST77xx driver (0x7777) - onderkant
Bron: forum.arduino.cc

Arduino Library / Driver: UNKNOWN


MCUFriend 2.4 inch LCD Shield – ST7781 driver (0x7783)

MCUFriend 2.4 inch LCD Shield - ST7781 driver (0x7783) - bovenkantMCUFriend 2.4 inch LCD Shield - ST7781 driver (0x7783) - binnenkant  MCUFriend 2.4 inch LCD Shield - ST7781 driver (0x7783) - onderkant

Bron: YouTube

Arduino Library / Driver: Smoke and wires “SWTFT” library


MCUFriend 2.4 inch LCD Shield – S6D0154 driver (0x0154)

MCUFriend 2.4 inch LCD Shield - S6D0154 driver (0x0154) bovenkantMCUFriend 2.4 inch LCD Shield - S6D0154 driver (0x0154) - binnenkant  MCUFriend 2.4 inch LCD Shield - S6D0154 driver (0x0154) - onderkant

Arduino Library / Driver: Samuraijap “TFTLCD-Library”


MCUFriend 2.4 inch LCD Shield – ILI9341 driver (0x9341)

MCUFriend 2.4 inch LCD Shield - ILI9341 driver (0x9341) 01 - bovenkantMCUFriend 2.4 inch LCD Shield - ILI9341 driver (0x9341) 01 - onderkant

 

Arduino Library / Driver: Joao Lopes SPFD5408 bibliotheek”


 

MCUFriend 2.4 inch LCD Shield – ILI9327 driver (0x9327)

MCUFriend 2.4 inch LCD Shield - ILI9327 driver (0x9327) - onderkant

Bron: Arduino forum RU

Arduino Library / Driver: Samuraijap “TFTLCD-Library”


MCUFriend 2.4 inch LCD Shield – ST7783 LCD driver (0x07783)

MCUFriend 2.4 inch LCD Shield - ST7783 driver (0x7783) - onderkant

Arduino Library / Driver: “TFTLCD-ST7783”


MCUFriend 2.4 inch LCD Shield – UNKNOWN driver (0x0000)

MCUFriend 2.4 inch LCD Shield - xxxxxx driver (0x0000) - binnenkant  MCUFriend 2.4 inch LCD Shield - xxxxxx driver (0x0000) - bovenkant


MCUFriend 2.4 inch LCD Shield – LGDP4535 LCD driver (0x4535)

Informatie (ENG):
Bron Arduino forum

I was unable to find a programming datasheet for the lgdp4535 but I did turn-up some code for a different micropocessor platform that made this possible.
So this is a hack of the “Adafruit_TFTLCD” library where the ILI9341 initialisation valuse are replace with the values for the lgdp4535 and the library is initalised forced to use the ILI9341.

To do this modify “Adafruit_TFTLCD.cpp” and replace the array “ILI932x_regValues” with the following:

Then in your setup code use:  tft.begin(0x9341);


Touchscreen

Deze displays zijn voorzien van een touchscreen, met bijvoorbeeld de “Adafruit Touchscreen bibliotheek” zijn deze uit te lezen:

TFT LCD touchscreen


Adafruit GFX script functies:

Scherm vullen met een kleur:  tft.fillScreen([KLEUR IN HEX]);

Cursor coördinaten instellen:  tft.setCursor([X], [Y]);

Tekstkleur instellen:  tft.setTextColor([KLEUR IN HEX]);

Tekstgrootte instellen:  tft.setTextSize([1 t/m 5]);

Tekst printen op scherm:  tft.println("[TEKST]");

Lijn tekenen:  tft.drawLine([VAN X],  [VAN Y], [NAAR X], [NAAR Y], [KLEUR IN HEX]);

Vierkant tekenen:  tft.drawRect([X], [Y], [Lengte], [Breedte], [KLEUR IN HEX]);

Vierkant tekenen (gevuld):  tft.fillRect([X], [Y], [Lengte], [Breedte], [KLEUR IN HEX]);

Cirkel tekenen: tft.drawCircle([X], [Y], [RADIUS], KLEUR IN HEX);

Cirkel tekenen (gevuld):  tft.fillCircle([X], [Y], [RADIUS], KLEUR IN HEX);

Driehoek tekenen:  tft.drawTriangle([X TOP], [Y TOP], [X LINKS ONDER], [Y LINKS ONDER], [X RECHTS ONDER], [Y RECHTS ONDER], [KLEUR IN HEX]);

Driehoek tekenen (gevuld): =  tft.fillTriangle([X TOP], [Y TOP], [X LINKS ONDER], [Y LINKS ONDER], [X RECHTS ONDER], [Y RECHTS ONDER], [KLEUR IN HEX]);

etc…

Voorbeeld Scripts

Voorbeeld script “Hallo Wereld” (Adafruit)

Het resultaat:

MCUFriend 2.4 inch LCD Shield - hallo wereld


Voorbeeld script “Hallo Wereld” (MCU Friend library)

Het resultaat:


Voorbeeld script “figuren”

Het resultaat:

MCUFriend 2.4 inch LCD Shield - figuren


Schema