Skip to content

ESP32 S2 touch threshold has no effect #4076

Closed

Description

@RobinMeis

What happened?

I'm running WLED 0.15.0-b4 on ESP32 S2 Mini. Adjusting the touch threshold doesn't change anything. Sensitivity doesn't change, it doesn't make any difference if I set the threshold to 1 or to 100. Sensitivity is always too low.

To Reproduce Bug

Attach a touch surface to the board and play around with the touch threshold.

Expected Behavior

Changing the threshold should change the sensitivity

Install Method

Binary from WLED.me

What version of WLED?

0.15.0-b4

Which microcontroller/board are you seeing the problem on?

ESP32-S2

Relevant log/trace output

No response

Anything else?

I think this is related to #3798 and the shifting of touchThreshold in
https://github.com/DedeHai/WLED/blob/15526bd6e8c7a75ee1e36cf24ae397a674f63c56/wled00/cfg.cpp#L260

touchAttachInterrupt(btnPin[s], touchButtonISR, touchThreshold<<4); //threshold on Touch V2 is much higher (1500 is a value given by Espressif example)

Maybe the shifting causes a scaling issue.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. blazoncek commented on Jul 26, 2024

    @blazoncek
    Contributor

    This change was implemented by @DedeHai and will require his attention.

  2. DedeHai commented on Jul 26, 2024

    @DedeHai
    Collaborator

    I will take a look. If I remember correctly, the base value is automatically adjusted (auto calibration) and thresholf is just for fine-tuning but that may be a misconception on my side.
    What was the exact geometry and setup of your touch button?

  3. RobinMeis commented on Jul 26, 2024

    @RobinMeis
    ContributorAuthor

    I started to compile the firmware on my own and played around with the mentioned threshold scaling. I could achieve the desired sensitivity by lowering the threshold significantly. In my tests including touch buttons behind plastic covers, values around 100 worked best.

    With ESP32 Wroom I observed that I had to increase the threshold to get a higher sensitivity but for Touch V2 it seems to be opposite. Setting the threshold < 100 results in ghost touches for some buttons. On the other hand setting the threshold static to 65300 results in no sensitivity at all.

    So I think that we need to find a proper range to implement a better scaling. I modified the scaling to allow values between 50 and 3050. At least for the buttons I tested with, the range seems to be suitable.

    I pushed my current changes to https://github.com/RobinMeis/WLED/blob/9c7afedece573d0611541cfe372f48fbd9b0c056/wled00/cfg.cpp#L299

  4. RobinMeis commented on Jul 26, 2024

    @RobinMeis
    ContributorAuthor

    What was the exact geometry and setup of your touch button?

    For testing I used a round copper plate with a diameter of 18mm behind different thin plastic cards to simulate a hidden button. Without the plastic cards it worked. The real "button" is actually a coil spring that is part of a light.

    Both worked well with ESP32 Wroom, but I could only get them working with ESP32 S2 after the described modifications.

  5. changed the title [-]ESP32 C2 touch threshold has no effect[/-] [+]ESP32 S2 touch threshold has no effect[/+] on Jul 26, 2024
  6. DedeHai commented on Jul 26, 2024

    @DedeHai
    Collaborator

    So I think that we need to find a proper range to implement a better scaling. I modified the scaling to allow values between 50 and 3050. At least for the buttons I tested with, the range seems to be suitable.

    Bit contradictory. The code uses a range from 0 to 4080 (at least it should, no PC access RN to check), which you say does not do anything. Could it be just a missing typecast?

  7. RobinMeis commented on Jul 26, 2024

    @RobinMeis
    ContributorAuthor

    It doesn't. What I replaced from current 0_15 branch was
    256 + (touchThreshold << 4)
    which won't allow to go below 256, but yes, not adding 256 should also work and would be a cleaner solution, just missed to test this while playing around

  8. GHBLoos commented on Sep 7, 2024

    @GHBLoos

    I have the same problem, meaning there is no response at all on a touch. I like to check my config first to exclude a possible wrong setting or so, before I build and flash.

    ESP32 wemos S2 mini
    version v0.14.4 "Hoshi"

    In prefeferences:
    Button 0 GPIO 14 - Touch
    Currently I have a 10cm wire connected to GPIO 14 with a stripped end of about 4 cm

    @RobinMeis : Do you have a comparable config?

  9. DedeHai commented on Sep 7, 2024

    @DedeHai
    Collaborator

    V0.14 has no touch support for S2/S3, that bug is fixed in latest 0.15

  10. cameronnathan707 commented on Sep 22, 2024

    @cameronnathan707

    Hi, I have not been able to get touch working with a 5cm wire using the "SEEEDSTUDIO XIAO ESP32S3". I have tried on multiple pins and on multiple boards with the version 0.15.0-b5.

  11. DedeHai commented on Sep 22, 2024

    @DedeHai
    Collaborator

    If you need help with your setup, this is not the place, please use Discord or Discourse forum. Touch works fine on S3 in 0.15-B5.

  12. added
    fixed in source
    on Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixed in source

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions