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