ESP32 Cheap Yellow Display (CYD)

repository·main·Indexed 26 days ago

https://github.com/witnessmenow/esp32-cheap-yellow-display

Documentation and resources for the ESP32-2432S028R, a low-cost ESP32 board with an integrated 2.8" LCD and resistive touchscreen. Includes 3D design files for cases and stands, ESPHome configuration guides, and implementation examples for LVGL 8/9, ESP-IDF, and openHASP.

Tokens
9.2K
Snippets
19
Records
84
Agent score
85%

What's inside esp32-cheap-yellow-display

  1. Overview of the ESP32 Cheap Yellow Display (CYD)

    main
    The ESP32 Cheap Yellow Display (CYD), officially known as the ESP32-2432S028R, is an affordable development board featuring an integrated ESP32 microcontroller and a 2.8" LCD display. It is designed for rapid prototyping without the need for soldering or external components.
  2. Understand the 3248S035C Hardware Modification for Performance

    main

    The provided Rust example for the 3248S035C variant is designed for hardware that has been manually modified to improve screen performance.

    The Problem: On stock hardware, the LCD and the XPT2046 touch controller share the same SPI bus. Because the XPT2046 requires a low clock speed (2.5MHz) and the LCD can run much faster (80MHz), the shared bus limits the LCD update performance.

    The Modification: The XPT2046 sck, din, and dout pins have been moved to GPIO 22, 26, and 39 respectively using Kynar wires. This allows the LCD and touch controller to operate on separate SPI buses.

    Reverting to Stock Hardware: To use this code with unmodified hardware, you must replace the embedded_hal_bus::ExclusiveDevice instances with embedded_hal_bus::CriticalSectionDevice instances. Both should be provided with the same embedded_hal::SpiDevice reference. Note that this will result in slower screen updates.

  3. Available ESPHome Example Projects for CYD

    main

    The repository provides several YAML examples for different features of the ESP32-2432S028R display:

    • 1-HelloWorld: Displays centered 'Hello World' text.
    • 2-ESPHomeClock: Displays the ESPHome logo with the current date and time.
    • 3-RGBLED: Publishes the onboard RGB LED status to Home Assistant.
    • 4-TouchDemo: Creates two rectangles acting as binary touch sensors in Home Assistant.
    • 5-TemperatureGraph: Visualizes a Home Assistant temperature sensor via a graph.
    • 6-VariousFeatures: A comprehensive example for boards with 2 USB ports (also compatible with single USB port boards).
    • 7-ExtendedTouchDemo: An advanced touch demo including Material Design Icons, a WiFi signal icon, backlight sleep mode, and onboard LED control.

    Note: Some examples require you to manually copy font or image files into your ESPHome folder. Instructions for these files are included within the respective YAML files.

  4. Install LVGL for CYD in Arduino IDE

    main

    To use the LVGL 9 examples with the ESP32 Cheap Yellow Display (CYD), follow these specific installation steps. Note that standard LVGL installation via the Library Manager requires manual file manipulation to work with the Arduino IDE and the CYD hardware.

    1. Install Required Libraries

    Install the following via the Arduino Library Manager:

    • TFT_eSPI: Ensure it is configured for the CYD display.
    • XPT2046_Touchscreen: Ensure the touchscreen is working using the 2-TouchTest example.
    • LVGL: Install version v9.0.0.

    Warning:

    • Do not install lv_examples (intended for older versions).
    • Do not install lv_arduino (a different port).

    2. Manual Configuration

    Because of Arduino IDE limitations and CYD hardware architecture (where the XPT2046 is on a different SPI bus than the display), you must perform these steps:

    1. Configure lv_conf.h: Copy the lv_conf.h file from the Examples/LVGL9/ folder in this repository to your Arduino libraries folder (the parent directory containing all your library folders, not inside the LVGL library folder itself).
    2. Relocate LVGL Directories: Inside your LVGL library directory, move both the examples and demos directories into the src directory.
  5. Configure ESPHome for CYD with USB-C Hardware

    main

    If you are using the newer hardware version of the ESP32-2432S028R that features a USB-C connector, you must configure the ili9xxx display platform with specific settings: model ili9342, no rotation, and invert_colors: true.

    display:
      - platform: ili9xxx
        id: esp_display
        model: ili9342
        spi_id: tft
        cs_pin: GPIO15
        dc_pin: GPIO2
        invert_colors: true