Problems with DS18b20 and long cables

Hi all,

I am trying to use a DS18b20 temperature sensor to control a heater based on the outside temperature.
Everything works beautifully on my bench table, however I can't get temperature readings once I install the DS18b20 50 feet away from the pro mini.

I used cat. 5 cable for the leads, about 50 feet long, and unfortunately the cable does ride along multiple 220V power cables.
I have read the posts I could find on the topic, and before I start experimenting I have a few questions:

  • would it generally be easier to use an LM35 - like sensor for this application (i.e. long, noisy leads)?

  • if I stick with the DS18b20, is there any way to tell if the problem is a) noise or b) timing issues with the OneWire protocol (several posts recommend experimenting wit different resistors between signal & ground, I tried 1.2K and 2K to no avail)?

  • beyond 0.1uF capacitors between VCC * GND on both ends (which I haven't tried yet), is there more sophisticated filtering I could use, maybe specifically targeted at the 50Hz of the mains power? The LM35 datasheet has schematic for an "RC damper" between signal and GND, would that be useful with the DS18b20?

Any suggestions appreciated, I'm kind of stuck at this point :slight_smile:
Thanks!
Franck

Edit: related posts I found:
Problems with LM35 Temp Sensors with long leads
Problem with DS18B20 OneWire and long cables

Hi,

See THIS PAGE with information about using the DS18B20.

At the end of the page is information on long wires.

CAT5 should be good; see the wiring example. Grounding unused wires should help also..

There is a MAXIM application note "Guidelines for Reliable Long Line 1-Wire Networks" on long cables HERE

I just tested with a spare sensor and 50 other feet of cat 5 cable I had, installed along the same main power cables, and I get perfect readings with a 2K resistor... so I guess I'll need to check the real cable & sensor tomorrow, I may simply have damaged something while routing it.

If I resolder the sensor, is there a recommended choice as to which of the cat 5 wires to use? You mentioned grounding the unused wires (I'll do that), I also saw someone recommend using one of the twisted pairs for VCC & GND to help cancel noise?

Would it make sense to use two pairs of wires for VCC & GND (e.g. solid green and solid blue for VCC, and striped green & blue for GND): more reliable, less impedance?

Franck

I also am trying to get a waterproof DS18B20 working with arduino over a long cable. I successfully got 5 sensors all working on a 100ft 12AWG extension cord. So now I need to get it working on a very long 18AWG waterproof sprinkler wire to put into the water. When I go to a 400 ft cable, I don't get any sensors "Found". I've read many of the forum entries on this subject and tried 1.2K, 2.2K, 4.7K pull down resistors, 5vdc, 3.3vdc and can't get the sensors acknowledged. I read an old entry from 2009 where someone changed the timing when driving the output low and high but then he seemed to use a later OneWire libtrary successfully. Does anyone have a sure way of using a DS18B20 on a long wire? Thanks.

I also am trying to get a waterproof DS18B20 working with arduino over a long cable.

Are you using two wires only, in "Parasite" mode?? That is not expected to work over long distances.

You could use Ethernet cable in wet environments. There is a version called "plenum cable" that is even more waterproof.

See the entry near the bottom called Long Cables on this page: Brick-Temperature-DS18B20 - ArduinoInfo

tried 1.2K, 2.2K, 4.7K pull down resistors

Did you mean pull up? Pull up resistors are what are required.

Pete

Could you possibly use something like an an ESP8266, located near your sensors, to send the temperature information back to your location. You could power it using your cat 5 cable if necessary.

I have been doing this to monitor my spa temperature. My 'temporary' setup with the ESP8266 mounted on a breadboard and located in a flimsy plastic container has been running for about a year.

Don

franck102:
I just tested with a spare sensor and 50 other feet of cat 5 cable I had, installed along the same main power cables, and I get perfect readings with a 2K resistor... so I guess I'll need to check the real cable & sensor tomorrow, I may simply have damaged something while routing it.

If I resolder the sensor, is there a recommended choice as to which of the cat 5 wires to use? You mentioned grounding the unused wires (I'll do that), I also saw someone recommend using one of the twisted pairs for VCC & GND to help cancel noise?

Would it make sense to use two pairs of wires for VCC & GND (e.g. solid green and solid blue for VCC, and striped green & blue for GND): more reliable, less impedance?

Franck

Use one twisted pair for Vcc/GND, one twisted pair for signal/GND (or signal/Vcc). 50 foot of CAT5 doesn have enough
resistance to matter, but you should have a 100nF decoupling cap on the sensors supply/GND anyway.

Try 4k7 or 2k7 pullups at each end of the cable and 100 ohm resistor in series with the signal at either end to
reduce reflections.

Once I added capacitor between "+5" and "ground" (near legs 1 and 3) of DS18b20 sensor it works with long cat 5 cable without any other changes!

1 Like