-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[User Interface and DOC] - Pulldown/pullup in Plugin "Switch input - Switch" #4800
Comments
The internal pull-up/pull-down resistor is a rather high value, around 80-100 kOhm, and in somewhat 'unstable' environments, this isn't enough for a stable, properly defined, signal. |
Ciao Ton, ok but if in the Plugin "Switch input - Switch" there is the check box to use these resistors for both PullUp and PullDown anyway it's an error that on the Web interface the text specify only "PullUp". It can be also specified in the DOC about this internal 80 khom value cannot be enough to have a stable condition, in my case this internal resistor is OK. |
@TD-er I used a Category 6 ethernet cable (50 cm long) to connect the push button and the GPIO, anyway it flapping (I used a twisted pair). As told, for me, the internal PullDown resistor is (for now) OK, maybe the sum of the internal PullDown resistor and the twisted cable is enough. Thanks for the info but here the topic is the possibility, in ESPEasy, to use the internal PullDown resistor and in the Web Interface (and in the DOC pages) it specified only the PullUp and this generate confusion. Thanks! |
The internal pull-up should only be used on directly connected stuff, like a button on the PCB, or to set a state for a directly connected chip/transistor. An example use case where a pull-up resistor cannot be used is when some sensor is connected to a pin which needs to be pulled down at boot. (or a pull-down resistor for pins that need to be pulled up) For example a LAN chip with external crystal needs to have this crystal connected to GPIO-0. (on ESP32) There are numerous other use cases where the pull-up or -down resistor can be useful. I know ESP32 does allow to set the 'strength' of these pull resistors, but I haven't tried it yet and I also don't know whether it can be set per pin or group of pins. So I have planned to have a look at this at some moment, but it may also complicate things as I don't know whether you need to set those strengths again and also what effect this may have on deep sleep current. Also this glitch filtering is based on some hardware timer and I don't know yet whether this makes this timer unavailable for other use cases. |
It may depend on the plugin. This checkbox is part of the standard UI, shown based on the device configuration in code, but the actual execution of the code can behave differently from the Switch plugin (that's probably the most 'sophisticated' in this area and most tested). |
Yep, adding more options to the bootstates menu should also be implemented in the locations where a pull-up checkbox is used. Right now, the settings file uses an entry for this in the settings as type However, what can be done also depends on which pin is selected as "pin 1" for that task, as not all pins have the same pull-up/down options. So this takes quite a bit more work and is not just a matter of adding a combo box. |
Ok, yes. |
Maybe there links can be of interest about internal pull-down/pull-up: https://people.eecs.berkeley.edu/~boser/courses/49_sp_2019/N_gpio.html https://linuxhint.com/esp32-pull-up-pins/ It seems the internal pulldown resistor is 17 kohm. |
Hello.
Recently I have done some test and experience using the Plugin "Switch input - Switch" on ESP32 board.
My work was to use a push button switch connected to a pin of the GPIO in order to generate actions/commands.
What I discovered is that just adding a 10 centimeter copper cable to the GPIO (so leave it free on the air) generate a State flapping (floating) between 0 and 1, so it looks like some residual current (or may be better to call "energy") is received (sensed) by the GPIO pin.
I noticed this behavior also depend on the quality of Power Supply, connecting a Power Bank seems that this behavior disappear or is reduced.
This is what I see in the log:
So also if the push button is not pressed anyway I have a State flapping between 0 and 1.
Well, so in order to fix it I thought to enable the internal pull-down resistor of the ESP32 board, so I went in the Hardware page and I set the GPIO from "Default" to "Input pulldown", then to be sure I also rebooted the board.
I went again in the log and I see the GPIO is still flapping between 0 and 1:
So only to set the GPIO mode to "Input pulldown" didn't solve.
Then I went in the "Device" page and editing the "Switch input - Switch" and I see there is the option "Internal PullUp:", so I was confused because I need to enable the "PullDown" and not the "PullUp"...
But anyway I tried and I enabled "PullUp" and well, I SOLVED.
So I understood the option to enable or disable the "Internal PullUp:" in fact is related to the GPIO pin settings of the Hardware page.
So if the GPIO pin is configured as "Input pulldown" (in the Hardware page) then when I enable "Internal PullUp:" (in the Device page of the "Switch input - Switch ") it works as PullDown.
So, for what I have discovered, this means the check box to enable or disable "Internal PullUp:" in the Plugin "Switch input - Switch" should be renamed to "Internal PullDown / PullUp:" and add a Note that this setting will follow the GPIO Mode configured in the Hardware page for that GPIO pin.
Currently there is a note for "Inversed Logic:" that say "Note: Will go into effect on next input change.", well we need a new Note for the PullDwon / PullUp that this setting will follow the Mode (PullDwon or PullUp) configured in the Hardware page for that GPIO pin.
Also che be useful to update the DOC (https://espeasy.readthedocs.io/en/latest/Plugin/P001.html) by specify the concept about PullDown and PullUp when this Plugin is used for Switch or Push Button.
More, also here https://espeasy.readthedocs.io/en/latest/Plugin/P001_Switch.html is spcefied "Internal pull-up: Check if you want to use the internal pull-up of the ESP (not all GPIO pins have this internal pull-up.)" so it only specify there is the PullUp and not also the PullDown.
Thanks!
PS: Just a funny note, before I discovered this, in order to solve this flapping of the State, I physically added a 10 kohm resistor between GND and the GPIO pin, so I created the PullDown and I fixed the State flapping. But since it can be used the Internal PullDown resistor of the board and have the same goal, I prefer to use the Internal PullDown.
The text was updated successfully, but these errors were encountered: