ILI9341 TFT LCD

Philips Hue Wandschalter Modul, Doppelpack, ermöglicht ständige Erreichbarkeit von Hue Lampen, Installation hinter vorhandende Wandschalter, 2-er Pack, Weiß
Philips Hue Wandschalter Modul, Doppelpack, ermöglicht ständige Erreichbarkeit von Hue Lampen, Installation hinter vorhandende Wandschalter, 2-er Pack, Weiß
Unverb. Preisempf.: 79,99 €
49,99 €
Sie sparen 30,00 € (38%)

Vielen dank an, Dr.Jones für die Bereitstellung seines Projektes.

Pinbelegung:

Display –> ESP-Wromm32

CS ———–> GPIO27
Reset ——–> GPIO5
D/C ———-> GPIO26
SDI(MOSI)—-> GPIO23
SCK ———-> GPIO18
LED ———-> GPIO4
SDO(MISO) –>GPIO19

Konfiguration für das Display

display:
  - platform: ili9341
    model: TFT_2.4
    cs_pin: 27
    dc_pin: 26
    led_pin: 4
    reset_pin: 5
    rotation: 270

spi:
 clk_pin: 18 
 mosi_pin: 23
 miso_pin: 19

output:
  - platform: ledc
    pin: 4
    id: gpio_4_backlight_pwm
    
light:
  - platform: monochromatic
    output: gpio_4_backlight_pwm
    name: "Touchdisplay Licht"
    id: back_light
    restore_mode: ALWAYS_ON

Schriften und Farben

font:
  - file: 'arial.ttf'
    id: font1
    size: 20
    glyphs:
      ['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
       
  - file: 'arial.ttf'
    id: font2
    size: 24
    glyphs:
      ['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
       
color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_turkis
    red: 5%
    green: 50%
    blue: 80%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%

Textausgabe

lambda: |-
      it.printf(145, 60, id(font1), my_red, "Smarthome yourself");

Beispiel für Wetterdaten auf dem Display

text_sensor:
  - platform: homeassistant
    id: wetter_ani
    entity_id: weather.dwd_weather_berlin_brandenburg
    filters:
    - substitute:
      - "sunny -> sonnig"
      - "partlycloudy -> teilweise wolkig"
      - "rainy -> Regen"
      - "windy -> windig"
      - "snowy -> Schnee"
      - "lightning -> Gewitter"
      - "cloudy -> wolkig"
      
  - platform: homeassistant
    id: windgeschwindigkeit
    entity_id: weather.dwd_weather_berlin_brandenburg

Beispiel für Textausgabe auf dem Display

 it.printf(145, 80, id(font1), id(wetter_ani).state.c_str());
 it.printf(145, 98, id(font1), "Wind: %.1f km/h", id(wind_speed).state);

Vollständiges Esphome Code-Beispiel

esphome:
  name: touchdisplay
  platform: ESP32
  board: nodemcu-32s
  platformio_options:
    upload_speed: 921600
    monitor_speed: 115200


logger:

api:

ota:
  password: "cc3e253e9022dac095965c5e0563989d"

wifi:
  ssid: SSID
  password: "PASSWORT"
  power_save_mode: none
  output_power: 20dB

  ap:
    ssid: "Touchdisplay Fallback Hotspot"
    password: "xVxOKhNVKpWm"

captive_portal:

sensor:
  - platform: homeassistant
    id: temp_keller
    entity_id: sensor.temp_keller

  - platform: homeassistant
    id: temp_aussen
    entity_id: sensor.temp_aussen
    
  - platform: homeassistant
    id: wind_speed
    entity_id: sensor.wind_speed
    
    
  - platform: homeassistant
    id: ha_disk_use
    entity_id: sensor.disk_use
    
  - platform: homeassistant
    id: phase_a
    entity_id: sensor.shellyem3_c45bbe6c1e95_channel_a_power    
    
  - platform: homeassistant
    id: phase_b
    entity_id: sensor.shellyem3_c45bbe6c1e95_channel_b_power
    
  - platform: homeassistant
    id: phase_c
    entity_id: sensor.shellyem3_c45bbe6c1e95_channel_c_power
    
binary_sensor:
  - platform: homeassistant
    id: lino
    entity_id: binary_sensor.pet_lino

time:
  - platform: homeassistant
    id: homeassistant_time

text_sensor:
  - platform: homeassistant
    id: abfall_naechster
    entity_id: sensor.abfallnaechster
    
  - platform: homeassistant
    id: nachster_abfall
    entity_id: sensor.nachster_abfall
    
  - platform: homeassistant
    id: wetter_ani
    entity_id: weather.dwd_weather_berlin_brandenburg
    filters:
    - substitute:
      - "sunny -> sonnig"
      - "partlycloudy -> teilweise wolkig"
      - "rainy -> Regen"
      - "windy -> windig"
      - "snowy -> Schnee"
      - "lightning -> Gewitter"
      - "cloudy -> wolkig"
      
  - platform: homeassistant
    id: windgeschwindigkeit
    entity_id: weather.dwd_weather_berlin_brandenburg
      
      
font:
  - file: 'arial.ttf'
    id: font1
    size: 20
    glyphs:
      ['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
       
  - file: 'arial.ttf'
    id: font2
    size: 24
    glyphs:
      ['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
       
color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_turkis
    red: 5%
    green: 50%
    blue: 80%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%

image:
  - file: "image.jpg"
    id: my_image
    type: RGB24
    
  - file: "smarthomeinberlin.png"
    id: my_logo
    resize: 70x70
    type: RGB24
    
  - file: "temp.gif"
    id: thermometer
  - file: "trash.gif"
    id: trash


display:
  - platform: ili9341
    model: TFT_2.4
    cs_pin: 27
    dc_pin: 26
    led_pin: 4
    reset_pin: 5
    rotation: 270
    lambda: |-
      it.printf(2, 5, id(font1), "HA Disk use");
      it.printf(115, 5, id(font1), "%.1fGB", id(ha_disk_use).state);
      it.image(250, 5, id(my_logo));
      it.line(0, 80, 400, 80);
      it.printf(25, 30, id(font1), "Abholung");
      it.print(0, 55, id(font1), id(nachster_abfall).state.c_str());
      it.printf(2, 80, id(font1), "Aussen: %.1f°C", id(temp_aussen).state);
      it.printf(2, 98, id(font1), "Innen: %.1f°C", id(temp_keller).state);
      it.printf(145, 80, id(font1), id(wetter_ani).state.c_str());
      it.printf(145, 98, id(font1), "Wind: %.1f km/h", id(wind_speed).state);
      it.line(0, 121, 400, 121);
      it.image(0, 30, id(trash));
      it.line(140, 122, 140, 240);
      it.printf(145, 120, id(font1), my_red, "Stromverbrauch");
      it.printf(235, 140, id(font1), "%.1f W", id(phase_a).state);
      it.printf(235, 160, id(font1), "%.1f W", id(phase_b).state);
      it.printf(235, 180, id(font1), "%.1f W", id(phase_c).state);
      it.printf(145, 140, id(font1), my_green, "Phase A");
      it.printf(145, 160, id(font1), my_turkis, "Phase B");
      it.printf(145, 180, id(font1), my_yellow, "Phase C");
      it.printf(2, 122, id(font1), "Lino: %s", id(lino).state ? "Zuhause" : "Draussen");
      it.line(140, 205, 340, 205);
      it.strftime(150, 210, id(font2), "%H:%M %d.%m.%y", id(homeassistant_time).now());

spi:
 clk_pin: 18 
 mosi_pin: 23
 miso_pin: 19

output:
  - platform: ledc
    pin: 4
    id: gpio_4_backlight_pwm
    
light:
  - platform: monochromatic
    output: gpio_4_backlight_pwm
    name: "Touchdisplay Licht"
    id: back_light
    restore_mode: ALWAYS_ON