Sensor wire length

I am using 3 DS18B20 sensors to connect to a ESP8266 board.
All works well. then put the system at my other house. Two sensors are about 20 feet away and third one at about 100 feet away. When I connect all three, I get no readings from the sensors. I noticed that if I use the 2 closer ones, all works well. But when I connect the one at 100 feet, all three fail to give readings.
I am using a cellphone charger to power my system. I can't figure out what is the problem. Thanks.

At such distance you can't ignore inductance of the wire anymore (and possibly its capacity as well, depending on the cable) - most likely it distorts signal fronts too much and DS18B20 can't recognize the command or produce the response.
Are you using them in 3-wire configuration or in 2-wire?
In 2-wire case I suggest switching to 3-wire. If you are already using 3 wire option, maybe using lower value of pullup resistor would help

100ft is a long way for those sensors, see if this helps though

Pullup Resistor guide
Length 5.0 Volt 3.3 Volt
10cm (4") 10K0 6K8
20cm (8") 8K2 4K7
50cm (20") 4K7 3K3
100cm (3'4") 3K3 2K2
200cm (6'8") 2K2 1K0

Thanks. I am using them in 3-wire config. I will try a lower pullup tomorrow and see what happens. I tried with shielded wires thinking that may be a problem but same result. Also I was thinking maybe my charger was not giving enough amps to reach all the way to the sensor. Now I will try a 2.2k pullup resistor and try again tomorrow. if I use a low pullup resistor, will that not cause a loss in current?

Thank you. I will try that tomorrow. I read somewhere on the internet that the DS18B20 can be connected upto 100 meters, which is encouraging. Hoping that is true, I am only 100 feet, a third the 100 meter distance. But I doubt that is true and only hoping. I will try tomorrow again with a 2.2k pullup. Thanks again.

There's some reading here too, people have got long runs with multiple sensors

There is a great advice in that discussion: adding a small-ish resistor on the data line - they used 80 Ohms there, and it looks very reasonable (probably anything in 50-100 Ohms range would be ok). The reason is that resistor in series damps oscillations caused by wire inductance and capacitance - and them could be indeed the biggest problem here.

Thank you so much! that is a very interesting and encouraging read.

Thank you so much for the link, it is a very interesting and encouraging read.

Definitely impossible scenario: those sensors would take only about 1 mA of current regardless of the wire length. And it means that wire resistance itself is negligible comparing to sensor impedance. So it's not a power problem for sure - it's a signal shape problem.
Smaller pullup would apply "stronger force" so to say to a data line, making it harder for oscillations to break logical levels. But damping resistors mentioned in the discussion linked above would work much better for that purpose

Should I put the low-ish resistor only at the ends on the longest run sensor or do I need to put on all 3? I would assume only on the longest run as that is causing the problem, but I am fairly new to arduino and dont want to make any mistakes.

I would start with putting it on the ESP side of the longest wire, in this point it would make the biggest impact - possibly it would solve the problem already. Then maybe on ESP side of other wires. After that, on the other side of those wires

Try to pullup resistor first, then if required add two 80 ohm resistors in series with the signal wire, 1 close to the arduino, 1 close to the most distant sensor.
Twisted pair wire, like Cat5 networking cable will help.
Use one twisted pair for ground and signal, and another twisted pair for ground and 5v

Are you using the DS18B20 with 5V or 3V3? Use 5V with pullup to 3V3 or use a level converter like TXB0101

Placing an 47µ/100µ and 100n capacitor near the DS18B20 can help.

I am using the pull up on the sensor to +5 volt and using the Gnd/5V to power the sensors, as I assumed the distance might need the higher voltage. I will try the 2.2k pullup resistor this morning. Then I will try to put the 80 ohm resistor like you mentionned. For wire, I used alarm wire first, then I replaced it with shielded wire, both with same results. I will try the cat5/6 also today if the pullup and resistors doesnt solve the problem. Also if I need the capacitors, do they have to be in series or parallel to the data line/ground or data/+5v? Thank you.

Ok will try that today. Thank you for helping.

You might think that but power and ground do not count. This is in fact a 1 wire device from the point of view of signal wires. Therefore you must use the 1 wire library, nothing else. 1 Wire devices take a long time to respond in the order of seconds or so.

This is a link to help you use them.
https://www.elprocus.com/ds18b20-temperature-sensor/

Very bad idea. That means you are exceeding the 3V3 voltage level of the device. A great way to damage your processor.

Do you mean I should power the DS18b20 with 3.3 v instead of 5V and use the pull up resistor between its sensor to 3.3? I have the thing online for about a week now.

I saw the wiring diagram here https://lastminuteengineers.com/ds18b20-arduino-tutorial/ which says to use the 5.5v. I hope I am not using my sensor wrongly wired and damage the processor.

It does say that but that example is for a 5V processor, not a 3V3 processor. Nowhere does it say you connect it to 5V if your processor is powered by 3V3.

The pinout of the sensor on this page shows the power labelled as Vcc. In electronics, that means to the power supply of the processor itself.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.