JohnsUPS
Posts: 56
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: DS18B20 Max Distance

Mon Oct 08, 2018 11:10 pm

Just an update to my earlier post about the data center temperature monitor. The monitor has been installed, and everything is working perfectly. I wanted to share some of the installation details, as this installation technique is now proven to work in an electrically noisy environment and should be applicable to many other temperature sensor projects.

The final installation used five sensors spread out along the length of a CAT 6 cable running through the data center. The cable as installed is 369 feet from the first sensor to the DS2482-100 driver chip on the interface board. The first four sensors are spaced about 30 feet apart, and the fifth is about 50 feet from the fourth. Each sensor has a 10uf tantalum SMD capacitor between Vcc and Gnd at the sensor.

All of the sensors are wired in parallel and are NOT being used in parasitic mode. Along the length of the cable run, there were five RJ45 keystones punched down. The RJ45 receptacles in the middle were installed without cutting the wire. About 3-4" section of insulation was carefully removed, then the wires spread out and punched down (I just followed the 568B wiring pattern on the keystone), essentially tapping the cable along its length. Each keystone was then installed into a single port biscuit block and labeled. This took some time, but was worth the effort.

The sensor assemblies consisted of a short piece of CAT 6 cable about ~5" long (could easily be longer) with a RJ45 plug crimped on the end, also following the 568B standard. Modularity makes it easy to replace sensors if necessary, as they just plug right in. Each sensor was wired as follows: org+org/wht connected together and soldered to the VCC pin, blu+blu/wht connected together soldered to the data pin and grn+grn/wht+brn+brn/wht all connected together and soldered to the GND pin. The capacitor was soldered very close to the body of the sensor. Liberal use of heat shrink tubing finished the job. At the monitor box end, the cable pairs were connected together the same way the sensor pigtails were wired.

So, if someone encounters a distance issue (and common category type cable is being used), first check to see what wires are being used and how they are connected. Capacitance on the data line is a bad thing. There is significant capacitance between the twisted pairs, so don't connect the data line to just one side of a twisted pair. Connecting the pairs as I have outlined above by connecting them together will minimize the inter-electrode capacitance (of course feel free to choose your own colors for Vcc, Gnd and Data :D ) Next, what is the voltage swing on the wire? If you are using the common pull-up on GPIO pin technique, don't expect to go hundreds of feet. This is good for code development, but bad for the Pi, as it exposes the pin to the outside world and only has a 3.3v swing. Use a driver chip - not only will your Pi thank you, but you will surely wind up with a much more robust/reliable circuit. Power the chip from 5v and use a level shifter on the I2C. This will get you an almost 5v data swing on the line and will go much farther. Better the chip die than the Pi.
Cheers.....

frankpc
Posts: 1
Joined: Sun Mar 24, 2019 5:06 am

Re: DS18B20 Max Distance

Sun Mar 24, 2019 5:29 am

@JohnsUPS,

Thank you for all your hard work on this and for providing the ideas you have to make it work. I've been battling this myself. Today, I doubled up on conductors per your advice. And it seems things may be working better. I am not using a driver chip, nor am I using a RPi. (yet).

I ended up using a heavier cat5e cable -- 24 awg. I believe I started with 32 awg. I am wondering what you are using.

Also, I am wondering whether cat5 cable is the best way to do this. For example, did you consider using a three-conductor cable of say 22 gauge perhaps even 20 gauge? Most likely cat5 or cat6 is less expensive. Perhaps more resistant to noise. But maybe capacitance would be lower (?) as would the voltage drop with a little heavier gauge non-cat cable.

Did you measure the voltage swings at the end of your cable? I am getting around 4.6 v on the Vcc lead. I haven't measured the data lead. By chance, did you look at the effect the cable length has on the waveform with a scope?

And evidently, you aren't concerned with the effect the delay would have with timing. I suppose since this is a polling system, the delay wouldn't be an issue as long as there are no reflections.

Sorry... I keep coming up with more questions... Did you find that a certain DS18B20 outperformed others?

Thanks again for your helpful write-up documenting your results! I've spent hours researching this subject, and your results are by far superior to any other results I've read about.

Frank

JohnsUPS
Posts: 56
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: DS18B20 Max Distance

Tue Mar 26, 2019 12:40 am

frankpc wrote:
Sun Mar 24, 2019 5:29 am
@JohnsUPS,

Thank you for all your hard work on this and for providing the ideas you have to make it work. I've been battling this myself. Today, I doubled up on conductors per your advice. And it seems things may be working better. I am not using a driver chip, nor am I using a RPi. (yet).

I ended up using a heavier cat5e cable -- 24 awg. I believe I started with 32 awg. I am wondering what you are using.

Also, I am wondering whether cat5 cable is the best way to do this. For example, did you consider using a three-conductor cable of say 22 gauge perhaps even 20 gauge? Most likely cat5 or cat6 is less expensive. Perhaps more resistant to noise. But maybe capacitance would be lower (?) as would the voltage drop with a little heavier gauge non-cat cable.

Did you measure the voltage swings at the end of your cable? I am getting around 4.6 v on the Vcc lead. I haven't measured the data lead. By chance, did you look at the effect the cable length has on the waveform with a scope?

And evidently, you aren't concerned with the effect the delay would have with timing. I suppose since this is a polling system, the delay wouldn't be an issue as long as there are no reflections.

Sorry... I keep coming up with more questions... Did you find that a certain DS18B20 outperformed others?

Thanks again for your helpful write-up documenting your results! I've spent hours researching this subject, and your results are by far superior to any other results I've read about.

Frank

Frank,
Thank you.
For testing and final installation, I used CAT6 cable (CAT5e would also work as well). It is readily available to me in the data center environment, so that is what I used, along with the associated pieces-parts like RJ45 plugs, receptacles and housings. It also worked well with the installation methodology I used. The CAT6 cabling I used was 23AWG - typical. 32AWG is really too small of a gauge in my opinion.

I didn't consider using any other type of wire, although I probably could have had it purchased, but my initial testing was with CAT6, so I just continued to stay the course. I believe that three conductor 22AWG would probably work just fine also (like security system wire), because the inter-electrode capacitance between the data wire and the others will be low. Actually, using security system type wire may be better, because there are no twisted pairs that you have to double up. The overall conductivity of the wire probably isn't as important as the capacitance, so long as the wire isn't too thin. I don't think I'd go 20AWG though - not because it's too thick, but because it would be harder to pull when installing. It is the line reflections that apparently kill a lot of attempts at longer distances. It is one of those things that isn't too apparent or readily diagnosed.

I didn't actually measure the voltage swings, but probably should have. I was satisfied with the sensors working for several days continuously without a hiccup at the end of 470 feet of cable. Any delay significant enough to cause data issues would have exposed itself sooner or later. I was actually surprised to see it working so well. A single hiccup in the data (it was being saved into an RRDtool database) would have told me that things were possibly marginal, but that never happened. The data was solid, so I probably could have used a longer test wire, but a 470 ft spool remnant is what I had laying around. I would have pulled out the scope if there were a problem or indications of instability. Knowing that the final install would probably be less than 470 feet, I was satisfied.

Yes,I did find that some DS18B20's were better than others - I bought some from China (Bangood.com) through two different sellers. I used the non-parasitic type (I didn't even consider the parasitic type). The measurements/calibrations were way off - knock-offs no doubt. I then bought some from Mouser, who certainly sources direct from Maxim/Dallas, and they tracked each other as advertised. Those were the ones that wound up in the data center. I calculated offsets for the others (using the Mouser sensors as my calibration standards), and I'll use them somewhere at some point. Bottom line - spend a bit more and get quality sensors and save the grief.

In another post I have schematic drawings of the sensors and driver chip, and also some photos of the sensor pigtails and construction details. If you have any additional questions, please let me know.


viewtopic.php?f=37&t=231164

Return to “Interfacing (DSI, CSI, I2C, etc.)”