Temperature Sensor DS18B20

The 1-wire temperature sensors DS18B20 have become particularly popular, because they’re inexpensive and easy to use, providing calibrated digital temperature readings directly. They are more tolerant of long wires between the sensor and Raspberry PI. The  “1-wire” temperature sensor DS18B20 can be connected in parallel. All sensors should share the same pins and you only need one 4.7K resistor for all of them


  • Connect Black (GND) wire with GND pin of the Raspberry PI
  • Connect Red (VCC) wire with 3.3V pin of the Raspberry PI
  • Connect White/Yellow (DATA) wire  with pin number 7
  • Put the 4.7kΩ resistor between DATA wire and VCC wire.

After connecting to a Raspberry PI, the new temperature sensor will be recognised and the current temperature will be displayed on the ‘main page’.

If you need to extend wires, we recommend to use CAT5 cable or to build a wifi temperature probe. If there is a problem with reading temperatures, try to use different resistor (3.3kΩ, 2.2kΩ)

Connect the data and ground to one pair of wires – blue/blue-white for example. Use a single wire from another pair for 3.3 volt power. Leave all other wires unconnected – do not attach them to ground.

Also, avoid the temptation to double-up wires to reduce resistance.
Doubling up wires dramatically increases capacitance on the data circuit, as does grounding unused lines. The increased capacitance distorts the waveform, potentially putting the pulses outside the required limits, and so resulting in the one-wire system not communicating with the sensors.


connect temperature sensor to raspberry pi, home automation

Temperature Sensor & Raspberry Pi – Connecting diagrem