Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# ============================================================================
# ESPHome YAML - Generated by ESPHome Designer
# ============================================================================
# TARGET DEVICE: Waveshare ESP32-C6 LCD 1.47" 172x320
# - Display Platform: st7789v
# - PSRAM: No
# - Touchscreen: None
# - Framework: ESP-IDF
# Name: Waveshare ESP32-C6 LCD 1.47"
# Resolution: 172x320
# Shape: rectangle
# Inverted: false
# Orrientation: portrait
# Dark Mode: disabled
# ============================================================================
#
# BASED ON: https://www.waveshare.com/esp32-c6-lcd-1.47.htm
# Hardware configuration adapted for ESPHome Designer.
#
# ============================================================================
#
# SETUP INSTRUCTIONS:
#
# STEP 1: Copy the Material Design Icons font file
# - From this repo: resources/fonts/materialdesignicons-webfont.ttf
# - To ESPHome: /config/esphome/fonts/materialdesignicons-webfont.ttf
# (Create the fonts folder if it doesn't exist)
#
# STEP 2: Create a new device in ESPHome
# - Click "New Device"
# - Name: your-device-name
# - Select: ESP32-C6
# - Framework: ESP-IDF (Required for this device)
#
# STEP 3: PASTE this snippet into your device YAML
# - Paste this snippet at the end of your configuration.
# - System sections (esphome, esp32, psram, etc.) are auto-commented
# to avoid conflicts with your existing setup.
#
# ============================================================================

substitutions:
name: "waveshare_esp32_c6_lcd_147"
id: esp32_c6_lcd_147
friendly_name: "Waveshare ESP32-C6-LCD-1.47\""
device_description: "Waveshare ESP32-C6 LCD 1.47 inch"
project_name: "karl-petter.ESPHomeDesigner_Waveshare_LCD_1_47"
project_version: "1.0.0"
#GPIO pins for the LCD screen and SD Card
rstpin: GPIO21
dcpin: GPIO15
blpin: GPIO22
clkpin: GPIO7
mosipin: GPIO6
misopin: GPIO5
cspin: GPIO14
# GPIO pins for i2c
sdapin: GPIO1
sclpin: GPIO2
# SD Card
sd_cs_pin: GPIO4
# LED
rgb_led: GPIO8
# One Wire
one_wire: GPIO10
logger: "DEBUG"

esp32:
board: esp32-c6-devkitc-1
variant: esp32c6
flash_size: 4MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT: y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y
CONFIG_OPENTHREAD_ENABLED: n
CONFIG_USE_MINIMAL_MDNS: y
# Memory optimization
COMPILER_OPTIMIZATION_SIZE: y
COMPILER_OPTIMIZATION_LEVEL_RELEASE: y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE: y
CONFIG_HEAP_POISONING_DISABLED: y

esphome:
friendly_name: $friendly_name
name: $name
project:
name: "${project_name}"
version: "${project_version}"
platformio_options:
board_build.flash_mode: dio
build_flags:
- "-DI2C_NUM_1=I2C_NUM_0"
- "-DBOARD_HAS_PSRAM"
- "-Wl,-Map,output.map"
board_build.arduino.memory_type: qio_opi

spi:
mosi_pin: $mosipin
miso_pin: $misopin
clk_pin: $clkpin

i2c:
sda: $sdapin
scl: $sclpin

one_wire:
- pin: $one_wire
platform: gpio

text_sensor:
# ESPHome Version
- platform: version
name: "ESPHome Version"
id: "${id}_esphome_version"
icon: si:esphomes
hide_timestamp: 'true'
entity_category: diagnostic
# WiFi Info: IP, MAC, SSID, BSSID, Scan
- platform: wifi_info
ip_address:
name: "IP Address"
icon: mdi:ip
entity_category: diagnostic
disabled_by_default: True
mac_address:
name: "WiFi MAC Address"
icon: mdi:fingerprint
entity_category: diagnostic
disabled_by_default: True
ssid:
name: "Connected SSID"
icon: mdi:wifi-settings
entity_category: diagnostic
disabled_by_default: True
bssid:
name: "Connected BSSID"
icon: mdi:wifi
entity_category: diagnostic
disabled_by_default: True
scan_results:
name: "Latest Scan Results"
icon: mdi:wifi-sync
entity_category: diagnostic
disabled_by_default: True

binary_sensor:
# https://esphome.io/components/binary_sensor/status.html
# Reports if this device is Connected or not
- platform: status
name: "Status"
id: "${id}_status"
icon: mdi:check-network
entity_category: diagnostic

light:
# RGB LED
- platform: esp32_rmt_led_strip
pin:
number: $rgb_led
ignore_strapping_warning: true
name: "RGB LED"
id: rgb_led
chipset: ws2812
num_leds: 1
rgb_order: RGB
# gamma_correct: 2.8
default_transition_length: 2s
restore_mode: RESTORE_DEFAULT_OFF

output:
- platform: ledc
pin: $blpin
id: lcd_backlight
frequency: 1000 Hz

number:
- platform: template
name: "Display Brightness"
id: display_brightness
optimistic: true
min_value: 0
max_value: 100
step: 1
initial_value: 100
restore_value: true
mode: slider
on_value:
then:
- output.set_level:
id: lcd_backlight
level: !lambda "return x / 100.0;"

# https://esphome.io/components/display/
# TFT Display (ST7789)
display:
- platform: st7789v
cs_pin: $cspin
dc_pin:
number: $dcpin
ignore_strapping_warning: true
reset_pin: $rstpin
model: Waveshare 1.47in 172X320
id: my_display
rotation: 0
# __LAMBDA_PLACEHOLDER__