Connecting 20 DS18B20 in 1-wire

The DS18B20 devices start communicating by pulling the data line low briefly. When it releases the data line it should rise to a logic high. This is why you need a pullup resistor.

You really need an oscilloscope to determine the correct pullup resistor size.
The specification for a logic high says: "The lower of 5.5 or VDD + 0.3". As you add more devices on the bus the pullup needs to be smaller to achieve a logic high on the data line.

Look at the data line with a scope and I'll bet that it never comes up to 5V when all 20 devices are connected.

Did it work when you tested the system on the bench?

Oh, and a dumb question, but you do have a common ground with the PSU and the Arduino?

Sorry, had to spread it out a bit.

Tom.. :smiley: :+1: :coffee: :australia:

Thank you all for your amazing ideas and suggestions. After toying around with all the ideas, two of them worked for me.

  • Splitting the sensors on more than one Arduino Pin: this works although it means that more cabling is required and the code becomes increasingly messy as more sensors are added.

  • Decreasing the pull-up resistor value: this worked like a charm! I don't have the knowledge to do exact calculations but found that a 1k ohm resistor worked for 20 sensors on a single serial bus line.

I'm sure that the first solution has many added benefits to it but for the sake of simplicity, I went with the second option.

Using 2 or more busses is complicated but there is an example in the IDE under 1Wire.

I would consider it more of a last resort when all else fails.

Regarding Schrodingers Cat, Occams Razor says. DON'T OPEN THE BOX