PinLab › Components › DS18B20
DS18B20 GNDDQVDD flat side facing you waterproof

DS18B20

digital temperature sensor (also waterproof)

An accurate temperature sensor (±0.5 °C) that sends a digital value over a single wire. It comes as a small transistor package (TO-92) and as a waterproof probe for water, soil or a fridge.

Open the course →

How it works

It uses the 1-Wire protocol: one data line (DQ) with a 4.7 kΩ pull-up resistor to 3.3 V. Every sensor has a unique 64-bit serial number, so dozens of sensors can share the same wire. The ESP32 says "measure", the sensor measures for up to 750 ms (at 12-bit precision), then returns the temperature. The OneWire and DallasTemperature libraries do all of that.

Pins and wiring

PinWhat it isWhere it connects / why
GNDGround (left leg, flat side facing you)→ GND.
DQData (middle leg)→ GPIO (e.g. 4) + 4.7 kΩ to 3.3 V.
VDDSupply (right leg)→ 3V3.

Specifications

Range−55 to +125 °C
Accuracy±0.5 °C (−10…+85 °C)
Resolution9–12 bit (0.5–0.0625 °C)
Conversion timeup to 750 ms at 12 bit
Supply3.0–5.5 V

Tips and typical mistakes

Used in projects