2.4 inch TFT touch LCD Screen Module For Arduino UNO R3 SD low price jocks

jock 2
tft.fillScreen(BLACK); very slow =(

// art100 write message 
//TOUCH PCB ARDUINO UNO
//YU 13 A1
//XL 12 6
//YD 15 7
//XR 14 A2     
//TFT    
//A 
//K1 
//K2 
//K3 
//K4
#include "TFTLCD.h"
//pins
#define LCD_RESET A4
#define LCD_CS A3    
#define LCD_CD A2    
#define LCD_WR A1   
#define LCD_RD A0    
// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
const int analogInPin = A5;  // Analog input pin that the potentiometer is attached to
//const int analogInPin = A4; // :(
//const int analogInPin = A3;// :(
//const int analogInPin = A2;// :(
//const int analogInPin = A1;// :(
//const int analogInPin = A0;// :(
//const int analogInPin = A-1;// ;)
//const int analogInPin = A-2;// ;)
//const int analogInPin = A-3;// ;)
int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)
//-----------------------
void setup(void) {
  Serial.begin(9600);
  Serial.println("8 Bit LCD test! more pinssssss");
  tft.reset();
  tft.initDisplay();
  tft.fillScreen(BLACK); // very slooooooow
//  testtext(YELLOW);
}
//===================
void loop(void) {
//    tft.initDisplay();
    tft.fillScreen(BLACK); // very slooooooow
    
    // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // map it to the range of the analog out:
//  outputValue = map(sensorValue, 0, 1023, 0, 255); 
  outputValue = map(sensorValue, 0, 1023, 0, 240);//lcd 320x240 
  // print the results to the serial monitor:
  Serial.print("sensor = " );  Serial.print(sensorValue);  Serial.print("\t output = ");  Serial.println(outputValue);  
  
for (uint16_t y=0; y<tft.height(); y+=10) {
  if(180<outputValue) {tft.drawHorizontalLine(  0, y, outputValue,   RED);}
  else{                tft.drawHorizontalLine(  0, y, outputValue, GREEN);}
}

 
Serial.println("tft.drawHorizontalLine(125, y, pin analog A5 only , GREEN);");
delay(1000);  
//delay(1); 

}

So have you managed to get this fully working?

Regards

I have the same problem with the same board.

I had bought this TFT 2.4 LCD Touch Shield for over a year, but only now I could test it. I can only see a white screen (backlight).
My Arduino is a Duemilanove.

Can you help me?
I just dont know where to start to make it work.

Use the libraries for the ST7781R controller.
Adafruit has a 2.8" TFT with the same controller. You can use those.

Just dont use the version above. Aprarently the poster hasnt gone anywhere and they dont work with the current version of the IDE.

Thank you for the tip.
I will try again with that and then return here to tell what happend.

Regards
Marcos

I also bought this shield and after searching the web found this page with a working library and demos:
http://www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino/

Hope this might help some of you...

Hi, I'm newbie with displays, and after more or less difficulties, I could make the things runing,
I share some observations:
On arduino UNO, after mapping correctly the pins according to display design, it is working quite well with a library called TFTLCD, found in this forum: Touch Screen Shield for Arduino UNO – misc.ws
Connected to Arduino MEGA, is is more complicated, the TFT pins D0 to D7 must be connected to pins 22 to 29, the other pins are unchanged (MEGA has strange port arrangement connected to digital pins 0 to 13, therefore the library is not able to use the shield directly connected to MEGA). I have made the tes and it is working well also.
The touchscreen share the same pins as TFT, therefore it can be used only when LCD_CS is high (LCD outputs are high impedance). To run the touchscreen alone, on UNO, this is added in setup():
pinMode(A3, OUTPUT);
digitalWrite(A3, HIGH);
The SD card is also working well... BUT there is a problem: the voltage given to the SD is 4.3V, and the absolute maximum voltage allowed for SD is 3.6V... DANGER to burn the SD card. This is caused by the HC245 buffer, which is not a level shifter, it has internal diodes between I/O and VCC and it push up the VCC3.3V by taking current on the arduino I/O. When Arduino is connected to USB (USB voltage on my computer=4.6V), the SD is powered at 3.9V; but with the jack, the SD has 4.3V.
I am not sure how to solve that... adding level shfters somewhere... The most safe is not using the SD slot at all.

About the libraries for TFT:
The author Mike McCaule, explained he has used the Adafruit TFT library, and modified several elements: capability to mirror X and Y, update the pins for UNO and MEGA, and use a faster method for rotation.
Anyway, it is very slow. This display is able to show moovies at 60fps, but filling it with plain color, it takes ~0.3 second on Arduino.
320x240=76800 pixels with 16MHz processor, that means ~70 CPU clock per pixel, it seems not very optimized...

Also the tested library has poor text function (the text background is always transparent, making problems to overwrite an existing text; font management does not exist, writing bigger than 8point font is managed by zoom 2, 3, 4, ... times the 8point font, the result is slow and ugly).
The display has some hardware accelerator (scrolling functions, layers management,...), but this is not used with the library; except rotation.

Does someone here has made comparaison between the available libraries?

I find the adafruit the best compromise between speed and size.
I use a dedicated arduino mini just to drive the display and SD card. The master only sends commands via serial, so the latency is reduced and its cheap to implement

One note about the last posters link - the touchscreen works perfectly with that version, so a ++!

Now the thing with this displays is that the arduino will never make them fast, unless you use a Due or upgrade to a cortex. maple would be brilliant but there are no libraries.

What i do is create the simbols using the fill reclanges and fill lines. The same functions can be used to clear only a specific area of the screen, so the result is a very fast display.

Attached is an example. This one refreshes very quicly

I will check the latest adafruit library for faster operation. Nice example casemod!

I have seen on ATMEGA2560 / 1280 data sheet, it has an external memory interface:

ATMEGA1280 pin connections to SRAM device:
Port A = Multiplexed Address low byte (A0....A7) / Data (D0....D7) <--------> Direct connection to SRAM (D0...D7) and connected to Input D of octal latch (typically “74 x 573” or equivalent) to (A0.....A7) of SRAM chip
Port C = Address high byte (A8....A15) <--------> direct connection to for example SRM (A8....A15)
Port G Pin 0 = WR (Write strobe to external memory) <--------> direct connection to for example SRAM WR
Port G Pin 1 = RD (Read strobe to external memory) <--------> direct connection to for example SRAM RD
Port G Pin 2 = ALE (Address Latch Enable to external memory) <--------> Connected to G Input of octal latch (typically “74 x 573” like 74 x 573)

Using the hardware pins dedicated to communicat to external memory should make the software several times faster, as fast as using internal RAM. If I have time, I will make a try.

berni_:
I will check the latest adafruit library for faster operation. Nice example casemod!

I have seen on ATMEGA2560 / 1280 data sheet, it has an external memory interface:

ATMEGA1280 pin connections to SRAM device:
Port A = Multiplexed Address low byte (A0....A7) / Data (D0....D7) <--------> Direct connection to SRAM (D0...D7) and connected to Input D of octal latch (typically “74 x 573” or equivalent) to (A0.....A7) of SRAM chip
Port C = Address high byte (A8....A15) <--------> direct connection to for example SRM (A8....A15)
Port G Pin 0 = WR (Write strobe to external memory) <--------> direct connection to for example SRAM WR
Port G Pin 1 = RD (Read strobe to external memory) <--------> direct connection to for example SRAM RD
Port G Pin 2 = ALE (Address Latch Enable to external memory) <--------> Connected to G Input of octal latch (typically “74 x 573” like 74 x 573)

Using the hardware pins dedicated to communicat to external memory should make the software several times faster, as fast as using internal RAM. If I have time, I will make a try.

Not quite sure what you're talking about.
Performance is limited by the actual core speed, not the memory itself.

Both the Mega and the UNO are just slow, with the mega having more pins. Technically you can make the LCD on the mega a bit faster by using 16 bit interface, but just a bit.

To unlock the potential of such LCD's you need to use an arduino due or other arm device like a stm32 or a mbed compatible device. In fact with the due you can even crank an SPI display way above the 8MHz limit an uno/mega can drive it.

But if you just want to replace a HD44780 LCD and can live with monochrome graphics on this displays a £3 arduino mini can take care of driving the display quite reasonably. Its just a lot of work writing the code

It's the hardware peripheral available on MEGA2560 micros, called "external memory interface". The WR, RD, ALE pins are manages automatically, no need to set/clear these pins by program. It is designed for connecting more SRAM directly to the uC.
In the code, display memory is then addresses with pointers, exactly the same way as internal RAM. I have used that a long time ago to interface displays with 8051 micros; it should work here also.

Anyway, by using the latest Adafruit library, it is faster than before (~2x).

Touchscreen calibation
I have written a small function to calibtrate the TS with the display. In every examples I have seen, calibration is done at compile time, and require multiple trys and recompile if touch point is not aligned with TFT pixels. I was inspired by my vintage Palm, it has the same feature.
Maybe someone will save time to reuse it.
It is written for TFTLCD library (from Adafruit, June 2014) + TouchScreen (also from Adafruit)

The macros with TS calibration parameters must be changed to variables

/*//Macros replaced by variables
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940*/
short TS_MINX=150;
short TS_MINY=120;
short TS_MAXX=920;
short TS_MAXY=940;

and the function, that can be called at the end of Setup() function. It works well with tftpaint example

void calibrate_TS(void){
  TSPoint p1, p2;
  int16_t temp;
  int32_t tempL;
  tft.fillScreen(BLACK);
  tft.fillCircle(10,10,4,WHITE); //show the first point
  tft.setCursor(5, 30); tft.setTextColor(WHITE);  tft.setTextSize(1);
  tft.println("Please touch the dot");
  do {  p1 = ts.getPoint(); }while((p1.z < MINPRESSURE) || (p1.z > MAXPRESSURE)); // wait touch
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT); //Pins configures again for TFT control
  tft.fillScreen(BLACK);
  tft.fillCircle(230,310,4,WHITE); //show the 2nd point
  tft.setCursor(50, 280);
  tft.println("Please touch the other dot");
  delay (500); // debunce
  do {  p2= ts.getPoint(); }while((p2.z < MINPRESSURE )|| (p2.z > MAXPRESSURE));
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  delay (300); 
  temp=p2.x-p1.x; // Calculate the new coefficients, get X difference
  tempL=((long)temp*1024)/(tft.width()-20);
  TS_MINX=p1.x-( (tempL*10)>>10);// 10 pixels du bord
  TS_MAXX=p1.x+( (tempL*tft.width())>>10);// 220 pixels entre points
  temp=p2.y-p1.y; // ¨get Y difference
  tempL=((long)temp*1024)/(tft.height()-20);
  TS_MINY=p1.y-( (tempL*10)>>10);// 10 pixels du bord
  TS_MAXY=TS_MINY+( (tempL*tft.height())>>10);
  /*
 // For debug, show results
  tft.setCursor(5, 30);
  tft.println("After calibration: ");
  tft.print("TS_MINX= ");tft.println(TS_MINX);
  tft.print("TS_MAXX= ");tft.println(TS_MAXX);
  tft.print("TS_MINY= ");tft.println(TS_MINY);
  tft.print("TS_MAXY= ");tft.println(TS_MAXY);
  p1.x = map(p1.x, TS_MAXX,TS_MINX, tft.width(), 0);
  p1.y = map(p1.y, TS_MAXY,TS_MINY, tft.height(), 0);
  p2.x = map(p2.x, TS_MAXX,TS_MINX, tft.width(), 0);
  p2.y = map(p2.y, TS_MAXY,TS_MINY, tft.height(), 0);
  tft.println("Last touched points: ");
  tft.print("Pt 1: ");tft.print(p1.x);tft.print(" : ");tft.println(p1.y);
  tft.print("Pt 2: ");tft.print(p2.x);tft.print(" : ");tft.println(p2.y);
  // wait 1 more touch to exit finction
  do {  p2= ts.getPoint(); }while((p2.z < MINPRESSURE )|| (p2.z > MAXPRESSURE));
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT);
*/
}

Again something new with these low cost displays...
After the success with the first display, I have ordered 5 more on Aliexpress (26$ for the lot), and surprise, there is differences.
The first differene is that the first one is working well with Adafruit and UTFT (GEEK24 model selected). The 2nd is not working at all.
Below some pictures that shows differences and similarities. Same manufacturer mcufriend.com.
The not working display seems to have a different controler. It answer 7777 when adafruit library is checking the model.
On le left: the NOT WORKING display, on the right, the display is OK
Anyone has an idea?

2.4inch diff.jpg

berni_:
The first differene is that the first one is working well with Adafruit and UTFT (GEEK24 model selected). The 2nd is not working at all.

... We certainly cannot guess what you are using. Care to post all the required libraries you used? UTFT is a large library suited to several displays, micro-controllers and pinouts, even with the right model selected, there are different pinouts, plus we dont know if you are using an uno, a mega or anything in between.

berni_:
Below some pictures that shows differences and similarities. Same manufacturer mcufriend.com.
The not working display seems to have a different controler. It answer 7777 when adafruit library is checking the model.
On le left: the NOT WORKING display, on the right, the display is OK

I have both and you are right the display is different, but it still complies with the ST778x command set as described on previous posts. As far as i know they are not supported by UTFT, however it may be that one of the LCD's has an extended command set, for example, some are known to be compatible with ILI9325. I have no idea what controller the GEEK24 model uses, this should be your first mystery to be solved - why are you using it and who told you it would be compatible?

Ive just ported these displays to a different platform and used the ILI9325 library as my reference.

In order to get both types to work with such library the following registers need to be changed on the ILI9325.cpp file:

Register 0x90 - Change Value to 0x0033
Register 0x02 - Change value to 0x0700

This should allow UTFT and similar libraries to be used with these displays

For the TFTLCD from mcufried.com as sold on the cheap via various providers, attached is a complete working sketch with drivers and examples:

  • TFTLCD using st7783 driver
  • resistive touchscreen
  • SD, including images to be stored on micro-SD card

st7783.zip (1.53 MB)

arduhckr:
For the TFTLCD from mcufried.com as sold on the cheap via various providers, attached is a complete working sketch with drivers and examples:

  • TFTLCD using st7783 driver
  • resistive touchscreen
  • SD, including images to be stored on micro-SD card

The actual driver was already posted on #13, but thanks for the contribuition

Hello, I buyed the display mcufriend and I'm trying to make it work. I think it's an error on the example tftpaint on line 97: "Point p=..." should be "TSPoint p=..." ?

It works good! Sorry, after some try I noticed that there was 2 libraries called "TouchScreen" in my IDE. Thank you.

Thank you arduhckr, yout last post makes both displays working!