Pages: [1]   Go Down
Author Topic: What's the longest distance you've achieved with the 1-wire bus (DS18B20)?  (Read 1010 times)
0 Members and 1 Guest are viewing this topic.
Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I want to get the temperature from the top of our roof, ideally as far up as we can get it to avoid shade.  I don't have a lot of flexibility of where to put the project box so the cable will be quite lengthy, at least 10m.  I have a weatherproof DS18B20 probe and some 4-core burglar alarm wire (that I only need 3 cores from).  For giggles I wired the probe up via the entire 30m roll...and I wasn't too surprised to see no sensor is found by the Arduino now. 

To reduce the cycle of trial/error that's ahead, what distance has anyone else achieved, and were there any tricks with resistor values that worked for you?  I'm just using the 4k7 resistor presently.

Thanks
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using parasitic power? If so don't.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using parasitic power? If so don't.

______
Rob
I've wired it up with 3, so running 5V, GND & signal rather than parasitic.  I did read that was problematic over distance, and I also thought this was a better way to allow for expansion later, and that is on the cards depending on how far we can run the cable.
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't answer your question about the length except to say that you can go longer if you use a chip like the DS2482-100 with an active FET pullup. And talking about expansion there's an eight-channel version as well (DS2482-800).

That may be an option if you have trouble.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was hoping to avoid adding a driver chip if possible, and the notes on the Maxim site gave me hope that wasn't required:
Quote
Network weight is limited by the ability of the cable to be charged and discharged quickly enough to satisfy the 1-Wire protocol. A simple resistor pullup has a weight limitation of about 200m. Sophisticated 1-Wire master designs have overcome this limitation by using active pullups, that provide higher currents under logic control and have extended the maximum supportable weight to over 500m.
(source: http://www.maxim-ic.com/app-notes/index.mvp/id/148 )So at first I thought the 30m multicore cable would work fine even at full length, if for a single sensor.
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like you'll be right then.

Have a look at this thread from the PICAXE forum

http://www.picaxeforum.co.uk/showthread.php?15306-One-Wire-Devices-Networks&highlight=1-wire

It's pretty long but there might be an answer in there, the author (westaust55) seems to know a lot about the protocol.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Rob,

You've nudged in the right direction and whether you realise it or not provided hints of the right questions to to be looking up so very much value your help.

That link was very handy, and it led me to this :
 
Quote
The pull-up resistor value must be low enough to provide sufficient current through it to power devices on the bus, but not so low that the open drain slaves are unable to successfully pull the data line down to a logic 0 level.
Slave devices are typically able to pull the bus line down to about 0.4 volts when faced with 4 ma of pull-up current due to their internal resistance of approximately 100 ohms. Any additional resistance (due to wiring or other devices) will limit this ability even more. This defines what is referred to as the base floor for logic 0 states. As you may have recognized from this the theoretical noise immunity has been cut in half. To only 0.4 volts (0.8 -0.4 = 0.4 volts).  Typical values for the pull-up resistor are between about 1K ohms to 4.7K ohms. This sets the current range to between 5 ma and 1.06ma

(source : http://www.1wire.org/Files/Articles/1-Wire-Design%20Guide%20v1.0.pdf )

So now with a 1k pull-up resistor installed I have a functional temperature probe running at the far end of the 30m tangle of multicore on the floor at my feet.

Rather than take this at face value (I just jumped to the opposite end of the value range so that came too easy) I think I'll write a sketch to log the output over a hot day to pachube or similar to ensure it doesn't drop out when the wire resistance rises due to heat. 

 Presuming all goes well, we know the answer to this situation with just 1 sensor is over 30m using Jaycar alarm wire.  smiley

Cheers ! Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11197
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using parasitic power? If so don't.

______
Rob

I tried this briefly and came to the conclusion that the 1-wire library didn't support parasitic mode. I couldn't get it to work by just connecting the hardware in a parasitic configuration. Looking at the 1-wire library the code to switch modes on the data pin didn't seem to provide logic to supply power when required. Am I missing a trick? Does parasitic mode actually work?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Cumming, GA
Offline Offline
Edison Member
*
Karma: 18
Posts: 1628
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It does support parasitic mode.  You *must* have a pullup resistor to +5v on the data line.

1-wire SIGNALS on the DATA/POWER pin by pulling it low... so it must be held HIGH by a PULLUP.

However, DISTANCE impacts the signal in subtle ways.

1) Short wire + 4.7K Pullup  (~1-50ft)  OK.  Signal remains close to 5V and reasonably noise immune
2) Long Wire + 4.7K Pullup  (>~50ft)   Not as OK.  Signal drops lower than 5V, weaker pullup allows more noise and signal edges start to deform.

Solution: Stronger Pullup  (use lower value resistor,  like 2.2K instead)
« Last Edit: February 22, 2012, 10:16:03 am by pwillard » Logged

Pages: [1]   Go Up
Jump to: