The DS18B20 sensor circuit requires only a 4.7K resistor to work with Raspberry Pi. We'll use the extra space available in Perma-Proto HAT to mount the 4.7 K resistor as well as three male header pins which will be used to connect with DS18B20 GND, +Ve and data wires. The sensor itself will be wired with a male audio jack and will be used to connect with the female audio jack mounted in the enclosure.

Following is a Fritzing breadboard view of the circuit. Two of the male header pin are directly connected to GND and 3.3V while the 4.7K resistor is used as a pull-up resistor (from the 3.3V power) on the data pin, in the center. 

Note: though we are using only a single DS18B20 sensor, it is possible to connect multiple sensors (I have tested with maximum 7 sensors). The wiring remains the same (since the underlying one-wire protocol is a bus).

Prepare Connectors

Connect a male audio jack with DS18B20 sensor. Assuming the tip of the male audio jack is upward, the longest terminal of the jack represents GND, left terminal represents +Ve and the right terminal represents data. Tin the DS18B20 wires and male audio connector terminals before soldering them together

This is how the temperature sensor will look once connected with a male audio jack

We'll use a female panel mount audio connector to connect the temperature sensor.

Solder the male end of three male-female jumper wires with the female audio jack. Strip the male end of jumper wires and tin both jumper wires as well as male audio jack terminals before soldering. Opposite to the male audio connector, when the female audio connector is arranged upwards, the longest terminal represents GND, left terminal represents +Ve, and right terminal represents data. Throughout this build, the data pin is represented by yellow wires which in turn connect to Raspberry Pi GPIO 4.

Making DS18B20 circuit

We'll be using 22 AWG solid core wires as jumpers to connect all the pins. The yellow wire is used to connect GPIO 4 with central male header pin. A 4.7K pull up resistor is soldered perpendicular to save space.

Since we are extending the power controller circuit, the entire DS18B20 circuit sits on the left side of the Perma Proto HAT, with ULN2803A (used by power controller circuit) sitting in central location, occupying bulk of the HAT.

Next, we'll mount the female audio jack in the enclosure.

This guide was first published on Sep 25, 2018. It was last updated on Sep 25, 2018.

This page (Circuit Construction) was last updated on Jan 25, 2021.