Multiple DS18B20 temperature sensor problem - Page 1
Forum section: electronics / beginners

author: FreeBeer
author_rank: Newbie
timestamp: March 13, 2017, 06:54:32 pm
content: Hi!Noob here as well as in electronics in general. (so use small words)As a first project with my Raspberry Pi 3, I wanted to build a multiple temperature sensor device for remote sensing a number of locations. Having poured over the interwebz and youtubez, I was successfully able to read multiple sensors on my breadboard. Cool so far. So the next step was to attach the sensors to a 10 foot long length of wire to simulate "remoteness". I wired, soldered and shrink tubed 5 sensors to 10 feet of wire each (don't have the specs handy at the moment, but should be able to get it if deemed important). Then I connected each red, yellow and black (3.3v, one-wire, GRD) to each other (crimped, solders and shrink tubed) at the other end, with a red, yellow and black lead so I can plug it in to the breadboard. All good - I can read all five sensors just fine. I next build another set of 5 wires, this time with 20 feet of wire per sensor. That worked out just fine. I can read all sensors.If it helps, this video is basically how I have the breadboard wired up:(two minutes in)The problem comes in when I try to connect both sets of wires to the breadboard. Mostly, I can't read any sensors when both sets of sensors are plugged in. If I take one set of wires off the breadboard and insert more sensors directly on the board, I can read the 5 wire bundle and the other sensors (up to an additional 4 for a total of 9 sensors).Can anyone explain why I can't seem to read the two sets together? I've been pouring over videos and forums trying to figure this out, but my extreme beginnerness is showing through.Some forums seem to think that the one-wire protocol doesn't like star configurations (I'm assuming that's what I have, no?), but no explanation as to why. Timing?Is perhaps the total lengths of wire creating issues? Perhaps because one set is 10' long and the other 20'? Any other insights would be welcome and appreciated.

author: GoneTomorrow
author_rank: Regular Contributor
timestamp: March 13, 2017, 09:08:11 pm
content: You want each slave to have an equal length wire to the bus, like one of these examples:

author: ggchab
author_rank: Frequent Contributor
timestamp: March 14, 2017, 12:10:20 pm
content: Did you try with a slightly smaller resistor value ?

author: FreeBeer
author_rank: Newbie
timestamp: March 14, 2017, 03:23:17 pm
content: Thanks for the replies!Hmm... I didn't see anything about balanced wire lengths in the various areas I checked, but you could be on to something.I guess I need to do a little bit of research on what exactly constitutes a "bus". (Newb creds showing.). If I have a bundle of sensors, say 10' long and plugged into the breadboard, then I have a few more sensors plugged into the breadboard directly, does that constitute two different busses? I'm a little (very?) confused since I can read 9 sensors (5 in a bundle and 4 on the breadboard) yet can't read any from two sets of bundled sensors (different lengths).No, I haven't tried changing the resistor yet. I thought about that, but haven't actually tried it yet. I'm currently using the recommended 4.7k resistor. What resistor rating would you suggest I try?Thanks!

author: ggchab
author_rank: Frequent Contributor
timestamp: March 14, 2017, 07:27:43 pm
content: I would first try 3.3K. This is still perfectly safe since the datasheet says the DQ pin can sink up to 4 mA (I have used 4.7K with a 5V supply).

author: FreeBeer
author_rank: Newbie
timestamp: March 15, 2017, 06:41:39 pm
content: Great! I'll see if I've got one in that range and give it a try. Thanks!