|
| 1 | +# ============================================================================ |
| 2 | +# ESPHome YAML - Generated by ESPHome Designer |
| 3 | +# ============================================================================ |
| 4 | +# TARGET DEVICE: Guition 2432S028R 240x320 ESP32 2.8-inch LCD resistor touch |
| 5 | +# - ESP32: Sparkleiot XH-32S |
| 6 | +# - Display Platform: 2.8-inch color TFT display screen with ILI9341 driver chip |
| 7 | +# - PSRAM: None |
| 8 | +# - Touchscreen: XPT2046 |
| 9 | +# - Framework: ESP-IDF |
| 10 | +# Name: Guition 2432S028R 240x320 ESP32 2.8-inch LCD resistor touch |
| 11 | +# Resolution: 240x320 |
| 12 | +# Shape: rectangle |
| 13 | +# ============================================================================ |
| 14 | +# |
| 15 | +# BASED ON: https://randomnerdtutorials.com/esp32-cheap-yellow-display-cyd-pinout-esp32-2432s028r/ |
| 16 | +# Hardware configuration adapted for ESPHome Designer. |
| 17 | +# |
| 18 | +# ============================================================================ |
| 19 | +# |
| 20 | +# SETUP INSTRUCTIONS: |
| 21 | +# |
| 22 | +# STEP 1: Copy the Material Design Icons font file |
| 23 | +# - From this repo: resources/fonts/materialdesignicons-webfont.ttf |
| 24 | +# - To ESPHome: /config/esphome/fonts/materialdesignicons-webfont.ttf |
| 25 | +# (Create the fonts folder if it doesn't exist) |
| 26 | +# |
| 27 | +# STEP 2: Create a new device in ESPHome |
| 28 | +# - Click "New Device" |
| 29 | +# - Name: your-device-name |
| 30 | +# - Select: ESP32 |
| 31 | +# - Framework: ESP-IDF (Required for this device) |
| 32 | +# |
| 33 | +# STEP 3: PASTE this snippet into your device YAML |
| 34 | +# - Paste this snippet at the end of your configuration. |
| 35 | +# - System sections (esphome, esp32, psram, etc.) are auto-commented |
| 36 | +# to avoid conflicts with your existing setup. |
| 37 | +# |
| 38 | +# ============================================================================ |
| 39 | + |
| 40 | +substitutions: |
| 41 | + name: "guiton_2432s028r_esp32" |
| 42 | + friendly_name: 'Guition 2432S028R ESP32-2.8" ' |
| 43 | + device_description: "Guition 2432S028R ESP32-2.8-inch resistor touch 240x320" |
| 44 | + project_name: "karl-petter.ESPHomeDesigner_Guition_2432S028R_240x320" |
| 45 | + project_version: "1.0.0" |
| 46 | + #GPIO pins for the LCD screen |
| 47 | + misopin: GPIO12 |
| 48 | + mosipin: GPIO13 |
| 49 | + sclkpin: GPIO14 |
| 50 | + cspin: GPIO15 |
| 51 | + dcpin: GPIO2 |
| 52 | + blpin: GPIO21 |
| 53 | + # GPIO pins for Touchpanel |
| 54 | + tp_irqpin: GPIO36 |
| 55 | + tp_mosipin: GPIO32 |
| 56 | + tp_misopin: GPIO39 |
| 57 | + tp_clkpin: GPIO25 |
| 58 | + tp_cspin: GPIO33 |
| 59 | + # GPIO pins for RGB LED |
| 60 | + led_rpin: GPIO4 |
| 61 | + led_gpin: GPIO16 |
| 62 | + led_bpin: GPIO17 |
| 63 | + # GPIO LDR |
| 64 | + ldr_pin: GPIO34 |
| 65 | + # GPIO pins for i2c |
| 66 | + sdapin: GPIO27 |
| 67 | + sclpin: GPIO22 |
| 68 | + # SD Card |
| 69 | + sd_cs_pin: GPIO4 |
| 70 | + logger: DEBUG |
| 71 | + |
| 72 | +esphome: |
| 73 | + friendly_name: $friendly_name |
| 74 | + name: $name |
| 75 | + project: |
| 76 | + name: "${project_name}" |
| 77 | + version: "${project_version}" |
| 78 | + |
| 79 | +esp32: |
| 80 | + board: esp32dev |
| 81 | + framework: |
| 82 | + type: esp-idf |
| 83 | + |
| 84 | +spi: |
| 85 | + - id: tft |
| 86 | + clk_pin: $sclkpin |
| 87 | + mosi_pin: $mosipin |
| 88 | + miso_pin: |
| 89 | + number: $misopin |
| 90 | + ignore_strapping_warning: true |
| 91 | + - id: touch |
| 92 | + clk_pin: $tp_clkpin |
| 93 | + mosi_pin: $tp_mosipin |
| 94 | + miso_pin: $tp_misopin |
| 95 | + |
| 96 | +i2c: |
| 97 | + sda: $sdapin |
| 98 | + scl: $sclpin |
| 99 | + |
| 100 | +output: |
| 101 | + - platform: ledc |
| 102 | + pin: $blpin |
| 103 | + frequency: 1000hz |
| 104 | + id: gpio_backlight_pwm |
| 105 | + - id: output_red |
| 106 | + platform: ledc |
| 107 | + pin: $led_rpin |
| 108 | + inverted: true |
| 109 | + - id: output_green |
| 110 | + platform: ledc |
| 111 | + pin: $led_gpin |
| 112 | + inverted: true |
| 113 | + - id: output_blue |
| 114 | + platform: ledc |
| 115 | + pin: $led_bpin |
| 116 | + inverted: true |
| 117 | + |
| 118 | +light: |
| 119 | + - platform: monochromatic # Define a monochromatic, dimmable light for the backlight |
| 120 | + output: gpio_backlight_pwm |
| 121 | + name: Display Backlight |
| 122 | + icon: mdi:lightbulb-on |
| 123 | + id: display_backlight |
| 124 | + restore_mode: ALWAYS_ON |
| 125 | + - platform: rgb # RGB Led on backside |
| 126 | + id: rgb_led |
| 127 | + name: RGB LED |
| 128 | + red: output_red |
| 129 | + green: output_green |
| 130 | + blue: output_blue |
| 131 | + restore_mode: ALWAYS_OFF |
| 132 | + |
| 133 | +sensor: |
| 134 | + # Board LDR |
| 135 | + - platform: adc |
| 136 | + pin: $ldr_pin |
| 137 | + name: "board_ldr" |
| 138 | + update_interval: 1500ms |
| 139 | + |
| 140 | +touchscreen: |
| 141 | + - id: my_touchscreen |
| 142 | + platform: xpt2046 |
| 143 | + spi_id: touch |
| 144 | + cs_pin: $tp_cspin |
| 145 | + interrupt_pin: $tp_irqpin |
| 146 | + threshold: 400 |
| 147 | + calibration: |
| 148 | + x_min: 280 |
| 149 | + x_max: 3860 |
| 150 | + y_min: 340 |
| 151 | + y_max: 3860 |
| 152 | + transform: |
| 153 | + mirror_x: true |
| 154 | + on_touch: |
| 155 | + - lambda: |- |
| 156 | + ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", |
| 157 | + touch.x, |
| 158 | + touch.y, |
| 159 | + touch.x_raw, |
| 160 | + touch.y_raw |
| 161 | + ); |
| 162 | +
|
| 163 | +display: |
| 164 | + - id: my_display |
| 165 | + platform: ili9xxx |
| 166 | + model: ILI9341 |
| 167 | + spi_id: tft |
| 168 | + cs_pin: |
| 169 | + number: $cspin |
| 170 | + ignore_strapping_warning: true |
| 171 | + dc_pin: |
| 172 | + number: $dcpin |
| 173 | + ignore_strapping_warning: true |
| 174 | + invert_colors: false |
| 175 | + auto_clear_enabled: false |
| 176 | + color_order: BGR |
| 177 | + color_palette: 8BIT |
| 178 | + dimensions: |
| 179 | + width: 240 |
| 180 | + height: 320 |
| 181 | + lambda: |- |
| 182 | + # __LAMBDA_PLACEHOLDER__ |
0 commit comments