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

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
PetrJakes
New user
Posts: 5
Joined: 09 Nov 2019, 01:40

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

#1 Post by PetrJakes » 09 Nov 2019, 02:24

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?

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

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

#2 Post by ThomasB » 09 Nov 2019, 04:22

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

PetrJakes
New user
Posts: 5
Joined: 09 Nov 2019, 01:40

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

#3 Post by PetrJakes » 09 Nov 2019, 08:42

The pull-up option is chosen in the device's plugin.
Where to find this option in the ESPEasyMega?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

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

#4 Post by TD-er » 09 Nov 2019, 10:13

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.

PetrJakes
New user
Posts: 5
Joined: 09 Nov 2019, 01:40

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

#5 Post by PetrJakes » 09 Nov 2019, 10:36

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.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

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

#6 Post by ThomasB » 09 Nov 2019, 19:25

Since the counter plug-in does not have a pullup option you should install the external resistor. Couple minutes work, done.
- Thomas

PetrJakes
New user
Posts: 5
Joined: 09 Nov 2019, 01:40

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

#7 Post by PetrJakes » 09 Nov 2019, 21:29

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

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

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

#8 Post by ThomasB » 09 Nov 2019, 21:47

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

PetrJakes
New user
Posts: 5
Joined: 09 Nov 2019, 01:40

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

#9 Post by PetrJakes » 09 Nov 2019, 21:58

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

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

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

#10 Post by ThomasB » 09 Nov 2019, 22:45

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

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests