Getting Started

Setup the Hardware

Connecting the temperature sensor to the Pi is straight forward. There a bunch of tutorials on the web but you’re looking to connect the following physical pins on the Pi to the following sensor connectors.

Physical Pi Pin Description DS18b20 Connector
1 3.3v Power Power (red)
7 GPIO 4 Data (yellow)
9 Ground Ground (black)

The other thing you’ll need to do is connect the 4.7k Ω resistor between the power and data lines. This acts as a pull-up resistor to ensure that the Pi knows that the data line starts in a “high” state. Without it, it can’t tell if it should start as high or low; it would be left floating.

Soldering a resistor inline can be a bit tricky, so I build a add-on board to make the whole process simpler. See the Add-on Board section for details.

Setup the Pi

For a quick start guide in setting up a new Raspberry Pi, see the Raspbian Setup section.

Once setup, make sure you have the following line in your /boot/config.txt. It will load the GPIO 1-wire driver and any attached temperature sensor should be automatically detected.

dtoverlay=w1-gpio§

Older tutorials on the web will also say you have to load the w1-therm module but that seems to load automatically these days.

Setup the Software

In terms of installing, you have two options here.

  1. Install via apt-get (recommended)
  2. Build and run from source