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?

1

5 Answers 5

3

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

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.

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
3
  • 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
    Commented Feb 14, 2018 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
    Commented Feb 14, 2018 at 1:37
  • 1
    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
    Commented Feb 14, 2018 at 1:40
1

I'm currently running 24 probes, all of which are wired at about 1,25 meters. This didn't work with the standard 5kΩ resistor. What I changed is that I changed the supply voltage to 5V, and changed the pullup to 3.3V to 1kΩ. After this, it's all working fine. I think the lower resistance makes the line less susceptible to interference. I'm not sure if the higher supply voltage makes a difference, but the Pi's 5V rail can deliver a much higher current than the 3.3V rail.

0

Slave Device Weight

The weight that can be supported in a network is limited, and depends on the driver (1-Wire master interface). In simple terms, the weight can consist of many slaves on very little cable, or very few slaves on a lot of cable.

Although weight is influenced by many factors, capacitance is clearly the largest single contributor. For example, the weight contribution of Category 5e unshielded twisted pair (UTP) can be related to their capacitance by a factor of about 52pF/m at 1-Wire speeds. As a general rule, the weight contribution of ESD circuits and PC-board traces can be related to their capacitance by a factor of about 24pF/m. A circuit-board trace or device that exhibits 24pF across the 1-Wire bus will add a weight of about 0.5m.

The network radius is limited by several factors: the timing of waveform reflections, the time delay produced by the cable, the resistance of the cable, and the degradation of signal levels.

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. See application note 244, "Advanced 1-Wire Network Driver."

Source: Analog.com: Guidelines for Reliable Long Line 1-Wire Networks (PDF)

See too: YouTube: Transmission Lines - Signal Transmission and Reflection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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