How do I utilize multiple displays on one ESP32
My wife loves daisies, and I wanted to make a daisy display for her. It would basically be a status board with 6 GC9A01 Displays just a different look on the wall, adding a button to swap between the pages and then also later a gesture sensor as well. I originally started with arduino coding but integrating home assistant into it was a hassle. SO, I shifted to ESPhome but I can't get multiple displays to show at the same time.
I know its a lot but I had all the screens displaying with arduino. ESPhome is having a issue with the dc pins and reset pins using the same for all displays. Right now, I'm just trying to get 2 displays to show at the same time. Please if you have any advice let me know! Here is the code that I am using.
color:
- id: my_red
hex: ff0000
- id: my_blue
hex: 407cff
- id: my_yellow
hex: dcff40
- id: my_purple
hex: c340ff
spi:
clk_pin: GPIO18 # SCL or clock line
mosi_pin: GPIO23 # SDA or MOSI line
interface: hardware
display:
- platform: ili9xxx # Display 1
model: GC9A01A
dc_pin:
number: GPIO02 # Set DC pin to GPIO2
mode: OUTPUT
ignore_strapping_warning: true
allow_other_uses: true # Allows sharing of this pin
reset_pin:
number: GPIO04 # Set Reset pin to GPIO4
mode: OUTPUT
allow_other_uses: true # Allows sharing of this pin
cs_pin: GPIO22 # Unique CS pin for display 2
invert_colors: true
update_interval: 7s # Updates every 5 seconds instead of 1
id: display_1
pages:
- id: display1a
lambda: |-
it.fill(id(my_red));
- id: display1b
lambda: |-
it.fill(id(my_blue));
- platform: ili9xxx # Display 2
model: GC9A01A
dc_pin:
number: GPIO02 # Set DC pin to GPIO2
mode: OUTPUT
allow_other_uses: true # Allows sharing of this pin
ignore_strapping_warning: true
reset_pin:
number: GPIO04 # Set Reset pin to GPIO4
mode: OUTPUT
allow_other_uses: true # Allows sharing of this pin
cs_pin: GPIO05 # Unique CS pin for display 2
invert_colors: true
update_interval: 10s # Updates every 5 seconds instead of 1
id: display_2
pages:
- id: display2a
lambda: |-
it.fill(id(my_yellow));
- id: display2b
lambda: |-
it.fill(id(my_purple));
binary_sensor:
- platform: gpio
pin:
number: GPIO15
mode: INPUT_PULLUP # Enables the internal pull-up resistor
inverted: True
ignore_strapping_warning: true
name: "Switch Display"
on_press:
- logger.log: "Switching display to next page on Display 1"
- display.page.show_next: display_1
- component.update: display_1
- delay: 100ms
- logger.log: "Switching display to next page on Display 2"
- display.page.show_next: display_2
- component.update: display_2
- delay: 100ms
filters:
- delayed_off: 10ms