> Source: https://www.tinkered.ai/components/ds18b20-waterproof (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/ds18b20-waterproof. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# Waterproof DS18B20

Waterproof stainless steel probe housing a Maxim DS18B20 digital thermometer that reports temperature from -55 to +125 °C over a single 1-Wire data line.

Source page: https://www.tinkered.ai/components/ds18b20-waterproof
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf

## In short

The waterproof DS18B20 is a sealed stainless-steel probe around Maxim's DS18B20 1-Wire thermometer, which runs from 3.0 V to 5.5 V and measures -55 to +125 °C, accurate to ±0.5 °C from -10 to +85 °C (Maxim DS18B20 datasheet, p. 1). Connect red to VCC, black or blue to GND and yellow or white to any digital pin, with a 4.7 kΩ pull-up from DATA to VCC (p. 6). Every probe has a unique 64-bit code, so several can share one pin, and a 12-bit reading takes up to 750 ms (pp. 1, 3).

The Waterproof DS18B20 is a sealed temperature probe built around the Maxim/Analog Devices DS18B20 1-Wire digital thermometer. The sensor die sits inside a stainless steel tube on a flexible lead, so it can be dropped directly into liquids, soil, or outdoor enclosures. It measures from -55 to +125 °C and is accurate to ±0.5 °C across the -10 to +85 °C range (Maxim datasheet, p. 1); the cable and seal of a given probe may limit how hot it can actually go.

Communication uses the 1-Wire protocol on the single DATA (DQ) line. Resolution is programmable at 9, 10, 11, or 12 bits; it powers up at 12 bits, which resolves 0.0625 °C and takes up to 750 ms per conversion (pp. 1, 3). Every DS18B20 carries a unique factory-programmed 64-bit ROM address, so many probes can share one data pin and be read individually by address.

The three flying leads are typically red (3 V to 5 V power), blue or black (ground), and yellow or white (DATA). The device can also run in parasite-power mode, drawing its energy from the data line, though a normal three-wire hookup is more forgiving. On-chip TH and TL alarm registers can flag out-of-range readings without host polling.

## Agent rules

Follow these when you wire this part or write code for it.

- Do: 1-Wire bus: connect DATA to any digital pin
- Do: Power from 3.3-5V (probe works across the range); share GND with the MCU
- Do: A 4.7k pull-up resistor on DATA is required: without it the bus floats and the sensor is never found. Wire it between DATA and VCC: one resistor pin on the DATA net, the other on the VCC net (the server assigns holes automatically).
- Do: Multiple DS18B20 can share one DATA line (each has a unique 64-bit ROM); the library enumerates them with a ROM search.
- Do: On ESP32: DATA to any GPIO; power VCC from 3V3 and tie the 4.7k pull-up to 3V3 (not 5V, ESP32 GPIOs are 3.3V).
- Never: No omitting the 4.7k DATA pull-up
- Never: No wiring the pull-up to GND: it pulls UP, to VCC
- Never: No expecting analog/analogRead: DS18B20 is digital 1-Wire only

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| VCC | Red: 3-5V · 3.3 V (max 5.5 V) | power in |
| GND | Black: GND | power in |
| DATA | 1-Wire | bidirectional |

## Wiring

### Arduino Uno

| Waterproof DS18B20 | Arduino Uno | Note |
| --- | --- | --- |
| VCC | 5V |  |
| GND | GND |  |
| DATA | D2 | with a 4.7 kΩ pull-up resistor from DATA to VCC |

### ESP32 DevKit V1

| Waterproof DS18B20 | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| DATA | GPIO13 (D13) | with a 4.7 kΩ pull-up resistor from DATA to VCC |

### Raspberry Pi Pico

| Waterproof DS18B20 | Raspberry Pi Pico | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| DATA | GP0 | with a 4.7 kΩ pull-up resistor from DATA to VCC |

## Code

### Arduino Uno

Libraries: milesburton/DallasTemperature, paulstoffregen/OneWire

```cpp
// Waterproof DS18B20 on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/ds18b20-waterproof
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2          // DATA on D2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(9600);
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures();
  Serial.print(sensors.getTempCByIndex(0));
  Serial.println(" C");
  delay(1000);
}
```

Compiled for arduino:avr:uno on 2026-10-30.

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Supply | 3.0 V to 5.5 V, or parasite power from DATA | Maxim DS18B20 datasheet (rev 042208), p. 1 |
| Range | -55 °C to +125 °C | Maxim DS18B20 datasheet (rev 042208), p. 1 |
| Accuracy | ±0.5 °C from -10 °C to +85 °C, ±2 °C from -55 °C to +125 °C | Maxim DS18B20 datasheet (rev 042208), pp. 1, 19 |
| Resolution | 9 to 12 bits (0.5 to 0.0625 °C), 12 bits at power-up | Maxim DS18B20 datasheet (rev 042208), p. 3 |
| Conversion time | 750 ms max at 12 bits | Maxim DS18B20 datasheet (rev 042208), p. 1 |
| Current | 1 to 1.5 mA converting, 750 nA typical standby | Maxim DS18B20 datasheet (rev 042208), p. 19 |
| Pull-up | 4.7 kΩ from DQ to VDD | Maxim DS18B20 datasheet (rev 042208), p. 6 |
| Addressing | Unique 64-bit ROM code per sensor | Maxim DS18B20 datasheet (rev 042208), p. 1 |
| Power-on temperature register | +85 °C | Maxim DS18B20 datasheet (rev 042208), p. 4 |
| Supply voltage | 3.3 V | Tinkered component registry |
| Maximum supply voltage | 5.5 V | Tinkered component registry |
| Interface | 1-Wire | Tinkered component registry |
| Dimensions | 78 × 68 × 14 mm | Tinkered component registry |
| Weight | 18 g | Tinkered component registry |

## Circuit notes

- Supply the red lead with 3.0 V to 5.5 V and tie the blue/black lead to ground.
- The yellow/white DATA (DQ) line requires a 4.7 kΩ pull-up resistor to VCC (Maxim datasheet, p. 6); the bus will not communicate without it.
- DATA is open drain and idles at the pull-up's voltage, so on a 3.3 V board such as an ESP32 power the probe from 3.3 V and tie the pull-up to 3.3 V; on an Uno use 5 V.
- Multiple probes can share one DATA pin because each has a unique 64-bit ROM address; a single 4.7 kΩ pull-up serves the whole bus.
- A 12-bit conversion can take up to 750 ms, so wait for the conversion to finish before reading the result.
- Parasite-power mode (DATA and GND only) is possible but the master must switch in a strong pull-up within 10 µs of each conversion command and hold it for the whole conversion (Maxim datasheet, p. 5); Maxim does not recommend parasite power above +100 °C. A dedicated VCC connection is more reliable, especially with several probes.

## Common mistakes

- **Omitting the 4.7 kΩ pull-up.** The 1-Wire bus is open drain and idles high through an external resistor. Without a 4.7 kΩ pull-up from DATA to VCC the sensor is never found, and the DallasTemperature library reports -127 °C, its value for a disconnected device, which looks like a dead sensor.
- **Reading before the conversion completes.** A 12-bit conversion needs up to 750 ms. Reading the scratchpad before the first conversion finishes returns +85 °C, the register's power-on value (Maxim datasheet, p. 4). Either wait the full conversion time or poll the bus until the device signals it is done.
- **Confusing the wire colors.** Cable coloring is not universal. Many probes use blue for ground, but some batches use black for ground and reserve another color for DATA. Verify against the probe's own labeling before wiring, since swapping GND and DATA prevents communication.
- **Assuming parasite power just works.** Parasite power omits the VCC wire but demands a strong pull-up that clamps the bus high throughout every conversion. With long cables or multiple probes it becomes unreliable. Use the normal three-wire connection unless pins are truly scarce.
- **Hardcoding a single device on a shared bus.** Because each probe has its own 64-bit ROM address, code that assumes one sensor breaks when a second is added. Enumerate the addresses on the bus and target each device explicitly instead of relying on a skip-ROM broadcast.

## Questions

### Why does my DS18B20 read -127 °C?

-127 °C is the DallasTemperature library's code for a sensor it cannot reach. Check the 4.7 kΩ pull-up from DATA to VCC (Maxim datasheet, p. 6), that DATA goes to the pin your sketch names, and that the ground and data leads are not swapped.

### Why does my DS18B20 read 85 °C?

+85 °C is the temperature register's power-on value (Maxim datasheet, p. 4). You are reading before a conversion has finished, often because the supply dipped and reset the sensor; give a 12-bit conversion its full 750 ms (p. 1) and check the power wiring.

### Can I use the DS18B20 with an ESP32 or 3.3 V board?

Yes. The DS18B20 runs from 3.0 V to 5.5 V (Maxim datasheet, p. 1), so power the probe from 3.3 V and tie the 4.7 kΩ pull-up to 3.3 V; DATA then never rises above the ESP32's 3.3 V.

### Do I need a resistor for the DS18B20?

Yes, one 4.7 kΩ pull-up from DATA to VCC (Maxim datasheet, p. 6). One resistor serves the whole bus, however many probes share the pin.

### How many DS18B20 sensors can I put on one pin?

Several, because each carries a unique 64-bit serial code that the master uses to address it (Maxim datasheet, p. 1). Use the library's address search to list them and read each one by address.

### How accurate is the DS18B20?

±0.5 °C from -10 to +85 °C and ±2 °C across the full -55 to +125 °C range (Maxim datasheet, p. 19), with up to 12-bit resolution, or 0.0625 °C steps (p. 3).

## Related parts

- [220Ω Resistor](https://www.tinkered.ai/components/resistor-220.md): wired with it in its circuit
- [DHT22](https://www.tinkered.ai/components/dht22.md): same job: measures temperature
- [BME280](https://www.tinkered.ai/components/bme280.md): same job: measures temperature, I2C
- [BME680](https://www.tinkered.ai/components/bme680.md): same job: measures temperature, I2C
- [NTC Thermistor (10kΩ)](https://www.tinkered.ai/components/thermistor-ntc-10k.md): same job: measures temperature
- [DHT11 Temp & Humidity Sensor](https://www.tinkered.ai/components/dht11.md): same job: measures temperature

## Try it

Tinkered simulates the Waterproof DS18B20 in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
