I’ve have a handful of Raspberry Pis around, and several of them have Dallas 18B20 temperature sensors connected for data collection. Up to this point I’ve used all of them in 3-wire mode (Vcc, Data, Ground).
I just recieved my first Raspberry Pi 2 yesterday, and went to connect it to a network of 4 sensors to replace an Arduino I was previously using.
I ran into a few snags. Here are my notes:
1. Device Tree vs Modprobe
The old way to get this all working was to setup the modules to load, either after boot via
sudo modprobe w1-gpio etc, or setting those up to load on boot.
The new way to do this is via Device Tree. You can read all about the changes here. The changes are myriad, as are the reasons behind them.
In any case, to get things working I added this to my
2. Using parasitic mode without an external pull-up resistor just didn’t work.
In 3-wire mode I’ve never needed to use an external pull-up resistor to get things to work on the RPi. That wasn’t the case with the parasitic mode. I had to use a 4.7k pull-up.
3. The built-in kernel driver only supports loading the 1-wire bus on a single pin at a time.
I had 4 sensors, and I had hoped to run 4 separate networks. My experience has been that more networks is typically more reliable than many sensors on a single network.
At this time, that isn’t possible without compiling your own kernel. I had to wire all 4 of my sensors together into a single star-network. Thankfully, the sensors have proven to be reliably pinged so far.