Go Down

Topic: 2.4 inch TFT touch LCD Screen Module For Arduino UNO R3 SD low price jocks (Read 205692 times) previous topic - next topic

casemod

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

CircuitGuru
http://www.circuitguru.co.uk/

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.

casemod


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
CircuitGuru
http://www.circuitguru.co.uk/

berni_

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).

berni_

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
Code: [Select]

/*//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
Code: [Select]

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);
*/
}




berni_

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?

casemod


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.


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?
CircuitGuru
http://www.circuitguru.co.uk/

casemod

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
CircuitGuru
http://www.circuitguru.co.uk/

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

casemod


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
CircuitGuru
http://www.circuitguru.co.uk/

mikiray

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=..." ?

mikiray

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

berni_

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

magnetman

From my understanding after a test of the sd card part of this board the logic of the sdcard is 3.3V, so should not work without "Bi-Directional Level Shifter / Logic Level Converter". Has any of you guys made it work on 5V arduino?

casemod


From my understanding after a test of the sd card part of this board the logic of the sdcard is 3.3V, so should not work without "Bi-Directional Level Shifter / Logic Level Converter". Has any of you guys made it work on 5V arduino?


The board feeds the SD with 5V signals and 3.3V power, so you need an SD card with 5V tolerant pins. Most are, but do check.
I can confirm the reader on this shield does work.
CircuitGuru
http://www.circuitguru.co.uk/

Go Up