I am following wiki. As I understand, the current firmware is allow to set up push-button to conbtrol on/off. This button connects GPIO0 (pin D3) to GND.
I want to use sensor button instead physical one. Sensor touch buttons has 3 connectors: VCC (+3.3v), GND and I/O. (I am using TTP223 like this one)
As I understood, sensor button works as: sensor not activated, I/O produces nothing. sensor is activated - I/O produces +3.3v, (not connects GND).
Could you tell me, are there any options to use sensor touch button with WLED?
Thank you!! Which transistor should I use? Any? I will unsolder from some old electronic stuff .
By the way, Any other options to change behaviour and make wled work with touch button via code?
@sergge The little transistor circuit @tonyo showed is probably easiest.
However it is of course possible to do this in code - you’ll have to have a 10K or similar pulldown resistor between GND and the sensor out. ESP cant boot if gpio0 is low, so you’ll have to set a different
BTNPIN in NpbWrapper.h. I’d recommend gpio5.
Then remove lines 244-251 in wled.cpp.
Lastly, replace LOW with HIGH and vice versa in lines 24 and 40 of button.cpp
Thanx,I will try with the code.
That is necessary for my new project: WLED atthekitchen
Do not understood whether noone asked for this))
I have finally came back to my kitchen project.
I see that the source code changed since the Aircookie reply and the lines numbers in instructions above do not correspond to the current code.
So, I have done these changes to the source code following the instructions:
changed the BTNPIN to 5 within NpbWrapper.h
#define BTNPIN 5 //button pin. Needs to have pullup (gpio0 recommended)
Changed LOW to HIGH at button.cpp, line 21:
if (digitalRead(BTNPIN) == HIGH) return true;
- Connected three Touch button’s wires to the:
- 3.3v NodeMCU pin 3.3v
- GND to NodeMCU’s GND pin
- I/O to the NodeMCU’s D1 (GPIO5).
No resistors is used (in front of recommendation above).
Works like a charm.
Here is a brief (1 minute) video summary on youtube.
- How to make the turn ON by the physcall Button connected to GPIO always to the pre-set colors (e.g. sometimes I can play with the effects, but later if the user will turn ON by button - led should light on with white color - not the last turned off color).
Minor questions, not so important:
- Is there could be a problem (in the future) of not using the resistor as recommended by Aircookie above?
- Are the option to include such behavior to the source code, e.g. to be able to change in user interface the HIGH to LOW in order to make the touch button work.
Made with macros
I’ve been looking for an easier and cleaner solution and think I have found it. It seems like the awesome people at WLED has solved it for us.
I have the little red TTP223 link, and a Wemos D1 mini installed with latest WLED 0.11.0. The TTP223 has jumpers at the back (A/B) that you can bridge.
- If you bridge only the A jumper on the TTP223 (for low output)
- Connect data cable from TTP223 to D3(GPIO0) Pin
- Check On/Off button enabled in settings under: Config/Sync Interfaces
Everything should work just fine, I tested 2 of my lamps with no issues at all. Hope this help.
I was wondering if you have any picture of your installation? I have the same button that I tried to use some rod to make nice button but it boost so much the sensibility that the buttons are acting weird. Thus since, I’m looking for a way to have a button to control the wled and maybe other stuff but I can’t find anything.
Why are you using a separate touch sensor and not one of the 10 built in touch sensing inputs of the ESP8266? ESP32 Capacitive Touch Sensor Pins with Arduino IDE - YouTube
I think you meant the 10 built in capacitive touch sensors on the esp32 since the esp8266 does not have these sensors built in, as far as I know.
Is there any change in the code that needs to occur to use these built in touch sensors or am I able to change it in the general settings on WLED’s interface?
Which version are you using?
0.12 at present
Try a 0.13 beta version. Touch worked prior to 0.12 where you would set the touch pin in a compile flag. But it got overlooked when they switched to UI configured pins in version 0.12.
I’m a relative novice at the coding aspect. What is a compile flag and do you have any suggested tutorials on how to enact it in relation to WLED and esp32? I’m not using the arduino ide so I don’t know how to go about editing the binary or if that’s even what needs to be done.
You need to edit the source and compile. Alternatively, you can use Blaz’s code and just set your touch pins.
Lol. I had just copied the link to Serg’s binaries and Tonyno beat me to it. Use 0.13.0-b2 probably the ESP32 no mods version. Set the button to the gpio of your touch pin (not the touch number)
Look like main has touch support (b2 above).