← Free library

Free library · Buying guide

ESP32 "Cheap Yellow Display" boards

20 Sep 2026Buying guide, MicroPython notes and a board-detect script

"CYD" is the community nickname for a family of Sunton ESP32 boards with a colour touchscreen, a microSD slot and the ESP32 on one (usually yellow) PCB. "The CYD" usually means the 2.8" ESP32-2432S028R, but the family runs from about 1.9" up to 7".

They're cheap and brilliant, but the listings are unreliable and two boards with the same model number can behave differently. This guide covers what I've learnt buying and programming them in MicroPython.

Short answer

Best buy for MicroPython in Thonny

ESP32-2432S028R, the original single micro-USB version (ILI9341 display). Roughly A$15–30, locally or from AliExpress. Then run the board-detect script on it before you design anything around it.

1. Decode the part number

The model number tells you the resolution, the screen size and the touch type.

Resolution
2432
240 × 320
3248
320 × 480
8048
800 × 480
4827
480 × 272
1732
170 × 320
Screen size
S019
1.9"
S024
2.4"
S028
2.8"
S035
3.5"
S043
4.3"
S050
5.0"
S070
7.0"
Touch
N
None
R
Resistive, XPT2046 (SPI)
C
Capacitive, I²C: CST820 on small panels, GT911 on large

2. How the main boards compare

BoardChipDisplay busPSRAMMicroPython fit
2432S024 / S028 / S0322.4–3.2", 240 × 320ESP32 classic, 240 MHz dual-coreSPI, ILI9341 or ST7789NoneExcellent huge community
3248S0353.5", 480 × 320ESP32 classicSPI, ST7796NoneOK more pixels on slow SPI
4827S0434.3", 480 × 272ESP32-S316-bit RGB parallelYesSpecial firmware
8048S043 / S050 / S0704.3–7", 800 × 480ESP32-S316-bit RGB parallelYesSpecial firmware
1732S019 / 2424S012small and roundS3 / C3SPIVariesFine niche
Speed

The small boards drive the screen from a classic ESP32 over SPI, so full-screen redraws are slow. Only redraw the regions that change. The S3 RGB boards have far more display bandwidth and run MicroPython noticeably faster.

Memory: the big one for MicroPython

Classic ESP32 boards have 520 KB SRAM, 4 MB flash and no PSRAM. A full 320 × 240 RGB565 framebuffer is about 150 KB, which won't reliably fit in the MicroPython heap. Draw directly to the display instead of using a full-screen framebuf.

3. Gotchas when buying

  1. There are two versions of the 2.8" board

    The original has a single micro-USB port and an ILI9341 display driver. The "CYD2USB" has micro-USB and USB-C, an ST7789 driver, and needs display inversion turned on.

    Its USB-C port has no CC resistors, so a USB-C to USB-C cable won't power it. Use a USB-A to USB-C cable, or the micro-USB port.

  2. Batches vary, even within one model

    The driver IC, the light-sensor resistor and the button positions can all change between batches. Listings and boxes aren't reliable: one buyer's box said "7789" but the board inside was an ILI9341.

  3. R or C touch

    Resistive (R) is cheaper, works with a stylus, needs calibrating and uses an SPI driver. Capacitive (C) is nicer for fingers and uses an I²C driver. Most MicroPython CYD tutorials assume the R version.

  4. Very few spare pins

    Once the display, touch, SD card and LEDs are wired, the small boards have very few GPIOs left. The big RGB boards use many pins for the panel. Check this before designing a product around a board.

4. Gotchas with MicroPython and Thonny

2.8" pin map (ESP32-2432S028)

FunctionPins
Display (HSPI)SCK 14 · MOSI 13 · MISO 12 · CS 15 · DC 2 · Backlight 21
Touch (XPT2046)SCK 25 · MOSI 32 · MISO 39 · CS 33 · IRQ 36
RGB LED (active low)Red 4 · Green 16 · Blue 17
Light sensorGPIO 34

Other sizes often move the backlight and touch pins. Keep your pin definitions in one config file so you can swap boards easily. The board-detect script below writes one for you.

5. What to buy

For MicroPython in Thonny: the ESP32-2432S028R, original single micro-USB version (ILI9341), roughly A$15–30.

Listing checklist

Even so, run the board-detect script on every new board before designing around it.

Choose something else if:

6. Board-detect script

cyd_board_detect.py tells you exactly which board you've been sent, fixes the colours and saves a config file your projects can import. It's self-contained, so no display driver library is needed.

Download cyd_board_detect.py BetaNot yet tested on every board revision

To use it: flash ESP32_GENERIC MicroPython, open the file in Thonny, press F5, and answer the prompts in the Shell.

  1. Board info. CPU speed, flash size and free RAM, which shows whether there's PSRAM.
  2. Display chip. Reads the controller ID: ILI9341 or ST7789.
  3. Colour test. Draws red, green, blue, white and black stripes. You type the colour of the top stripe, and it adjusts and redraws until it's right.
  4. Touch. Touch the screen for 8 seconds and it records the raw X/Y range for calibration. If resistive touch is silent, it scans I²C (SDA 33, SCL 32) for a capacitive chip.
  5. RGB LED and light sensor. Blinks each colour and reads the LDR.
  6. Saves cyd_config.py to the board with the working settings and pin map, so your project code can simply import cyd_config.
Top stripe looksTypeWhat it means
RedrSettings are correct
BluebRed and blue swapped: BGR toggled
CyancInversion is wrong
YellowyBoth are wrong

Capacitive chips it recognises by I²C address:

0x15
CST816 / CST820
0x14 or 0x5D
GT911
0x38
FT6x36
Good to know
  • The pin map at the top of the script is for the 2.8" boards. Check the backlight and touch pins before testing other sizes.
  • The ID read occasionally fails on some batches. The colour test has the final say.
  • On some batches the light sensor barely changes. That's a resistor difference, not a fault.
  • If a step misbehaves, copy the Shell output and email it to .
View the script (about 290 lines)
cyd_board_detect.py
# cyd_board_detect.py
# Board detect / sanity test for ESP32 "Cheap Yellow Display" boards
# Target: 2.8" ESP32-2432S028 family (single micro-USB AND 2-USB revisions)
# MicroPython - open in Thonny and press F5 (Run). Answer the prompts in the Shell.
#
# What it does:
#   1. Prints chip, CPU speed, flash size and free RAM (spots PSRAM)
#   2. Reads the display controller ID (ILI9341 vs ST7789)
#   3. Draws colour stripes and walks you through fixing inversion / BGR
#   4. Tests resistive touch (XPT2046); if silent, scans I2C for a capacitive chip
#   5. Blinks the RGB LED and reads the light sensor
#   6. Saves the working settings to cyd_config.py on the board
#
# AP Design Labs - apdesignlabs.com.au
# Beta: not yet tested on every board revision. If a step misbehaves, send the Shell output.

import time, gc, os, machine, esp
from machine import Pin, SPI, SoftSPI, ADC, I2C

# ---------------- Pin map: 2.8" ESP32-2432S028 ----------------
# Other CYD sizes move pins (especially backlight and touch) - edit here.
TFT_SCK, TFT_MOSI, TFT_MISO = 14, 13, 12
TFT_CS, TFT_DC, TFT_BL = 15, 2, 21
TP_SCK, TP_MOSI, TP_MISO, TP_CS, TP_IRQ = 25, 32, 39, 33, 36
LED_R, LED_G, LED_B = 4, 16, 17      # RGB LED, active low
LDR_PIN = 34                          # light sensor

W, H = 240, 320                       # native portrait size

# RGB565 colours
RED, GREEN, BLUE, WHITE, BLACK = 0xF800, 0x07E0, 0x001F, 0xFFFF, 0x0000

# ---------------- Low-level display helpers ----------------
cs = Pin(TFT_CS, Pin.OUT, value=1)
dc = Pin(TFT_DC, Pin.OUT, value=1)
bl = Pin(TFT_BL, Pin.OUT, value=1)    # backlight on
spi = None


def make_spi(baud):
    global spi
    spi = SPI(1, baudrate=baud, polarity=0, phase=0,
              sck=Pin(TFT_SCK), mosi=Pin(TFT_MOSI), miso=Pin(TFT_MISO))


def cmd(c, data=None):
    cs(0)
    dc(0)
    spi.write(bytes([c]))
    if data:
        dc(1)
        spi.write(data)
    cs(1)


def read_reg(c, n):
    cs(0)
    dc(0)
    spi.write(bytes([c]))
    dc(1)
    buf = spi.read(n)
    cs(1)
    return buf


def window(x0, y0, x1, y1):
    cmd(0x2A, bytes([x0 >> 8, x0 & 255, x1 >> 8, x1 & 255]))
    cmd(0x2B, bytes([y0 >> 8, y0 & 255, y1 >> 8, y1 & 255]))


def fill_rect(x, y, w, h, colour):
    window(x, y, x + w - 1, y + h - 1)
    rows = 8
    chunk = bytes([colour >> 8, colour & 255]) * (w * rows)
    cs(0)
    dc(0)
    spi.write(b"\x2C")
    dc(1)
    full, rem = divmod(h, rows)
    for _ in range(full):
        spi.write(chunk)
    if rem:
        spi.write(chunk[: w * rem * 2])
    cs(1)


def init_display(bgr, invert):
    cmd(0x01)                                   # software reset
    time.sleep_ms(150)
    cmd(0x11)                                   # sleep out
    time.sleep_ms(120)
    cmd(0x3A, b"\x55")                          # 16-bit colour
    cmd(0x36, bytes([0x40 | (0x08 if bgr else 0)]))   # MADCTL: MX + BGR bit
    cmd(0x21 if invert else 0x20)               # inversion on / off
    cmd(0x29)                                   # display on
    time.sleep_ms(20)


def draw_stripes():
    h = H // 5
    for i, c in enumerate((RED, GREEN, BLUE, WHITE, BLACK)):
        fill_rect(0, i * h, W, h, c)


# ---------------- 1. Board info ----------------
def board_info():
    print("\n=== Board info ===")
    u = os.uname()
    print("Firmware :", u.release)
    print("Module   :", u.machine)
    print("CPU      :", machine.freq() // 1_000_000, "MHz")
    try:
        print("Flash    :", esp.flash_size() // (1024 * 1024), "MB")
    except Exception:
        print("Flash    : (unknown)")
    gc.collect()
    free = gc.mem_free()
    psram = free > 1_000_000
    print("Free RAM :", free // 1024, "KB",
          "-> PSRAM present" if psram else "-> no PSRAM (don't use full-screen framebuffers)")
    return psram


# ---------------- 2. Display controller ID ----------------
def detect_driver():
    print("\n=== Display controller ===")
    make_spi(4_000_000)                          # reads need a slow clock
    cmd(0x01)
    time.sleep_ms(150)
    cmd(0x11)
    time.sleep_ms(120)

    d3 = read_reg(0xD3, 4)                       # ILI9341: dummy, 00, 93, 41
    d3_shift = (int.from_bytes(d3, "big") >> 7) & 0xFFFF
    if (d3[2] == 0x93 and d3[3] == 0x41) or d3_shift == 0x9341:
        print("ID 0xD3 =", d3, "-> ILI9341 (original single micro-USB CYD)")
        return "ILI9341"

    raw = read_reg(0x04, 4)                      # RDDID, 1 dummy clock bit
    ident = (int.from_bytes(raw, "big") >> 7) & 0xFFFFFF
    print("ID 0x04 = 0x%06X" % ident)
    if ident >> 16 == 0x85:
        print("-> ST7789 (2-USB 'CYD2USB' revision)")
        return "ST7789"

    print("-> Could not read an ID. The colour test below will still sort it out.")
    return "UNKNOWN"


# ---------------- 3. Colour / inversion test ----------------
FIXES = {  # what you see in the TOP stripe -> (toggle BGR, toggle invert)
    "r": (False, False),
    "b": (True, False),
    "c": (False, True),
    "y": (True, True),
}


def colour_test(driver):
    print("\n=== Colour test ===")
    make_spi(40_000_000)
    bgr, invert = {"ILI9341": (True, False), "ST7789": (False, True)}.get(driver, (True, False))

    for attempt in range(4):
        init_display(bgr, invert)
        draw_stripes()
        print("Stripes top to bottom should be: RED, GREEN, BLUE, WHITE, BLACK")
        ans = input("What colour is the TOP stripe? r=red b=blue c=cyan y=yellow : ").strip().lower()[:1]
        if ans not in FIXES:
            print("Please type r, b, c or y")
            continue
        t_bgr, t_inv = FIXES[ans]
        if not (t_bgr or t_inv):
            print("Colours correct.  bgr =", bgr, " invert =", invert)
            return bgr, invert
        bgr ^= t_bgr
        invert ^= t_inv
        print("Adjusting and redrawing...")
    print("Giving up after several tries - check the pin map at the top of the file.")
    return bgr, invert


# ---------------- 4. Touch test ----------------
TOUCH_I2C_NAMES = {0x15: "CST816/CST820", 0x14: "GT911", 0x5D: "GT911", 0x38: "FT6x36"}


def touch_test(seconds=8):
    print("\n=== Touch test ===")
    print("Touch and drag around the screen for", seconds, "seconds (use corners too)...")
    tp = SoftSPI(baudrate=1_000_000, polarity=0, phase=0,
                 sck=Pin(TP_SCK), mosi=Pin(TP_MOSI), miso=Pin(TP_MISO))
    tcs = Pin(TP_CS, Pin.OUT, value=1)
    irq = Pin(TP_IRQ, Pin.IN)
    buf = bytearray(3)

    def rd(c):
        tcs(0)
        tp.write_readinto(bytes([c, 0, 0]), buf)
        tcs(1)
        return ((buf[1] << 8) | buf[2]) >> 3

    xs, ys = [], []
    end = time.ticks_add(time.ticks_ms(), seconds * 1000)
    while time.ticks_diff(end, time.ticks_ms()) > 0:
        if irq.value() == 0:
            x, y = rd(0xD0), rd(0x90)
            if 100 < x < 4000 and 100 < y < 4000:
                xs.append(x)
                ys.append(y)
        time.sleep_ms(20)

    if xs:
        print("Resistive XPT2046 touch OK:", len(xs), "samples")
        print("Raw X range: %d-%d   Raw Y range: %d-%d  (use for calibration)"
              % (min(xs), max(xs), min(ys), max(ys)))
        return "XPT2046", (min(xs), max(xs), min(ys), max(ys))

    print("No resistive touch detected. Scanning I2C for a capacitive controller...")
    # On capacitive 2.8" boards GPIO25 is usually the touch chip's RESET line.
    # The resistive test above left it low (SPI clock idle), so release it first.
    Pin(TP_SCK, Pin.OUT, value=1)
    time.sleep_ms(60)
    # CST816/CST820 chips often sleep and only answer I2C while being touched.
    print("Keep touching the screen for the next 3 seconds...")
    found = []
    try:
        i2c = I2C(0, sda=Pin(33), scl=Pin(32), freq=400_000)
        end = time.ticks_add(time.ticks_ms(), 3000)
        while time.ticks_diff(end, time.ticks_ms()) > 0 and not found:
            found = i2c.scan()
            time.sleep_ms(100)
    except Exception as e:
        print("I2C scan failed:", e)
    if found:
        for a in found:
            print("  I2C device at 0x%02X %s" % (a, TOUCH_I2C_NAMES.get(a, "")))
        print("-> Probably a capacitive 'C' board - needs an I2C touch driver.")
        return "I2C@" + ",".join("0x%02X" % a for a in found), None
    print("-> Nothing found. Either you didn't touch it, or this board uses different touch pins.")
    return "NONE", None


# ---------------- 5. LED and light sensor ----------------
def led_ldr_test():
    print("\n=== RGB LED and light sensor ===")
    for name, p in (("red", LED_R), ("green", LED_G), ("blue", LED_B)):
        led = Pin(p, Pin.OUT, value=1)
        print("LED", name)
        led(0)
        time.sleep_ms(400)
        led(1)
    adc = ADC(Pin(LDR_PIN))
    adc.atten(ADC.ATTN_11DB)
    dark = adc.read()
    print("Light sensor raw:", dark, "(cover it with a finger and re-run to compare;")
    print(" some batches barely change - a known resistor difference, not a fault)")


# ---------------- 6. Save config ----------------
def save_config(driver, bgr, invert, touch, cal, psram):
    lines = [
        "# Generated by cyd_board_detect.py",
        "DRIVER = %r" % driver,
        "BGR = %r" % bgr,
        "INVERT = %r" % invert,
        "TOUCH = %r" % touch,
        "TOUCH_CAL = %r  # (xmin, xmax, ymin, ymax) raw" % (cal,),
        "PSRAM = %r" % psram,
        "TFT_SCK, TFT_MOSI, TFT_MISO = %d, %d, %d" % (TFT_SCK, TFT_MOSI, TFT_MISO),
        "TFT_CS, TFT_DC, TFT_BL = %d, %d, %d" % (TFT_CS, TFT_DC, TFT_BL),
        "TP_SCK, TP_MOSI, TP_MISO, TP_CS, TP_IRQ = %d, %d, %d, %d, %d"
        % (TP_SCK, TP_MOSI, TP_MISO, TP_CS, TP_IRQ),
        "LED_R, LED_G, LED_B = %d, %d, %d" % (LED_R, LED_G, LED_B),
        "LDR_PIN = %d" % LDR_PIN,
    ]
    text = "\n".join(lines) + "\n"
    with open("cyd_config.py", "w") as f:
        f.write(text)
    print("\n=== Saved cyd_config.py to the board ===")
    print(text)


# ---------------- Main ----------------
def main():
    psram = board_info()
    driver = detect_driver()
    bgr, invert = colour_test(driver)
    touch, cal = touch_test()
    led_ldr_test()
    save_config(driver, bgr, invert, touch, cal, psram)
    fill_rect(0, 0, W, H, GREEN)
    print("Done - screen turned green.")


main()

Sources

#ESP32#CYD#MicroPython#Thonny#Displays