Max cable length for DS18b20 and AM2301

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 527
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Max cable length for DS18b20 and AM2301

#1 Post by mackowiakp » 16 Aug 2022, 12:38

What are the experiences of the Dear Colleagues from the forum? What is the max cable length for DS18b20 and AM2301?
For SOnnOff, extension cords as long as 5 m are available (on Ali for example).
Something does not bother me that ESP is working properly then.
I am thinking of using a shielded headphone cable with each wire individually shielded.
The data cable, of course, pull-up to 3.3V.
Is the length of 3 m too long?
And one more question.
Do I connect several DS18b20 (4-5 pcs) to one GPIO or each to a separate one?
And can I connect both DS18b20 and AM2301 to the same GPIO? Or each type to separate GPIO?

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

Re: Max cable length for DS18b20 and AM2301

#2 Post by TD-er » 16 Aug 2022, 12:52

Dallas sensors should be chained to the same GPIO pin.
However keep in mind that ESPEasy does not support parasitic powering of 1Wire sensors.

1Wire protocol dus have the data pin high (thus needs a pull-up resistor) and the ESP or the sensors may pull the line down for a short period.
This does make it less prone to noise as you need quite some high energy noise to disrupt this.
However, I got a feeling it does matter whether the pull-up is close to the ESP or close to the last sensor.
But I don't know yet which one is best.
Having the resistor near the last sensor causes a current to flow through the entire chain when the signal is pulled low, but it may have more noise on the ESP side.
Not sure which one is more sensitive to noise, the sensor or the ESP.
So that's some idea for testing if you run into issues.

Another thing to keep in mind with longer cables is that the voltage may drop even though these sensors do not consume a lot of power.
But not all 1Wire sensors may be happy about it.
Also longer cables increase the capacitance of the cable, which also "rounds off" the pulses.
Using a stronger (lower resistance) pull-up resistor may help here.

The AM2301 is actually a DHT sensor, which is not 1Wire compatible.

mackowiakp
Normal user
Posts: 527
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Max cable length for DS18b20 and AM2301

#3 Post by mackowiakp » 16 Aug 2022, 13:11

THX

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests