2

I initially asked this as an 'answer' to an existing thread on DS18B20 temperature probes as it seemed the obvious way to ask a question of people who were connecting the probes to various hardware. However this was deleted as it wasn't an answer, so here goes, again, as a straight question. I have been trying to create a fairly extensive 'network' of DS18B20 sensors in a house for remote monitoring and wondered whether anybody had any idea whether there are any limitations to the number of DS18B20s that can be connected together on a 1 wire bus.

I understand that bus length could be an issue as well as topology of the bus but in trying to set the sensors up on a breadboard to test I discovered that once I had reached a total of 10 sensors any additional ones I inserted on the breadboard only displaced one of the earlier ones I had on the line. This seems to be an internal maximum associated with the drivers (from a prior post). Using the command:-

cat /sys/bus/w1/devices/w1_bus_master1/w1_master_slaves

only ever lists 10 devices at once even when there are more than 10 attached at it seems to be the last ten that are visible.

In continuing the quest I tried wiring up the various probes around the house/cellar connected it all up and found that only two of the 5 installed were registering in the OS. Starting again and wiring them one-by-one (of course, I should have done this first!) I reached a maximum of 4 and when the fifth wire was attached they all dropped off, again. So I'm now down to 4 working but interested in knowing whether there is a way to add more to the "1-wire" bus that I have in place, or should I add another wire through another port or have more 'power' available...

So the question may be more "How many can a single Raspberry Pi handle?". Has it more (or as much) to do with the power drain through the +3.3V pin on the GPIO? Or the topology of the wire (how long, how many nodes etc)... If so any ideas what the maximums might be - ie number of nodes, length of wire, type of nodes (single lines off a backbone or star groups off at the nodes). What set-ups are others using?

2

I have encountered this, when I jumped from 5 to 15 probes.

I have read somewhere that there isn't a real limit and that a scan should detect 70 odd in a first pass. This makes me believe that the modules written for the Raspberry Pi/Debian software has an inbuilt restriction, but I have been unable to find any documentation on that either.

2

I have 20 of the DS18B20's, ten are the "waterproof" package, and another ten look like a simple transistor. For calibration, I wired them all up on a breadboard together. They were driven with the 3.3v power supply and a 4.7k pullup resistor on the data line (GPIO pin 4) connecting to 3.3v. In this configuration, I could read all 20 using the standard Pi package modules. (The only custom code I wrote was to modify some python code to loop through the 20 sensors.)

However, after adding various cable lengths to the sensors for deployment throughout the house (2 - 15 feet of 22 gauge stranded wire each), I discovered that I can only read about eight of them. I don't yet know how much wire was introduced, but plan to experiment to find out how much total wire the system will tolerate, both with a 3.3v supply and with a 5v supply (keeping the pullup resistor at 3.3v).

Scott

1

It seems that it is not only the total amount of wire that is important but also the topology of the wire and connections. For example I have 6 sensors connected to one RPi but with many metres of wire involved and this is about the limit although adding short wires to extremities may be possible. Ultimately it will depend on signal losses and interference picked up by the wire. I am intrigued that you had 20 sensors working on a breadboard as when I started looking at it there was a limit of 10 hardwired into the code - perhaps this has now changed.

S---------------8m----------------RPi
                                   |
                                  4m
                                   |
             S----------6m---------+----------3m------------S
                                   |
                                  8m
                                   |
             S----------4m---------+----------6m------------S
             |
            2m
             |
             S
  • The person said they "have 20" (i.e. they have purchased 20 probes). They can only use far less than this (8). They might as well "have 500000" probes, no difference :) Confusing! Many times in the code there is an array variable that stores the device addresses. This is may have a finite size (e.g an arbitrary # of 15). You need to look at the code and find where the array that will carry the device addresses is declared. Is there some constant e.g. MAX_DEVICES? What's the value of this? 5, 10, 15? – user391339 Feb 14 '18 at 1:26
  • The DS18B20 is a digital sensor and not an analog sensor like the TMP36. These digital pulse signals being sent are going to be much less sensitive to cable losses and noise than analog signals. – user391339 Feb 14 '18 at 1:37
  • That doesn't mean there aren't problems when you push the system. In this article they talk about issues with one-wire protocol with network lengths of >100meters (more like 200+ meters). maximintegrated.com/en/app-notes/index.mvp/id/148 . They introduce 2 terms: "network weight" and "network radius". Weight is the total length of all cables, and radius is the longest chain in your network. In your case, network weight is 41m and radius is 18m. – user391339 Feb 14 '18 at 1:40
0

You might have a look to this, that is the only place by now where I found advices on how to properly implement many (more than 10-15) 1-WIRE devices on long line : http://dreamgreenhouse.com/designs/automation/1wire/index.php

  • Welcome! Please take the tour and visit the helpcenter. Whilst this may theoretically answer the question, it is preferable to include the essential parts of the answer here, and provide the link for reference. In fact we're enforcing this policy: please edit so that the answer stands on its own should the link break in the future. If it is not edited within 48 hours it will be converted to Community Wiki. – Ghanima Jan 18 '17 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.