pull-up resistor esp8266 D1

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

pull-up resistor esp8266 D1

#1 Post by BartSr » 05 Mar 2025, 12:56

What's good pull-up resistor to prevent floating input esp8266 D1? 4K7 which I am using for Dallas seems not work well for a digital input.

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: pull-up resistor esp8266 D1

#2 Post by Ath » 05 Mar 2025, 13:03

Sounds like you have a really long wire (working like an antenna...), or maybe issues with soldering/connection?
The internal pull-up of ~80k is usually enough for short-wire connections, but for a doorbell-button with ~4mtr wire I'm using a 10k pull-up for years now.

What GPIO pin is involved here? (best pins to use on ESP8266)
/Ton (PayPal.me)

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

Re: pull-up resistor esp8266 D1

#3 Post by TD-er » 05 Mar 2025, 13:21

How did you wire the Dallas/1Wire sensor?
There are 2 ways to wire such sensor.
One is called "parasitic power" and that method is not supported in ESPEasy.

Also some of those sensors need a slightly higher voltage than 3V3.
Can you measure the voltage at the 1wire sensor side?

BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

Re: pull-up resistor esp8266 D1

#4 Post by BartSr » 05 Mar 2025, 13:38

Well, temp sensor is oke but just a digital input which is controlled by a solid state relay to monitor mainsvoltage is causing troubles. 4k7 pull-up didnot workout well.
BTW I am using a loose powerunit and feed the esp using Vin and ground.

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

Re: pull-up resistor esp8266 D1

#5 Post by TD-er » 05 Mar 2025, 16:34

Can you make a simple drawing of how the digital pin is connected?
I assume it is something like this:

3V3 --- R --- GPIO --- relay --- GND

How long is the wire between the ESP and the relay?
Can you twist the wires leading to the relay?
Just like the twists in UTP cable.

Another way to suppress noise is to add some 100 nF capacitor between GPIO and GND, as close as possible to the ESP board.

BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

Re: pull-up resistor esp8266 D1

#6 Post by BartSr » 05 Mar 2025, 22:17

the solid state relay is 1.5mtr away whereas a 2nd is kn same housing as the esp.
connected same as you mention.
signalcable 4*0.8
but what resistor value should be used
capacitor is good idea and I will try

Image
Attachments
Screenshot_20250305_220912_AliExpress.jpg
Screenshot_20250305_220912_AliExpress.jpg (510.45 KiB) Viewed 1383 times

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: pull-up resistor esp8266 D1

#7 Post by Ath » 05 Mar 2025, 23:05

Hm, what amount of current is needed to activate that SSR? The GPIO pin of an ESP8266 can (safely) supply only 12 mA max at HIGH level, though it can sink up to 20 mA to GND.
And I can only assume you have a DA model...?
/Ton (PayPal.me)

BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

Re: pull-up resistor esp8266 D1

#8 Post by BartSr » 05 Mar 2025, 23:21

Ath. The relay is activated by ac 230V. So how do I have to addres yr post re DC?

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

Re: pull-up resistor esp8266 D1

#9 Post by TD-er » 06 Mar 2025, 08:54

OK, let's move back a few steps...

What are you trying to do here?
In your start post you mention you want to measure an input.

What is connected to the input?
That solid state relay only seems to add to the confusion as those are very specific relays which can only switch AC current (not DC!!)

BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

Re: pull-up resistor esp8266 D1

#10 Post by BartSr » 06 Mar 2025, 10:25

When I read back my 1st post it may be confusing.
I tried to say that a pull-up of 4k7 works out well when using a dalles temp sensor
but now another input (D1)is used to monitor power and then the 4k7 seems to have too low value to pull up (or prevent from pull to ground by relay).
I also mentioned the esp is supplied via Vin and grnd. Might this cause a problem as well?

I have some same solid state relays in another project which are doing their job for years. (230V ac in same output as on previous picture).
So they certainly can pull down an digital input.
Now I have another one on my desk and I just found that external 4.7k pull-up resistor does not work whereas 15k does taken into account the solid state relay.
I just can't explain why in the other building it seems unstable. so also will try by adding the capacitor.
I can't try before next week (can't enter that building) so will report back progress later.

I just did some measurements. I found that the 4k7 pull up seems to keep a current going through the solid state output once it's deenergized so preventing from pull the D1 to 3.3V
the 15k does not keeps sufficient current to hold the output 'closed' while deenergized.

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

Re: pull-up resistor esp8266 D1

#11 Post by TD-er » 06 Mar 2025, 10:54

To be honest, I still don't understand how it all wired.
So can you maybe show some picture or photo of how things are wired?

Typically you need a pull-up resistor to do literally what the name states, pull up to some level.

So if you have a switch which closes and opens, you have something like this:

3V3 --- R --- GPIO --- switch --- GND.

The resistor R then pulls the GPIO level 'up' to 3V3 when the switch is 'open' and the switch pulls the level 'down' to GND when closed.

However you're showing a solid-state relay which is triggered by some AC mains voltage and switches also some AC mains voltage.
That's all fine and well, but it isn't closing 2 points like an ordinary relay does.
The solid state relay typicall only changes resistance from nearly 0 Ohm to nearly infinite resistance when it detects a 0-crossing.
That's why I mentioned a solid state relay can only be used to switch AC, not DC.

So it looks like you're trying to connect the load-side of such a solid state relay to an input of an ESP module.
But that won't work or if it does, it will be rather unpredictable.
When the output of the solid state relay is "closed" (thus the load is powered), the resistance over the output is near 0, thus the voltage is near 0 Volt.
So it will be able to switch "off" as it is similar to a zero-crossing for AC.
However switching "on" will probably not work as it will detect a non-zero voltage.

BartSr
Normal user
Posts: 177
Joined: 27 Sep 2019, 17:45

Re: pull-up resistor esp8266 D1

#12 Post by BartSr » 11 Mar 2025, 23:09

Oke, allthough I have at home same solidstate relay to detect if a light is powered I understand it may not reliable.
For that I replaced in the scouting building it with a conventional relay. It has a co contact. The D1 is connected to the common and toggles from 3.3V to grnd.
In fact such a relay should be provided with gold contacts....
So for now problem closed.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests