ESP32-C3 with integrated GC9A01 - cheap touch controller

FWIW Interestingly, Waveshare have released this device.

It appears to be very similar to what we’ve been using, but with a handful of improvements including:

  • 32-bit LX7 dual-core processor, up to 240MHz (vs single-core processor, up to 160Mhz)
  • 512KB of SRAM and 384KB ROM, with onboard 2MB PSRAM and an external 16MB Flash memory (vs 400KB SRAM, 384KB and 4MB Flash)
  • CNC metal case with plastic base (vs all plastic)
  • 3-axis accelerometer and 3-axis gyroscope (does not have)
  • 30 multifunction GPIO pins (not even close)

All up, definitely better but more expensive - currently USD$20 on their website. Still, if you need something with more power, the ability to hook up multiple sensors, etc then this could be an option worth considering. The screen itself appears to be the same, so it’s likely that the code won’t need much tweaking.

As an aside, from a design perspective I suspect I actually prefer the cheaper case - it looks better with the rounded edges of the screen and is more compact. I suspect that the raised metal case might make it a little harder to touch something that is on the edge of the screen, and it is more likely that dust and other muck might end up in the crack between the screen and case. Hard to tell for certain without seeing one in person of course!

2 Likes

PSA - I bought another four of these, and although they look the same externally I found that I could not power them using a usb-c to usb-c cable from my laptop (used two different, known to work, cables as well as two different laptops). I was concerned that the things were dead but they worked when I tried a usb-a to usb-c cable. Not good. This implies that there has been some cost cuts with the termination resistors in the device - so a standards based USB-C power source will not turn on power.

On a more positive note, once I was able to power it up, I was able to use https://web.esphome.io/ to initialise and then install my own firmware.

On starting it also had a slightly different firmware installed, with the initial boot splash screen showing it is “powered by Guition”. It should still work for what I need it to do, but if your project requires you to power it from a usb-c source then you may want to avoid this updated version. Might be hard to identify when buying, but here’s some photos that might help.



Late reply, but might be useful to some. Mine wouldn’t connect to wifi and I couldn’t figure it out, then I went to put it back in the little plastic box and try later, and then spotted the tiny wifi antenna in the box! Plugged it in and all works perfectly :smiley:

1 Like

Good news LVGL Graphics — ESPHome

1 Like

Definitely good news - should make it a lot easier to develop more professional looking screens!

hello
Thank you for these code examples, I took 2 and already tested them on one, it works perfectly

FYI The most recent update to Esphome - ESPHome 2024.6.0 - 19th June 2024 — ESPHome - has introduced some breaking changes. For my example code there is just the one item that needs to be updated, specifically:

ota:
  password: !secret ota_password

needs to now be:

ota:
  password: !secret ota_password
  platform: esphome

I’ll update my example code. :slight_smile:

2 Likes

Anyone try to use this new code with the waveshare device (esp32-s3-touch-1.28)

# V1.0 - 1/7/2024
# Compiled and tested on esphome 2024.6.4 and HA 2024.6.4

substitutions:
  devicename: thelittlecircle
  friendname: The Little Circle
  location: guest
# Change the timezone to suit your location, or even just remove it - it will likely be picked up automatically
  timez: Australia/Melbourne
  board: esp32-c3-devkitm-1
# Display state on initial start
# Note that the screensaver only starts after the first touch of the display
# Change to ALWAYS_OFF if want the screen to be off after booting, ALWAYS_ON if want it on at start eg for initial troubleshooting
  screenstart: ALWAYS_OFF
# Timeout for the screen
  screensaver: 10 min
#GPIO pins for the LCD screen
  repin: GPIO1
  dcpin: GPIO2
# Note - you may see an error on compilation "WARNING GPIO2 is a Strapping PIN and should be avoided" - ignore this as you have no choice
# This error message may be removed via the "ignore_strapping_warning" option for the screen driver
  bkpin: GPIO3
  clpin: GPIO6
  mopin: GPIO7
  cspin: GPIO10
# GPIO pins for the touch screen
  sdapin: GPIO4
  sclpin: GPIO5
  intpin: GPIO8  

esphome:
  name: $devicename
  friendly_name: $friendname
  platformio_options:
    board_build.flash_mode: dio

esp32:
  board: $board
  framework:
    type: arduino

# Enable logging
# Change to avoid "Components should block for at most 20-30ms" warning messages in the log - an issue since 2023.7.0
# Not really a breaking change - it's an issue I suspect due to the device being slow and this error previously
# simply not being reported
logger:
  level: DEBUG #makes uart stream available in esphome logstream
  logs:
    component: ERROR
  #Turn off UART logging over RX/TX 
  baud_rate: 0

#uart:
#  rx_pin: GPIO20
#  tx_pin: GPIO21
#  baud_rate: 9600
#  id: uart_bus

# Enable Home Assistant API
api:
  encryption:
    key: !secret esphome_key

ota:
  platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "$devicename Fallback Hotspot"
    password: !secret wifi_password

captive_portal:


# Amazingly, ble_tracker now seems to work
# Things to note if using it:
# 1. Make sure you use https://web.esphome.io/ to wipe the device first and then upload the new image
# Do not use OTA after enabling esp32_ble_tracker: as it needs to change the partition to support the code
# 2. Comment out "#eight_bit_color: false" in the display section. Drawback is screen redraw is slower and colours less vibrant.
# 3. Don't be surprised if the thing locks ups or reboots randomly - this is bleeding edge
# 4. Refer to https://esphome.io/components/binary_sensor/ble_presence.html for more info

#esp32_ble_tracker:
#binary_sensor:
#  # Presence based on MAC address
#  - platform: ble_presence
#    mac_address: AC:37:43:77:5F:4C
#    name: "ESP32 BLE Tracker Google Home Mini"
#    min_rssi: -80dB
#  # Presence based on BLE Service UUID
#  - platform: ble_presence
#    service_uuid: '11aa'
#    name: "ESP32 BLE Tracker Test Service 16 bit"
#  # Presence based on iBeacon UUID
#  - platform: ble_presence
#    ibeacon_uuid: '68586f1e-89c2-11eb-8dcd-0242ac130003'
#    name: "ESP32 BLE Tracker Test Service iBeacon"



external_components:
  - source: github://GadgetFactory/[email protected] 
  - source: github://clydebarrow/esphome@lvgl_original
    refresh: 10min
    components: [ lvgl ]


# Still need this external driver to support the touch screen
# Supported added via https://github.com/esphome/esphome/pull/5941
# Currently testing

spi:
  mosi_pin: $mopin
  clk_pin: $clpin
# Don't use software - makes it crawl  
#  force_sw: True
#mosi = Master Out Slave In
#miso = Master In Slave Out or fermented bean paste. In this case, most likely the former rather than the latter. Doesn't matter as not used.

i2c:
  sda: $sdapin
  scl: $sclpin
  #Following helped someone get rid of the "Components should block" error messages but didn't for me
  #frequency: 400kHz
   
text_sensor:
#  - platform: ble_scanner
#    name: "BLE Devices Scanner"
  - platform: CST816S_touchscreen
    id: my_touchscreen


#-------------------------------------------
# lvgl Buttons
#-------------------------------------------    
lvgl:
  displays:
    - watchface
  touchscreens:
    - my_touchscreen
  pages:
  - id: main_page
    widgets:
      - label:
          align: CENTER
          text: 'Hello World!'

display:
  - platform: ili9xxx
    model: GC9A01A
    id: watchface
    reset_pin: $repin
    cs_pin: $cspin
    dc_pin: 
      number: $dcpin
      ignore_strapping_warning: true
      # The above is to remove the strapping pin warning message
 # The next are optional
#    width: 240
#    height: 240
# Disable this if using ble_tracker as the poor thing doesn't have enough memory 
# Enable it if not using ble_tracker as you will find the screen looks and responds better
# Disable this if you are encountering random reboots or other issues   
#    eight_bit_color: false
# How often to refresh the display
    update_interval: 1s
# Rotate the screen so usb socket is pointing down
#    rotation: 90
# No longer needed as integrated ili9xxx driver rotates the screen by default


tried this to use lvgl component…

Unfortunately I get this error. Looks like the touchscreen as defined in the CST component does not play well with the lvl component.

I know it is a “blind” try but I had to :slight_smile: hope it will be soon supported

For others, I have the waveshare Esp32-S3-touch-lcd-1.28-B. Here

I was able to get it to work by changing the PINs. I couldn’t get the touchscreen to work until I added the “resetPin” to the touchscreen section.

I am interested in trying the LVGL component as I am already using it on a esp32-s3-lcd-4.3

That’s because you are trying to use a text_sensor instead of a touchscreen platform. :crazy_face:. Just use the standard ESPHome CST816 touchscreen component.

2 Likes

Dooooooooh what a dumb

1 Like

Hi all,

Just wanted to share that I got one of these a while back and set up an example project using the native ESP-IDF developer tools. Don’t know anything about the software requirements for Home Assistant, but it should have all the correct pinouts and drivers.

2 Likes

Cool. I actually would like to try to get this thing working under esphome using the esp-idf framework (instead of arduino) at some point in time as it’s more memory efficient so might leave more room to enable things like esp32_ble_tracker to work without causing the thing to randomly reboot due to low memory. As I have one now in pretty much every room it would be handy to have for presence tracking. Sadly I haven’t been able to get it to work without errors, albeit I will admit I didn’t spend a lot of time on it.

Hi, this configuration works for running lvgl. Does anyone know how to move between screens using lvgl?

# Display configuration
display:
  - platform: ili9xxx
    model: GC9A01A
    id: watchface
    reset_pin: $repin
    cs_pin: $cspin
    dc_pin:
      number: $dcpin
      ignore_strapping_warning: true
    invert_colors: True 
    auto_clear_enabled: False

# Touchscreen configuration
touchscreen:
  - platform: cst816
    id: my_touch_screen
    i2c_id: i2c_touch

# LVGL Configuration
lvgl:
  displays:
    - watchface
  touchscreens:
    - my_touch_screen
  pages:
    - id: main_page
      widgets:
        - label:
            align: CENTER
            text: 'Hello World!'
        - button:
            id: hello_button
            align: CENTER
            on_click:
              - lambda: |-
                  ESP_LOGI("Button", "Hola");
    - id: second_page
      widgets:
        - label:
            align: CENTER
            text: 'Esta es la Segunda Página'

# Gesture handling with touch events

text_sensor:


  - platform: CST816S_touchscreen
    id: my_touch_screenx
    on_value:
      then:
        - script.execute: screentime

Switching screens is in my example. Don’t use the whole YAML though as I need to share the updated version that works with newer ESPhome LVGL versions.

Put this at the bottom of your touchscreen section:

  on_touch:
    then:
      lvgl.page.next:

thank you!!!

As far as I can see, this thread is not only discussing one specific device but also anything similar :slight_smile: So, I’ll add my two cents.

Recently, for my DIY project, I purchased a round display with a rotary encoder based on the ESP32C3.

I liked it very much. The build and material quality are very high. It looks great, and the knob has satisfying tactile feedback. The display is bright with wide viewing angles. While this product does not have a touch screen, for such a compact size, it is not necessary, as the encoder knob is sufficient.

This display is available on AliExpress for about $20. It is based on the ESP32C3 chip and features a round IPS display with a 240x240 resolution, a GC9A01A display driver with LVGL support, PWM-controllable backlight, and an aluminum rotary encoder knob around the display with a push-button function. As far as I can tell, it uses a similar screen and display driver to the M5Dial, but with fewer peripheral components. However, it’s almost twice as cheap, has a more minimalist design, and can be used in projects where the M5Dial is not suitable due to its overly colorful and flashy appearance.

I created two templates for connecting it to ESPHome. The first template is basic, while the second one enables LVGL support.

I created a separate thread for this device, where you’ll find ready-made templates, a brief overview, and resource links:

Here’s a video with ESPHome & LVGL:

Link to the manufacturer’s store:

https://www.aliexpress.com/item/1005007045539218.html

2 Likes

Heh, thanks, I’ve bought the same one and I thought mine was bricked as well :smiley:

also, can I ask a stupid question? I’m now on this forum, is this your latest sample code version?

or rather this?

Both should be fine - I’ve tried to keep them updated. I have however just updated the code from one of my wall controllers. There was a minor breaking change that I just needed to allow for. :slight_smile: