Getting Started with ESP32 Cheap Yellow Display Board – CYD (ESP32-2432S028R)

In this guide, you’ll learn how to get started with the ESP32 Cheap Yellow Display (ESP32-2432S028R). This is a TFT Touchscreen display LCD with an ESP32 development board included. This is a great option to build graphical user interfaces (GUI) for your IoT projects.

Getting Started with ESP32 Cheap Yellow Display Board - CYD ESP32-2432S028R

If you have a standalone TFT Touchscreen Display 2.8 inch with ILI9341 driver, you can follow this getting started guide.

Introducing the ESP32 Cheap Yellow Display – CYD (ESP32-2432S028R)

The ESP32-2432S028R development board has become known in the maker community as the “Cheap Yellow Display” or CYD for short. This development board, whose main chip is an ESP32-WROOM-32 module, comes with a 2.8-inch TFT touchscreen LCD, a microSD card interface, an RGB LED, and all the required circuitry to program and apply power to the board.

ESP32 Cheap Yellow Display CYD Board ESP32-2432S028R front

This is a very versatile board to build GUIs for your IoT projects and is much more convenient and practical than using a separate ESP32 board with a TFT screen.

ESP32 Cheap Yellow Display CYD Board ESP32-2432S028R back labeled

Here’s a list of more detailed specifications of this development board:

  • Dual-core MCU, integrated WI-FI and Bluetooth functions
  • Frequency can reach 240MHz
  • 520KB SRAM, 448KB ROM, Flash size is 4MB
  • Module size 50.0×86.0mm
  • Operating Voltage: 5V
  • Power consumption: approximately 115mA
  • Product weight: approximately 50g
  • The module includes:
    • 2.8-inch color TFT display screen with ILI9341 driver chip
    • Display resolution: 240x320px with resistive touchscreen
    • Backlight control circuit
    • TF card interface for external storage
    • Serial interface
    • Temperature and humidity sensor interface (DHT11 interface) and reserved IO port interface
    • It can be programmed with: Arduino IDE, MicroPython, ESP-IDF

In the Extended GPIO connectors, there are at least 4 GPIOs available: GPIO 35, GPIO 22, GPIO 21, and GPIO 27. It also has the TX/RX pins available (see previous image).

The RGB LED is connected to the following pins: red (GPIO 4), green (GPIO 16), and blue (GPIO 17).

For more information about the Cheap Yellow Display pinout, please check the following guide:

Where to buy?

You can click on the link below to check where to buy the ESP32 Cheap Yellow display and its price on different stores.

Installing Arduino Libraries

The ESP32 communicates with the TFT Display and Touchscreen using SPI communication protocol. We’ll be using the TFT_eSPI and XPT2046_Touchscreen libraries.

Installing the TFT_eSPI Library

Open your Arduino IDE and go to Sketch Include Library > Manage Libraries. The Library Manager should open. Search for TFT_eSPI. Select the TFT_eSPI library by Bodmer and install it.

Installing TFT_eSPI library Bodmer Arduino IDE 2

Installing the XPT2046_Touchscreen Library

Open your Arduino IDE and go to Sketch Include Library > Manage Libraries. The Library Manager should open. Search for XPT2046_Touchscreen. Select the XPT2046_Touchscreen library by Paul Stoffregen and install it.

Installing XPT2046_Touchscreen Library by Paul Stoffregen Arduino IDE 2

Prepare User_Setup.h Config File for TFT_eSPI Library

To properly use the TFT_eSPI library, you need a configuration file called User_Setup.h with the right definitions. We’ve already prepared that file so that you don’t have any configuration issues following our examples. You just need to download it and move it to the right folder. Follow the next instructions to learn how to do it.

a) Preparing the Config File – Windows PC

b) Preparing the Config File – Mac OS

a) Preparing the Config File – Windows PC

Having both libraries installed (TFT_eSPI and XPT2046_Touchscreen), download the User_Setup.h configuration file.

User_Setup.h file for TFT_eSPI library Bodmer Arduino IDE 2

In your Arduino IDE, go to File and open the Preferences menu.

Open Arduino IDE 2 Preferences Menu Windows PC

Copy the Arduino IDE “Sketchbook location” path. In my case it’s:

C:\Users\rui_s\Documents\Arduino
Open Sketchbook Location Arduino IDE 2 Browse

Then, in your Windows PC File Explorer tab enter the sketchbook location path to open the Arduino folder (it’s usually under the Documents folder).

Browse to Arduino libraries folder to copy lv_conf.h file Arduino IDE 2

Open the libraries folder:

Open the Arduino IDE 2 Libraries Folder Windows PC

You should see the TFT_eSPI library folder there. Open it.

Open TFT_eSPI folder libraries Arduino IDE 2

You should be in a similar folder path as shown below:

C:\Users\rui_s\Documents\Arduino\libraries\TFT_eSPI

Copy the User_Setup.h file provided earlier and replace the existing file.

Move copy User_Setup.h file to TFT_eSPI library folder Arduino IDE 2

IMPORTANT: other User_Setup.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials. You must use the exact User_Setup.h file provided in this article.

b) Preparing the Config File – Mac OS

Having both libraries installed (TFT_eSPI and XPT2046_Touchscreen), download the User_Setup.h configuration file.

Download User_Setup.h file for TFT_eSPI library Bodmer Arduino IDE 2

In your Arduino IDE, open the Settings menu.

Open Arduino IDE 2 Preferences Menu Mac OS

Copy the Arduino IDE “Sketchbook location” path. In my case, it’s:

/Users/rui/Documents/Arduino
Open Sketchbook Location Arduino IDE 2 Browse Mac OS

In Finder, type /Users/rui/Documents/Arduino and open that directory.

Open the Arduino IDE 2 Folder Mac OS

Open the libraries folder.

Open the Arduino IDE 2 Libraries Folder Mac OS

You should see the TFT_eSPI library folder there. Open it.

Open TFT_eSPI folder libraries Arduino IDE 2 Mac OS

You should be in a similar folder path as shown below:

/Users/rui/Documents/Arduino/libraries/TFT_eSPI

Copy the User_Setup.h file provided earlier and replace the existing file.

Move copy User_Setup.h file to TFT_eSPI library folder Arduino IDE 2 Mac OS

You should now have the User_Setup.h file provided on that path.

Move User_Setup.h file to TFT_eSPI library folder Arduino IDE 2 Mac OS

IMPORTANT: other User_Setup.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials. You must use the exact User_Setup.h file provided in this article.

Code – Display Text and Testing the Touchscreen

The following code displays a simple text in your TFT display and allows you to test the touchscreen. When you press the touchscreen with your finger or pen, it should print the coordinates and pressure.

Copy the following code to the Arduino IDE and upload it to your board.

/*  Rui Santos & Sara Santos - Random Nerd Tutorials
    THIS EXAMPLE WAS TESTED WITH THE FOLLOWING HARDWARE:
    1) ESP32-2432S028R 2.8 inch 240×320 also known as the Cheap Yellow Display (CYD): https://makeradvisor.com/tools/cyd-cheap-yellow-display-esp32-2432s028r/
      SET UP INSTRUCTIONS: https://RandomNerdTutorials.com/cyd/
    2) REGULAR ESP32 Dev Board + 2.8 inch 240x320 TFT Display: https://makeradvisor.com/tools/2-8-inch-ili9341-tft-240x320/ and https://makeradvisor.com/tools/esp32-dev-board-wi-fi-bluetooth/
      SET UP INSTRUCTIONS: https://RandomNerdTutorials.com/esp32-tft/
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

#include <SPI.h>

/*  Install the "TFT_eSPI" library by Bodmer to interface with the TFT Display - https://github.com/Bodmer/TFT_eSPI
    *** IMPORTANT: User_Setup.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials ***
    *** YOU MUST USE THE User_Setup.h FILE PROVIDED IN THE LINK BELOW IN ORDER TO USE THE EXAMPLES FROM RANDOM NERD TUTORIALS ***
    FULL INSTRUCTIONS AVAILABLE ON HOW CONFIGURE THE LIBRARY: https://RandomNerdTutorials.com/cyd/ or https://RandomNerdTutorials.com/esp32-tft/   */
#include <TFT_eSPI.h>

// Install the "XPT2046_Touchscreen" library by Paul Stoffregen to use the Touchscreen - https://github.com/PaulStoffregen/XPT2046_Touchscreen
// Note: this library doesn't require further configuration
#include <XPT2046_Touchscreen.h>

TFT_eSPI tft = TFT_eSPI();

// Touchscreen pins
#define XPT2046_IRQ 36   // T_IRQ
#define XPT2046_MOSI 32  // T_DIN
#define XPT2046_MISO 39  // T_OUT
#define XPT2046_CLK 25   // T_CLK
#define XPT2046_CS 33    // T_CS

SPIClass touchscreenSPI = SPIClass(VSPI);
XPT2046_Touchscreen touchscreen(XPT2046_CS, XPT2046_IRQ);

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define FONT_SIZE 2

// Touchscreen coordinates: (x, y) and pressure (z)
int x, y, z;

// Print Touchscreen info about X, Y and Pressure (Z) on the Serial Monitor
void printTouchToSerial(int touchX, int touchY, int touchZ) {
  Serial.print("X = ");
  Serial.print(touchX);
  Serial.print(" | Y = ");
  Serial.print(touchY);
  Serial.print(" | Pressure = ");
  Serial.print(touchZ);
  Serial.println();
}

// Print Touchscreen info about X, Y and Pressure (Z) on the TFT Display
void printTouchToDisplay(int touchX, int touchY, int touchZ) {
  // Clear TFT screen
  tft.fillScreen(TFT_WHITE);
  tft.setTextColor(TFT_BLACK, TFT_WHITE);

  int centerX = SCREEN_WIDTH / 2;
  int textY = 80;
 
  String tempText = "X = " + String(touchX);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);

  textY += 20;
  tempText = "Y = " + String(touchY);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);

  textY += 20;
  tempText = "Pressure = " + String(touchZ);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);
}

void setup() {
  Serial.begin(115200);

  // Start the SPI for the touchscreen and init the touchscreen
  touchscreenSPI.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
  touchscreen.begin(touchscreenSPI);
  // Set the Touchscreen rotation in landscape mode
  // Note: in some displays, the touchscreen might be upside down, so you might need to set the rotation to 3: touchscreen.setRotation(3);
  touchscreen.setRotation(1);

  // Start the tft display
  tft.init();
  // Set the TFT display rotation in landscape mode
  tft.setRotation(1);

  // Clear the screen before writing to it
  tft.fillScreen(TFT_WHITE);
  tft.setTextColor(TFT_BLACK, TFT_WHITE);
  
  // Set X and Y coordinates for center of display
  int centerX = SCREEN_WIDTH / 2;
  int centerY = SCREEN_HEIGHT / 2;

  tft.drawCentreString("Hello, world!", centerX, 30, FONT_SIZE);
  tft.drawCentreString("Touch screen to test", centerX, centerY, FONT_SIZE);
}

void loop() {
  // Checks if Touchscreen was touched, and prints X, Y and Pressure (Z) info on the TFT display and Serial Monitor
  if (touchscreen.tirqTouched() && touchscreen.touched()) {
    // Get Touchscreen points
    TS_Point p = touchscreen.getPoint();
    // Calibrate Touchscreen points with map function to the correct width and height
    x = map(p.x, 200, 3700, 1, SCREEN_WIDTH);
    y = map(p.y, 240, 3800, 1, SCREEN_HEIGHT);
    z = p.z;

    printTouchToSerial(x, y, z);
    printTouchToDisplay(x, y, z);

    delay(100);
  }
}

View raw code

How the Code Works

Let’s take a quick look at the parts of the code that are relevant to this example.

Libraries

Include the SPI, TFT_eSPI and XPT2046_Touchscreen libraries.

#include <SPI.h>
#include <TFT_eSPI.h>
#include <XPT2046_Touchscreen.h>

Initialize TFT

Create a TFT_eSPI instance:

TFT_eSPI tft = TFT_eSPI();

Initialize Touchscreen

The following lines set the touchscreen pinout:

#define XPT2046_IRQ 36
#define XPT2046_MOSI 32
#define XPT2046_MISO 39
#define XPT2046_CLK 25
#define XPT2046_CS 33

Create a touchscreenSPI and touchscreen instances:

SPIClass touchscreenSPI = SPIClass(VSPI);
XPT2046_Touchscreen touchscreen(XPT2046_CS, XPT2046_IRQ);

Other Variables

Set the screen width, screen height, and font size:

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define FONT_SIZE 2

Variables to store the coordinates: (x, y) and pressure (z).

int x, y, z;

setup()

Start a serial communication with the Serial Monitor at a baud rate of 115200:

Serial.begin(115200);

Start the SPI for the touchscreen and initialize the touchscreen.

touchscreenSPI.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
touchscreen.begin(touchscreenSPI);
touchscreen.setRotation(1);

Note: in some displays, the touchscreen might be upside down, so you might need to set the rotation to 3: touchscreen.setRotation(3);

Start the TFT display and set the TFT display rotation in landscape mode.

tft.init();
tft.setRotation(1);

Set the TFT screen background to white. Then, set the text color to black with white background.

tft.fillScreen(TFT_WHITE);
tft.setTextColor(TFT_BLACK, TFT_WHITE);

Set X and Y coordinates for the center of the display.

int centerX = SCREEN_WIDTH / 2;
int centerY = SCREEN_HEIGHT / 2;

Display two centered welcome messages in the TFT display:

tft.drawCentreString("Hello, world!", centerX, 30, FONT_SIZE);
tft.drawCentreString("Touch screen to test", centerX, centerY, FONT_SIZE);

loop()

In the loop(), it constantly checks if the touchscreen was touched.

if (touchscreen.tirqTouched() && touchscreen.touched()) {

When it detects that the touchscreen was touched, it will get the (x,y) coordinates and the pressure (z) from the point.

TS_Point p = touchscreen.getPoint();
// Calibrate Touchscreen points with map function to the correct width and height
x = map(p.x, 200, 3700, 1, SCREEN_WIDTH);
y = map(p.y, 240, 3800, 1, SCREEN_HEIGHT);
z = p.z;

Call the printTouchToSerial and printTouchToDisplay functions to print the touchscreen info in the Serial Monitor and TFT display.

printTouchToSerial(x, y, z);
printTouchToDisplay(x, y, z);

printTouchToSerial()

The printTouchToSerial() function prints touchscreen info about X, Y, and Pressure (Z) on the Serial Monitor.

void printTouchToSerial(int touchX, int touchY, int touchZ) {
  Serial.print("X = ");
  Serial.print(touchX);
  Serial.print(" | Y = ");
  Serial.print(touchY);
  Serial.print(" | Pressure = ");
  Serial.print(touchZ);
  Serial.println();
}

printTouchToDisplay()

The printTouchToDisplay() function prints touchscreen info about X, Y, and Pressure (Z) on the TFT Display.

void printTouchToDisplay(int touchX, int touchY, int touchZ) {
  // Clear TFT screen
  tft.fillScreen(TFT_WHITE);
  tft.setTextColor(TFT_BLACK, TFT_WHITE);

  int centerX = SCREEN_WIDTH / 2;
  int textY = 80;
 
  String tempText = "X = " + String(touchX);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);

  textY += 20;
  tempText = "Y = " + String(touchY);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);

  textY += 20;
  tempText = "Pressure = " + String(touchZ);
  tft.drawCentreString(tempText, centerX, textY, FONT_SIZE);
}

Demonstration

Upload the code to your board. Go to Tools > Board and select ESP32 > ESP32 Dev Module. Then, select the right COM port in Tools > Port. Finally, click the upload button.

Arduino IDE 2 Upload Button

After uploading the code to your board, it should display the sample “Hello, world!” text centered at the top. Press the touchscreen with your finger to test it.

ESP32 Cheap Yellow Display CYD Board ESP32-2432S028R Touchscreen Demonstration

It should print the coordinates: (x, y) and pressure (z) in the TFT display. You should note that this is a 240x320px resistive touchscreen.

ESP32 Cheap Yellow Display CYD Board ESP32-2432S028R Touchscreen Testing

The coordinates and pressure are also printed on the your Arduino IDE serial monitor:

ESP32 Cheap Yellow Display CYD Board ESP32-2432S028R Touchscreen Testing Arduino IDE Serial Monitor

Wrapping Up

In this tutorial, you learned how to use the ESP32 Cheap Yellow Display board, a versatile board that comes with a TFT touchscreen display, an ESP-WROOM-32 chip, all the required circuitry to power and upload code to the board, and more. This is a great board to add a graphical user interface to your projects.

If you already have a TFT Touchscreen display with ILI9341 driver, you can follow this guide to wire it directly to an ESP32 board to control it.

We hope you found this tutorial useful. Here’s a list of other projects/tutorials you may like:

To learn more about the ESP32, make sure to take a look at our resources:



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Enjoyed this project? Stay updated by subscribing our newsletter!

251 thoughts on “Getting Started with ESP32 Cheap Yellow Display Board – CYD (ESP32-2432S028R)”

  1. I would love to see some more tutorials on this board. If possible using MicroPython. Thanks for keeping me educated and up to date

    Reply
  2. I came across these boards some time ago but couldn’t find much documentation so I put them aside. About a week ago I realized that quite a lot of information has been posted since then so I got them out and started experimenting. In spite of the available data it took me many hours to get things working. Most of the examples given didn’t actually work with 2 SPI busses. I finally got it worked out a couple of days ago. I have not tried the touch library you are using yet but I know from experience that your projects work. I want to thank you for posting an article which makes it easy to use this board.

    Do you have any idea why they used different SPI busses for the display and the touch? It does not seem to have any advantage but it takes away 5 more pins and adds a further level of complexity to the sketch.

    Reply
    • I should have added that I used LovyanGFX and had a great deal of trouble figuring out how to save the touch calibration. LovyanGFX is mostly compatible with TFT_eSPI but presumably works better with 2 SPI busses. When I tried using TFT_eSPI I had a lot of conflicts – mostly because I had no idea what I was doing. I used the TFT_eSPI keypad from the demo but it insisted on using the SPI bus for TFT_eSPI to read the touch pad. Once I abandoned that and wrote my own keypad, everything started working but I had already switched to LovyanGFX.

      Reply
      • Does this article apply to ESP32-8048S050 5” smart display too?
        I intend to use as a terminal using the WiFi link, if it is possible to install VNC viewer on it!
        In this case, I only need 5V or does the capacitive touch need the usb-c connection?
        Thanks

        Reply
        • This guide only works with the ESP32-2432S028R board model. Other boards with built-in displays will require additional configurations which I don’t have at the moment.

          Reply
          • I tried it on the 2.4inch ESP32-2432S024R version which has the same resolution display, just smaller. Works fine. Thanks so much. You are often getting the “get started” part of a project so much more enjoyable. 🙂 Saving a ton of time. I used the aliexpress ESP32 Arduino LVGL WIFI&Bluetooth Development Board 2.4 inch 240*320 Smart Display Screen 2.4inch LCD TFT Module

  3. A nifty board !

    Thanks for covering the topic so well!

    Particularly grocery discounters introduced E-Ink ESLs up to 10 inches (white, black, red).

    It would be great, if you could cover this topic also. I mean the topic of getting and using those displays. I know of some folks that got to manage utilizing those displays privately.

    A good source for the displays would be helpful and a RNT-“recipe” using them.

    Thanks

    Reply
      • Thanks for the reply. Just to mention it: Aaron Christophel is the guy that knows everything about it. However, he might have some potential left of transferring his findings to other people like you do or Bill, Andreas or Scott.

        When it comes to real, ready to use recipies for “cooking”, you are the best. You hit exactly the sweet spot and also convey trust, that it works what you talking about.

        Reply
  4. Hi ! How many pins free to use are left ? In case we need more pins, is there a shield or something ? Thanks for your answer !

    Reply
    • My board, which does not have the “R” at the end of the part number, has ground and 3 pins on one connector and a second connector with ground, positive, and 2 pins. This could be used as an I2C interface to connect a port expander. There are several 8 and 16 bit port expanders available.

      Reply
      • Has anyone ever tried to use there extended Pins and get them work?
        I am struggeling for weeks to get an propper I2C connection. I own 2 of these modules. By adding a BME280 at GPIO21 and GPIO22 and using the module internal 3.3V/GND it was killing the TFT (not working anymore!). I dont know how this can happen.
        This module has also an great issue to work with TFT an SD at same time -> SPI issue.
        I think this module is not realy good designed at the current state and needs to be hw-updated

        Reply
  5. Apparently there are a few variations of these boards. Currently I have 2 which do not have the “R” at the end of the part number. They differ from most published images in that connector CN1 does not have an open pin. GPIO2 is connected there making this a potential I2C connector. Also, I just ordered 3 more and the product photo shows that they have a “C” USB connector in addition to the micro connector.
    Get them for $9.10 here:
    aliexpress.us/item/3256806284604156.html?spm=a2g0o.order_list.order_list_main.5.162e1802SAGoo2&gatewayAdapt=glo2usa

    Reply
    • Even though it’s not exactly the same as mine, can you try the example provided in this article? You should use the exact config file provided. Let me know if it works!

      Reply
      • As usual, your example works perfectly. I compared your user file with my non-working one. The only difference was that, in mine, the following lines were REMed out:
        379 #define SPI_TOUCH_FREQUENCY 2500000
        384 #define USE_HSPI_PORT
        On my board 379 doesn’t matter but 384 is critical. At the time I wasn’t sure if it applied to the display or the touch so I left it alone and forgot about it. The LovyanGFX library has separate settings for each. Most of the LovyanGFX documentation was in Chinese but Google Translate did a remarkable job of fixing that.

        I have noticed that there are now some very similar boards available with capacitive touch. Maybe you could consider one of them for a future project.

        Thanks again for all the work you do.

        Reply
      • Hi, thanks for this amazing tutorial. I am struggling to get mine working. I have tried your example exactly and the screen stays blank. The board worked with the demo screen when I go it. After uploading the Arduino code the screen remains blank. Serial is working, but it just displays the max touch pressure. Is there a way I could DM you? Thanks again!

        Reply
          • Hi, thanks for helping me with this. I am testing this out for my students. I teach middle school computer science. I haven’t been stuck on using a board like this for a while. The model number is JC2432W328. I got the screen to work and display information using these pin definitions:
            #define ST7789_DRIVER
            #define TFT_RGB_ORDER TFT_BGR
            #define TFT_WIDTH 240
            #define TFT_HEIGHT 320
            #define TFT_INVERSION_OFF
            #define ESP32_DMA
            #define TFT_MOSI 13
            #define TFT_SCLK 14
            #define TFT_CS 15
            #define TFT_DC 2
            #define TFT_RST -1
            #define TFT_BL 27
            #define TOUCH_CS 33
            But the touch screen still doesn’t seem to work.

          • Hi.
            I’m not familiar with that module.
            Does it have capacitive or resistive touchscreen?
            If it has capacitive touchscreen, it will not work with our examples (created for the resistive touchscreen).
            The capacitive ones required a different library to detect touch.
            Regards,
            Sara

          • That makes sense. Yes, I have the capacitive touch model. I can’t find the capacitive library anywhere or how to configure it anywhere. I have searched the entire internet, I may have even found the end of the internet. Turns out it ends as a text file hosted on a private server registered to Al Gore. 😉 Who knew?!

            Anyway, I have reached out to the manufacture. I will let you know if they have any information as well.

    • I’ve got one that also has the 2 USB ports (one USB-C, one USB-Micro-B), and I’ve seen articles saying to use slightly different libraries with them but haven’t dug down into the differences.
      I ran the demo from this page, and the only difference I noticed was that the screen was dark with white letters instead of light with black letters. I tried it with both ports, worked the same, though I had to reload because the COM port was different (I’m using Windows as my dev platform.)

      Reply
  6. Dear Rui and Sara,
    I have been trying to get some text on this display for a month or so and I did not succeed. So I am very happy with this example. It took about a quart hour to do the setup and compile and upload the example. It works out of the box.
    Thank you and keep up the good work!

    Reply
  7. Hi Rui and Sara,

    Great job as usual !
    I have bought 2 boards somme weeks ago, and they run correctly but on both the ana input doesn’t run (light sensor). In all cases, the voltage on this input is near of Zero. do you have the same problem on yours ?
    Best regards,
    JMH

    Reply
      • Hi Rui,

        It refers to GPIO 34 where is a resistor bridge of 2 x 1 MOhoms and a photoresistor on the front of the device. See the code below (loaded from the device doc). It can be used to adjust the brightness of the screen related to the ambiant light.

        #define ANALOG_PIN_0 34

        void setup(){
        Serial.begin(115200);
        pinMode(ANALOG_PIN_0,INPUT);
        }

        void loop() {
        int analog_value = 0;
        analog_value = analogRead(ANALOG_PIN_0);
        delay(1000);
        Serial.printf(“Current Reading on Pin(%d)=%d\n”,ANALOG_PIN_0,analog_value);
        delay(3000);
        }

        Reply
          • I have implemented to code wich works (you can play with map function values to achieve better results ).I covered sensor by tape aswell, because is too sensitive to light (maybe some nonlinear funcion wouldo the same) Code is updated in loop so refresh rate is dependeent on delay:
            #define ANALOG_PIN_0 34 // Photoresistor connected to GPIO 34
            #define BACKLIGHT_PIN 21

            void setup() {
            Serial.begin(115200);

            // Initialize the photoresistor pin
            pinMode(ANALOG_PIN_0, INPUT);

            // Initialize the backlight pin
            pinMode(BACKLIGHT_PIN, INPUT_PULLDOWN);
            }

            void loop() {
            // Read the value from the photoresistor
            int analog_value = analogRead(ANALOG_PIN_0);

            // Map the analog value to a brightness level (0-255)
            int brightness = map(analog_value, 0, 1300, 255, 0);
            if (brightness <1) brightness = 1;
            // Use analogWrite if available, otherwise use digitalWrite
            analogWrite(BACKLIGHT_PIN, brightness);
            // analogWrite(BACKLIGHT_PIN, analogRead(ANALOG_PIN_0));

            // Print the readings for debugging
            Serial.printf(“Current Reading on Pin(%d)=%d, Brightness=%d\n”, ANALOG_PIN_0, analog_value, brightness);

            delay(1000); // Update every second
            }

    • I think I have the same board as you, with ESP32-2432S028 but no “R”. It has the light sensor on the front. When you say “they run correctly,” I assume you mean they run Rui’s demonstration code without modification?

      My units were ordered from the links in this article from Aliexpress, but the captions on 4 of the 5 web pages did not include the version. The delivered packages had the “R” in the label, but not the PC boards.

      Reply
  8. Are these libraries specifically for Arduino 2.3.2 or can they download to the 1.8.10 ?
    I’m guessing it’s only for the newer IDE.

    Reply
    • They should work under Arduino 1.8.X as long as you are using the exact libraries versions that I use in this blog post and you install my User_Setup.h file for the TFT_eSPI library

      Reply
  9. Thanks Rui,
    The code works well, good stuff! Thankyou..!!!
    Ive been trying to implement the touchscreen to use as a remote with ESP-Now protocol to another ESP Device for bi-directional motor control but have had no success at all so far.
    Any Ideas..?
    Maybe something to consider including for your lvgl posts…?
    Thanks again, Reece

    Reply
    • I’ve added a note in the blog post: In the Extended GPIO connectors, there are at least 4 GPIOs available: GPIO 35, GPIO 22, GPIO 21, and GPIO 27. It also has the TX/RX pins available.

      Reply
        • I don’t find any reference or definition of GPIO21 or pin 21 in either the User_Setup.h file or Rui’s code. Does that pin need to be set as an output and set High in order illuminate the screen?

          Reply
      • Hi I am quite new to microprocessors and this coding stuff but I have at least 3 of the two Usb versions. Macsbug listed above is a good source of info and I have managed to use i2c and connected various sensors with no isssues but I think that gpio 21 is tied into the screen Back light and can cause issues.
        I have successfully got Yo radio to run on these boards and also the macsbug internet radios to work.. there is alot of info on these boards on git hub and Youtube which have helped me no end. I look forward too more from yourselves as I think these boards are great without having to uses lots of leads and breadboards etch and their price is great.
        Many thanks

        Reply
        • Hi Mark,
          how did you manage the audio of Macsbug‘s internet radio through the MAX module? What pins do you use and how did you prevent clipping the audio signal at high gain?

          Reply
          • Hi hans I used the gpios as showns in maxsbug wiring diagram I soldered wires as shown. I realised later than if I have two of the 4 pin connection wires then on the two usb version there is enough GPIO to correctly wire with no soldering but have not tried that yet.
            Another project which works wonderfully is Yoradio, watch the youtube video from Daradici Levanti youtu.be/czBkxkYREG8. this explains how to do it much better radio than macshub version.
            When using external DAC sound quality is great

        • Hi Mark,
          YoRadio doesn’t work on my CYD, something seems to be wrong with the display driver. The screen is rotated 90° and some of the graphics seems not to be right.

          Reply
          • Hi Hans, did you follow the youtube that includes the options file. ill put in the link to the paste bin where he stored his options for cyd. pastebin.com/Fjam0cnC.
            This may help and also watch his video and tutorial. Please let me know how you get on.
            Regards
            Mark D

  10. Another great intro Rui. The CYD has a lot more power in terms of GUI than shown here. Consider using Squareline Studio to create beautiful graphic UIs. Here is a template for getting started with that: github.com/witnessmenow/ESP32-Cheap-Yellow-Display/discussions/102 Also, the designers of the CYD really dropped the ball when they picked the exposed input/output pins. There is a lack of usable ADC inputs if you are using WIFI with this board as you can only use ADC1 when using WIFI. They could have simply used other pins for the display and exposed more useful pins. As for exposed pins, if you are not using the SD card, you can bring out 4 IO pins from there. Here is a properly labeled breakout board in a kicad project that others could use. drive.google.com/drive/folders/165wcDzaYBXRDlv0eurGinze3bf3cezEy?usp=sharing

    Reply
  11. This is fantastic! Great job, as usual!

    I have been using ESP32-324S8035, which is the slightly larger option in my lab for all sorts of displays. For the life of me, I still cannot get the touch option to work no matter how I try. However, these are wonderful options for small systems nonetheless.

    I have found the source: macsbug.wordpress.com/2022/10/02/esp32-3248s035/

    To be extremely useful for those having issues. If you ever get the larger option of these, I would love to see both a tough screen tutorial such as the one provided as well as a step by step for LVGL as well as the TFT_eSPI.

    Once again, you are doing wonderful work and I feel that this site is an incredible tool.

    Reply
    • I recommend buying this exact board, it will definitely work and you’ll be able to find more examples online. I’ll personally have many guides already lined up for this board.

      We’ll also cover LVGL!

      Reply
      • Rui,
        Your link doesn’t guarantee getting the board with “R” at the end of the version. I think JMH posted that it works anyway (his post included the info on the light sensor). I ordered from your link and the delivered packages included the “R” in the label, but not the PC board.

        Reply
    • Are you using the latest version of the libraries mentioned in the guide? Are you using my exact User_Setup.h in the correct TFT_eSPI folder?
      If you are using another config file, different libraries or something missing, it will not work.

      Reply
      • Hi Rui,
        yes, I use the correct library versions and I also use your version of the setup file in the correct TFT_eSPI directory.
        The card comes with a demo program which works every time I reinstall it via burn operation!! so I am sure that the card is operational….

        Ezio

        Reply
          • Hi Hans,
            sorry for the late response, but I was away for a few days, and thank you for your help.
            I redid the entire procedure step by step also following your instructions (library version, setup file, erase flash), but nothing changes !!!
            Would there be containers for power?

        • Hans,

          My CYD version is ESP32-2432S028 without the “R”. When originally powered on, it came up with the demo software, so the hardware is good. I backed out of the latest TFT-eSPI (.43) and installed the previous version (.34). I’m pretty sure I have Rui’s User_Setup.h file installed. If you have the orginal file, you get a “touchpad pin not defined” warning. The IDE (ver. 1.8.19) reports using 314617 bytes of program storage space and the serial output after reset looks reasonable, but the serial touchpad data is static/wrong. After all those checks, the screen is still black. Others with the non-R version seem to report success, so either I’m misreading their comments or I’ve missed a step.

          Reply
          • Some of the displays aren‘t ILI9341 but ST7789. They need another driver. Please try choosing the right driver.

          • Thanks. I assume there is no way to check this except by changing the driver to see if it works. The physical appearance of my unit is exactly the same as Rui’s, so I also assume that the display controller is embedded in the display and is not visible.

  12. Awesome tutorial. Very useful!
    If you could add an example of how to use TX/RX for uart to another device that would be very interesting. Also i2c.

    Reply
  13. Hello Rui,
    I have purchased an ESP32 2.8″ board (SKU DIS04028H) from elecrow and am trying to run the display. But all attempts have failed. Neither the supplied User_Setup.h nor the User_Setup.h from RandomTutorials work. Unfortunately I have not found any documentation about the GPIO ports used. Does anyone have any advice?
    Greetings Rudolf

    Reply
  14. Hello Rui,
    I have purchased an ESP32 2.8″ board (SKU DIS04028H) from elecrow and am trying to run the display.
    With the following settings in User_Setup.h the TFT works:

    #define TFT_MISO 12
    #define TFT_MOSI 13
    #define TFT_SCLK 14
    #define TFT_CS 15
    #define TFT_DC 2
    #define TFT_RST -1
    #define TFT_BL 27
    #define TFT_BACKLIGHT_ON HIGH
    #define TOUCH_CS 33

    But the display flickers and it appears in quick succession:
    x = -17
    y = -15
    Pressure = 4095
    So something with

    // Touchscreen pins
    #define XPT2046_IRQ 36 // T_IRQ
    #define XPT2046_MOSI 32 // T_DIN
    #define XPT2046_MISO 39 // T_OUT
    #define XPT2046_CLK 25 // T_CLK
    #define XPT2046_CS 33 // T_CS

    is wrong?
    Greetings Rudolf

    Reply
    • Unfortunately this guide wasn’t tested with that board, so I don’t know if it will work… I also don’t have that board, so I can’t test it.
      I recommend contacting the board supplier and requesting the correct User_Setup.h file for your board.

      Reply
    • I believe I am using the correct board and I am getting the same touch data via serial, and no screen illumination.

      Reply
  15. Hello Rui,
    I used your exact code and also replaced the user_setup.h file in the correct location.
    I am using VScode and loaded the required libraries.
    I am getting a compile error on this line:
    touchscreen.begin(touchscreenSPI);

    Compiling .pio\build\az-delivery-devkit-v4\src\main.cpp.o
    src/main.cpp: In function ‘void setup()’:
    src/main.cpp:82:35: error: no matching function for call to ‘XPT2046_Touchscreen::begin(SPIClass&)’
    touchscreen.begin(touchscreenSPI);
    ^
    In file included from src/main.cpp:30:
    .pio/libdeps/az-delivery-devkit-v4/XPT2046_Touchscreen/XPT2046_Touchscreen.h:46:7: note: candidate: ‘bool XPT2046_Touchscreen::begin()’
    bool begin();
    ^~~~~
    .pio/libdeps/az-delivery-devkit-v4/XPT2046_Touchscreen/XPT2046_Touchscreen.h:46:7: note: candidate expects 0 arguments, 1 provided

    Reply
        • Roger,
          I have the same issue using Platformio with Rui’s example code. I was able to get the example to work after tinkering around. There are 2 simple changes:

          1: Change statement
          touchscreen.begin(touchscreenSPI);
          to
          touchscreen.begin();

          2: Add this statement immediately after Serial.begin() and before any touchscreen related statements

          SPI.begin();

          That’s it! FYI, here’s my platformio.ini:

          [env:esp32-2432S028R]
          platform = espressif32
          board = esp32-2432S028R
          framework = arduino
          monitor_speed = 115200
          lib_deps =
          bodmer/TFT_eSPI@^2.5.43
          paulstoffregen/[email protected]+sha.26b691b2c8

          Note that there are currently 3 Platformio board definitions available on github for the ESP32-2432S028R:

          esp32-2432S028R.json //(micro USB port – this is what I have)
          esp32-2432S028Rv2.json //(USB C port)
          esp32-2432S028Rv3.json //(USB C and micro USB port)

          URL:
          github.com/rzeldent/platformio-espressif32-sunton/blob/281d5e4278ae31ad133074328ec1d291a4d62673/README.md

          Reply
        • I investigated further and found that Platformio did not install the latest version of the touchscreen library. I installed it manually using Rui’s link and removed my edits to restore the code back to the original. Now everything works as it should. Here’s my platformio.ini:

          [env:esp32-2432S028R]
          platform = espressif32
          board = esp32-2432S028R
          framework = arduino
          monitor_speed = 115200
          lib_deps =
          bodmer/TFT_eSPI@^2.5.43
          github.com/PaulStoffregen/XPT2046_Touchscreen.git

          Reply
  16. Hello Rui,
    today, my original CYD board arrived and I started to explore. I first installed the needed versions of the libraries and copied User_Setup.h into the correct folder. But while compiling your code with Arduino IDE 2.3.2 I get the following error message:

    xtensa-esp32-elf-g++: error: unrecognized command line option ‘-std=gnu++2b’; did you mean ‘-std=gnu++2a’?
    exit status 1

    Compilation error: exit status 1

    What’s going wrong?
    Best regards,
    Hans

    Reply
    • Hello Hans,
      It looks like something is missing in your Arduino IDE (it doesn’t look related to the CYD project).
      Are you able to compile a blank Arduino sketch?

      void setup() {
      // put your setup code here, to run once:

      }

      void loop() {
      // put your main code here, to run repeatedly:

      }

      Reply
      • Hello Rui,

        I found the solution: I had to update my boards file for ESP32. Now it works.

        My first steps on the board after elimination the compiler error show me inverted colours. It took a while to figure out what’s going wrong. I found out that I had to edit the User_Setup.h file and had to set #define TFT_INVERSION_ON. I also edited the configuration file of the display driver ILI9341_Init.h and had to set two lines in comments to make the colours better:
        //writecommand(0xE0); //Set Gamma
        //writecommand(0XE1); //Set Gamma
        Maybe it can help others with the same problems. It seems to appear only on the board with the two USB ports.

        Best regards,
        Hans

        Reply
  17. Why do you define the width/height again:

    #define SCREEN_WIDTH 320
    #define SCREEN_HEIGHT 240

    They are already defined in the User_Setup.h as:
    #define TFT_HEIGHT 320
    #define TFT_WIDTH 240

    Is it necessary to redefine them? Or can we just use the already defined width and height from the User_Setup.h

    Reply
    • In the User_Setup.h is mandatory to have those definitions.
      However in the code, i just define them to do some math to display the text in the right coordinates, so I don’t need to always type 320 or 240 in all operations.

      Example:

      x = map(p.x, 200, 3700, 1, SCREEN_WIDTH);
      y = map(p.y, 240, 3800, 1, SCREEN_HEIGHT);

      int centerX = SCREEN_WIDTH / 2;
      int centerY = SCREEN_HEIGHT / 2;

      Reply
  18. OMG, this is very helpfull, I need more tutorials about this DIsplay, I recently bought it, And I need to make some menu with 2 or 3 options and read 4 or 5 sensors to show them.

    Reply
    • We don’t have that planned, but the same library with this config file also works with VS Code. So, if you install the libraries and move the config file to the correct directory, it works.

      Reply
  19. My module is a 3248S035 so I’ve edited the height and width. I have X= -26 | Y= -20|
    PRESSURE = 4096 on the Serial Monitor.
    However the screen is blank and the displayed pressure and coordinates do not alter when the screen is pressed.
    Any suggestions? Also, should the library examples all work since the User_Setup.h file has been replaced? What has been edited in this file?
    Thanks

    Reply
  20. Back again. I downloaded bb_captouch library which correctly detects the GT911 IC
    for the capacitive screen. So touching the screen now shows sensible coordinates on the serial monitor.
    The TFT_eSPI programs don’t light up the screen or show any graphics.
    Any suggestions?

    Reply
  21. Nice tutorial, Maybe next possible topic could be LVGL & SquareLine Studio Together, Then wow… I assume it will blow some minds up! Hi 🙂

    Reply
  22. I have tried your sketch and it does not work on my CYD, several tft examples from other sources do. Your sketch complies OK, and loads without error, but screen remains blank when running although serial monitor output is OK. Touchscreen does not respond!

    Reply
      • I have the same problem that the screen is completely blank. But I’m not using ESP32-2432S028R (I think the R means resistive). I’m using ESP32-2432S028 (I assume this is capacitive). Should this work the same?

        Reply
        • Hi.
          No. At the moment, our examples are only compatible with the resistive touchscreen.
          The capacitive touchscreen requires a different library.
          Regards,
          Sara

          Reply
  23. Rui/Sara;
    First of all congratulations on this and all other tutorials you have done. You are a great “teacher”. You always explain everything in detail on an easy to understand language. Thanks for you hard work.

    Reply
  24. Hello Rui,
    at first Thank you for your excellent tutorials.
    I found this branch with full CYD support: github.com/Bodmer/TFT_eSPI/tree/7c60e884afe0c5c8d97846addacd2e80ad532337
    in this branch there is the CYD fully supported. Choose from the User-Setup-Folder: Setup303_CYD_ESP32-2432S028R.h.
    I have installed the library from this branch. It is easy to use, without any addiditional Touch-cofigurations. All TFT_eSPI – Examles which use the Touch are working perfect.
    Regards Friedrich

    Reply
  25. I ran the board. Works according to the tutorial.
    Thanks.
    Then I consider using this module.
    I tried to control it using the “x” position on the screen, I connected LEDs to the outputs on the P3 and CN1 connectors, but they do not turn on. However, the blue LED on the board turns on and off. Specification of P3 and CN1 connectors needed (circuit diagram)

    //added code:
    pinMode(p22, OUTPUT); digitalWrite(p22, LOW);//2
    pinMode(p27, OUTPUT); digitalWrite(p27, LOW);//17
    pinMode(p35, OUTPUT); digitalWrite(p35, LOW);//18
    pinMode(p21, OUTPUT); digitalWrite(p21, LOW);//15

    if ((x > 100) && (x <150)) {
    digitalWrite(p22, LOW);//2
    digitalWrite(p27, LOW);//17
    digitalWrite(p35, LOW);//18
    digitalWrite(p21, LOW);//15
    }
    else {
    digitalWrite(p22, HIGH);//2
    digitalWrite(p27, HIGH);//17
    digitalWrite(p35, HIGH);//18
    digitalWrite(p21, HIGH);//15
    }
    //////////////

    Reply
  26. Again great job;
    I have a older cyd with the single mini USB connector everything works great.
    I just purchased 4 more cyd for a project and they came with both a mini USB and a USB-C connect Still Great.
    Upoaded my test code and everything worked great except all the colors are inverted put a
    tft.invertDisplay(1);
    Now every thing is fine.
    Note boards have same part number ESP32-2432E028 and a fairly comprehensive review of the board shows no diferances other than the USB-C connector.

    Reply
    • Hi Jim!
      I got same cry board as yours with USB C.
      I followed the guide grid test code but my screen is blank. Codes load ok and the RGB led blinks green .
      Any help,please?

      Reply
      • When you powered up the display the first time did the demo come up if not you probaly have a bad board.

        My experiance tells me that if you follwed the RNT guide board will work.
        With that in mind my frst step would be to try using the following to init the board
        tft.init();
        tft.invertDisplay (1);
        If that does not work I would then
        Verify you are actualy uploading code by uploading a simple sketch that outputs some form of data to the serial monitor.
        If that works my guess is a library conflict in otherwords some how you missed a step in the Guide.

        Reply
    • Hello Jim!
      I have the board same as you said and am trying to run with RUI’s test code but no luck so far.
      Serial Terminal outputs, X and Y and pressure no. but screen is still blank and black.
      Tried some suggestions from the replies in this guide but no luck.
      Any help you can suggest?

      Thanks.

      Reply
  27. Hello Rui,
    at first Thank you for your excellent tutorials.
    I found this TFT_eSPI – branch with full CYD support:
    github.com/ggaljoen/TFT_eSPI
    in this branch there is the CYD fully supported. Choose from the User-Setup-Folder: Setup303_CYD_ESP32-2432S028R.h.
    I have installed the library from this branch. It is easy to use, without any addiditional Touch-cofigurations. All TFT_eSPI – Examles which use the Touch are working perfect. Also all my Sketches with Touch for other TFT-Displays work easy with die setup without modifikations of the sketch.
    Regards Friedrich

    Reply
  28. Mine came with a connector with the wires already connected – where can I get more of these – Or at least what type of connector is it to order with…

    Reply
    • My yellow boards
      Model: ESO32-3248S035C use the following connector.

      On Amazon elechawk 1.25mm Pitch Connectors and Pre-Crimped Cables Compatible with JST Molex PicoBlade 1.25mm for Pixhawk Silicone 15cm Wire. https://a.co/d/19sonxm

      Reply
  29. I followed the guide and installed all necessary files as listed in the guide.
    Code loaded but the screen is blank.
    In the guide in RED is says to also download the user_config.h file but I could not find that.

    Any help, please?

    Thanks.

    Reply
    • Hi.
      Please read the whole instructions.
      There’s a section called “Prepare User_Setup.h Config File for TFT_eSPI Library” with the instructions for that.
      If you don’t have configured the file, it will not work.
      Regards,
      Sara

      Reply
      • I did that but it did not work.
        How to find out what type of try display my cue has?
        Mg cue does not look as your in the guide, though.

        Reply
        • You need to check the product page… If your board is different than mine, it’s very likely that it will not work. This guide was designed to work with this exact board model: ESP32-2432S028R

          Reply
          • My board shows board model: ESP32-2432S028.

            Is that will be different than with R?
            The chop says ESP32-WROOM.

  30. I followed the guide line by line and now I am getting this error.
    I am not sure how to fix this.
    Any help, please?

    In file included from C:\Users\jhuss\AppData\Local\Temp\arduino\sketches\A9CA139F159229F8678F454D4C03FA97\sketch\sketch_apr12a.ino.cpp:1:0:
    C:\Users\jhuss\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.15\cores\esp32/Arduino.h:206:12: error: ‘std::round’ has not been declared
    using std::round;
    ^

    exit status 1

    Compilation error: exit status 1

    Reply
    • Hi Javed, not sure if this will help but recently Arduino IDE updated some esperiff esp32 stuff and after that I found almost all sketches would not upload or work and I got similar error messages on every sketch.
      I looked through the core files of Arduino15 and deleted version 2.0.15 and left an older version in restarted Ide and all went back to normal.
      It keeps asking me to update my libraries but I simply ignore it and IDE now works as it did.
      The files were in C/users/user/AppData/Local/Arduino15/packages/esp32/hardware/esp32

      Reply
  31. Dear Ruis,
    I would like to thankyou and the team for all you do, I am very new to the subject and have found sources like yours are invaluable to us newbies.
    I can confirm that your code works perfectly when downloaded to the TWO USB version of the CYD.
    Some of the Tft_espi examples will not work if they require touch because tft_espi library assumes the SPI for tft and touch run on the same pins but the CYD using different Spi for screen and touch which is why your Version works perfectly.
    Regads
    Mark D

    Reply
  32. Hi, it seems some people are struggling with other types of the CYD boards in combination with visual studio code and platformio.

    I have a Sunton 5 inch 800×480 pxl screen with capacitive touch and found this library to get realy easy up and running with lvgl / platformio in visual studio code:

    Library (use library installer in platformio -> home – libraries):
    Search for ‘esp32-smartdisplay’ and install. You can find more information in the readme of this library.

    Demo app for this library: After installing the library, you can download a minimal demo project and open this project in visual studio code, compile and upload to your board:

    github.com/rzeldent/esp32-smartdisplay-demo

    Sunton HMI screens can be found here:
    nl.aliexpress.com/store/1100192306?spm=a2g0o.detail.0.0.3fc4E7t8E7t8Gw

    Google search for sunton for more information about these boards.

    Reply
    • Greetings
      I have the 5″ display and I followed the code at github.com/rzeldent/esp32-smartdisplay-demo, and it worked. Only, needed to uncomment the default_envs = esp32-8048S050C.

      I am now trying to learn how to adapt the demo code to implement a vnc client, any help is appreciated.

      Reply
  33. Hi Sara & Ruis
    I have a slightly different ESP 024 display
    on the display side we find the RGB LED
    the other side has a connector for an external battery as well as an ON/OFF switch

    Reply
  34. Thanks to this tutorial page for CYD. I am learning a lot.
    I was able to get the sketches worked presented on this CYD page.

    I would like to know how to display a ESP32_CAM on this CYD.

    Any thoughts on this?

    Reply
  35. Thank you very much !
    I could at last see this Cheap Yellow Display Board writing someting .
    Very good tutorial .
    PAtrice

    Reply
  36. Hello Sara and Rui,
    Thanks a lot for all your work, you have an amazing site 🙂
    I try your code and everything is ok. You realy help me to make this screen works 🙂
    Do you know if it is ok to use the pin 21 to control the backlight?

    Best regards
    David

    Reply
  37. Rui/Sara

    Does the CYD have enough resources to be an MQTT client? I currently have a home control network using 17 Arduino Nano boards. The MQTT broker would need to handle 122 16-bit variables, but individual clients would subscribe to a maximum of 32 variables. The Nanos currently talk to each other via a token ring TTL serial network, but it’s difficult to add a node, due to the need for wiring. MQTT would be a real upgrade.

    Reply
    • The ESP32 can easily handle MQTT. I have some ESP8266 (ESP-07) units with only one meg of memory and even those work fine. MQTT does not seem to need much in the way of resources.

      Reply
      • I shouldn’t have used the word “resources.” I was more concerned about conflicts. I’ll be using Rui’s guide to putting the broker on a RPi. But that will have to wait until I can figure out why my displays aren’t working.

        Reply
        • I have some ESP32 “Clocks” which do the following:
          1) Display time, temperature, relative humidity, barometric pressure, and a graphic
          2) Publish above atmospheric data by MQTT every 20 seconds
          3) Publish above data to an MSSQL DB by https GET statements every 20 minutes
          3) Publish MQTT commands to other devices at specified times
          4) Listen (subscribe) for data from other devices and add that to the DB published in #3
          5) Sync time by NTP at various intervals
          Some of these devices have been running for years.
          The only conflict I have come across is that SD cards need to be initialized before the display.

          Reply
          • Allen, I took a look at your “inspiration” web page and I am inspired. I not familiar with things like SPIFFS, but I’m going to see how much of your work can be converted to the CYD. Thanks.

          • I’m glad to be of any help. I believe everything I have done can be moved to the CYD. If you look at the pictures the red clock at the top is the one where I went wild with feature creep. I wanted to see just how much these little things could do. Most of them do not monitor or control other devices but they all have the ability to do so. All of my devices check for an SD card at bootup. If one is available they take most of their configuration from an ini file on it.

  38. Just to reiterate: v3 of the CYD, the one with 2 USB sockets, has the ST7789 display rather than the ILI9341. It requires a number of changes to the User_Setup.h file.

    You need to replace (comment out) the driver #define ILI9341_2_DRIVER and uncomment #define ST7789_DRIVER
    Also you need to uncomment
    #define TFT_RGB_ORDER TFT_BGR and
    #define TFT_INVERSION_OFF
    to get the colours right.

    I think also TFT_MISO is on 12 rather than 16 and the TFT_RST should be -1 rather than 12.

    As has already been noted this information is detailed in macsbug.wordpress.com/2022/08/17/esp32-2432s028/

    Reply
    • I think too many people are obsessing with the R…I have the 2 usb version, in fact I have quite a few and all my boards are ILI9341_2 displays.
      It seems our various sources use different displays etc.
      I believe if you do have an R or no R it is not significant.
      The photos you buy from show you the back of the board to determine whether you have 2 USB or a single USB.
      I have had no problems with the sketches so Dick maybe correct that you may have a different display type on your board.

      Reply
      • Have you unzipped and copied unchanged the User_Setup.h file that RND distributed and insisted you use? Yes

        Have you copied it to the right place overwriting the original? Yes (renamed the old one, so it’s still there)

        Are you sure you haven’t reinstalled or updated the TFT_eSPI library since you copied the file? Made that mistake at least twice (BTW, this is one of those seemingly obscure, but fatal, mistakes). Yes

        When you open the User_Setup.h file in the library/TFT_eSPI with an editor does it have the Rui Santos … header in it? Yes

        *** and enabled the erase flash before upload? Yes

        Can anyone verify that using IDE 1.8.19 works? I get 314781 bytes of program space used and the upload report is “Wrote 315152 bytes (175049 compressed)…”. No errors. The code is running because it get a good header via serial on power-on reset and I get the “x= -17 y= -15 pressure= 4095” text line, so the loop is running but the touchpad is not responding.

        Reply
        • “The code is running because it get a good header via serial on power-on reset”

          Is that saying it prints “Hello World” on the display?
          If so the display is working.
          You could try one of the examples from the TFT_eSPI library to confirm. I like the 320×240/TFT_Meters example. It’s quite dynamic. It should just compile and load without modification.

          If the display is working – then you need to look at touch. Touch is not configured by the TFT_eSPI library. What are you getting at the serial monitor when you reboot (The RND tutorial example)? It should print the same stuff as is shown on the display. Are you getting esp errors, rebooting etc? “Brown out” is common if you don’t have a good power source.

          Reply
          • No display. I only see that the code is running because I see serial output (the power-on reset header) and for the touchpad, but the data is frozen, so the pad itself is not working.

          • Thanks for the IDE 1.8.19 confirmation. I’m going to change the driver for the display and see if that makes it work. I’m a bit doubtful, since the touchpad code is also not working (the lack of any touchpad data in the serial stream confirms the code is running, but the pad is not).

    • The 2-USB unit is easy to identify :-). However, your comment adds some mystery, since other comments have indicated that at least one person has gotten the 2-USB units to work without mentioning any change of driver.

      Thanks for your detailed info. I am going to give that a try.

      Reply
      • I have a 2 USB version and it worked fine with Rui’s sketches.
        I just followed line by line the instruction.
        I am using Arching 1.8.9 as Fui is.

        Reply
    • Hi Dick,
      just read what you said and although I had been using the ILI9341-2 driver with my CYD 2 usb for the last couple of months without an issue, I tried your suggestion and it works perfectly too.
      do you know if there are any other gains or losses between which driver to use as both appear to function ok?

      Reply
      • “do you know if there are any other gains or losses between which driver to use as both appear to function ok?”

        The main problem is colours – the RND example rendered white writing on a black background for me whereas it’s supposed to be black writing on white. That can be fixed with settings in Setup_Config but then the coloured colours (?) go wrong. So I investigated and found the display was actually ST7789.

        The real problem came when I tried the TFT_eSPI Sprite/Animated_dial example. This needs to be able to read data back from the display and that didn’t work. It turned out that the MISO line is connected to a different GPIO pin.

        I think it’s best to use the correct settings as far as possible even it usually doesn’t make much difference.

        Reply
        • Many thanks,
          I will leave it as you have suggested th ST7789 and rerun a few things that did or didnt run before.
          Upon first impressions the colours and screen seem to be alot better in clarity and gamma.
          Cheers

          Reply
  39. Rui/Sara,

    I’ve Googled a zillion sale ads and I don’t see any versions that have the “R” at the end of the version label that’s in the PCB copper (ESP32-2432S028). Even the dual USB connector version has ESP32-2432S028 in the PCB, not ESP32-2432S028R. A few of the ads don’t have an image of the back side, so you can’t tell on those. Maybe I have a real “R” version, but I’ve followed your guide and I still have a blank screen. See my post to HANS about halfway up with all the details of my upload.

    Reply
  40. I suspect the “R” is just a designation for “Resistive” touch as opposed to capacitive. I have 6 of these boards and none have an “R” on them. The only difference I can see is that the ones with the USB-C connector have inverted graphics. This is easy to fix with tft.invertDisplay(Invert); where I define Invert = 0 or 1 at the top of the sketch.

    Reply
    • Thanks. I made about 6 comments before I realized that Rui’s CYD was also missing the “R” in the PCB. The paper label on the delivered packaging did have the “R”, but at the time I didn’t trust it.

      So now the problem is, I believe I followed the software instructions faithfully, but I still have a blank screen and the touchpad data is frozen at -17, -15, and 4096.

      Reply
      • “I believe I followed the software instructions faithfully” Hmm, you’ve done something wrong.

        Have you unzipped and copied unchanged the User_Setup.h file that RND distributed and insisted you use? Have you copied it to the right place overwriting the original? Are you sure you haven’t reinstalled or updated the TFT_eSPI library since you copied the file? When you open the User_Setup.h file in the library/TFT_eSPI with an editor does it have the Rui Santos … header in it?

        Reply
      • Hi Dr Quark,
        Just a thought did the board have a fully working demo when you first powered it on before uploading any code?
        I am just asking incase you have a faulty board?
        All the boards I havew purchased had a pre installed demo showing screen and touch working together.
        Just a thought.
        A couple of other questions, are you compiling the board as ESP32 Dev module?
        can you show us a copy of the setup.h file in your tft_espi library? and is the setup.h file in the root of the library?

        Reply
        • Yes, the unit boots up with the demo software. Actually, all 3 do.

          The setup.h file has Rui’s header, so I’m pretty sure it’s corrrect. I replaced the existing file in the TFT-eSPI library, so it’s definitely in the root of that library, not in the root of the libraries directory.

          But you may have asked the right question, what board am I compiling? I think Rui says in the text that it doesn’t matter as long as it’s ESP32, but this is high on my list of excellent questions.

          Reply
          • i have a esp32-2432S028 and had the same -15,-17 readout.

            i fixed it today by changing
            SPIClass touchscreenSPI = SPIClass(VSPI);

            to
            SPIClass touchscreenSPI = SPIClass(HSPI);

            after that it worked as expected

  41. Hi Dr Quark,
    I am not sure where you are in the world but maybe someone would be willing to hook up with you in team viewer and try to assist you?
    These are great little boards with alot of potential and I hope you can get things sorted.
    It would be worth trying some of the TFT_espi library examples as (not touch) most of them work fairly easily and would prove if your board was running ok.
    Do you have the 2 USB version or the single USB version?

    Reply
    • Single USB version. I’ve had a number of comments that suggest my display has the alternate control chip, which I can check by changing the setup.h provided by Rui. But my serial output indicates that the touchpad code is also not working (the touchpad chip, checked under high magnification, is the resistive version). I’ve asked if IDE 1.8.19 could be the problem, but no comments on that, yet.

      I’m in Colorado (GMT – 7 hrs). A second set of eyes could be helpful.

      Reply
  42. Mark D asked the right question. Somewhere I got the idea that any ESP32 board would work. Nope. Use “ESP32 Dev Module”!!!!!!

    It’s almost always the dumb thing….

    Reply
      • Yes, and all the other TFT demos that are at GITHUB. You put some sunshine into a very gray day. Thanks.

        Now I just need to be smart enough to use Allen Mulvey’s MQTT modifications to RNT’s “ESP32 Web Server: Display Sensor Readings in Gauges”. His networking of the RNT project is exactly what I want to do with the CYD.

        Allen, or any other of you smart people out there, I would be perfectly happy to follow your lead!

        Reply
        • Well Allen is alot smarter than me all this funny talk about servers and MQTT. I just tinker about and read and try to find things to do with the CYD and ESP32.
          Glad I was lucky and managed to help someone.
          I looked at Allens web site, very nice setup loved the RED CYD with snoopy on it lol.
          Just a note to anyone interested I have the 2 USB version of the CYD and have been using the TFT_espi Il19341_2 driver.
          After seeing a few people mention the version had St7789 screen I tried this on my board and it runs but with a few oddities in colors etc. I am gonna tinker with the setup.
          Does anyone know what difference it makes in terms of picture quality speed etc as both seem to work?

          Reply
  43. The GFX_Library_for_Arduino has made it easy to use this display and many others in the examples there is PDQgraphicstest here you find Arduino_GFX_databus.h , Arduino_GFX_dev_device.h , Arduino_GFX_display.h , Arduino_GFX_pins.h these files added to your project define the used GPIOs in Arduino_GFX_dev_device.h you just un-comment the used display , for touch screen in the TouchCalibration example you find touch.h by putting the correct GPIOs in there you get a working touch screen and can calibrate it.

    Reply
  44. did copy/replace the config file as described (though i use linux). dasly can’t even compile as i get error: TFT_eSPI/Processors/TFT_eSPI_ESP32.h:14:25: fatal error: hal/gpio_ll.h: No such file or directory. guess i have to dive a bit deeper into it.
    My CYD is working, as it has a nice demoprogram installed

    Reply
    • I see it was brought up as an issue in the Bodmer library, but seemingly the solution ‘update your esp32 board does not work, judging by the comments

      Reply
      • OK everything solved. Had to bring the upload speed down to 115200 to avoid an “Unable to verify flash chip connection (Invalid head of packet (0xE0): Possible serial noise or corruption.).” error
        On 115200 it worked well.
        Thanks for all yr work

        Reply
    • Hi Ed, I am also trying to get the CYD working using my Ubuntu OS. I am also using the Visual Studio Code Platform IDE that I am just now learning.
      On this tutorial I am up to “Prepare User_Setup.h Config File for TFT_eSPI Library”. Should I follow the Mac OS instructions (as it is a linux derivative)? I think the User_Setup.h config file may need to be used in the platformio.ini file but I have no clue.
      Any help would be appreciated.

      Reply
  45. Hi Rui and Sara
    Thank you for another great tutorial. For me, rnt is often the starting point for a project: I get an understandable and working project which I can modify. Your work is definitely worth to support.
    I would buy an ebook about CYD… to build a smart home center at home which shows different temperatures and status (via MQTT).

    Reply
  46. Rui and Sarah, been a couple of years (pre-pandemic I think) but I just happened upon a CYD on Amazon which is ideal for the Quick and Dirty curve tracer I’ve designed – just need to test it.

    Turns out I already had a CYD in the box of bits because I never had the software to drive it and then, lo and behold… THIS!

    This has saved me absolutely hours of faffing around just getting the basic drawing functions and text. Can I get you a coffee or something?

    Reply
      • Thank you both, I’ll grab a copy of that.

        Might be useful, but at least I can support you both!

        Most of what I needed for this project was in this very article. I’ve just managed to figure out PlatformIO on VSCode again so I needed to come back and grab the UserSetup.h file. 😉

        I’ve really tried to love the Arduino IDE but it just never feels finished and it’s so slooooow.

        Reply
    • The connectors are Molex Picoblade which have 1.25mm pin spacing. Sometimes referred to as JST 1.25mm. I have used cables from Adafruit and Aliexpress.
      adafruit.com/product/4722
      aliexpress.us/item/3256806435550656.html

      Reply
  47. Hi Sara/Rui,

    I accidentally found something out about the CYD (probably applies to other ESP32s too) when connecting to a couple of I2C devices that I’ve been using: the MCP4725 DAC and the ADS1015 ADC.

    Using Wire at the normal rate, it’s impossible to get the data from the 1015 at anywhere close to the 3300SPS advertised data rate. I haven’t done the bit math (I’m too bone idle) but I expect that even at the normal max I2C speed, there isn’t the bandwidth to get readings from the ADC in continuous conversion mode. There is a 1115 ADC with 16-bit resolution but that’s even slower and 12 bits is enough for a curve tracer on such a small screen (4096 values over 320 pixels at most).

    Imagine my shock when I put an extra “0” in the Wire.begin statement and found that it just worked. We’re supposed to set a register in the 1015 to enable high-speed mode but unless something has flipped this switch in the DAC too… I’m at a loss.

    I was able to push the clock beyond the maximum (3400000 in the constructor) although that’s unlikely to be much benefit at a modest sampling rate, so it’s not going to make much of an oscilloscope.

    It should work for audio signals if someone really wanted to do that though. Perhaps this is something you would like to explore?

    I’m using it as a bipolar curve tracer (so it has some extra electronics hanging off to accomplish that) but it should easily be able to display an audio signal and give a nice waveform.

    Using Bodmer’s SPI library as you’ve detailed above, I’ve been able to create a double-buffered 8-bit display (using a “sprite”) that doesn’t flicker at all.

    When I figure out how to get back into GitHub (cough, cough) I’ll publish my code but there’s not a lot to it in reality. It might be the sort of thing that would fit in your eBook (all my stuff is Open Source hardware and software). I’ve looked through the various projects and there’s nothing like this for the ESP32 CYD – perhaps because it doesn’t have access to the DAC/ADC so far as I can tell.

    I’ll link the GitHub when I get it up there but if you want any more details I’m totally happy to share to help the community that’s helped me so much over the years.

    Meantime if you want to try my experimental code, I’d be quite happy to share.

    Reply
  48. Hi,
    I used this example for the 3.5″ device and changed resolution and miso(12) , mosi(13), clk(14), but screen remains blank.
    Is there anything that I overlook?
    Regards
    Ludo

    Reply
    • Hi.
      What is exactly the board you’re using?
      You might need to reconfigure the whole pinout.
      And if you’re using a capacitive touchscreen, you’ll need to use a different library for the touchscreen.
      Regards,
      Sara

      Reply
  49. These would be perfect as an interface for Home Assistant in a wall electrical box. The only issue is how to get power to it. Do you have any tutorials for a safe in-wall 110V to 5v power supply?

    Reply
    • It ships with the power plug, and happily takes 5v and 12v inputs just fine.
      It draws 0.006a (on both 5v and 12v) while sleeping, 0.04a when running (screen off) and 0.15a with screen on.

      Reply
  50. I was having trouble where the port option was greyed out. On another website I read about needing CH340 drivers for this board which I installed and was then able to successfully connect to the port. I had the CP2102 drivers installed as instructed, but this board apparently uses the CH340 chip.

    Reply
  51. I love your tutorials and eBooks. Everything usually works fine. I am having trouble with this tutorial though. I followed it to the letter. I have a blank black screen after loading the program. The serial monitor gives this information: timestamp-> x = -17 y = -15 pressure = 4095. This is all without touching the screen. Nothing changes when I do touch the screen. I bought this from Aliexpress using your link. The board says ESP32-2432S028. Could this be the problem?

    Thanks for your help.

    Reply
  52. Sensor Readings on a Table:
    Sketch uses 1365837 bytes (104%) of program storage space. Maximum is 1310720 bytes.
    Global variables use 64080 bytes (19%) of dynamic memory, leaving 263600 bytes for local variables. Maximum is 327680 bytes.
    Sketch too big; see support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
    text section exceeds available space in board

    Compilation error: text section exceeds available space in board

    Reply
  53. Learn LVGL: Build GUIs
    for ESP32 Projects” eBook
    3.3 – Display Sensor Data on a Table
    I get this message
    all other project before this one works.

    Reply
  54. Excellent MicroPython suite of tools here:

    github.com/jtobinart/MicroPython_CYD_ESP32-2432S028R

    Also, from cydr.py, some pins:

    ######################################################

    Pin Reference

    ######################################################
    Pins
    0 Digital Boot Button
    1 Digital Connector P1 – TX
    2 Digital Display – TFT_RS / TFT_DC
    3 Digital Connector P1 – RX
    4 Digital RGB LED – Red
    5 Digital SD Card – SS [VSPI]
    6 Digital Unpopulated Pad U4: pin 6 – SCK / CLK
    7 Digital Unpopulated Pad U4: pin 2 – SDO / SD0
    8 Digital Unpopulated Pad U4: pin 5 – SDI / SD1
    9 Digital Unpopulated Pad U4: pin 7 – SHD / SD2
    10 Digital Unpopulated Pad U4: pin 3 – SWP / SD3
    11 Digital Unpopulated Pad U4: pin 1 – SCS / CMD
    12 Digital Display – TFT_SDO / TFT_MISO [HSPI]
    13 Digital Display – TFT_SDI / TFT_MOSI [HSPI]
    14 Digital Display – TFT_SCK [HSPI]
    15 Digital Display – TFT_CS [HSPI]
    16 Digital RGB LED – Green
    17 Digital RGB LED – Blue
    18 Digital SD Card – SCK [VSPI]
    19 Digital SD Card – MISO [VSPI]
    21 Digital Display & Connector P3 – TFT_BL (BackLight) / I2C SDA
    22 Digital Connector P3 & CN1 – I2C SCL
    23 Digital SD Card – MOSI [VSPI]
    25 Digital Touch XPT2046 – CLK [Software SPI]
    26 Analog Speaker – !!!Speaker ONLY! Connected to Amp!!!
    27 Digital Connector CN1 – Can be used as a capacitive touch sensor pin.
    32 Digital Touch XPT2046 – MOSI [Software SPI]
    33 Digital Touch XPT2046 – CS [Software SPI]
    34 Analog LDR Light Sensor – !!!Input ONLY!!!
    35 Digital P3 Connector – !!!Input ONLY w/ NO pull-ups!!!
    36 Digital Touch XPT2046 – IRQ !!!Input ONLY!!!
    39 Digital Touch XPT2046 – MISO !!!Input ONLY!!! [Software SPI]

    Reply
  55. Oh yeah – and for completeness – the Circuitpython version is here:
    circuitpython.org/board/sunton_esp32_2432S028/

    MicroPython is a dual-core “OS” with threads, poor driver/hardware support, and a somewhat toxic development team. This would be the better-choice for the “high tech” users here, but don’t expect them to accept any work you might submit.

    CircuitPython is a single-core-only “OS” which does not support threads, but has excellent driver support for all kinds of hardware, and a welcoming development team and community. This would be the better choice for newcomers who want things to work more “out of the box”.

    Reply
  56. Muuuuchas gracias, es un gran ejemplo, la mia funcionó a la primera siguiendo tus pasos, ya voy entendiendo como manejarla, veré de ir dandole funciones de a poco

    Reply
  57. Thanks for great tutorials, vendor’s site inaccessible for code, these just worked. You guys are my first go-to for reference, in fact I only discovered the CYD through seeing it here. Another excellent resource is here, lots of examples including ESPHome code too. github.com/witnessmenow/ESP32-Cheap-Yellow-Display

    Reply
  58. thx for the tutorial.ill be on this site for a bit learning. when i rotate the screen in the code the touch location dont rotate also so will that be something i will need to handle in the code or should it rotate also

    Reply
    • lv_init();
      // Register print function for debugging
      lv_log_register_print_cb(log_print);

      // Start the SPI for the touchscreen and init the touchscreen
      touchscreenSPI.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
      touchscreen.begin(touchscreenSPI);
      touchscreen.setRotation(3);// <<<<<<< uou need set rotation of touch here (same of screen rotation)
      // Create a display object
      lv_display_t* disp;
      // Initialize the TFT display using the TFT_eSPI library
      disp = lv_tft_espi_create(SCREEN_WIDTH, SCREEN_HEIGHT, draw_buf, sizeof(draw_buf));
      tft.setRotation(3);// <<<<<<< SAME OF TOUCH
      tft.invertDisplay(1); // COLOUR RGB try 0 or 1 (for me work1);
      // Initialize an LVGL input device object (Touchscreen)
      lv_indev_t* indev = lv_indev_create();
      lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
      // Set the callback function to read Touchscreen input
      lv_indev_set_read_cb(indev, touchscreen_read);

      Reply
  59. Hi,
    I followed all instructions, and compiled the program with error :
    i:\arduino\hardware\espressif\esp32\sketches\libraries\lvgl\src\examples\styles\lv_example_style_14.c:1:10: fatal error: ../../src/themes/lv_theme_private.h: No such file or directory
    1 | #include “../../src/themes/lv_theme_private.h”
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    exit status 1

    I copied lv_theme_private.h from another place to where the error said it wasn’t, but still get the error.
    Any idea what to do ?
    thank you in advance
    best regards
    Ludo

    Reply
  60. I bought a CYD that has a USB type C and a micro usb connector. I have tried this posting as well as a number of others that you have and can not get any on them to perform.
    Any ideas for me?

    Reply
  61. BONJOUR,

    je possede un CYD jaune mais en 2.4 pouces, et malheureusement je ne sait pas sur quelles pins sont connestés l’ecran tactile ST7789, la LED RGB, le lecteur MSD et je ne trouve pas l’info pouvez-vous m’aider ?

    Reply
  62. Great tutorial about a great display, you rock.
    I am at an obstacle that I don’t know how to overcome: I use an Ubuntu linux setup with Visual Studio Code (which I recently learned with your tutorial: “Getting Started with VS Code and PlatformIO” in which you cover Linux). Now I am moving on to “Getting Started with ESP32 Cheap Yellow Display Board”. In this tutorial I am up to “Prepare User_Setup.h Config File for TFT_eSPI Library”. Should I follow the Mac OS instructions (as it is a linux derivative)? I think it may have something to do with the platformio.ini file but I have no clue. I noticed one comment that mentioned linux but it didn’t help me.
    Assistance, or a linux CYD tutorial would be appreciated.

    Reply
  63. Here is my start up experience with this very helpful project:

    I received an ESP32-2432S028 Board this week from AliExpress.
    Yes, it is not an ESP32-2432S028R.
    I integrated your project in my existing Arduino 1.8.19 programming environment.
    Compiling ended with the following result:

    ……../esp32/include/soc/soc.h:212:51: error: invalid conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘gpio_drive_cap_t’ [-fpermissive]
    ((READ_PERI_REG(reg)>>(shift))&(mask));
    …….esp32/include/hal/gpio_ll.h:512:17: note: in expansion of macro ‘GET_PERI_REG_BITS2’
    *strength = GET_PERI_REG_BITS2(GPIO_PIN_MUX_REG[…….
    …….
    exit status 1
    Error compiling for board ESP32 Dev Module.

    Hmmmmm… checking my Installation, Updating Libraries and all sort of that stuff did not bring it to success.
    As a last resort I updated my programming tool to IDE 2.3.3. Compiling the project gave an immediate success!
    Conclusion:
    The board ESP32-2432S028 works well with IDE 2.3.3, but it does not work with IDE 1.8.19.

    Thanks for your great work and your very helpful Tutorials and programming examples.
    Best regards from Switzerland

    Reply
  64. Hi Sara,

    When I compile the program I get the following error:

    In file included from c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.h:100,
    from c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:16:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c: In function ‘void dc_callback(spi_transaction_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: ‘GPIO’ was not declared in this scope
    189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:760:28: note: in expansion of macro ‘DC_D’
    760 | if ((bool)spi_tx->user) {DC_D;}
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:761:9: note: in expansion of macro ‘DC_C’
    761 | else {DC_C;}
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::begin_tft_write()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: ‘GPIO’ was not declared in this scope
    233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:80:5: note: in expansion of macro ‘CS_L’
    80 | CS_L;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘virtual void TFT_eSPI::begin_nin_write()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: ‘GPIO’ was not declared in this scope
    233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:92:5: note: in expansion of macro ‘CS_L’
    92 | CS_L;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::end_tft_write()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:106:7: note: in expansion of macro ‘CS_H’
    106 | CS_H;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘virtual void TFT_eSPI::end_nin_write()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:121:7: note: in expansion of macro ‘CS_H’
    121 | CS_H;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::begin_tft_read()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: ‘GPIO’ was not declared in this scope
    233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:141:5: note: in expansion of macro ‘CS_L’
    141 | CS_L;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::end_tft_read()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:161:7: note: in expansion of macro ‘CS_H’
    161 | CS_H;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::writecommand(uint8_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:964:3: note: in expansion of macro ‘DC_C’
    964 | DC_C;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::writedata(uint8_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: ‘GPIO’ was not declared in this scope
    189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1012:3: note: in expansion of macro ‘DC_D’
    1012 | DC_D; // Play safe, but should already be in data mode
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘uint8_t TFT_eSPI::readcommand8(uint8_t, uint8_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1049:3: note: in expansion of macro ‘DC_C’
    1049 | DC_C; tft_Write_8(0xD9);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘virtual uint16_t TFT_eSPI::readPixel(int32_t, int32_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1205:3: note: in expansion of macro ‘CS_H’
    1205 | CS_H;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::readRectRGB(int32_t, int32_t, int32_t, int32_t, uint8_t
    )’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:2209:3: note: in expansion of macro ‘CS_H’
    2209 | CS_H;
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘virtual void TFT_eSPI::setWindow(int32_t, int32_t, int32_t, int32_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3419:5: note: in expansion of macro ‘DC_C’
    3419 | DC_C; tft_Write_8(TFT_CASET);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘void TFT_eSPI::readAddrWindow(int32_t, int32_t, int32_t, int32_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3495:3: note: in expansion of macro ‘DC_C’
    3495 | DC_C; tft_Write_8(TFT_CASET);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function ‘virtual void TFT_eSPI::drawPixel(int32_t, int32_t, uint32_t)’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3677:7: note: in expansion of macro ‘DC_C’
    3677 | DC_C; tft_Write_8(TFT_CASET);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3684:7: note: in expansion of macro ‘DC_C’
    3684 | DC_C; tft_Write_8(TFT_PASET);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: ‘GPIO’ was not declared in this scope
    188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3690:3: note: in expansion of macro ‘DC_C’
    3690 | DC_C; tft_Write_8(TFT_RAMWR);
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Extensions/Touch.cpp: In member function ‘void TFT_eSPI::begin_touch_read_write()’:
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: ‘GPIO’ was not declared in this scope
    234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
    | ^~~~
    c:\Users\User\OneDrive\Documents\Arduino\libraries\TFT_eSPI\Extensions/Touch.cpp:20:3: note: in expansion of macro ‘CS_H’
    20 | CS_H; // Just in case it has been left low
    | ^~~~

    exit status 1

    Compilation error: exit status 1

    Please help.

    Reply
    • Hi.
      in Arduino IDE go to Tools > Partition scheme > choose anything that has more than 1.4MB APP, for example: “Huge APP (3MB No OTA/1MB SPIFFS“.
      Regards,
      SAra

      Reply
  65. Hi, can the RX & TX pins on the P1 connector be used to communicate with another serial port (e.g. from a PMS5003/PMS7003 sensor) or are they permanently assigned to the module’s serial console and programming?

    Reply

Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.