@spuj, I’ve just published a library for working with multiple DS18B20 thermometers on a single 1-wire bus:
I followed the wiring instructions in this guide:
I have the waterproof version of the thermometers:
red = VDD
black = ground
yellow = signal
The first thing you need to do is determine the eight byte address of each of your thermometers. Connect just one of your thermometers and run the example-read-address patch in the debugger:
Make a note of the eight byte address of your thermometer. Repeat process for each of your other thermometers. I label my thermometers so that I can match them to their addresses.
Once you know the addresses of all of your thermometers you can connect them all in parallel. To check that you can get a temperature reading from all thermometers, use patch example-read-temp-multi-devices:
node represents the 1-wire bus connecting your thermometers. You can change the resolution of all thermometers on the bus using the set-resolution
node. The request-temperatures
node has to be pulsed before using the get-temp-c
nodes to read each thermometer. You’ll obviously need a get-temp-c
for each of your thermometers. get-temp-c
output the temperature in degrees Celsius. If you prefer Fahrenheit you can use get-temp-f
A note of caution: if any of the get-temp-c nodes output the value 85, check your wiring (see discussion here: https://www.raspberrypi.org/forums/viewtopic.php?t=63085). Initially I was using relatively heavy test leads in my circuit and I frequently got these erroneous 85 readings. After replacing the test leads with short dupont wires the dodgy readings disappeared. If a sensor becomes disconnected its get-temp-c will output -127.