Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for m5dial touch driver #2500

Open
dgaust opened this issue Nov 27, 2023 · 7 comments
Open

Support for m5dial touch driver #2500

dgaust opened this issue Nov 27, 2023 · 7 comments

Comments

@dgaust
Copy link

dgaust commented Nov 27, 2023

Describe the problem you have/What new integration you would like
The m5dial uses a GC9A01 screen with a FT3267 touch driver. I have been able to integrate the display using an external component, but not the touchscreen.

Please describe your use case for this integration and alternatives you've tried:
I have tried external components with used for other devices with GC9A01 based screens (like the ones with CST816S series touchscreens), but have not had any luck registering touch events.

Additional context
Details of the m5dial are here, including pinouts and other details

https://docs.m5stack.com/en/core/M5Dial

@lboue
Copy link

lboue commented Dec 13, 2023

I'd like to do exactly the same.
Maybe this Arduino lib could help: LILYGO-TRGB-Library

@lboue
Copy link

lboue commented Mar 9, 2024

I found an ESPHome config file for M5Dial 1.28" Round Touch Screen.

external_components:
  - source: github://dgaust/esphome@gc9a01
    components: [ ft3267, gc9a01 ]
    refresh: 0s

i2c:
  - id: bus_internal
    sda: GPIO11
    scl: GPIO12
    scan: False
    frequency: 400kHz

touchscreen:
  platform: ft3267

binary_sensor:
  - platform: touchscreen
    name: "Central Circle Touch"
    x_min: 90   # Center x - radius
    x_max: 150  # Center x + radius
    y_min: 90   # Center y - radius
    y_max: 150  # Center y + radius
    page_id: TestPage
    on_release:
      - display.page.show: FirstPage
  - platform: touchscreen
    name: "Circle 2 Touch"
    x_min: 160  # Center x - radius
    x_max: 220  # Center x + radius
    y_min: 90   # Center y - radius
    y_max: 150  # Center y + radius
    page_id: TestPage
    on_release:
      then:
        - logger.log: "Circle 2 Touched"
  - platform: touchscreen
    name: "Circle 3 Touch"
    x_min: 125  # Center x - radius
    x_max: 185  # Center x + radius
    y_min: 151  # Center y - radius
    y_max: 211  # Center y + radius
    page_id: TestPage
    on_release:
      - display.page.show: WifiQR
  - platform: touchscreen
    name: "Circle 4 Touch"
    page_id: TestPage
    x_min: 55   # Center x - radius
    x_max: 115  # Center x + radius
    y_min: 151  # Center y - radius
    y_max: 211  # Center y + radius
    on_release:
      then:
        - logger.log: "Circle 4 Touched"
  - platform: touchscreen
    name: "Circle 5 Touch"
    page_id: TestPage
    x_min: 20   # Center x - radius
    x_max: 80   # Center x + radius
    y_min: 90   # Center y - radius
    y_max: 150  # Center y + radius
    on_release:
      then:
        - logger.log: "Circle 5 Touched"
  - platform: touchscreen
    name: "Circle 6 Touch"
    page_id: TestPage
    x_min: 55   # Center x - radius
    x_max: 115  # Center x + radius
    y_min: 29   # Center y - radius
    y_max: 89   # Center y + radius
    on_release:
      - display.page.show: AirConPage
  - platform: touchscreen
    name: "Circle 7 Touch"
    page_id: TestPage
    x_min: 125  # Center x - radius
    x_max: 185  # Center x + radius
    y_min: 29   # Center y - radius
    y_max: 89   # Center y + radius
    on_release:
      then:
        - logger.log: "Circle 7 Touched"

And it works !

[09:48:03][D][ft3267.touchscreen:132]: Read 0 status, id: 0, pos 113/73
[09:48:03][D][ft3267.touchscreen:132]: Read 0 status, id: 0, pos 130/79
[09:48:05][D][ft3267.touchscreen:132]: Read 0 status, id: 0, pos 129/44
[09:48:05][D][ft3267.touchscreen:132]: Read 0 status, id: 0, pos 117/11

@dgaust
Copy link
Author

dgaust commented Mar 9, 2024

Yeah, that's mine, I ended up writing a custom component that got the touchscreen working based off a similar touchscreen component

@lboue
Copy link

lboue commented Mar 9, 2024

Yeah, that's mine, I ended up writing a custom component that got the touchscreen working based off a similar touchscreen component

You should have put a comment here to share 😉
Maybe you can create a PR to integrate it in ESPHome.

@dgaust
Copy link
Author

dgaust commented Mar 9, 2024

Probably, if someone with more experience than me with esphome components wants to the repository is here.... It works, but no idea how it complies with esphome's requirements

https://github.com/dgaust/esphome/tree/gc9a01/esphome/components/ft3267

More discussion on how it all comes together is over

https://community.home-assistant.io/t/m5stack-dial-esp32-s3-smart-rotary-knob/623518

@dgaust
Copy link
Author

dgaust commented Apr 15, 2024

Yeah, that's mine, I ended up writing a custom component that got the touchscreen working based off a similar touchscreen component

You should have put a comment here to share 😉 Maybe you can create a PR to integrate it in ESPHome.

Coming back to this, you can use an inbuilt touch component for the touchscreen in the dial. Just need to define the address for it to work.

touchscreen:
  platform: ft5x06
  address: 0x38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants