Cheep Yellow Display ESP32 ESPHOME

Hallo ich bekomme mein CYD ESP32-2432S028 einfach nicht zum laufen das Display zeigt immer nur “Schneegestöber” an.

Ich komme mit dem Code einfach nicht weiter. Hat einer von euch eine Idee?

esphome:
  name: cyd
  friendly_name: CYD

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "8svgc3SC2Tzjw5F+6SP4aet+tTe4KKj+TG72/ny+qDA="

ota:
  - platform: esphome
    password: "de63498622927f5a3caa50c9d5dc4286"


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  reboot_timeout: 5min
  fast_connect: true

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cyd Fallback Hotspot"
    password: "MBPjjXBwIqAX"

captive_portal:

#web_server:
#  port: 80
#  version: 3
#  local: true
##  auth:
##    username: !secret web_server_username
##    password: !secret web_server_password
#
#time:
#  - platform: homeassistant
#    id: esptime

##########################################################################################################
# SPI aktivieren für das Display (Strapping-Pins vermeiden)
# Setup SPI for the display. The ESP32-2432S028R uses separate SPI buses for display and touch
spi:
  - id: tft
    clk_pin: GPIO14
    mosi_pin: GPIO13
    miso_pin: GPIO12
  - id: touch
    clk_pin: GPIO25
    mosi_pin: GPIO32
    miso_pin: GPIO39 

# Display-Treiber für das Cheap Yellow Display (ILI9341)
display:
  - platform: ili9xxx
    id: my_display
    model: ILI9341
    spi_id: tft
    cs_pin: GPIO15
    dc_pin: GPIO02
    dimensions:
      width: 320
      height: 240
    rotation: 90
    invert_colors: false
    #update_interval: 1s
    lambda: |-
      it.printf(30, 18, id(my_font), "%s", id(oledtext).state.c_str());
    

# Schriftart
font:
  - file: "fonts/roboto.ttf"
    id: my_font
    size: 15

text_sensor:
  - platform: homeassistant
    name: "OLED Text"
    entity_id: input_text.oledtext
    id: oledtext
    on_value:
      then:
        - component.update: my_display


# Sensor aus Home Assistant
sensor:
  - platform: homeassistant
    id: power_sensor
    entity_id: sensor.shelly_3pm_pro_total_active_power
    internal: true


# Software-Schalter für Neustart
switch:
  - platform: restart
    id: restart_switch

light:
  - platform: monochromatic
    output: backlight_pwm
    name: Display Backlight
    id: backlight
    restore_mode: ALWAYS_ON
  - platform: rgb
    name: LED
    red: output_red
    id: led
    green: output_green
    blue: output_blue
    restore_mode: ALWAYS_OFF

output:
  - platform: ledc
    pin: GPIO21
    id: backlight_pwm
  - platform: ledc
    id: output_red
    pin: GPIO4
    inverted: true
  - platform: ledc
    id: output_green
    pin: GPIO16
    inverted: true
  - platform: ledc
    id: output_blue
    pin: GPIO17
    inverted: true

Hi x1marc,

Ich habe mal in meinen Code für ein scheinbar ähnliches CYD geschaut und finde dort nur einen Unterschied in der Ansteuerung.

Bei mir ist der dc_pin im display auf GPIO2 und nicht auf GPIO02 gesetzt, also ohne die explizite 0 .

Gruß

Angus71

Danke für den Tipp ich hab es getestet aber leider führt das nicht dazu das das Display funktioniert.
Mit eine anderen Firmware aus dem Internet geht aber das Display und der Touchscreen. Daher kann ich ein defekt ausschließen.

Hi x1marc,

Wenn ich dazu komme, lade ich deinen Code Morgen mal auf eins meiner CYD … Mal sehen, ob er dort funktioniert … Ich glaube auch nicht, das es ein Defekt ist. Ist es Absicht, dass du keinen touchscreen definiert hast?

# Set up the xpt2046 touch platform
touchscreen:
  platform: xpt2046
  spi_id: touch
  cs_pin: GPIO33
  interrupt_pin: GPIO36
  threshold: 400
  #update_interval: 50ms
  calibration:
    x_min: 220
    x_max: 3760
    y_min: 270
    y_max: 3760
  transform:
    mirror_x: true
    mirror_y: true
    swap_xy: true

Ein weiterer Unterschied bei mir ist die model Info ist bei mir in lowercase … Aber das sollte auch keinen Unterschied machen :slight_smile:

display:
  - platform: ili9xxx
    model: ili9341
    spi_id: tft
    cs_pin: GPIO15
    dc_pin: GPIO2
....

Viel Dank das wäre super wenn sie mir ihren Code als Beispiel geben könnten.

Hi x1marc,

Ich glaube ich habe gute und schlechte Nachrichten :slight_smile:

Ich habe meinen alten Code mal mit der aktuellen ESPHome Version übersetzt und habe genau das selbe Problem wie du … Wenn ich mich richtig erinnere, dann ist der benutze MADCTL Wert für dieses Display nicht korrekt … Da es noch eine init_sequence für die display Komponente gibt kann man da sicher was machen … Da muss ich mal später schauen :slight_smile:

Soweit die schlecht Nachricht …

Ich habe mal ein minimales Code Fragment auf lvgl Basis erstellt, welches auf Anhieb auf meinem Display funktioniert hat … Da fehlt noch dein Code, aber dass sollte auf lvgl Basis auch einfach sein und das Display sollte erstmal laufen … Für weitere Tests einfach show_test_card auf false setzen …


# Hier bitte deinen Header einfügen .. Also den Code vom Anfang bis `captive_portal:`

light:
# Set up display backlight
  - platform: monochromatic
    output: backlight_pwm
    name: Display Backlight
    id: backlight
    restore_mode: ALWAYS_ON

output:
  - platform: ledc
    pin: GPIO21
    id: backlight_pwm

# Setup SPI for the display. The ESP32-2432S028R uses separate SPI buses for display and touch
spi:
  - id: tft
    clk_pin: GPIO14
    mosi_pin: GPIO13
    miso_pin: GPIO12
  - id: touch
    clk_pin: GPIO25
    mosi_pin: GPIO32
    miso_pin: GPIO39

display:
  - platform: ili9xxx
    model: ili9341
    spi_id: tft
    cs_pin:
      number: GPIO15
      ignore_strapping_warning: true
    dc_pin:
      number: GPIO2
      ignore_strapping_warning: true
    invert_colors: false
    show_test_card: true
    transform:
      swap_xy: false
      mirror_x: true
    dimensions:
      width: 320
      height: 240

# Set up the xpt2046 touch platform
touchscreen:
  platform: xpt2046
  spi_id: touch
  cs_pin: GPIO33
  interrupt_pin: GPIO36
  threshold: 400
  #update_interval: 50ms
  calibration:
    x_min: 220
    x_max: 3760
    y_min: 270
    y_max: 3760
  transform:
    mirror_x: true
    mirror_y: true
    swap_xy: true

lvgl:
  buffer_size: 25%

Hi x1marc,

Kurzes Update … Es scheint tatsächlich in der alten Implementierung nur eine Zeile in der display Konfiguration zu fehlen … color_palette: 8bit

Mit der funktioniert bei mir dann auch die alte Implementierung wieder :slight_smile:

Siehe auch EspHome Issue #6817

display:
  - platform: ili9xxx
    id: my_display
    model: ILI9341
    spi_id: tft
    cs_pin: GPIO15
    dc_pin: GPIO02
    dimensions:
      width: 320
      height: 240
    rotation: 90
    invert_colors: false
    color_palette: 8bit
    #update_interval: 1s
    lambda: |-
      it.printf(30, 18, id(my_font), "%s", id(oledtext).state.c_str());

Vielen dank für die Bemühungen. Mit ihrer Hilfe habe ich es endlich geschafft das es funktioniert. :+1: :+1: