TFT Display

I guess it depends on what you want the display to do, I've only ever worked with gui front ends with images, fonts, touch screen and widgets then use an intelligent controller such as EVE4 series from Bridgetek (Rudolph library) or Nextion (BriComp library), these support up to 10" display 1200x600 at 60Hz, or even larger as the rendering is offloaded to a dedicate cocntroller chip.

For smaller pixel based drawing displays I'm sure there a load of pently of options out there, just search the forums and see what you can find, however the larger the dispay size the lower the framerates you will get, memory will also be a constraint.
 
Hi @Turby, I see you use my Nextion library. Some time ago I updated it to version 2, called Nextion2. I am currently working on a version 3. The latest does not include many updates, just sorts out some potential problems.

Edit: I should have said that Nextion2 has many enhancements and is well worth a try. See Nextion2.h for details of all the enhancements.
 
Last edited:
I have used on a Teensy 4.1, Arduino Portenta H7, Uno Q (I think)...

It is also the same one in the Protosupplies.com Teensy 4.1 mini platform.
If you don't mind, could I seed you my pinout small sketch trying to get the display to work. Very frustrated.
 
If you don't mind, could I seed you my pinout small sketch trying to get the display to work. Very frustrated.
I would say yes - show us your pinout and a test sketch you are using. Wondering what library are you using for the display - you should be using the ST7735 library that ships with Teensy. It supports the ST7796 as well as the ST7735.
 
With the Protoboard:

Code:
#include <ST7796_t3.h> 

#ifdef USE_PROTO_SUPPLY_BOARD
#undef TFT_DC
#undef TFT_CS
#undef TFT_RST
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST -1
#endif
#endif
#undef TOUCH_CS

// For 1.54" TFT with ST7789
//ST7789_t3 tft = ST7789_t3(TFT_CS, TFT_DC, TFT_RST);
ST7796_t3 tft = ST7796_t3(TFT_CS, TFT_DC, TFT_RST);

Using SPI so pins 11-13...

Initialize:
Code:
tft.init(320, 480);
    tft.invertDisplay(true);

The color bits are inverted on this display...

Should mention, that all of the pinout information on the Protoboard (link in previous post) has technical information, like the pinout:
1784041360938.png
 
Last edited:
Here is a simple touch paint sketch that you can click on a color and then drag around to paint...
It works on my protoboard, with capacitive touch
Code:
/***************************************************
  This is our touchscreen painting example for the Adafruit ILI9341
  captouch shield
  ----> http://www.adafruit.com/products/1947

  Check out the links above for our tutorials and wiring diagrams

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/


#include <SPI.h>       // this is needed for display
#include <ILI9488_t3.h>
#include <Wire.h>      // this is needed for FT6206
#include <Adafruit_FT6206.h>

// The FT6206 uses hardware I2C (SCL/SDA)
Adafruit_FT6206 ctp = Adafruit_FT6206();

// The display also uses hardware SPI, plus #9 & #10
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
#define TFT_BL 7
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);

// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor;

void setup(void) {
  while (!Serial && millis() < 5000);     // used for leonardo debugging
 
  Serial.begin(115200);
  Serial.println(F("Cap Touch Paint!"));
 
  tft.begin();

  if (! ctp.begin(40)) {  // pass in 'sensitivity' coefficient
    Serial.println("Couldn't start FT6206 touchscreen controller");
    while (1);
  }

  Serial.println("Capacitive touchscreen started");
 
  tft.fillScreen(ILI9488_BLACK);
 
  // make the color selection boxes
  tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9488_RED);
  tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9488_YELLOW);
  tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9488_GREEN);
  tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9488_CYAN);
  tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9488_BLUE);
  tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9488_MAGENTA);
 
  // select the current color 'red'
  tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
  currentcolor = ILI9488_RED;
}

void loop() {
  // Wait for a touch
  if (! ctp.touched()) {
    return;
  }

  // Retrieve a point
  TS_Point p = ctp.getPoint();
 
 
  // Print out raw data from screen touch controller
  /*
  Serial.print("X = "); Serial.print(p.x);
  Serial.print("\tY = "); Serial.print(p.y);
  Serial.print(" -> ");
 
// Maybe flip it around to match the screen.
//  p.x = map(p.x, 0, 240, 240, 0);
//  p.y = map(p.y, 0, 320, 320, 0);

  // Print out the remapped (rotated) coordinates
  Serial.print("("); Serial.print(p.x);
  Serial.print(", "); Serial.print(p.y);
  Serial.println(")");
  */

  if (p.y < BOXSIZE) {
     oldcolor = currentcolor;

     if (p.x < BOXSIZE) {
       currentcolor = ILI9488_RED;
       tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     } else if (p.x < BOXSIZE*2) {
       currentcolor = ILI9488_YELLOW;
       tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     } else if (p.x < BOXSIZE*3) {
       currentcolor = ILI9488_GREEN;
       tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     } else if (p.x < BOXSIZE*4) {
       currentcolor = ILI9488_CYAN;
       tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     } else if (p.x < BOXSIZE*5) {
       currentcolor = ILI9488_BLUE;
       tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     } else if (p.x <= BOXSIZE*6) {
       currentcolor = ILI9488_MAGENTA;
       tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9488_WHITE);
     }

     if (oldcolor != currentcolor) {
        if (oldcolor == ILI9488_RED)
          tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9488_RED);
        if (oldcolor == ILI9488_YELLOW)
          tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9488_YELLOW);
        if (oldcolor == ILI9488_GREEN)
          tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9488_GREEN);
        if (oldcolor == ILI9488_CYAN)
          tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9488_CYAN);
        if (oldcolor == ILI9488_BLUE)
          tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9488_BLUE);
        if (oldcolor == ILI9488_MAGENTA)
          tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9488_MAGENTA);
     }
  }
  if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
    tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
  }
}
Note: there are probably bugs in this, but...
1784085257673.png
 
Last edited:
White screen on those displays is seriously frustrating. usually ends up being a mismatch between the driver chip and the library header — might be worth checking what's actually printed on the chip itself
 
Back
Top