DS18B20 Temp Probe does not work when having more than one 1-Wire pin enabled

I bit stuck and was hoping for some help
I have DS18B20 probe with 1 m cable…when I connect it to a PI that has just 1-wire interface enabled on pin4 (default), it talks and recognises it as normal. The moment I specify additional pins on 1-wire interface, it is gone. I cannot see it and the addresses in /sys/bus/w1/devices just keep on changing with no probe displaying…same wiring, same connection. If I am doing something wrong (i.e. enabling other 1-wire overlay) how do I get multiple 1-wire device connected.

Many thanks,

Peter

1 Like

It seems that I might have resolved the issue so I am posting a reply in case someone else runs into it. As it seems there were two issues going on, being:

Non 1-Wire sensors on 1-Wire pin
It seems that DHT11 sensor is actually not 1-wire sensor…so if you enable multiple 1wire pins, it can get confused with it (mine did). Therefore, place DHT11 sensors on a GPIO pin that does not have 1-wire enabled and call it form the code. It seems to work.

Definition of the 1-Wire Pins

In the same time if you are modifying /boot/config.txt file with more than one GPIO pins as follows:

dtoverlay=w1-gpio,gpiopin=X, you cannot add more than one gpiopin=X parameters on a single master like this:

dtoverlay=w1-gpio,gpiopin=X,gpiopin=Y,gpiopin=Z

For each pin you need to specify its own overlay as the last gpiopin=Z change persist and it ignores previous ones. So the correct way isto create multiple masters as follows:

dtoverlay=w1-gpio,gpiopin=X
dtoverlay=w1-gpio,gpiopin=Y
dtoverlay=w1-gpio,gpiopin=Z

Hopt that it helps someone else trying to do more than one 1-wire sensor on the same PI.

5 Likes

Thanks Peter,

Always useful to share information in case it helps someone else in the future. Make sure to let us know if you run into any further issues :slightly_smiling_face:

1 Like

Peter,
just a question though. I thought a 1-wire bus would handle several devices, so why have multiple buses?

Dave

1 Like

Hi Dave,

Great question and that was my understanding as well. However, when it comes to defininig these in scripts, everything I found and tried indicates that the last GPIOPIN value overwrites the previous one for the same bus. Would love if someone has a better solution fir this.

Best,

Peter

1 Like

Hi Dave and Peter,

You’re exactly right, 1-Wire can handle multiple devices, I’m not sure how you’d have to modify the script in order to suit this, but one of the most difficult parts of using multiple devices on the same line is ensuring that your pull-up resistor is at an appropriate value. I found an interesting discussion on it on a forum I’ve linked below.

2 Likes

Many thanks @Bryce…this makes sense.

1 Like

You’re welcome Peter,

Glad I could help, have a Merry Christmas! :partying_face: