Darranking
Posts: 46
Joined: Thu May 31, 2012 9:14 pm

Joining multiple DS18B20 sensors

Sun Jan 13, 2019 4:11 pm

I have been looking at using multiple 1 wire temp sensors to read temperatures in some vivariums, I am ok with the Pi end and reading the sensors, but looking for some advise on the cabling side.

The internet suggest I should daisy chain these, and as my overall lengths are not great distance use cat 5 cable. I have sensors that are already on 1m cables but nothing attached to the other end.

So if I run cat 5 to the first vivarium, then join the sensorcable to it and then more cat 5 to the next one and repeat is that daisy chaining. I would use a small junction box with screw clamp connectors to join the incoming cable with the sensor cable and the outgoing cable.

Or am I creating a star set up doing it this way.

Help appreciated.

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

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 4:17 pm

That sounds like the correct way to do it.

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

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 7:51 pm

You want to wire all of the sensors in parallel. This will avoid the star topology, and you can go quite a distance. I currently have an installation of five DS18B20 sensors along 369 feet of CAT6, and they are working flawlessly.

Wired like so:
At each sensor, there is a 10ufd tantalum capacitor across Vcc & Gnd. These are NOT the parasitic type sensors.
CAT6 cable (CAT5e would also be fine). The pairs within the cable are connected together:
ORG/ORG+WHT connected together, and is used for 5V Vcc to each sensor.
BLU/BLU+WHT connected together, and is used for the data connection.
BRN/BRN+WHT & GRN/GRN+WHT all connected together and is the ground connection.
Notice that the twisted pairs are connected together. This is done to reduce inter-electrode capacitance, especially on the data line.
A DS2482-100 1-wire driver (using 5V Vcc) for driving the data line.
The chip uses I2C, so 5v to 3.3V level shifting is done on the I2C lines to the Pi.
Small Python script then reads then data and populates an RRDTool Database.

As an alternate solution, there is a DS2482-800 driver chip with eight channels. You could run one sensor off of each channel. This may provide more flexibility in your layout if the number of sensors is likely to change, or if the sensor locations are moved.

chadk5utc
Posts: 10
Joined: Wed Dec 26, 2018 4:34 pm

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 9:26 pm

mutitempcircuit (1).jpg
mutitempcircuit (1).jpg (20.41 KiB) Viewed 1460 times
add cat5 or other wire as needed

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

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 9:35 pm

chadk5utc wrote:
Sun Jan 13, 2019 9:26 pm
mutitempcircuit (1).jpg add cat5 or other wire as needed
Wrong! Only one 4.7K Ohm resistor is required. Using more than one will cause problems.

Darranking
Posts: 46
Joined: Thu May 31, 2012 9:14 pm

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 9:46 pm

JohnsUPS wrote:
Sun Jan 13, 2019 7:51 pm
You want to wire all of the sensors in parallel. This will avoid the star topology, and you can go quite a distance. I currently have an installation of five DS18B20 sensors along 369 feet of CAT6, and they are working flawlessly.

Wired like so:
At each sensor, there is a 10ufd tantalum capacitor across Vcc & Gnd. These are NOT the parasitic type sensors.
CAT6 cable (CAT5e would also be fine). The pairs within the cable are connected together:
ORG/ORG+WHT connected together, and is used for 5V Vcc to each sensor.
BLU/BLU+WHT connected together, and is used for the data connection.
BRN/BRN+WHT & GRN/GRN+WHT all connected together and is the ground connection.
Notice that the twisted pairs are connected together. This is done to reduce inter-electrode capacitance, especially on the data line.
A DS2482-100 1-wire driver (using 5V Vcc) for driving the data line.
The chip uses I2C, so 5v to 3.3V level shifting is done on the I2C lines to the Pi.
Small Python script then reads then data and populates an RRDTool Database.

As an alternate solution, there is a DS2482-800 driver chip with eight channels. You could run one sensor off of each channel. This may provide more flexibility in your layout if the number of sensors is likely to change, or if the sensor locations are moved.
Cool, so how is each sensor connected in this setup do you wire in and out cat 6 to the pins of the sensor ?

Alex Konshin
Posts: 41
Joined: Sun Jan 29, 2017 10:02 pm
Location: Boston MA, USA

Re: Joining multiple DS18B20 sensors

Sun Jan 13, 2019 10:57 pm


prairietech
Posts: 28
Joined: Wed Mar 20, 2013 9:22 pm

Re: Joining multiple DS18B20 sensors

Mon Jan 14, 2019 2:52 am

Is the DS2482 used to obtain the 369' or is it just the DS18B20 sensors driving this distance?

JohnsUPS wrote:
Sun Jan 13, 2019 7:51 pm
You want to wire all of the sensors in parallel. This will avoid the star topology, and you can go quite a distance. I currently have an installation of five DS18B20 sensors along 369 feet of CAT6, and they are working flawlessly.

Wired like so:
At each sensor, there is a 10ufd tantalum capacitor across Vcc & Gnd. These are NOT the parasitic type sensors.
CAT6 cable (CAT5e would also be fine). The pairs within the cable are connected together:
ORG/ORG+WHT connected together, and is used for 5V Vcc to each sensor.
BLU/BLU+WHT connected together, and is used for the data connection.
BRN/BRN+WHT & GRN/GRN+WHT all connected together and is the ground connection.
Notice that the twisted pairs are connected together. This is done to reduce inter-electrode capacitance, especially on the data line.
A DS2482-100 1-wire driver (using 5V Vcc) for driving the data line.
The chip uses I2C, so 5v to 3.3V level shifting is done on the I2C lines to the Pi.
Small Python script then reads then data and populates an RRDTool Database.

As an alternate solution, there is a DS2482-800 driver chip with eight channels. You could run one sensor off of each channel. This may provide more flexibility in your layout if the number of sensors is likely to change, or if the sensor locations are moved.

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

Re: Joining multiple DS18B20 sensors

Wed Jan 16, 2019 2:27 am

Prarietech, yes, the DS2482 is driving the line the whole distance. Also keep in mind that some of the time the driver chip is driving the wire, and sometimes the DS18B20 is driving the wire, so the devices at each end have to be able to drive the whole distance at some point in time. This is why the driver chip and sensors are powered from 5 volts instead of 3v3. This is also the reason that I use a driver chip, and do not drive from the GPIO pin directly. The driver chip also protects the GPIO pin in case a transient were to find its way back down the line towards the Pi.

Because the DS18B20's also have to drive the line the whole way back that I put a capacitor at each sensor (10ufd/16v tantalum). The capacitor supplies an extra bit of power to the sensor (right AT the sensor - this is important) when needed to drive the line.
Each sensor was wired like the pic, and a regular RJ45 plug attached to to a pigtail on the sensor per AT568B. The keystone is wired the same way, so sensors can be added/removed/replaced as needed just by plugging them in. Note that in the picture that the keystone is just tapped into the line. I stripped about four inches of insulation off, separated the wires and carefully punched it down. This effectively puts all of the sensors in parallel. My installation has five keystones along the 369 foot length. Along this length, there is a sensor at the end, and ones spaced at about ~340, ~320, ~300 and ~280 foot marks from the driver chip. The far end of the wire goes to the DS2482 (data wires), and of course +5 and ground.

When I was initially designing and testing this, I was using 470 feet of CAT6 wire, and it worked perfectly at that distance too.

The first pic shows the soldering detail of one sensor. An 8 inch pigtail was being soldered onto the sensor.
The second pic shows the keystone tap detail. I took this when I was doing the actual installation.

Image
Image

prairietech
Posts: 28
Joined: Wed Mar 20, 2013 9:22 pm

Re: Joining multiple DS18B20 sensors

Wed Jan 16, 2019 3:54 am

Great information! Several months ago I spent a far amount of time googling how to extend the distance of ds18b20s. But never found anyone with your success. I understand the cat5 pairs wiring configuration but am not clear on the physical layout of the ds18b20s in relationship to the ds2482?

You mention sometimes the ds2482 is driving and also the ds18b20s. But doesn't the ds2482 convert data from the 1-wire format to i2c so isn't it the only device pushing data to the RPi?

Sorry to be dense but maybe a simple drawing showing the physical relationship between devices might clear the fog in my head.

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

Re: Joining multiple DS18B20 sensors

Wed Jan 16, 2019 12:14 pm

I'll try tp post a schematic. Can't do it right now though.
When I was referring to "driving the wire", I am referring to the long length of wire from the driver to the sensors. The Pi only talks to the driver chip (DS2482-100 in this case) using I2C through a couple of level shifters, as the chip is powered from 5V.

Basically wired like so:
[Pi] ------(level shifter/I2C)-----> [DS2482] ------------(1 wire over CAT cable)-------------------------------->[sensor] ----->[sensor] ----->[sensor] ----->........

Note that the sensors are not wired to any GPIO pin directly, but via the driver. In a real world installation, you really don't want to connect long wires in an electrically noisy environment directly to the Pi. It is OK for develoment purposes and non-critical short run installations, but personally I like to protect the inputs on the Pi in some way or another, either with a resistor, transister buffer, or in this case a driver chip made for that purpose. I also have protection diodes on the data line (low capactance types) also.

prairietech
Posts: 28
Joined: Wed Mar 20, 2013 9:22 pm

Re: Joining multiple DS18B20 sensors

Wed Jan 16, 2019 1:19 pm

Thanks! A picture is worth a 1000 words as they say.
In your application, is the ds2482 close to the RPi or is it a distance down the line?
A schematic would be great too. I appreciate your information and sure there are other readers that do too.

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

Re: Joining multiple DS18B20 sensors

Thu Jan 17, 2019 4:05 am

Prarietech, The driver chip is at the end of the line, near the Pi. In my application, it is in the same project enclosure as the Pi. I2C is a protocol that isn't designed to work over distance. It was developed for inter-chip communication, implying that the runs are generally short - on the order of inches to a few feet usually. Maybe someone out there has experimented with this, but I haven't.

This is how I have things wired:
I omitted the category color code on the schematic, but the twisted pairs are connected as I have described in previous posts.
Image

Good luck!

prairietech
Posts: 28
Joined: Wed Mar 20, 2013 9:22 pm

Re: Joining multiple DS18B20 sensors

Thu Jan 17, 2019 1:30 pm

Thanks!! Now your design is perfectly clear. I'm going to order a 3.3v to 5v level shifter and a ds2482-100 and give it a try. I've been saving reel end scraps of cat5 just for something like this.
Thanks again!

Return to “Automation, sensing and robotics”