WT32-SC01 with esphome

Are you able to share the link to that please?
Not that I intent to purchase it, but curious to know what they’ve done.

I did find this, but haven’t tried it yet: jhogendorn/esphome-wt32-sc01-display: A custom esphome component to support the wt32-sc01 display (github.com)

1 Like

Disregard, found the link.

I did however find this: 3.5" 320x480 WT32-SC01 | OXRS Docs

They use the ESP web flasher to deploy it, so there’s hope. Unfortunately the site doesn’t seem to explain how to install their main system, so I’m going to see if I can pick it apart.

1 Like

The WT32-SC01 device is now supported with the ILI9xxx driver in the 2023.3.1 ESPHome build

1 Like

Awesome!
What “model:” should we use to define it on the YAML?
Is there any documentation or examples to get started?

1 Like

this works for me. have not played with touch yet.

esp32:
board: esp-wrover-kit
framework:
type: arduino
output:

  • platform: gpio
    pin: GPIO23
    id: Backlight

Which pins are you using to interface the display? In ESPHome there is information about using cs/dc/reset pins, but the panel seems to be using a whole set of other data pins from the documentation.
Trying to map this…

reset_pin -> LCD_RESET = GPIO4
cs_pin -> LCD_RS (Command/Data selection) = GPIO0
dc_pin -> LCDWR (Write clock) = GPIO47
?? -> LCD_TE (Frame sync) = GPIO48

MOSI/CLK pins?

Could someone be kind to post the full YAML configuration?

not giving full YAML, but here are the important parts that should get you going…

esp32:
  board: esp-wrover-kit
  framework:
    type: arduino
output:
  - platform: gpio
    pin: GPIO23
    id: tst_Backlight
light:
  - platform: binary
    name: "wt32 Back Light"
    output: tst_Backlight    
    id: backlight
    restore_mode: ALWAYS_ON
spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  miso_pin: GPIO12
display:
  - platform: ili9xxx
    model: ST7796
    cs_pin: GPIO15
    dc_pin: GPIO21
    reset_pin: GPIO22
    rotation: 270

hth

2 Likes

Awesome, thanks!
Will give it a shot.

That worked a treat, thank you!
Here’s my with code to at least display some text.
Next step is to start playing with touch.

substitutions:
  name: "wt32-sc01"
  friendly_name: "WT32-SC01"
  id_prefix: "wt32_sc01"

esphome:
  name: ${name}
esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

packages:
  device_base: !include includes/common_settings.yaml

#esp32_ble_tracker:

#bluetooth_proxy:
#    active: true

time:
  - platform: homeassistant
    id: homeassistant_time

output:
  - platform: gpio
    pin: GPIO23
    id: tst_Backlight

light:
  - platform: binary
    name: "${friendly_name} Back Light"
    output: tst_Backlight    
    id: ${id_prefix}_backlight
    restore_mode: ALWAYS_ON

spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  miso_pin: GPIO12

display:
  - platform: ili9xxx
    id: ${id_prefix}_display
    model: ST7796
    cs_pin: GPIO15
    dc_pin: GPIO21
    reset_pin: GPIO22
    rotation: 270
    pages:
      - id: page1
        lambda: |-
          it.printf(64,0, id(my_font), TextAlign::TOP_CENTER, "WT32-SC01");
          it.strftime(64, 40, id(my_font), TextAlign::BASELINE_CENTER, "%I:%M:%S %p", id(homeassistant_time).now());
          it.printf(64, 60, id(my_font), TextAlign::BOTTOM_CENTER, "Time");
      - id: page2
        lambda: |-
          it.printf(64,0, id(my_font), TextAlign::TOP_CENTER, "WT32-SC01");
          it.printf(64, 40, id(my_font), TextAlign::BASELINE_CENTER, "Hello Loryan!");
          it.printf(64, 60, id(my_font), TextAlign::BOTTOM_CENTER, "Hi from down here");

font:
  - file:
      type: gfonts
      family: "Open Sans"
    id: my_font
    size: 20

color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%
  - id: my_white
    red: 100%
    green: 100%
    blue: 100%

interval:
  - interval: 5s
    then:
      - display.page.show_next: wt32_sc01_display
      - component.update: wt32_sc01_display
1 Like

@DeLorean,
I’ve same board and no problems to manage text and image on the display,
but no success with the touchscreen…
I’ve tried different configuration, related FT6236, without any good results…

Do you have some news, or some suggestion, to enable the touchscreen function on WT32-SC01 ???

Thanks in advance for any help !

I’ve struggled a bit with getting an image on screen. I was able to get it on, but not an animated GIF.
I haven’t been able to get the touch going natively with ESPHome unfortunately, unless I used openHASP - but then that just introduced considerably more stuff I had to learn and make work. :frowning:

Same experience, jerky anigif and touch going nowhere !

I also migrated to openHasp, it’s definitely easier and more effective,
but I have problems with the openHasp integration in HACS under HA.

Sometime it’s not loaded, I’m working on it.

1 Like

Hi,

I’m brand new to esphome and wt32-sc01

  1. thanks for having shared your informations, I’ve ended to get a first successful deployment in a few minutes.

  2. regarding touchescreen, I found two informations, that may help:

Touch (FT6336U)
    TOUCH_SDA=18
    TOUCH_SCL=19
    I2C_TOUCH_ADDRESS=0x38

so not tested so far, but this could be a good starting point:

external_components:
  - source: github://gpambrozio/esphome@FT6336U-touch
    components: [ ft63x6 ]

i2c:
  id: i2c_bus_intern
  sda: 18
  scl: 19
  scan: false

touchscreen:
  - platform: ft63x6
    id: ${id_prefix}_touch
    i2c_id: i2c_bus_intern
    on_touch:
      - logger.log:
          format: Touch at (%d, %d)
          args: [touch.x, touch.y]

1 Like

UPDATE: finally compiled, tested and it looks not bad

when I touch the screen, I get activity:

image

2 Likes

Very interesting, I’ll give it a try as soon as I have time !

Now I using the WT32 with OpenHasp and it works fine.

Thanks for the useful information!

1 Like

Nice work!
The question is… is it worth the effort for soooooooooooo much customisation work to be done in order to get touch points and layouts exactly right… or is it a more effective use of time to get an Android tablet and load Fully Kiosk Browser on it?

For me, I went with the latter as I’ve spend waaaaaay too many hours with both ESPHome and openHASP to try to get the tiny little $40 unit to work with even basic functionality.

1 Like

Actually, that is super helpful, thank you!
I’ve been able to replicate that, because following on from my previous comment - when I removed the Amazon Echo Dot with clock from our bedroom the other day we were left without a clock.
Given the WT32-SC01 was no longer being used, I quickly repurposed it as a basic clock display - but with A LOT more control over format, lighting levels at night, and also to show the currently playing track on the speaker it’s sitting on top of.

Thanks to you figuring out the touch screen, I’ll now be able to put a skip button on there.
Will share the code once I’ve got it going.

Ok, got it working, thank you @nouknouk for your researching and learnings on the touchscreen parts.
Here’s the YAML for ESPHome:

substitutions:
  name: "bedroom-clock"
  friendly_name: "Bedroom clock"
  id_prefix: "bedroom_clock"

esphome:
  name: ${name}
  comment: "WT32-SC01"
  on_boot:
    then:
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Night"
          then:
            - display.page.show: Night
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 25%
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Morning"
          then:
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 50%
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Day"
          then:
            - display.page.show: Day
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 75%


esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

packages:
  device_base: !include includes/common_settings.yaml

external_components:
  - source: github://gpambrozio/esphome@FT6336U-touch
    components: [ ft63x6 ]


time:
  - platform: homeassistant
    id: homeassistant_time

output:
  - platform: ledc
    pin: GPIO23
    id: gpio_23_backlight_pwm
light:
  - platform: monochromatic
    output: gpio_23_backlight_pwm
    name: "${friendly_name} Backlight"
    id: ${id_prefix}_backlight
    restore_mode: RESTORE_DEFAULT_ON

i2c:
  id: i2c_bus_intern
  sda: 18
  scl: 19
  scan: false

spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  miso_pin: GPIO12

button:
  - platform: restart
    name: "${friendly_name} restart"

display:
  - platform: ili9xxx
    id: ${id_prefix}_display
    model: ST7796
    cs_pin: GPIO15
    dc_pin: GPIO21
    reset_pin: GPIO22
    rotation: 90
    pages:
      - id: Day
        lambda: |-
         it.printf(245, 210, id(xxxxxlarge_font), TextAlign::BASELINE_CENTER, "%s", id(readable_ha_time).state.c_str());
      - id: Music
        lambda: |-
         it.printf(150, 10, id(xxlarge_font), TextAlign::TOP_LEFT, "%s", id(readable_ha_time).state.c_str());
         it.printf(50, 150, id(medium_font), TextAlign::TOP_LEFT, "%s", id(media_artist).state.c_str());
         it.printf(50, 200, id(medium_font), TextAlign::TOP_LEFT, "%s", id(media_title).state.c_str());
         it.printf(425, 280, id(small_font), TextAlign::TOP_LEFT, "SKIP");
      - id: Night
        lambda: |-
         it.printf(245, 210, id(xxxxxlarge_font), my_red, TextAlign::BASELINE_CENTER, "%s", id(readable_ha_time).state.c_str());

touchscreen:
  - platform: ft63x6
    id: ${id_prefix}_touch
    i2c_id: i2c_bus_intern
    on_touch:
      - logger.log:
          format: Touch at (%d, %d)
          args: [touch.x, touch.y]

font:
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxxxlarge_font
    size: 160
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxxlarge_font
    size: 140
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxlarge_font
    size: 120
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxlarge_font
    size: 100
  - file:
      type: gfonts
      family: "Open Sans"
    id: xlarge_font
    size: 80
  - file:
      type: gfonts
      family: "Open Sans"
    id: large_font
    size: 60
  - file:
      type: gfonts
      family: "Open Sans"
    id: medium_font
    size: 40
  - file:
      type: gfonts
      family: "Open Sans"
    id: small_font
    size: 20


color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%
  - id: my_white
    red: 100%
    green: 100%
    blue: 100%


text_sensor:
  - platform: homeassistant
    id: media_artist
    entity_id: media_player.master_bedroom
    attribute: media_artist
    internal: true

  - platform: homeassistant
    id: media_title
    entity_id: media_player.master_bedroom
    attribute: media_title
    internal: true

  - platform: homeassistant
    id: media_image
    entity_id: media_player.master_bedroom
    attribute: entity_picture
    internal: true

  - platform: homeassistant
    id: media_state
    entity_id: media_player.master_bedroom
    internal: true
    on_value:
      - if:
          condition:
            text_sensor.state:
              id: media_state
              state: 'playing'
          then:
            - display.page.show: Music
          else:
            - display.page.show: Day


  - platform: homeassistant
    name: Readable_time
    entity_id: sensor.12h_time
    id: readable_ha_time

  - platform: homeassistant
    id: clock_mode
    entity_id: input_select.bedroom_clock_mode
    on_value:
      then:
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Night"
            then:
              - display.page.show: Night
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 25%
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Morning"
            then:
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 50%
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Day"
            then:
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 75%

binary_sensor:
  - platform: touchscreen
    name: Skip
    id: skip_track
    internal: True
    x_min: 420
    x_max: 470
    y_min: 280
    y_max: 320
    filters:
      - delayed_on: 30ms
    on_press:
      - homeassistant.service:
          service: media_player.media_next_track
          data:
            entity_id: media_player.master_bedroom

I have a dropdown helper called “Bedroom clock mode”, which has options of: Day, Night, Morning.
These will make the screen to switch to another page where the clock is in red font and set the backlight brightness values depending on time of day. This is used by the automations in HA.

I could probably make this cleaner using a scene, but this works for now.
Automation actions for switching the screen out of night mode, but not turning up the backlight too much:

service: input_select.select_option
data:
  option: Morning
target:
  entity_id: input_select.bedroom_clock_mode

Automation actions for setting the brightness to 100% when the blinds are opened:

service: input_select.select_option
data:
  option: Day
target:
  entity_id: input_select.bedroom_clock_mode

Automation actions for dimming the clock and getting it to change to the page with the red font (aka “night mode” - when my wife turns her lamp off):

service: input_select.select_option
data:
  option: Night
target:
  entity_id: input_select.bedroom_clock_mode

Here’s the clock in normal daytime:

Here’s the clock when a song is playing on the speaker that it’s sitting on top of:

This is how it looks at night (unfortunately the phone tried to compensate for the dark, so it looks a lot brighter than it actually is):

And here it is when we wake up in the morning, but aren’t fully awake yet (again, looks brighter than it actually is):

Next steps from here would be to figure out if I can word wrap the song title, maybe show duration and current position (I’m already pulling those values but not using them yet), and getting a right-angled USB cable.

1 Like

Great work and wanted to jump in as well. I screwed up a bit by ordering the WT32-SC01 plus version which has a nicer display and frame. https://www.antratek.com/media/wysiwyg/pdf/WT32-SC01-Plus-V1.3-EN.pdf

What I didn’t notice is that it also uses the newer ESP32S3 chip, nice in itself but I cannot get it to compile and upload in ESPHOME. Tried downloading and uploading via low lever ESPFLASH tools but I end up in a boot loop… :woozy_face:

Well one step, got it working with this:

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

Touch and backlight work but apparently the ST7796 display is hard wired for 8 bit parallel interface (The IM0…IM2 pins)… anybody a clue how to proceed with this?

Thanks.

2 Likes