The breadboard layout for the DS18B20 transistor form factor (TO-92) part and waterproof corded model is shown below. We provide example for the older 20-pin and modern 40-pin Raspberry Pi connectors. This setup will work on all models of Raspberry Pi which have been released except for the Pi compute modules which do not have breakout headers. 

The DS18B20 "1-wire" sensors can be connected in parallel - unlike nearly any other sensor sold! All sensors should share the same pins, but you only need one 4.7K resistor for all of them

The resistor is used as a 'pullup' for the data-line, and is required to keep the data transfer stable and happy

Be careful to get the DS18B20 the right way around. The curved edge should be to the left as shown in the figure below. If you put it the wrong way around, it will get hot and then break.

Despite both being temperature sensors, the DS18B20+ is totally different than the TMP36. You cannot use a TMP36 for this tutorial!

40-Pin (A, B, B+ and Zero) Cobbler Plus Schematic

20-Pin (Raspberry Pi Rev 1 and Rev 2) Cobbler Schematic

Waterproof 40-Pin [black]

If you are using the waterproof version of the DS18B20 then the device has three leads, red, black and yellow. The bare copper screening lead that does not need to be connected.

Waterproof 20-Pin [black]

Hightemp Waterproof [white]

If you are using the "high temperature" version of the DS18B20 we sell, connect Orange Stripe to 3.3V, White connects to ground and Blue Stripe is data, pin #4.

You still need a ~4.7K-10K resistor from data to 3.3V

This guide was first published on Jan 28, 2013. It was last updated on Mar 18, 2024.

This page (Hardware) was last updated on Mar 08, 2024.

Text editor powered by tinymce.