There are a few advantages to running separate 1wire busses, including fault isolation, noise and other problems which can be caused by funky shaped busses (e.g. with "branches" - especially long ones).
Since a bug fix in the 4.9.28 Raspberry pi firmware image packages, it's now fairly easy to do this using device table overlays. e.g. create three busses on gpio 4, 17, 27 using device (not parasitic) power - at a root
shell (or with sudo
) execute the following commands to setup multiple gpio 1wire busses:
dtoverlay w1-gpio gpiopin=4 pullup=0
dtoverlay w1-gpio gpiopin=17 pullup=0
dtoverlay w1-gpio gpiopin=27 pullup=0
You can then see each device here (and you can see that there are two devices connected to bus 3) with ls -l /sys/bus/w1/devices/
10-00080257e469 -> ../../../devices/w1_bus_master3/10-00080257e469
28-02146311b1ff -> ../../../devices/w1_bus_master3/28-02146311b1ff
w1_bus_master1 -> ../../../devices/w1_bus_master1
w1_bus_master2 -> ../../../devices/w1_bus_master2
w1_bus_master3 -> ../../../devices/w1_bus_master3
... as usual, each bus will require pull-ups (and termination - especially for long busses).
Other solutions (which are likely to be more robust due to hardware differences) are to use a DS2482-800 i2c to 1Wire adaptor chip instead of gpio based busses, and/or to use logic level shifters to run the 1wire busses at 5 volts instead of the 3.3 volts which the pi gpio pins dictate.