DS18B20 wire length

General discussion on mikroBasic.
Author
Message
PortlandJohn
Posts: 251
Joined: 20 Jan 2006 11:17
Location: Portland UK

DS18B20 wire length

#1 Post by PortlandJohn » 14 Nov 2007 15:23

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
Never underestimate the value of a reply.

guyfoc
Posts: 297
Joined: 09 Sep 2005 11:34
Location: belgium

#2 Post by guyfoc » 14 Nov 2007 15:51

depends of the type of cable but can be 100m easilly
do not use coax
things we are knowing are always easy

PortlandJohn
Posts: 251
Joined: 20 Jan 2006 11:17
Location: Portland UK

#3 Post by PortlandJohn » 14 Nov 2007 15:54

The cable I am using is screen twisted pair. using the screen as the gnd.

John
Never underestimate the value of a reply.

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#4 Post by Charlie » 14 Nov 2007 22:29

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:
Regards Charlie M.

Colin
Posts: 738
Joined: 15 Oct 2007 08:53
Location: Australia

#5 Post by Colin » 15 Nov 2007 08:31

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.

guyfoc
Posts: 297
Joined: 09 Sep 2005 11:34
Location: belgium

#6 Post by guyfoc » 16 Nov 2007 10:39

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
things we are knowing are always easy

guyfoc
Posts: 297
Joined: 09 Sep 2005 11:34
Location: belgium

#7 Post by guyfoc » 16 Nov 2007 10:44

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..
things we are knowing are always easy

guyfoc
Posts: 297
Joined: 09 Sep 2005 11:34
Location: belgium

#8 Post by guyfoc » 16 Nov 2007 10:47

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..
things we are knowing are always easy

California
Posts: 361
Joined: 14 Dec 2005 20:56
Location: Slovenia

#9 Post by California » 16 Nov 2007 10:57

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

zuran
Posts: 29
Joined: 19 Oct 2007 08:15
Location: Belgium

#10 Post by zuran » 26 Nov 2007 14:46

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

PaulC
Posts: 100
Joined: 03 Oct 2007 15:15
Location: Ireland

wow

#11 Post by PaulC » 27 Nov 2007 20:18

used cat5e cable 4 pair
1k pulup at end + 1n non pol cap
50 mtr ds18s20 works fine :idea:

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#12 Post by yo2lio » 27 Nov 2007 21:15

PaulC ,

Data line is twisted with ground wire ? Wright ?
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

oliverb
Posts: 570
Joined: 24 May 2007 15:09

#13 Post by oliverb » 29 Nov 2007 10:52

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.

PaulC
Posts: 100
Joined: 03 Oct 2007 15:15
Location: Ireland

Data line is twisted with ground wire ? Wright ?

#14 Post by PaulC » 01 Dec 2007 16:42

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

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

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

#15 Post by yo2lio » 01 Dec 2007 18:02

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.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Post Reply

Return to “mikroBasic General”