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.
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.
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