Just wanted to share a basic working config for this device (DIS05035H)
Heads-up: I try to keep the configs in these posts updated but sometimes the configs in my repo are more up-to-date!
Here are the device-specific bits of the config separated out from everything else:
esp32:
board: odroid_esp32
framework:
type: arduino
i2c:
sda: 22
scl: 21
spi:
id: tft
clk_pin: 14
mosi_pin: 13
miso_pin: 33 #12 on v2.0
interface: hardware
output:
- id: gpio_backlight_pwm
platform: ledc
pin: 27
inverted: False
light:
- id: backlight
name: Backlight
platform: monochromatic
output: gpio_backlight_pwm
restore_mode: ALWAYS_ON
display:
- platform: ili9xxx
model: ILI9488_A
dimensions:
height: 480
width: 320
transform:
mirror_x: true
spi_id: tft
cs_pin:
number: 15
ignore_strapping_warning: true
dc_pin:
number: 2
ignore_strapping_warning: true
invert_colors: false
data_rate: 20MHz
update_interval: never
auto_clear_enabled: false
touchscreen:
platform: xpt2046
cs_pin:
number: 12 #33 on v2.0
ignore_strapping_warning: true
interrupt_pin: 36
update_interval: 50ms
threshold: 400
calibration:
x_min: 280
x_max: 3860
y_min: 3860
y_max: 340
lvgl:
buffer_size: 25%
I like to keep device-specific code like that its own file separate from everything else so that I can use the Packages component to import it into multiple relevant projects, rather than duplicate the whole thing into each one. In my case I save it into a file called templates/DIS05035H.yaml
.
In the spirit of not duplicating code into multiple projects, I create another file that is not device-specific but is common/repetitive among all my projects. In my case I chose to call it templates/common.yaml
and it has code like so:
esphome:
name: "${device_name}"
friendly_name: "${friendly_name}"
logger:
level: INFO
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
web_server:
port: 80
ota:
- platform: esphome
api:
Finally, this is how I use both of the above files together in a project.:
substitutions:
device_name: crowpanel-3.5-test-device
friendly_name: CrowPanel 3.5 Test Device
packages:
common: !include templates/common.yaml
device: !include templates/DIS05035H.yaml
# dashboard: !include templates/dashboard_480x320.yaml
#sensor: ...
Note: The contents of the dashboard
package referenced above aren’t in this post but I have it in the example to illustrate the power of setting up a config this way. In my case templates/dashboard_480x320.yaml
is a file that I’ve created with HA sensors and LVGL pages in it, and it can be reused on any of my devices that support the same resolution as this one.
If someone wants to help get this device listed on devices.esphome.io then be my guest! I was too lazy to dig into that but hopefully posting here is just as helpful.
Concerns / Potential Improvements
- This config is for hardware version 2.2 but there’s also a 2.0 which has 2 pins swapped.
- Rotating the screen is a bit painful. This config rotates it 90 degrees (portrait with USB connector at the bottom). For other rotations you need to play with both the display
transform
settings as well as the touchscreencalibration
settings.
More in my GitHub repo