Hello,
I would like to use ESPEasy for a doorbell. Everything is working, but I'm experiencing quite a few false positives. I must mention that the cable from the switch to the ESPEasy is quite long, around 50 meters. Can I add a resistor or a capacitor to prevent or filter out this noise that might be causing the false positives? I have the cable connected to GPIO13 (D7) on a NodeMCU with the pull-up activated. Thanks for any ideas you might have
switch false positives
Moderators: grovkillen, Stuntteam, TD-er
Re: switch false positives
For that kind of wire-length you'd need at max. a 4k7 pull-up resistor from gpio to 3.3V, and probably also a 10-100 nF capacitor from gpio to gnd, both at the NodeMCU side.
The built-in pull-up is around 80-100 kOhm, and that's way too weak to stabilize that kind of noisy signal. (Been there, done that )
In the Switch configuration the Debounce time should be set to 100 msec to make it more reliable/stable.
Another possibility would be to place the NodeMCU much closer to the button, and let the WiFi handle the distance, but that may be unpractical (long power lines etc.), though the pull-up should still be max. 10k, and the capacitor is also helpful.
The built-in pull-up is around 80-100 kOhm, and that's way too weak to stabilize that kind of noisy signal. (Been there, done that )
In the Switch configuration the Debounce time should be set to 100 msec to make it more reliable/stable.
Another possibility would be to place the NodeMCU much closer to the button, and let the WiFi handle the distance, but that may be unpractical (long power lines etc.), though the pull-up should still be max. 10k, and the capacitor is also helpful.
/Ton (PayPal.me)
Re: switch false positives
Hmm 50m cable is way too long.
You should for sure 'twist' the wires, but also make sure the wire ends have a very well defined state.
Depending on the switch type of the door bell, you can add some resistors.
I'll assume the switch of "NO" type (normally open, press to close)
So on the ESP side, you should pull the GPIO pin high using a rather strong pull-up resistor (e.g. 1k) and place a resistor of 10k over the door bell switch.
The ratio is still 10 : 1, so the logic level on the GPIO pin will be "high"
The switch and the 10k resistor will be connected to A and B
The long wires to A and B should be twisted, like the wires in UTP cable are.
By pressing the switch, the 10k resistor will be shorted and the capacitor between GPIO and GND will get discharged.
However since there is a 100 Ohm resistor in series with the switch, the capacitor will take some time to get discharged.
This will suppress noise picked up by the rather long antenna you created.
You can pick other resistor values, as long as the ratio of 1 : 10 : 100 is somewhat preserved. (ratio steps should be larger than 1 : 4)
And don't get too high resistance values, or else there won't hardly be any current flowing through the cable and thus less energetic noise can trigger false positives.
Still setting the debounce time, like Ton suggested, is needed.
You should for sure 'twist' the wires, but also make sure the wire ends have a very well defined state.
Depending on the switch type of the door bell, you can add some resistors.
I'll assume the switch of "NO" type (normally open, press to close)
So on the ESP side, you should pull the GPIO pin high using a rather strong pull-up resistor (e.g. 1k) and place a resistor of 10k over the door bell switch.
The ratio is still 10 : 1, so the logic level on the GPIO pin will be "high"
Code: Select all
3V3
|
|
1k
|
GPIO ----- 100 Ohm -----A
| |
100nF 10k
| |
GND --------------------B
The long wires to A and B should be twisted, like the wires in UTP cable are.
By pressing the switch, the 10k resistor will be shorted and the capacitor between GPIO and GND will get discharged.
However since there is a 100 Ohm resistor in series with the switch, the capacitor will take some time to get discharged.
This will suppress noise picked up by the rather long antenna you created.
You can pick other resistor values, as long as the ratio of 1 : 10 : 100 is somewhat preserved. (ratio steps should be larger than 1 : 4)
And don't get too high resistance values, or else there won't hardly be any current flowing through the cable and thus less energetic noise can trigger false positives.
Still setting the debounce time, like Ton suggested, is needed.
Re: switch false positives
Okay, thank you for the information. I will give it a try.
Who is online
Users browsing this forum: No registered users and 13 guests