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.