Page 1 of 2

DS18B20 wire length

Posted: 14 Nov 2007 15:23
by PortlandJohn
Hi, Its me again trying to use a DS18B20 temp sensor.
Does any one know how long the wires can be when using the DS18B20 in VCC mode ( not parasitic mode.)

I can get it to work with about 1m of cable but would like to use 3-4 metres.

Best regards

John

Posted: 14 Nov 2007 15:51
by guyfoc
depends of the type of cable but can be 100m easilly
do not use coax

Posted: 14 Nov 2007 15:54
by PortlandJohn
The cable I am using is screen twisted pair. using the screen as the gnd.

John

Posted: 14 Nov 2007 22:29
by Charlie
Hi Guys,

I was needing to now the same thing.Thanks.I'm using 4 conductor telephone cable. I asked Maxim IC tech support this question and all I got was "It all depends" and he gave me a link to a app note.Some support. :shock:

Posted: 15 Nov 2007 08:31
by Colin
I have seen a setup where the guy used cat5 cable about 10 meters long.
He had to change the pull-up resistor to 2k2. Also, at that distance, he could only have one device on the bus.

Posted: 16 Nov 2007 10:39
by guyfoc
use if possible utp cable tel twisted pair and make a real bus, not a star bus
if you have more than 1 dev
i tested 4 x ds1820 on a cable not used for 230v in // with pwr cable s
about 10m and a star bus goin to 4 radiators accu type
i receive sometime a bad reading (0c) but not critic in my application( just to ctl the charge at the end of the night and see the temp to modif it or not)
i do not use the crc check but exclude the false reading and make a means for 5 times for ex if the application is more critical
i use also ds2408 and ds2540 to ctl a home made alarm and let say every 3h a bad reading so i test it 5 times befor an action...( no crc check)
like that 100% ok

Posted: 16 Nov 2007 10:44
by guyfoc
i forget to say that i use 1k tie up res
and i discus before in the forum about cables (also good info on maxim but not always easy to understand for beginners)
rem i use the eeprom of my pic to store some result so i can see what was the value that trigger an even later with the progammer..

Posted: 16 Nov 2007 10:47
by guyfoc
i forget to say that i use 1k tie up res
and i discus before in the forum about cables (also good info on maxim but not always easy to understand for beginners)
rem i use the eeprom of my pic to store some result so i can see what was the value that trigger an even later with the progammer..

Posted: 16 Nov 2007 10:57
by California
UTP cable is OK. I have 6 DS18S20 connected in LINE in parasite mode. I solved problems of bad reading with few capacitors (1nF) on the LINE. And it works OK.

Best regards

Posted: 26 Nov 2007 14:46
by zuran
Same for me, I use UTP, and up to 15 m distance with 1.8k pull up register. I have 6 ds1820 connected to the line. I also use CRC control so far no errors

you have to take care about timings, after the command for calculating the temp you need to wait 750msec before calculation is done.
Also for reading the temperature you need a few msec before the data is ready to receive

wow

Posted: 27 Nov 2007 20:18
by PaulC
used cat5e cable 4 pair
1k pulup at end + 1n non pol cap
50 mtr ds18s20 works fine :idea:

Posted: 27 Nov 2007 21:15
by yo2lio
PaulC ,

Data line is twisted with ground wire ? Wright ?

Posted: 29 Nov 2007 10:52
by oliverb
Might be worth someone putting a scope on it and checking for ringing. I was under the impression that 1-wire could withstand a few N on the pin.

It might benefit from a small series resistor at the PIC I/O pin, at roughly the cable Z.

Also the PIC logic threshold might be a bit low.

Data line is twisted with ground wire ? Wright ?

Posted: 01 Dec 2007 16:42
by PaulC
Data line is twisted with ground wire ? Wright ?
4 x twisted pair
1pair is supply brown + brown/white
blus i/o line
pullup
from brown +5v supply
cap across brown + brown/white

Re: Data line is twisted with ground wire ? Wright ?

Posted: 01 Dec 2007 18:02
by yo2lio
PaulC wrote:4 x twisted pair
1pair is supply brown + brown/white
blus i/o line
pullup
from brown +5v supply
cap across brown + brown/white
Hmmm....

I don't understand .... :oops:

I use also UTP CAT 5E cable for 1wire bus, but i make few mistakes :

pair white/orange - orange : + 5V
pair white/blue - blue : GND
pair white/green - green : DATA LINE

:?: :!:

I think, the wright choses is : (not tested)

1. wire orange : + 5V (or green or blue or brown .... not mater)
wire white/orange : GND
2. wire green : DATA LINE :arrow: data line twisted with ground
wire white/green : GND
3. wire blue : + 5V
wire white/blue : GND
4. wire brown : + 5V
wire white/brown : GND


Of course pull up resistor from data line to VCC , depend of cable length ( 2k2 - 4k7), and decoupling capacitor 100nF from VCC to GND.