Use touchread() touch sensing inputs as on/off switch

I built a vertical standing torch with a 1 m / 144 LED strip and an aluminum profile. I want to be able to turn on and off the light by touching the aluminum profile. The ESP32 has several touch sensing one-wire inputs that are perfect for this application. I would just have to solder one wire from one of the touch inputs to the back of the aluminum profile, and it would register every touch to the lamp.

How can I use this to turn on and off the WLED strip?

Thank you!
Chris

Are the touch inputs digital inputs, or are they analog inputs, or are they configurable touch inputs as either digital or analog?
If they can be configured as touch inputs and digital inputs automatically, can you simply tell WLED to use the proper touch input pin as a button input?
If you need more, like what the button input needs to do, a usermod might get you there right now. Or, if enough people want it, it could get included in main WLED code.

1 Like

Yes, but touch pins are only on ESP32 not ESP8266.

You could have a single touch pin on previous versions by defining the touch pin and compiling. And dev/future versions support multiple touch pins. Unfortunately, I believe touch pins got overlooked in the change to dynamic pin assignment, and don’t work with current version (0.12.0)

1 Like

Oh I did not know that touchpins are exclusive to the ESP32. But it is not a problem to use an ESP32.

So do you think touch pins will work again soon? Or is the only solution to try to modify the code directly?

Thanks!

Touch is supported in latest code.

1 Like

Oh that’s wonderful. Where can I find information about how to turn this feature on and which pin to solder to? Thank you!

In LED Preferences, enter the GPIO number of the touch pin you are using then change the type to Touch.

image

2 Likes

Thank you! Will try :slight_smile:

By current here, I don’t think he meant most recent officially release. That’s not 0.12.0 in screen shot. You can either download one of the beta releases or compile yourself.

Yes, this does not seem to be in the current build version 0.12.0:

image

So beta version 0.12.1-b1 should have this option?

If you need latest bin files, you can download here WLED-wemos-shield/esp32_no_mods.bin at master · srg74/WLED-wemos-shield · GitHub

1 Like