feature-requests
feature-requests copied to clipboard
Add support ST7701 RGB SPI display
Describe the problem you have/What new integration you would like Please add support TFT capacitive touch display driver GT911 + ST7701 RGB+SPI 40pin
Please describe your use case for this integration and alternatives you've tried: link on aliexpress: https://www.aliexpress.com/item/1005006302251538.html support files: http://pan.jczn1688.com/directlink/1/ESP32%20module/4.0inch_ESP32-4848S040.zip?spm=a2g0o.detail.1000023.1.606ePmrUPmrU2K&file=4.0inch_ESP32-4848S040.zip
Thanks
Additional context info on github: https://github.com/HASwitchPlate/openHASP/issues/603 A community: https://community.home-assistant.io/t/potential-nspanel-alternative-anyone-have-more-information-on-this-device/655236
Arduino code Arduino_ST7701_RGBPanel.zip
There is already an PR that should work with the ST7701 from @clydebarrow.
Yes this: https://github.com/esphome/esphome/pull/5872 just trying to configure the pins
I have been looking for 4.0inch_ESP32-4848S040.zip
and the link no longer works. Is it possible to reupload it somewhere for download? thanks.
I have been looking for
4.0inch_ESP32-4848S040.zip
and the link no longer works. Is it possible to reupload it somewhere for download? thanks.
This link is ok: http://pan.jczn1688.com/directlink/1/ESP32%20module/4.0inch_ESP32-4848S040.zip
I have been looking for
4.0inch_ESP32-4848S040.zip
and the link no longer works. Is it possible to reupload it somewhere for download? thanks.This link is ok: http://pan.jczn1688.com/directlink/1/ESP32%20module/4.0inch_ESP32-4848S040.zip
I know this URL but gives 404 error
Works for me.
@clydebarrow Do you have a configuration example for this screen? I tried the code below but it didn't work. All the info you should need is here.
https://github.com/HASwitchPlate/openHASP/blob/master/user_setups/esp32s3/esp32-s3-4848S040.ini
- platform: st7701s
auto_clear_enabled: false
update_interval: never
spi_mode: MODE3
color_order: RGB
dimensions:
width: 480
height: 480
invert_colors: true
transform:
mirror_x: true
mirror_y: true
cs_pin: 39
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
init_sequence:
- 1 # select canned init sequence number 1
- [ 0xE0, 0x1F ] # Set sunlight readable enhancement
data_pins:
red:
- 4 #r1
- 3 #r2
- 2 #r3
- 1 #r4
- 0 #r5
green:
- 10 #g0
- 9 #g1
- 8 #g2
- 7 #g3
- 6 #g4
- 5 #g5
blue:
- 15 #b1
- 14 #b2
- 13 #b3
- 12 #b4
- 11 #b5```
what device do you have?
To embed yaml or other code enclose it in with three back ticks = ```
You didn't show the rest of your yaml - did you set up the SPI? Did you turn on the backlight?
I have TFT capacitive touch display GT911 + ST7701 RGB+SPI 40pin (ESP32-4848S040) linked to at the top of this thread. It works OK with OpenHASP so I have been trying to modify their config file to work with ESPhome.
https://github.com/HASwitchPlate/openHASP/blob/master/user_setups/esp32s3/esp32-s3-4848S040.ini
My code complies fine and boots up with no errors. But the backlight does not come on and the screen is black.
esphome:
name: esp32s3
friendly_name: esp32s3
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
flash_size: 16MB
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: "75BPcrp4DpO6QMWcvUiQuZMml5ePMk7AidkCzTWx9VY="
ota:
password: "b94b562281f06b5162bfe38b47d6f8f5"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32S3 Fallback Hotspot"
password: "UT27cXnwGaSk"
captive_portal:
font:
- file: "gfonts://Roboto"
id: roboto30
size: 30
output:
- platform: ledc
pin: GPIO38
id: gpio38
frequency: 100
light:
- platform: monochromatic
output: gpio38
name: "Backlight"
restore_mode: ALWAYS_ON
spi:
clk_pin: 48
mosi_pin: 47
miso_pin: 41
display:
- platform: st7701s
auto_clear_enabled: false
update_interval: 5s
spi_mode: MODE3
color_order: RGB
dimensions:
width: 480
height: 480
invert_colors: true
transform:
mirror_x: true
mirror_y: true
cs_pin: 39
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
init_sequence:
- 1 # select canned init sequence number 1
data_pins:
red:
- 11 #r1
- 12 #r2
- 13 #r3
- 14 #r4
- 0 #r5
green:
- 8 #g0
- 20 #g1
- 3 #g2
- 46 #g3
- 9 #g4
- 10 #g5
blue:
- 4 #b1
- 5 #b2
- 6 #b3
- 7 #b4
- 15 #b5
lambda: |-
it.print(0, 0, id(roboto30), Color(55, 183, 220), TextAlign::TOP_LEFT, "Hello World!");
On my device final +/- code yaml
#-------------------------------------------
# BUG AND REPAIR AND PLANNED
#-------------------------------------------
#-------------------------------------------
# REVISION
#-------------------------------------------
# 2024.03.01 - Fisrt version
#-------------------------------------------
# FEATURES
#-------------------------------------------
#-------------------------------------------
# SUBTITUTIONS - basic definitions and description of the device
#-------------------------------------------
substitutions:
friendly_name: assitant-voice
device_name: assitant-voice
created_by: "StudioTiiM 2024"
device_description: "Voice assitantn HA"
#-------------------------------------------
# POWER CONSUMPTION
# whit multimeter
#-------------------------------------------
# Power consumption V
# Booting Peak MCU: mA
# Normal- wifi: mA
# Normal - no wifi: mA
# Deep sleep: mA
#-------------------------------------------
# DEFINE PINS AND VARIABILES
# CIRCUIT AND MODULES - basic definitions and description of the device
#-------------------------------------------
# ----- MCU -----
# Module: ESP32-S3-WROOM-1U-N16R8
# Circuit:
# LDO:
# Current per pin: max 40mA (default 20mA) / Cumulative: 1500mA
# Power Consumption: Peak / Normal wifi: / Normal: / Wifi disable: / DeepSleep:
# Specification: Chip Family: ESP32 / Chip Model: ESP32-D0WDQ6 (revision 1) / Number of Cores: 2 /Max CPU Frequency: 240MHz / Has Bluetooth: YES / Has Embedded Flash: NO / Has Factory-Calibrated ADC: YES /MAC Address: C8:C9:A3:C7:C4:F4
# Pinout:
# +-----------------------+
# | +--+ +--+ +--+--+ |
# | | | | | | | | |
# | | +--+ +--+ | | |
# | |
# GND --+| |+-- GND
# 3V3 --+| |o| |+-- GPIO01 ADC1 TOUCH
# EN --+| |+-- GPIO02 ADC1 TOUCH
# ADC1 TOUCH GPIO04 --+| +----------+ |+-- GPIO43 TXD0
# ADC1 TOUCH GPIO05 --+| | MCU | |+-- GPIO44 RXD0
# ADC1 TOUCH GPIO06 --+| | | |+-- GPIO42 MTMS
# ADC1 TOUCH GPIO07 --+| | | |+-- GPIO41 MTDI
# ADC2 GPIO15 --+| | | |+-- GPIO40 MTD0
# ADC2 GPIO16 --+| +----------+ |+-- GPIO39 MTCK
# ADC2 TXD1 GPIO17 --+| +---------+ |+-- GPIO38
# ADC2 RXD1 GPIO18 --+| -| FLASH |- |+-- GPIO37 PSRAM
# ADC1 TOUCH GPIO08 --+| -| |- |+-- GPIO36 PSRAM
# ADC2 USB_D- GPIO19 --+| -| |- |+-- GPIO35 PSRAM
# ADC2 USB_D+ GPIO20 --+| -| °|- |+-- GPIO0 NOT_USE
# | +---------+ |
# +-----------------------+
# + + + + + + + + + + + +
# | | | | | | | | | | | |
# ADC1 TOUCH GPIO03 ----+ | | | | | | | | | | +---- GPIO45 NOT_USE
# NOT_USE GPIO46 ------+ | | | | | | | | +------ GPIO48
# ADC1 TOUCH GPIO09 --------+ | | | | | | +-------- GPIO47
# ADC1 TOUCH GPIO10 ----------+ | | | | +---------- GPIO21
# ADC2 TOUCH GPIO11 ------------+ | | +------------ GPIO14 ADC1 TOUCH
# ADC2 TOUCH GPIO12 --------------+ +-------------- GPIO13 ADC2 TOUCH
# Description pins:
# PINS ESP32 | USED ON PROJECT | FUNCTION | INPUT | OUTPUT | RTC*13 | ADC | PWM | TOUCH |PU/PD*12| RESISTOR | BOOT | FLASH | HIGH AT BOOT | BOOT FAILS | NOTES
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# EN | BUTTON RST | RESET | | | | | | | | | | | | |
# GPIO0 | DISPLAY DB17(R) BUTTON BOOT | STRAPPING *1 | OK! | OK! | OK | | OK | | OK | | | | | |
# GPIO01 | SPEAKER I2S-BCLK /RELAY L3 | | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO02 | SPEAKER I2S-LRCLK/RELAY L2 | | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO03 | DISPLAY DB8(G) | STRAPPING *1 | OK! | OK! | OK | OK | OK | OK | OK | | | | | |
# GPIO04 | DISPLAY DB1(B) | *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO05 | DISPLAY DB2(B) | *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO06 | DISPLAY DB3(B) | *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO07 | DISPLAY DB4(B) | *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO08 | DISPLAY DB6(G) | I2C SCL def. *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO09 | DISPLAY DB10(G) | I2C SDA def. *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO10 | DISPLAY DB11(G) | SPI SCO def. *2 | OK | OK | OK | OK | OK | OK | OK | | | | | |
# GPIO11 | DISPLAY DB13(B) | SPI MOSI def. *2 | OK | OK | OK | OK *9 | OK | OK | OK | | | | | |
# GPIO12 | DISPLAY DB14(R) | SPI SCK def. *2 | OK | OK | OK | OK *9 | OK | OK | OK | | | | | |
# GPIO13 | DISPLAY DB15(R) | SPI MISO def. *2 | OK | OK | OK | OK *9 | OK | OK | OK | | | | | |
# GPIO14 | DISPLAY DB16(R) | *2 | OK | OK | OK | OK *9 | OK | OK | OK | | | | | |
# GPIO15 | DISPLAY DB5(B) | XTAL_32K_P *2 *10 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO16 | DISPLAY HSYNC | XTAL_32K_N *2 *10 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO17 | DISPLAY VSYNC | U1_TXD *2 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO18 | DISPLAY DE | U1_RXD *2 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO19 | TOUCH TP_SDA | USB_D- *3 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO20 | DISPLAY DB7(R) | USB_D+ *3 | OK | OK | OK | OK *9 | OK | | OK | | | | | |
# GPIO21 | DISPLAY PCLK | | OK | OK | OK | | OK | | OK | | | | | |
# GPIO26 | Flash/PSRAM SPICS1 | SPICS1 *6 |
# GPIO27 | Flash/PSRAM SPIHD | SPIHD *6 |
# GPIO28 | Flash/PSRAM SPIWP | SPIWP *6 |
# GPIO29 | Flash/PSRAM SPICS0 | SPICS0 *6 |
# GPIO30 | Flash/PSRAM SPICLK | SPICLK *6 |
# GPIO31 | Flash/PSRAM SPIQ | SPIQ *6 |
# GPIO32 | Flash/PSRAM SPID | SPID *6 |
# GPIO33 | Flash/PSRAM SPIWP | SPIQ4 *4 |
# GPIO34 | Flash/PSRAM SPIWP | SPIQ5 *4 |
# GPIO35 | PSRAM 8MB | SPIQ6 *4 | | | | | OK | | OK | | | | | |
# GPIO36 | PSRAM 8MB | SPIQ7 *4 | | | | | OK | | OK | | | | | |
# GPIO37 | PSRAM 8MB | SPIQ8 *4 | | | | | OK | | OK | | | | | |
# GPIO38 | DISPLAY BL_C | SPIDQS *4 | OK | OK | | | OK | | OK | | | | | |
# GPIO39 | DISPLAY LCD_CS | MTCK *5 | OK | OK | | | OK | | OK | | | | | |
# GPIO40 | SPEAKER I2S-DATA/RELAY L1 | MTD0 CLK_OUT2 *5 | OK | OK | | | OK | | OK | | | | | |
# GPIO41 | SDCARD D1 | MTDI CLK_OUT1 *5 | OK | OK | | | OK | | OK | | | | | |
# GPIO42 | SDCARD D3 | MTMS *5 | OK | | | | OK | | OK | | | | | |
# GPIO43 | SLOT H1/TXD | U0_TXD *7 | OK! | OK! | | | OK | | OK | | | | | |
# GPIO44 | SLOT H1/RXD | U0_RXD *7 | OK! | OK! | | | OK | | OK | | | | | |
# GPIO45 | TOUCH TP_SCL USB_D- | STRAPPING VSPI *1 | OK! | OK! | | | OK | | OK | | | | | |
# GPIO46 | DISPLAY DB9(G) | STRAPPING LOG *1 | OK! | OK! | | | OK | | OK | | | | | |
# GPIO47 | SPI DISPLAY SDCARD SDA | SPICLK_P | OK | OK | | | OK | | OK | | | | | |
# GPIO48 | SPI DISPLAY SDCARD SCK | SPICLK_L | OK | OK | | | OK | | OK | | | | | |
# *1 Strapping pins: GPIO0 PULLUP : Boot Mode. Weak pullup during reset. (Boot Mode 0=Boot from Flash, 1=Download)
# GPIO03 FLOATING: JTAG Mode. Weak pull down during reset. (JTAG Config)
# GPIO45 PULLDOWN: SPI voltage. Weak pull down during reset. (SPI Voltage 0=3.3v 1=1.8v)
# GPIO46 PULLDOWN: Boot mode. Weak pull down during reset. (Enabling/Disabling ROM Messages Print During Booting)
# *2 60μs glitch on boot: Low-level glitch: the pin is at a low level output status for 60us.
# GPIO18 : Low 60us/high 60us
# GPIO19, 20: Low 60us/ 2*high 60us
# *3 UART whit USB connected pin D+ and D-
# Source: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/api-reference/peripherals/usb_device.html
# *4 not available if octal Flash or SPI RAM is used
# *5 JTAG interface: The default behaviour of these pins is JTAG debugging, during firmware download mode they will have spurious values on them.
# This can be turned off by burning some eFuses in conjunction with GPIO3 (see the datasheet for details).
# *6 not available if SPI RAM is used
# *7 These default to UART0 until they are used by your code. Disable hardware uart. logger baud_rate: 0
# *8 DAC Pins: There is NO DAC on the ESP32-S3 - you can simulate analog output using PWM or I2S PDM.
# *9 ADC2 not available if wifi enable
# *10 xTAL External 32k crystal
# *11 PU/PD: Pins that have software configurable pull-up/pull-down functionality.
# *12 RTC: Pins that are RTC GPIOs and can be used in deep-sleep mode.
# I2S
# The ESP32 S3 has two I2S interfaces which can be mapped to any available gpio pins.
# I2C
# Default pins are:
# GPIO9 SCL
# GPIO8 SDA
# There is an aditional I2C interface which does not seem to have default pins (wip).
# SPI
# The ESP32 S3 has four SPI interfaces which are:
# SPI0 used by ESP32-S3’s cache and Crypto DMA (EDMA) to access in-package or off-package flash/PSRAM
# SPI1 used by the CPU to access in-package or off-package flash/PSRAM
# SPI2 is a general purpose SPI controller with its own DMA channel
# SPI3 is a general purpose SPI controller with access to a DMA channel shared between several peripherals
# ----- TOUCH -------
# Modul: Goodix GT911 touch platform
# Support: maximum of 4 touch key and guestures, It is strongly recommended that transmission rate be kept at or below 400Kbps
# Specifications: Voltage: 1.8V internal LDO / Glass 0.55 - 2.0mm / Operational Range: Temperature: -40 ~ +85°C Humidity: 95%
# Circuit: Interface: I2C address: AHT 0x5D,
# Power consumption: normal: 14.5mA sleep: 0.12mA
# Pinout:
# 1. GND
# 2. SDA
# 3. SCL
# 4. RST =
# 5. INT = GND
# 6. VDD
# ----- DISPLAY -----
# Modul: 0400B009 (not found datasheet)
# Similar datasheet round display: TFT LCD Display Datasheet ER-TFT021-1
# Source: https://www.buydisplay.com/480x480-round-ips-tft-lcd-display-2-1-inch-capacitive-touch-circle-screen
# Desciption github:
# Tasmota: https://github.com/arendst/Tasmota/discussions/20527
# Esphome: https://github.com/esphome/esphome/pull/5872
# Openhasb: https://github.com/HASwitchPlate/openHASP/issues/603
# Description pinout:
# PIN NO | PIN NAME | DESCRIPTION | GPIO | DESCRIPTION # PIN NO | PIN NAME | DESCRIPTION | GPIO | DESCRIPTION
# 1 | VLED+ | LED ANODE | KDG2V GPIO38 | BACKLIGHT DISPLAY # 21 | DB5 | 18-BIT BUS | GPIO15 |
# 2 | VLED- | LED CATHODE | GND | # 22 | DB6 | 18-BIT BUS | GPIO08 |
# 3 | VLED- | LED CATHODE | GND | # 23 | DB7 | 18-BIT BUS | GPIO20 |
# 4 | GND | GROUND | GND | # 24 | DB8 | 18-BIT BUS | GPIO03 |
# 5 | VCC | POWER SUPPLY | 3V3 | # 25 | DB9 | 18-BIT BUS | GPIO46 |
# 6 | RST | RESET ACTIVE LOW| NC | # 26 | DB10 | 18-BIT BUS | GPIO09 |
# 7 | NC | | NC | # 27 | DB11 | 18-BIT BUS | GPIO10 |
# 8 | NC | | NC | # 28 | DB12 | 18-BIT BUS | NC |
# 9 | SDA | DATA I/O BI SPI | GPIO47 | # 29 | DB13 | 18-BIT BUS | GPIO11 |
# 10 | SCK | CLOCK I SPI | GPIO48 | # 30 | DB14 | 18-BIT BUS | GPIO12 |
# 11 | CS | CHIP SELECTED | GPIO39 | # 31 | DB15 | 18-BIT BUS | GPIO13 |
# 12 | PCLK | DOT CLOCK RGB | GPIO21 | # 32 | DB16 | 18-BIT BUS | GPIO14 |
# 13 | DE | DATA ENABLE | GPIO18 | # 33 | DB17 | 18-BIT BUS | GPIO0 |
# 14 | VSYNC | FRAME SYNC | GPIO17 | # 34 | GND | GROUND | GND |
# 15 | HSYNC | LINE SYNC | GPIO16 | # 35 | TP-INT | TOUCH INTERRUPT | GND |
# 16 | DB0 | 16-BIT BUS | NC | # 36 | TP-SDA | TOUCH SDA I2C | GPIO19 | TOUCH SDA GT911
# 17 | DB1 | 16-BIT BUS | GPIO04 | # 37 | TP-SCL | TOUCH SCL I2C | GPIO45 | TOUCH SCL GT911
# 18 | DB2 | 16-BIT BUS | GPIO05 | # 38 | TP-RST | TOUCH RESET | RST | TOUCH RESET GT911
# 19 | DB3 | 16-BIT BUS | GPIO06 | # 39 | TP-VCL | POWER SUPPLY | VDD | TOUCH POWER SUPPLY
# 20 | DB4 | 16-BIT BUS | GPIO07 | # 40 | GND | GROUND | GND |
# RGB DATA SIGNAL
# DB0: BLUE LSB GPIO04
# DB5: BLUE MSB
# DB6: GREEN LSB
# DB11: GREEN MSB
# DB12: RED LSB
# DB17: RED MSB
display_cs_pin: GPIO39
display_en_pin: "5" # not connected pseudo expander pin
display_de_pin: GPIO18
display_hsync_pin: GPIO16
display_vsync_pin: GPIO17
display_pclk_pin: GPIO21
# Data pin: show below on display label
# Backlight:
# Module: KDG2V (not found datasheet)
# Pinout: (not fit exactly)
# N.| CONNECT | Pin | Scheme | Pin | CONNECT | N.
# +----+
# 1 | 5V | IN -|° |- IN | 5V | 6
# 2 | GND | GND -| |- SW | LED_A | 5
# 3 | LED_K | FB -| |- EN | GPIO38 | 4
# +----+
display_led_pin: GPIO38
# ----- SDCARD ------
# Remove
# Pinout:
# N.| NAME | GPIO | PULLUP | NOTES
# -------------------------------------
# 1 | DAT2/X | | 10k |
# 2 | DAT3/CS | GPIO42 | 10k | Unsolder pullup -> free pin
# 3 | CMD/DI | GPIO47 | 10k | DISPLAY SPI mosi_pin
# 4 | VDD | VCC | |
# 5 | CLK/SCLK | GPIO48 | | DISPLAY SPI clk_pin
# 6 | VSS | GND | |
# 7 | DAT0/DO | GPIO41 | 10k | Unsolder pullup -> free pin
# 8 | DAT1/x | | |
# ----- SPEAKER -----
# Circuit: The 4-inch screen relay and I2S audio are shared IO ports, IO1, IO2, and IO40. If audio is needed, the 0 ohm resistors R25, R26, and R27 should be moved to R21, R22, and R23.
# Speaker: UNISON U3608B35U 8Ω 1.5W 701
# Chip: NS4168
# Pinout:
# N.| CONNECTED | DESCRIPTION | Pin | Scheme | Pin | DESCRIPTION | CONNECTED | N.
# +----+
# 1 | VCC-> 1MΩ | Control pin | CTRL -|° |- VoP | Output positive | SPEAKER | 8
# 2 | GPIO02 | I2S Frame clock | L/RCLK -| |- GND | Ground | GND | 7
# 3 | GPIO01 | I2S bit clock | BCLK -| |- VDD | Power supply | VCC | 6
# 4 | GPIO40 | Serial data | SDATA -| |- VoN | Output Negative | SPEAKER | 5
# +----+
sound_lrclk_pin: GPIO02
sound_bclk_pin: GPIO01
sound_dout_pin: GPIO40
# ----- BATTERY -----
# Chip: IP5306 (Datasheet source: https://datasheetspdf.com/datasheet/IP5306.html)
# Specifications: 2.4A synchronous boost conversion, 2.1A synchronous switch charging / Boost efficiency up to 92% / Charging efficiency up to 91% / Input: 4.65 ~ 5.5V /
# Power consumption Standby: 100 μA
# Protections: Output overcurrent, overvoltage, short circuit protection, Input overvoltage, overcharge, overdischarge, overcurrent discharge protection, Overheat protection of the whole machine
# Circuit: key -> connected to SW button
# Pinout:
# N.| CONNECTED | DESCRIPTION | Pin | Scheme | Pin | DESCRIPTION | CONNECTED | N.
# +-------+
# 1 | 5V IN | INPUT 5V | VIN -|° |- VOUT | 5V OUTPUT | 5V OUT | 8
# 2 | ? R50 | BAT INDICATOR 1 | LED1 -| POWER |- SW | DC DC SWITCH NODE | INDUCTOR | 7
# 3 | NC | BAT INDICATOR 2 | LED2 -| PAD |- BAT | VOLTAGE SENS | ? | 6
# 4 | ? | BAT INDICATOR 3 | LED3 -| GND |- KEY | ON/OFF KEY MULTIPLEX TORCH LIGHT DRIVER | SW1 BUTTON | 5
# +-------+
# ----- BUTTON ------
# Module:
# Circuit: 10kΩ PULLUP
# Description: When button push displey change color scheme because red datapoint. But the button is functional
button_pin: GPIO0
# Internal button: RESET connected to EN MCU / SW1 connected to KEY battery charger module
#-------------------------------------------
# PROTOCOLS
#-------------------------------------------
# ----- PROTOCOLS PINS -----
# i2c
i2c_sda_pin: GPIO19
i2c_scl_pin: GPIO45
#UART
spi_clk_pin: GPIO48
spi_mosi_pin: GPIO47
# ----- PROTOCOLS SETTINGS -----
i2c:
- id: bus_a
sda: "$i2c_sda_pin"
scl: "$i2c_scl_pin"
#frequency: 100kHz
spi:
- id: lcd_spi
clk_pin: "$spi_clk_pin"
mosi_pin: "$spi_mosi_pin"
#-------------------------------------------
# ESPHOME PLATFORM SETTINGS
#-------------------------------------------
esphome:
name: assistant-voice
friendly_name: assistant-voice
platformio_options:
board_build.flash_mode: dio
#build_unflags: -Werror=all
#platform_packages:
# - framework-espidf @ 5.4.0
#on_boot:
#- delay: 5s
#- lvgl.widget.hide: boot_screen
#-------------------------------------------
# ESP MCU SETTINGS
#-------------------------------------------
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 16MB
framework:
type: esp-idf
#version: recommended
#platform_version: 5.4.0
sdkconfig_options:
#CONFIG_ESP32_S3_BOX_3_BOARD: "y"
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
#CONFIG_AUDIO_BOARD_CUSTOM: "y"
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
#components:
# - name: esp32_s3_box_3_board
# #source: github://jesserockz/esp32-s3-box-3-board@main
# source: github://tiimsvk/esp32-s3-box-3-board@main
#refresh: 0s
psram:
mode: octal
speed: 80MHz
#-------------------------------------------
# LOGGER
#-------------------------------------------
logger:
#hardware_uart: USB_SERIAL_JTAG
hardware_uart : UART0
# HW UART ENABLE
# GPIO43-U0_TXD
# GPIO44-U0_RXD
#-------------------------------------------
# API
#-------------------------------------------
api:
# Client connected to HA status LVGL
on_client_connected:
- if:
condition:
binary_sensor.is_on: status_online
then:
- lvgl.widget.show: lvgl_online_status
on_client_disconnected:
- if:
condition:
binary_sensor.is_off: status_online
then:
- lvgl.widget.hide: lvgl_online_status
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#-------------------------------------------
# EXTERNAL AND CUSTOM COMPONENT
#-------------------------------------------
external_components:
#- source: github://pr#5872
# components: [ rpi_dpi_rgb, st7701s ]
- source:
type: local
path: custom_component
components:
- st7701s
- rpi_dpi_rgb
#- audio_board # skusit odstraniť
# - source: github://esphome/esphome@dev
# refresh: 10min
# components: [rpi_dpi_rgb]
- source: github://clydebarrow/esphome@lvgl
refresh: 10min
components: [lvgl, font, display]
#
#- source: github://pr#5230
# components:
# - esp_adf
#refresh: 0s
# - source:
# type: git
# url: https://github.com/gnumpi/esphome_audio
# ref: main
# components: [ adf_pipeline, i2s_audio ]
#-------------------------------------------
# PACKAGES
#-------------------------------------------
packages:
lvgl: !include packages/lvgl-package.yaml
#esp_adf:
#i2s_audio:
# - id: i2s_out
# i2s_lrclk_pin: GPIO02
# i2s_bclk_pin: GPIO01
#-------------------------------------------
# SENSORS
#-------------------------------------------
sensor:
#-------------------------------------------
# BINARY SENSORS
#-------------------------------------------
binary_sensor:
#-------------------------------------------
# GT911 touchscreen sensor
#-------------------------------------------
- platform: gt911
name: "Home"
index: 0
#-------------------------------------------
# OUTPUTS
#-------------------------------------------
output:
- platform: ledc
pin: $display_led_pin
id: backlight
frequency: 100Hz
#-------------------------------------------
# LIGHTS
#-------------------------------------------
light:
- platform: monochromatic
output: backlight
name: Display Backlight
id: display_backlight
restore_mode: ALWAYS_ON
# I/O expander. Touchscreen RESET and INTERRUPT are not used.
pca9554:
- id: p_c_a
pin_count: 16
address: 0x20
touchscreen:
platform: gt911
#rotation: 180
transform:
mirror_x: true
mirror_y: true
id: my_touchscreen
#interrupt_pin:
display: st7701_display
# address: 0x5D
on_release:
then:
- if:
condition: lvgl.is_paused
then:
- light.turn_on: display_backlight
- lvgl.resume:
- lvgl.widget.redraw:
on_touch:
- logger.log:
format: Touch at (%d, %d)
args: [touch.x, touch.y]
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
touch.x,
touch.y,
touch.x_raw,
touch.y_raw
);
#- display.page.show: main_page
#- component.update: st7701_display
#- delay: 10s
#- display.page.show: screen_saver
display:
- platform: st7701s
id: st7701_display
#rotation: 180
update_interval: never
auto_clear_enabled: True
data_rate: 8MHz
spi_mode: MODE3
color_order: RGB
dimensions:
width: 480
height: 480
invert_colors: false
transform:
mirror_x: true
mirror_y: true
cs_pin: 39
# reset not defined
reset_pin: # CONNECTED TO GND
pca9554: p_c_a
number: 5
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
init_sequence:
- 1
- [ 0xE0, 0x1F ]
- [ 0xCD, 0x00 ]
#hsync_pulse_width: 8
#hsync_front_porch: 10
#hsync_back_porch: 50
#vsync_pulse_width: 8
#vsync_front_porch: 10
#vsync_back_porch: 20
pclk_frequency: 12MHz
pclk_inverted: false
data_pins:
red:
- 11 # R1
- 12 # R2
- 13 # R3
- 14 # R4
- 0 # R5
green:
- 8 # G0
- 20 # G1
- 3 # G2
- 46 # G3
- 9 # G4
- 10 # G5
blue:
- 4 # B1
- 5 # B2
- 6 # B3
- 7 # B4
- 15 # B5
#lambda: !lambda |-
# // Draw the image my_image at position [x=0,y=0]
# it.image(0, 0, id(esphome_logo));
# it.print(240, 240, id(my_font), TextAlign::CENTER,"Hello ESPHome!");
Thanks that worked!
Great awsome it works
when i use this i receive an error on
on_client_connected: - if: condition: binary_sensor.is_on: status_online then: - lvgl.widget.show: lvgl_online_status on_client_disconnected: - if: condition: binary_sensor.is_off: status_online then: - lvgl.widget.hide: lvgl_online_status
and after removing this part from the api section it uploads but touch isnt working. is that normal. I see it recognize the touch in the logger but thats it. maybe its normal and yes i need to make my own thing anyway. but wanna be sure its i didnt forget something which i need to change before creating something and figure out after days that i missed something by using this sketch
Hello, I'd like to try your code too but :
#-------------------------------------------
# PACKAGES
#-------------------------------------------
packages:
lvgl: !include packages/lvgl-package.yaml
I don't understand where can i find that lvlg-package.yam file ? any clue ?
Best regards.
This demo is pulling in clydebarrow,s LVGL beta code. That file is in his git repo. This is not required to get the screen working.
This is a stripped down version that gets a basic hello world page going with no dependencies
#-------------------------------------------
# PROTOCOLS
#-------------------------------------------
i2c:
- id: bus_a
sda: GPIO19
scl: GPIO45
#frequency: 100kHz
spi:
- id: lcd_spi
clk_pin: GPIO48
mosi_pin: GPIO47
#-------------------------------------------
# ESPHOME PLATFORM SETTINGS
#-------------------------------------------
esphome:
name: 480screen
friendly_name: 480screen
platformio_options:
board_build.flash_mode: dio
#-------------------------------------------
# ESP MCU SETTINGS
#-------------------------------------------
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 16MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
psram:
mode: octal
speed: 80MHz
logger:
level: DEBUG
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#-------------------------------------------
# SENSORS
#-------------------------------------------
sensor:
#-------------------------------------------
# BINARY SENSORS
#-------------------------------------------
binary_sensor:
#-------------------------------------------
# GT911 touchscreen sensor
#-------------------------------------------
- platform: gt911
name: "Home"
index: 0
#-------------------------------------------
# OUTPUTS
#-------------------------------------------
output:
- platform: ledc
pin: GPIO38
id: backlight
frequency: 100Hz
#-------------------------------------------
# LIGHTS
#-------------------------------------------
light:
- platform: monochromatic
output: backlight
name: Display Backlight
id: display_backlight
restore_mode: ALWAYS_ON
# I/O expander. Touchscreen RESET and INTERRUPT are not used.
pca9554:
- id: p_c_a
pin_count: 16
address: 0x20
touchscreen:
platform: gt911
#rotation: 180
transform:
mirror_x: true
mirror_y: true
id: my_touchscreen
display: st7701_display
on_touch:
- logger.log:
format: Touch at (%d, %d)
args: [touch.x, touch.y]
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
touch.x,
touch.y,
touch.x_raw,
touch.y_raw
);
image:
- file: https://esphome.io/_images/logo.png
id: esphome_logo
resize: 200x162
- file: RGB_test.png
id: RGB_test
resize: 480x480
type: RGB565
font:
- file: "gfonts://Roboto"
id: roboto20
size: 20
extras:
- file: 'materialdesignicons-webfont.ttf'
glyphs: [
"\U000F004B",
"\U0000f0ed",
"\U000F006E",
"\U000F012C",
"\U000F179B",
"\U000F0748",
"\U000F1A1B",
"\U000F02DC",
"\U000F0A02",
"\U000F035F",
"\U000F0156",
"\U000F0C5F",
"\U000f0084",
"\U000f0091",
]
display:
- platform: st7701s
id: st7701_display
#rotation: 180
update_interval: 10s
auto_clear_enabled: True
data_rate: 8MHz
spi_mode: MODE3
color_order: RGB
dimensions:
width: 480
height: 480
invert_colors: false
transform:
mirror_x: true
mirror_y: true
cs_pin: 39
# reset not defined
reset_pin: # CONNECTED TO GND
pca9554: p_c_a
number: 5
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
init_sequence:
- 1
- [ 0xE0, 0x1F ]
- [ 0xCD, 0x00 ]
pclk_frequency: 12MHz
pclk_inverted: false
data_pins:
red:
- 11 # R1
- 12 # R2
- 13 # R3
- 14 # R4
- 0 # R5
green:
- 8 # G0
- 20 # G1
- 3 # G2
- 46 # G3
- 9 # G4
- 10 # G5
blue:
- 4 # B1
- 5 # B2
- 6 # B3
- 7 # B4
- 15 # B5
lambda: |-
it.image(0, 0, id(RGB_test));
it.print(240, 240, id(roboto20), TextAlign::CENTER,"Hello ESPHome!");
@tiimsvk thanks for all your help getting this working but it's not quite right yet. Once I did more testing I noticed the colors are not right. I am having the same issues that they discuss in this thread on the openHASP project.
https://github.com/HASwitchPlate/openHASP/issues/603
tbxMb get's it working on Jan 2 but needs to add a bunch of code.
https://github.com/tbxMb/openHASP/commit/7af48cff375fc0c73ffa10230f0dc45a7c1a2354
Can we get this added to esphome as well?
Thanks a lot for your reply.
Best regards.
Can we get this added to esphome as well?
If it's just a change in the init commands, which a quick glance suggests, you can do that in YAML using the init_sequence
option.
I don't understand where can i find that lvlg-package.yam file ?
Mine is here: https://gist.github.com/clydebarrow/ef89e9a93bd44771483b9144ae9042a1
The init sequence is over 100 lines of C code. I'm not sure how to add this to the YAML file. Would it be possible to add the esp32-s3-4848S040 as a supported board in esphome? That way when you selected the board from a YAML file it would already have all this information? Right now we are using a esp32-s3-devkitc-1 board then trying to mod it in YAML to be a esp32-s3-4848S040.
Although the init code seems long, it differs only two commands from the existing "standard" init code, so just adding a couple of lines to the yaml will be sufficient.
Supporting specific boards in ESPHome is a two-edged sword - on the one hand it's convenient if your board is already there, OTOH it's more work for devs to keep adding new boards, and ultimately it's a whack-a-mole job - there are always new ones appearing. Allowing init overrides in yaml is providing a way to quickly support new boards without a new release of ESPHome. Configs for specific boards can be contributed to https://devices.esphome.io/ once established (that needs a display
category.)
The downside is that someone still needs to work out what needs to be done for a specific board, and I appreciate that is a "dev" level activity, though there's nothing to stop anyone comparing init sequences.
I looked at the OpenHasp init sequence per the linked commit, and basically it is exactly the same as being used by ESPHome. So at this stage I have nothing further to suggest.
So as it turns out I actually have one of these esp32-s3-4848s040 boards, so was able to test it out.
The red and blue pin numbers used by OpenHasp are wrong, as is the pixel format - the two errors almost cancelled each other out, but the result was still slightly wrong. Here's a properly working config for ESPHome:
#-------------------------------------------
# ESPHOME PLATFORM SETTINGS
#-------------------------------------------
esphome:
name: 480screen
friendly_name: 480screen
platformio_options:
board_build.flash_mode: dio
#-------------------------------------------
# ESP MCU SETTINGS
#-------------------------------------------
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 16MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
psram:
mode: octal
speed: 80MHz
logger:
level: DEBUG
hardware_uart: uart0
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
switch:
- platform: gpio
pin: 40
id: relay1
name: Relay 1
#-------------------------------------------
# PROTOCOLS
#-------------------------------------------
i2c:
- id: bus_a
sda: GPIO19
scl: GPIO45
#frequency: 100kHz
spi:
- id: lcd_spi
clk_pin: GPIO48
mosi_pin: GPIO47
#-------------------------------------------
# OUTPUTS
#-------------------------------------------
output:
- platform: ledc
pin: GPIO38
id: backlight
frequency: 100Hz
#-------------------------------------------
# LIGHTS
#-------------------------------------------
light:
- platform: monochromatic
output: backlight
name: Display Backlight
id: display_backlight
restore_mode: ALWAYS_ON
# I/O expander. Touchscreen RESET and INTERRUPT are not used.
touchscreen:
platform: gt911
#rotation: 180
transform:
mirror_x: false
mirror_y: false
id: my_touchscreen
display: st7701_display
on_touch:
- logger.log:
format: Touch at (%d, %d)
args: [touch.x, touch.y]
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
touch.x,
touch.y,
touch.x_raw,
touch.y_raw
);
image:
- file: https://esphome.io/_images/logo.png
id: esphome_logo
resize: 200x162
- file: cat.jpg
id: RGB_test
resize: 480x480
type: RGB565
font:
- file: "gfonts://Roboto"
id: roboto20
size: 20
extras:
- file: 'fonts/materialdesignicons-webfont.ttf'
glyphs: [
"\U000F004B",
"\U0000f0ed",
"\U000F006E",
"\U000F012C",
"\U000F179B",
"\U000F0748",
"\U000F1A1B",
"\U000F02DC",
"\U000F0A02",
"\U000F035F",
"\U000F0156",
"\U000F0C5F",
"\U000f0084",
"\U000f0091",
]
display:
- platform: st7701s
id: st7701_display
update_interval: 10s
auto_clear_enabled: True
data_rate: 2MHz
spi_mode: MODE3
color_order: RGB
invert_colors: false
dimensions:
width: 480
height: 480
transform:
mirror_x: false
mirror_y: false
cs_pin: 39
# reset not defined
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
init_sequence:
- 1
- [0x3A, 0x50] # 16 bit pixel format.
pclk_frequency: 12MHz
pclk_inverted: false
data_pins:
red:
- 0 # R5
- 11 # R1
- 12 # R2
- 13 # R3
- 14 # R4
green:
- 8 # G0
- 20 # G1
- 3 # G2
- 46 # G3
- 9 # G4
- 10 # G5
blue:
- 15 # B5
- 4 # B1
- 5 # B2
- 6 # B3
- 7 # B4
lambda: !lambda |-
it.filled_rectangle(0, 0, 40, 40, Color(0x80, 0, 0));
it.filled_rectangle(0, 60, 40, 40, Color(0x40, 0, 0));
it.filled_rectangle(0, 120, 40, 40, Color(0x20, 0, 0));
it.filled_rectangle(0, 180, 40, 40, Color(0x10, 0, 0));
it.filled_rectangle(0, 240, 40, 40, Color(0x8, 0, 0));
it.filled_rectangle(40, 0, 40, 40, Color(0, 0x80, 0));
it.filled_rectangle(40, 60, 40, 40, Color(0, 0x40, 0));
it.filled_rectangle(40, 120, 40, 40, Color(0, 0x20, 0));
it.filled_rectangle(40, 180, 40, 40, Color(0, 0x10, 0));
it.filled_rectangle(40, 240, 40, 40, Color(0, 0x8, 0));
it.filled_rectangle(40, 300, 40, 40, Color(0, 0x4, 0));
it.filled_rectangle(80, 0, 40, 40, Color(0, 0, 0x80));
it.filled_rectangle(80, 60, 40, 40, Color(0, 0, 0x40));
it.filled_rectangle(80, 120, 40, 40, Color(0, 0, 0x20));
it.filled_rectangle(80, 180, 40, 40, Color(0, 0, 0x10));
it.filled_rectangle(80, 240, 40, 40, Color(0, 0, 0x8));
it.filled_rectangle(00, 360, 40, 40, Color(255, 0, 0));
it.filled_rectangle(40, 360, 40, 40, Color(0, 255, 0));
it.filled_rectangle(80, 360, 40, 40, Color(0, 0, 255));