DS18B20 Waterproof Temperature Sensor Probe with Terminal Adapter – Arduino Wiring, Code & Troubleshooting
This version of the DS18B20 waterproof temperature probe is supplied with a pluggable screw-terminal adapter and 3-pin connection cable. The adapter makes the normal three-wire DS18B20 connection easier and includes the required 1-Wire pull-up resistor.
This guide covers the probe wire colours, adapter pinout, Arduino UNO wiring, library installation, basic temperature-reading code, resolution and common troubleshooting.
DS18B20 Probe & Adapter Overview
The DS18B20 is a digital temperature sensor that communicates over a 1-Wire data connection. Unlike an analogue temperature sensor, the controller receives a digital temperature value rather than measuring an analogue voltage.
The terminal adapter includes a 4.7kΩ pull-up resistor between the 1-Wire data line and VCC. When using the supplied adapter in the standard three-wire configuration, no separate 4.7kΩ resistor needs to be added.
The DS18B20 sensor itself supports measurements from -55 to +125°C, but the cable supplied with this probe is specified for a maximum temperature of 85°C. Keep the cable and cable entry within their rated temperature even when the stainless steel probe tip is measuring a hotter location.
The stainless steel probe is supplied as a waterproof temperature probe, but the screw-terminal adapter, jumper connections and controller are not waterproof. Keep these electrical parts dry. No specific IP, pressure or maximum immersion-depth rating is specified for the complete assembly.
Terminal Adapter Pinout
The adapter provides three labelled connections: DAT, VCC and GND. The same functions are marked beside the 3-pin output header.
| Adapter Label | Function | Connects To |
|---|---|---|
| DAT | 1-Wire data signal | Controller digital GPIO |
| VCC | Sensor power and pull-up supply | 3.3V or 5V supply as appropriate |
| GND | Ground | Controller GND |
Connecting the Probe to the Screw Terminals
The DS18B20 probe supplied with this product uses the following wire colours:
| Probe Wire | Adapter Terminal | Function |
|---|---|---|
| Yellow | DAT | 1-Wire data |
| Red | VCC | Sensor power |
| Black | GND | Ground |
Connect the yellow wire to DAT, the red wire to VCC and the black wire to GND. Insert the stripped conductor fully into the screw terminal and tighten each terminal securely before applying power.
3-Pin Output Header
The controller-side header is also labelled DAT, VCC and GND on the adapter PCB. Follow these printed labels when connecting the supplied 3-pin cable.
Jumper cable colours are not an electrical standard. Confirm which conductor is connected to DAT, VCC and GND at the adapter before connecting the other end to your controller.
Arduino UNO Wiring
The example below uses Arduino digital pin D2 for the DS18B20 data connection.
| Adapter | Arduino UNO | Function |
|---|---|---|
| DAT | D2 | 1-Wire data |
| VCC | 5V | Sensor power and pull-up supply |
| GND | GND | Common ground |
The 4.7kΩ pull-up resistor required by the DS18B20 1-Wire data line is already present on this adapter.
When connecting the adapter to an ESP32, Raspberry Pi or another controller with 3.3V-only GPIO, power the adapter from an appropriate 3.3V supply. The adapter's pull-up resistor connects DAT towards VCC, so powering the adapter from 5V would also pull the data line towards 5V.
Arduino Library Installation
The Arduino example uses the DallasTemperature library together with the OneWire library.
- Open the Arduino IDE.
- Open Tools > Manage Libraries.
- Search for DallasTemperature and install the DallasTemperature library.
- Search for OneWire and install the OneWire library by Paul Stoffregen if it is not already installed.
- Select your Arduino UNO and the correct serial port.
Arduino UNO Basic Temperature Test
Before uploading the sketch, connect DAT to D2, VCC to 5V and GND to GND.
#include <OneWire.h>
#include <DallasTemperature.h>
const uint8_t ONE_WIRE_BUS = 2;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(9600);
sensors.begin();
Serial.print("DS18B20 sensors found: ");
Serial.println(sensors.getDeviceCount());
}
void loop() {
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
if (temperatureC == DEVICE_DISCONNECTED_C) {
Serial.println("Sensor read failed - check wiring.");
} else {
Serial.print("Temperature: ");
Serial.print(temperatureC, 2);
Serial.println(" C");
}
delay(1000);
}
Expected Result
Open the Arduino Serial Monitor and set it to 9600 baud. The startup message should report one detected sensor when a single probe is connected:
DS18B20 sensors found: 1
Temperature: 23.44 C
Temperature: 23.50 C
Temperature: 23.56 C
Your actual temperature will depend on the environment. Hold the stainless steel probe in your hand or place the probe into water at a different temperature. The displayed value should gradually move towards the new temperature.
Temperature Resolution
The DS18B20 supports 9-bit, 10-bit, 11-bit and 12-bit temperature resolution. Higher resolution provides smaller temperature increments but requires more time to complete each measurement.
| Resolution | Temperature Step | Maximum Conversion Time |
|---|---|---|
| 9 bit | 0.5°C | 93.75ms |
| 10 bit | 0.25°C | 187.5ms |
| 11 bit | 0.125°C | 375ms |
| 12 bit | 0.0625°C | 750ms |
At 12-bit resolution the reported value changes in steps as small as 0.0625°C, but this does not mean the sensor is accurate to 0.0625°C. The DS18B20 is specified to ±0.5°C accuracy from -10 to +85°C.
Practical Measurement Notes
Allow the probe temperature to settle
The stainless steel sheath and waterproof probe construction have thermal mass. After moving the probe between air, water or another material, allow enough time for the reading to stabilise before treating it as the final temperature.
Measure with the stainless steel probe section
Position the stainless steel probe where the temperature needs to be measured. Good thermal contact generally produces a more representative reading than leaving the probe loosely exposed near the target material.
Calibration
If your application requires a correction offset, compare the probe with a suitable trusted reference at temperatures relevant to the application. Do not assume a single offset will necessarily remain correct over the complete measurement range.
Multiple DS18B20 probes
DS18B20 sensors have individual device addresses and can share a 1-Wire bus. For a permanent multi-probe installation, identify each sensor by its address rather than relying only on its position in a detected-device list.
Troubleshooting
Arduino reports 0 sensors
- Confirm the yellow probe wire is connected to DAT, red to VCC and black to GND.
- Confirm DAT on the adapter is connected to Arduino D2 when using the example sketch.
- Confirm VCC is connected to Arduino 5V and GND is connected to Arduino GND.
- Check that all three screw terminals are tightened securely.
- Confirm the supplied 3-pin cable follows the DAT, VCC and GND markings on the adapter.
- Confirm both the DallasTemperature and OneWire libraries are installed.
Reading is -127°C or the sketch reports a disconnected sensor
- -127°C is used by the DallasTemperature library as a disconnected-device error value.
- Check the DAT connection between the adapter and Arduino.
- Check the yellow probe wire is firmly connected to the DAT screw terminal.
- Check VCC and GND connections at both the probe and controller sides of the adapter.
- Disconnect power before correcting any wiring.
Reading repeatedly shows exactly 85°C
- +85°C is the DS18B20 temperature register's power-on reset value.
- A persistent 85°C reading can indicate that a new temperature conversion is not completing correctly.
- Check sensor power, ground and DAT wiring before changing the software.
Readings are intermittent
- Tighten the screw terminals so the probe conductors cannot move.
- Confirm the 3-pin jumper connectors are fully seated.
- Keep the DAT wiring away from motors, relays and other electrically noisy wiring where practical.
- Confirm the controller and adapter have a reliable common ground.
- Longer or more complex 1-Wire networks may require additional attention to cable layout and bus design.
Temperature changes slowly
- This can be normal for a stainless steel waterproof probe because the sheath adds thermal mass.
- Ensure the metal probe is in good thermal contact with the material being measured.
- Allow time for the probe to stabilise after moving it between different temperatures.
Works on Arduino UNO but not on a 3.3V controller
- Check that DAT is connected to the GPIO pin used by your program.
- Power the adapter from the controller's appropriate 3.3V supply so the pull-up also operates at 3.3V.
- Confirm the controller and adapter share a common ground.
- Do not assume Arduino UNO pin numbers or software setup apply unchanged to a different controller platform.
Connect the probe with yellow to DAT, red to VCC and black to GND before applying power. The DS18B20 operates from 3.0V to 5.5V, and this terminal adapter already includes the required 1-Wire pull-up resistor. Keep the adapter, jumper connections and controller dry. The DS18B20 sensor IC supports temperatures beyond the rating of the supplied cable, which is specified for a maximum temperature of 85°C.