Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

max lengtth of DS18B20 cable

Thu May 07, 2015 9:30 am

I'm using a DS18B20 temp sensor with is standard having about 1 meter cable.
I do like to extend this cable.
Does anybody now the limit of length to be used?
Is there something to be taken care off beside the length?

Thanks

User avatar
rpdom
Posts: 18130
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 9:46 am

Some people have used cables of over 10m without any problems. I think they just used ordinary cat5 cable.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 9:48 am

rpdom wrote:Some people have used cables of over 10m without any problems. I think they just used ordinary cat5 cable.
Thanks!
That will be enough :D

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 9:57 am

You really should not exceed about 1.5 meters tops. This is similar to the i2c bus length; if you exceed about one meter then you will have intermittent problems due to capacitance issues and|or noise. words to the wise
marcus
:ugeek:

User avatar
rpdom
Posts: 18130
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 10:08 am

One wire is similar to I2C, yes, but has a much lower data rate and a much greater range (maybe 100m or more).

I2C was basically designed for interconnects inside a system (ranges of <1m).

The W1 bus was designed to be used with remote sensors.


User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 10:28 am

That's an excellent article; a very good read on 'why' to keep 1-Wire networks 'short' and detailing all of the PITA that is involved in making a long 1-Wire network reliable. Almost always folks are willing to push things to what they 'can' do (reliable or not) vs what they were designed to do. The 1-Wire network was designed to be short. Can you make it long, yeah, but will it be reliable? How good are you?

Just saying
marcus
:ugeek:

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 10:49 am

MarkHaysHarris777 wrote:You really should not exceed about 1.5 meters tops. This is similar to the i2c bus length; if you exceed about one meter then you will have intermittent problems due to capacitance issues and|or noise. words to the wise
This is utter nonsense. 10m is trivial, 20m is easy, and longer runs are quite achievable.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 11:02 am

ame wrote:
MarkHaysHarris777 wrote:You really should not exceed about 1.5 meters tops. This is similar to the i2c bus length; if you exceed about one meter then you will have intermittent problems due to capacitance issues and|or noise. words to the wise
This is utter nonsense. 10m is trivial, 20m is easy, and longer runs are quite achievable.
hi ame, I am utterly amazed at how argumentative everyone is here... YMMV is the expression that comes to mind. If you read the article carefully you will notice that running a long 1-Wire is NOT trivial (again, YMMV) and making reliable is more easily said than done (again, YMMV)... but, I am amazed at the sheer number of people who have trouble making the 1-Wire 'bus' work at 'any' length! ... and if you don't think so, just look around the net at all the questions about how to make it work; and it goes up proportionally to the length of the bus 'wire'. (again, YMMV) If its trivial for you, great! Not all people are electrical engineers, nor experienced hobbyists. For them, keeping the 1-Wire short is a great idea (again, YMMV)
marcus
:ugeek:

BMS Doug
Posts: 4420
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: max lengtth of DS18B20 cable

Thu May 07, 2015 11:37 am

MarkHaysHarris777 wrote:
ame wrote:
MarkHaysHarris777 wrote:You really should not exceed about 1.5 meters tops. This is similar to the i2c bus length; if you exceed about one meter then you will have intermittent problems due to capacitance issues and|or noise. words to the wise
This is utter nonsense. 10m is trivial, 20m is easy, and longer runs are quite achievable.
hi ame, I am utterly amazed at how argumentative everyone is here... YMMV is the expression that comes to mind. If you read the article carefully you will notice that running a long 1-Wire is NOT trivial (again, YMMV) and making reliable is more easily said than done (again, YMMV)... but, I am amazed at the sheer number of people who have trouble making the 1-Wire 'bus' work at 'any' length! ... and if you don't think so, just look around the net at all the questions about how to make it work; and it goes up proportionally to the length of the bus 'wire'. (again, YMMV) If its trivial for you, great! Not all people are electrical engineers, nor experienced hobbyists. For them, keeping the 1-Wire short is a great idea (again, YMMV)

The OP want's to extend his single sensor 1 wire network to have a longer cable run, reading the article shows that this is easily within the 1 wire capabilities.

Incorrectly telling someone that they cannot achieve what they want (when someone has already told them that they can do it) will raise people's hackles.

Disputing the evidence and claiming that it backs your position when it doesn't can also irritate people. YMMV.
Doug.
Building Management Systems Engineer.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: max lengtth of DS18B20 cable

Sat May 09, 2015 1:59 pm

I did add about 20 meter of CAT 5 cable to the sensor.
By proving I can tell that it works perfectly well
Thanks for the help everybody

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: max lengtth of DS18B20 cable

Tue May 19, 2015 6:05 am

FWIW I have used an ethernet Cat6 cable at approx 40m for my DS18B20 and I have had little or no problems with length thus far.
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

CyEE
Posts: 1
Joined: Thu May 21, 2015 4:09 am

Re: max lengtth of DS18B20 cable

Thu May 21, 2015 4:16 am

FWIW I have used an ethernet Cat6 cable at approx 40m for my DS18B20 and I have had little or no problems with length thus far.

There's the answer I'm looking for. I'm setting up a greenhouse (about 30m) with 5 sensors and already bought a box of cat6 cable.

I'm thinking it would be helpful to use a twisted pair (Brown/BrownWhite, etc.) for each 'wire' to the sensors, 3.3 V, Data, and Ground. Does anyone have an opinion on whether this would be helpful or harmful?

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: max lengtth of DS18B20 cable

Thu May 21, 2015 6:34 am

CyEE wrote: There's the answer I'm looking for. I'm setting up a greenhouse (about 30m) with 5 sensors and already bought a box of cat6 cable.

I'm thinking it would be helpful to use a twisted pair (Brown/BrownWhite, etc.) for each 'wire' to the sensors, 3.3 V, Data, and Ground. Does anyone have an opinion on whether this would be helpful or harmful?
The cool kids use pair one (blue and white) for data. Pin 4 (blue) is data and pin 5 (blue/white) is ground.

Here's one example:
http://dreamgreenhouse.com/designs/auto ... /index.php

There are many variants to choose from, but whatever you do, write it down!

I personally prefer 4-wire flat telephone cable. I can solder my one-wire devices to short pigtails with RJ11 plugs on the end, then plug them into RJ11 phone splitters. I can make my network by daisy-chaining these with other RJ11-RJ11 cables.

I use the cat5 wiring in the house to get me to the 'start' of the network then daisy-chain from there.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: max lengtth of DS18B20 cable

Thu May 21, 2015 3:15 pm

CyEE wrote:I'm thinking it would be helpful to use a twisted pair (Brown/BrownWhite, etc.) for each 'wire' to the sensors, 3.3 V, Data, and Ground. Does anyone have an opinion on whether this would be helpful or harmful?
I would strongly suggest against that arrangement.

The reasons are as follows:
1. Twisted pairs should be both parts of the signal-carrying pair. The twisting of the pair increases it's immunity to noise (external electro-magnetic radiation). Using untwisted pairs of twisted pairs effectively means you are carrying the signal over an untwisted cable.
2. According to the manufacturer's notes all unused pairs should be left unconnected. By using 6 wires when 3 would do, you are adding a very large amount of extra capacitance, which is a real killer for the 1-wire system. The increased capacitance far outweighs the value of reduced resistance.
3. 1-wire signaling is heavily dependent on the voltages rising and falling within short periods of time. Line capacitance is just like adding a capacitor to a circuit, it slows down the rise in voltage as it charges (signal goes from low to high) and it slows down the fall in voltage as it discharges (signal goes from high to low)

So use one twisted pair for data and ground and a single wire from another pair for power.

Leave unused wires disconnected - do not attach them to ground at either end.

30 metres and five sensors should be OK. It is noted that more sensors at the end of the line will impact performance. So start with one and if it works then add more and try again.

As I said, 5 sensors and 30 metres should be OK.
Two approaches if it is less than perfect:
1. change the value of the resistor at the Pi end of the cable
2. use a dedicated 1-wire line driver instead of the Pi's built-in system. These use an active pull-up rather than the passive resistor pull-up. I use the HA7s from Embedded Systems.
3. Add an error-correction algorithm to your reading process so that you re-read if the result shows an error.

Regards

anita2R

wayner
Posts: 84
Joined: Thu Oct 25, 2012 1:40 am
Location: Toronto, Ontario, Canada

Re: max lengtth of DS18B20 cable

Fri May 22, 2015 12:42 pm

I am using about 10m of 6-conductor twister pair telephone cable to carry the signal of two DS18B20 sensors from outside my house into my basement. My project has only been live for a few days but I read the temperatures every 5 minutes and I have yet to have a bad reading from the sensors. These are then connected in parallel with another DS18B20 sensor that has about a 3m run.

Return to “Automation, sensing and robotics”