Page 1 of 1

open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 02:24
by PetrJakes
Trying to monitor Zenner water meter EDC communication module

Module parameters:
  • Output type: N-channel Open-Drain (equivalent to an open collector)
  • Max output voltage: 24 V DC
  • Max Output current: 50 mA
  • Pulse length: >= 50 ms
  • Output resistance: 110 Ω
  • Output capacity: 1 nF
To connect open collector to the ESP input pin I need to be sure this pin has a pull-up resistor.

According to the Beginner's guide to the ESP8266 GPIO 0-15 all have a built-in pull-up resistor.

My questions are:
  • Is the internal pull-up resistor connected to the GPIO after boot by default?
  • If not, how to configure input to activate internal pull-up on the start?
  • Or it is necessary to use external pull-up?

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 04:22
by ThomasB
Is the internal pull-up resistor connected to the GPIO after boot by default?
No.
Keep in mind that there are some GPIO that are pulled high and low for boot configuration. See https://espeasy.readthedocs.io/en/lates ... on-esp8266
If not, how to configure input to activate internal pull-up on the start?
The pull-up option is chosen in the device's plugin.
Or it is necessary to use external pull-up?
Sometimes an external pull-up is needed (depends on the device). When using external pull-ups (or pull-downs) be sure to observe the special boot pin states.

- Thomas

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 08:42
by PetrJakes
The pull-up option is chosen in the device's plugin.
Where to find this option in the ESPEasyMega?

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 10:13
by TD-er
PetrJakes wrote:
09 Nov 2019, 08:42
The pull-up option is chosen in the device's plugin.
Where to find this option in the ESPEasyMega?
Depends on the plugin.
For example the switch plugin does have a pull-up checkbox in its configuration.

You can also set the gpio boot state in the "hardware" tab.

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 10:36
by PetrJakes
For example the switch plugin does have a pull-up checkbox in its configuration.

You can also set the gpio boot state in the "hardware" tab.
Yes, I know those settings.

I would like to configure: "Devices => Generic - Pulse counter" - but there is not setting/definition in the menu for pull-up/down

In the "hardware" tab, you can configure GPIO as an input, but similar situation: not option to configure pull-up/down.

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 19:25
by ThomasB
Since the counter plug-in does not have a pullup option you should install the external resistor. Couple minutes work, done.
- Thomas

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 21:29
by PetrJakes
Since the counter plug-in does not have a pullup option you should install the external resistor. Couple minutes work, done
Yes, until you have to do it 50 times :D

I have made some experiments.
  • Hardware Settings => GPIO boot states: PIN14 set as an input
  • Devices => Task Settings: Device: Generic - Pulse counter => Sensor GPIO ← Pulse: GPIO14 (D5)
  • water meter open-collector output connected to the GPIO14 and GND
  • analyzer and oscilloscope connected to the GPIO14 and GND
I was really amazed about the results (screen shot below).
  • When no output pulse from the water-meter, there is 3.22V on the GPIO14
  • When output pulse, signal to the 0V for about 50ms (exactly as described in the water meter technical list)
Can somebody here explain, why is 3.22V detected on the ESP (NodeMCU) input, when no pull-up (external nor internal) connected/set for the PIN14?

Image

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 21:47
by ThomasB
Can somebody here explain, why is 3.22V detected on the ESP (NodeMCU) input, when no pull-up (external nor internal) connected/set for the PIN14?
It is your lucky day. The counter plug-in enables the internal weak pullup by default. See _P003_Pulse.ino

- Thomas

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 21:58
by PetrJakes
See _P003_Pulse.ino
Do you mean this?:

Code: Select all

pinMode(Settings.TaskDevicePin1[event->TaskIndex], INPUT_PULLUP);
Anyway, thanks for your comments. Do you think it is good to report/request the pull-up/down issue to the
https://github.com/letscontrolit/ESPEasy/issues/new ?

In the Tasmota SW, for example, there it is possible to define:
  • Counter1 - Counter Input
  • Counter1n - Counter sensor, no pullup resistor

Re: open-drain (open-collector) on the input: is external pull-up necessary

Posted: 09 Nov 2019, 22:45
by ThomasB
Do you mean this?: {snip..snip}
Yes. The chosen input is configured with pull-up.
Do you think it is good to report/request the pull-up/down issue ...
You are free to do that. FWIW, I'm not a good person to ask about requesting new features because of my stubborn opinion about solving the ongoing stability issues first.

- Thomas