Fixing Cheap Yellow Display Frustrations

Making the ESP32-based "cheap yellow display" slightly less frustrating.

Alasdair Allan
6 months ago
A "cheap yellow display" (📷: Larry Bank)

The ESP32-2432S028R development board has become known in the maker community as the “Cheap Yellow Display” or CYD for short. Built around an ESP32-WROOM-32 module, the board comes with a 320 × 280 pixel 2.8-inch TFT touchscreen LCD, a microSD card slot, and an RGB LED. These are really rather nice boards. A lot of work has also been put in by various people in the community, like Brian Lough, to support them where the manufacturer fell down.

However, support for the display itself is based around the Bodmer TFT_eSPI display driver — an Arduino and PlatformIO IDE-compatible TFT library optimized for the RP2040, STM32, ESP8266, and ESP32 that supports different driver chips — which takes some configuration depending on the specific display is being used. For people hoping to use these boards directly from the Arduino environment, that can be frustrating.

"The user is required to set up a lot of macro defines and/or copy and edit a .h file filled with the unique info for the target display," says Larry Bank, "…for a user who is not a C++ expert, nor experienced with these displays, editing that file can be a challenge."

Bank therefore sat down and did wrote some code to simplify configuration and let users get started with CYDs more easily.

//
// Simple example of display and touch on CYDs (Cheap Yellow Displays)
//
// written by Larry Bank
// Copyright (c) 2024 BitBank Software, Inc.
//
#include <bb_spi_lcd.h>
BB_SPI_LCD lcd;

void setup() {
lcd.begin(DISPLAY_CYD); // initialize the LCD in landscape mode
lcd.fillScreen(TFT_BLACK);
lcd.setFont(FONT_12x16);
lcd.setTextColor(TFT_GREEN, TFT_BLACK);
lcd.println("CYD LCD & Touch Test");
lcd.rtInit(); // initialize the resistive touch controller
} /* setup() */

void loop() {
TOUCHINFO ti;
bool bPrinted = false;

while (1) {
lcd.rtReadTouch(&ti);
if (ti.count > 0) {
lcd.setCursor(0,16);
lcd.printf("Touch at: %d,%d ", ti.x[0], ti.y[0]);
bPrinted = true;
} else {
if (bPrinted) { // erase old info
bPrinted = false;
lcd.setCursor(0,16);
lcd.print(" "); // erase the line
}
}
}
} /* loop() */

More information can be found on Bank's CYD_Project GitHub repo where the README file talks you through the different variants of the CYD board and how to configure things — directly from your Arduino code — using his library code.

Alasdair Allan
Scientist, author, hacker, maker, and journalist. Building, breaking, and writing. For hire. You can reach me at 📫 alasdair@babilim.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles