Skip to content
Web app (opens in a new tab)Get the kit
Web app (opens in a new tab)Get the kit

Sensors Explained

DS18B20 Temperature Sensor: The Waterproof Probe Explained

The DS18B20 is a digital temperature sensor that sends exact readings over one data wire, and its waterproof probe version can sit in water or soil. This guide covers its specs, pinout, how the one-wire bus works, a no-code water rule and ESP32 code.

A steel-tipped DS18B20 probe sits in a beaker of water, its black cable running over the rim to the socket on an ESP32 board, which sends the reading to a dashboard card showing Temperature (DS18B20) 24.5 °C
A steel-tipped DS18B20 probe sits in a beaker of water, its black cable running over the rim to the socket on an ESP32 board, which sends the reading to a dashboard card showing Temperature (DS18B20) 24.5 °C

The DS18B20 is a digital temperature sensor. It measures from −55 to 125 °C and sends each reading to a microcontroller as a number on one data wire, using a system called 1-Wire. Its maker rates it at ±0.5 °C between −10 and 85 °C in the DS18B20 datasheet (opens in a new tab), and a full-detail reading takes up to 750 ms. The waterproof DS18B20 temperature sensor most students meet is the same chip sealed in a stainless steel tube at the end of a cable, so the tip can go into water or soil. It has three wires, power, ground and data, and the data wire needs one pull-up resistor.

On the MakerBuddy board the probe plugs into the socket marked 26, and the dashboard shows its reading with no wiring and no code. Lesson 11, Precision Temperature, teaches it, with a Try it demo that runs in your browser first.

DS18B20 specs at a glance

SpecDS18B20
MeasuresTemperature only, in °C
Range−55 to 125 °C (−67 to 257 °F)
Accuracy±0.5 °C from −10 to 85 °C, ±2 °C across the full range
Resolution9 to 12 bits: steps of 0.5, 0.25, 0.125 or 0.0625 °C
Time for one readingUp to 750 ms at 12 bits, up to 93.75 ms at 9 bits
Supply3.0 to 5.5 V
CurrentAbout 1 mA while measuring (1.5 mA at most), about 750 nA when idle
Interface1-Wire: one data wire plus ground
AddressA unique 64-bit code, starting with the family code 28 (hex)
Packages3-pin TO-92, 8-pin SO, 8-pin µSOP, and probes built around the TO-92
Reading at power-up+85 °C, until the first measurement finishes
Spec
Measures
DS18B20
Temperature only, in °C
Spec
Range
DS18B20
−55 to 125 °C (−67 to 257 °F)
Spec
Accuracy
DS18B20
±0.5 °C from −10 to 85 °C, ±2 °C across the full range
Spec
Resolution
DS18B20
9 to 12 bits: steps of 0.5, 0.25, 0.125 or 0.0625 °C
Spec
Time for one reading
DS18B20
Up to 750 ms at 12 bits, up to 93.75 ms at 9 bits
Spec
Supply
DS18B20
3.0 to 5.5 V
Spec
Current
DS18B20
About 1 mA while measuring (1.5 mA at most), about 750 nA when idle
Spec
Interface
DS18B20
1-Wire: one data wire plus ground
Spec
Address
DS18B20
A unique 64-bit code, starting with the family code 28 (hex)
Spec
Packages
DS18B20
3-pin TO-92, 8-pin SO, 8-pin µSOP, and probes built around the TO-92
Spec
Reading at power-up
DS18B20
+85 °C, until the first measurement finishes

Figures from Maxim's DS18B20 datasheet, revision 042208 (opens in a new tab). The probe is not a separate part: it is the TO-92 chip, a cable and a seal, as Adafruit's waterproof DS18B20 page (opens in a new tab) shows.

What do those numbers mean in a classroom? If the water in a cup is truly 22 °C, a probe in spec can read anything from 21.5 to 22.5 °C. In Fahrenheit that is ±0.9 °F, because each degree Celsius is 1.8 degrees Fahrenheit. The sensor only works in Celsius; the datasheet says Fahrenheit needs a conversion in your code.

The visual guide to the types of sensors used in student projects shows where the DS18B20 sits among the other kit sensors. More sensor guides are on the MakerBuddy blog.

What is inside the waterproof probe

The bare DS18B20 looks like a small black transistor with three legs. A waterproof probe puts that chip inside a short metal tube, fills the gap and seals the end where the cable comes out. Adafruit's waterproof DS18B20 (opens in a new tab), for example, uses a stainless steel tube 6 mm across and 30 mm long, a 91 cm cable and heat shrink for the seal. Probes from other sellers differ in length and cable.

The same page sets three limits that apply to most probes like it:

  • The chip works up to 125 °C, but the PVC cable jacket does not. Adafruit suggests keeping the probe under 100 °C.
  • It is not for salt water or other corrosive liquids.
  • It is not IP rated and not guaranteed for long-term or high-pressure use.

Only the metal tip and the cable go in water. The plug at the other end, and the board, always stay dry. In class, use cool tap water or lukewarm water, never a kettle, as Lesson 11's safety note says.

The tube and seal must warm up or cool down before the chip can, so a probe never reacts at once. Lesson 11's fist test shows it: hold the tip in your hand and the number climbs over many seconds, then falls back more slowly in air.

Cutaway of a waterproof DS18B20 probe in a cup of water: the three-legged TO-92 chip sits in filling inside a stainless steel tube, 6 mm across and 30 mm long on Adafruit's probe, with a heat-shrink seal where the cable leaves. Red power, black ground and yellow data wires run to a plug that stays dry, and heat must pass the steel and filling first, so the reading reacts slowly.
Cutaway of a waterproof DS18B20 probe in a cup of water: the three-legged TO-92 chip sits in filling inside a stainless steel tube, 6 mm across and 30 mm long on Adafruit's probe, with a heat-shrink seal where the cable leaves. Red power, black ground and yellow data wires run to a plug that stays dry, and heat must pass the steel and filling first, so the reading reacts slowly.

Is your probe a genuine DS18B20?

Many low-cost probes do not contain a Maxim chip. In Chris Petrich's counterfeit DS18B20 study (opens in a new tab), his group bought over 1,000 probes or chips from more than 70 vendors in 2019, and every probe bought on eBay and AliExpress held a counterfeit chip. Many clones still work, but the study found some that read further off than the datasheet allows and some that fail without a separate power wire. The code section below prints your probe's address so you can run the study's first check.

DS18B20 pinout and wiring

The datasheet numbers the TO-92 pins from its bottom-view drawing. A probe's wires carry the same three signals.

TO-92 pinNameWhat it doesUsual probe wireConnect it to
1GNDGroundBlack or blueGround
2DQData in and outYellow or whiteA digital pin, with a pull-up to power
3VDDPower, 3.0 to 5.5 VRed3.3 V on an ESP32, 5 V on an Arduino UNO
TO-92 pin
1
Name
GND
What it does
Ground
Usual probe wire
Black or blue
Connect it to
Ground
TO-92 pin
2
Name
DQ
What it does
Data in and out
Usual probe wire
Yellow or white
Connect it to
A digital pin, with a pull-up to power
TO-92 pin
3
Name
VDD
What it does
Power, 3.0 to 5.5 V
Usual probe wire
Red
Connect it to
3.3 V on an ESP32, 5 V on an Arduino UNO

Pin names come from the DS18B20 datasheet (opens in a new tab); wire colours from Adafruit's probe page (opens in a new tab). Colours are not a standard, so read the seller's label before you wire.

Three rules make it work:

  1. Add a pull-up resistor from DQ to VDD. The datasheet's drawings use 4.7 kΩ, and Adafruit ships one with its probe. The guide to pull-up and pull-down resistors explains why the line needs one.

  2. On an ESP32, power the probe from 3.3 V. The pull-up then holds the data line at 3.3 V, the voltage the ESP32 datasheet (opens in a new tab) gives its characteristics at.

  3. Use a pin that can drive the line low. Espressif's GPIO reference (opens in a new tab) says GPIO 34 to 39 are input only, so they cannot run a 1-Wire bus. The guide to which ESP32 GPIO pins are safe to use lists the rest.

Some guides use only data and ground, with VDD tied to ground. This is parasite power: the chip stores energy from the data line while it is high. A measurement can draw up to 1.5 mA, more than a pull-up can feed, so the bus then needs a transistor that connects the line straight to power, and the datasheet (opens in a new tab) advises against it above 100 °C. For student builds, use all three wires.

On the MakerBuddy board you wire nothing and add nothing. Unplug the USB cable, plug the probe into the 3-pin socket marked 26 on the right edge of the board, and plug the USB cable back in. The plug fits only one way, so never force it.

How a one-wire sensor sends its reading

1-Wire is a bus: one data line that a master, here the ESP32, shares with one or more sensors. The line rests high, held there by the pull-up. Anyone can pull it low; nobody pushes it high. That is why one wire is enough for questions and answers in both directions. Maxim's datasheet (opens in a new tab) gives the steps for one reading:

  1. Reset. The ESP32 pulls the line low for at least 480 µs, then lets go.

  2. Presence. The DS18B20 waits 15 to 60 µs, then pulls the line low for 60 to 240 µs. That pulse means "I am here".

  3. Choose a sensor. With one sensor, the ESP32 sends Skip ROM. With several, it sends Match ROM followed by the one sensor's 64-bit address.

  4. Measure. The ESP32 sends Convert T (44 in hex). The chip measures, which takes up to 750 ms at 12 bits.

  5. Read. After a fresh reset, the ESP32 sends Read Scratchpad (BE in hex) and reads up to 9 bytes. The first two hold the temperature. The ninth is a CRC, a check number that shows whether the bytes arrived intact.

Each bit gets a time slot of at least 60 µs, started by the ESP32 pulling the line low. To send a 1 it lets go within 15 µs; to send a 0 it holds the line low for the whole slot. To read a bit, it lets go and looks within 15 µs: a line still held low is a 0.

The 64-bit address is what makes a bus. The first 8 bits are the family code, 28 in hex for a DS18B20, the next 48 a serial number unique to that chip, and the last 8 a CRC. Because no two chips share an address, the datasheet calls the number of sensors on one bus "virtually unlimited".

So why one-wire, when the probe has three wires? Only one carries data. The others are ground and power, and parasite mode even drops power.

A 1-Wire bus: an ESP32 pin and a 4.7 kΩ pull-up to 3.3 V on one data line, with three probes on the same line, each with its own 64-bit address starting 28. Below, one reading: a reset of at least 480 µs, a 60–240 µs presence pulse from the sensor, Skip ROM and Convert T (44h), up to 750 ms of measuring, a reset and Read Scratchpad (BEh), then two temperature bytes, low byte first.
A 1-Wire bus: an ESP32 pin and a 4.7 kΩ pull-up to 3.3 V on one data line, with three probes on the same line, each with its own 64-bit address starting 28. Below, one reading: a reset of at least 480 µs, a 60–240 µs presence pulse from the sensor, Skip ROM and Convert T (44h), up to 750 ms of measuring, a reset and Read Scratchpad (BEh), then two temperature bytes, low byte first.

Worked example: turn two bytes into a temperature

The chip stores the temperature as a 16-bit number in steps of 1/16 °C, which is 0.0625 °C. Say the two temperature bytes arrive as 91 and then 01 (both hex). The low byte comes first, so the number is 0191 in hex:

text
0000 0001 1001 0001
  1. Add up the 1 bits. From the right they are worth 1, 2, 4, 8 and so on, so this is 256 + 128 + 16 + 1 = 401.

  2. Multiply by the step: 401 × 0.0625 = 25.0625 °C.

  3. Check it a second way. The middle eight bits, 0001 1001, are the whole degrees: 16 + 8 + 1 = 25. The last four bits, 0001, are sixteenths: 1/16 = 0.0625. Together, 25.0625 °C.

  4. For Fahrenheit, multiply by 9/5 and add 32: 25.0625 × 1.8 + 32 = 77.1125, about 77.1 °F.

Negative temperatures use two's complement. Say the bytes give FE6F:

text
1111 1110 0110 1111

The leading 1s say the number is negative. Flip every bit to get 0000 0001 1001 0000, which is 400, then add 1 to get 401. So the reading is −401 × 0.0625 = −25.0625 °C. Both answers match Table 1 of the DS18B20 datasheet (opens in a new tab).

Lower resolutions leave the last bits undefined but finish faster:

ResolutionStepLongest wait for a reading
9 bits0.5 °C93.75 ms
10 bits0.25 °C187.5 ms
11 bits0.125 °C375 ms
12 bits (factory setting)0.0625 °C750 ms
Resolution
9 bits
Step
0.5 °C
Longest wait for a reading
93.75 ms
Resolution
10 bits
Step
0.25 °C
Longest wait for a reading
187.5 ms
Resolution
11 bits
Step
0.125 °C
Longest wait for a reading
375 ms
Resolution
12 bits (factory setting)
Step
0.0625 °C
Longest wait for a reading
750 ms

Each extra bit halves the step and doubles the wait. For water that changes over minutes, 12 bits costs nothing.

DS18B20 accuracy: what ±0.5 °C really means

Three words get mixed up here, and Lesson 11 separates them.

  • Resolution is the smallest step the reading can change by. At 12 bits it is 0.0625 °C.
  • Precision is how closely repeated readings agree. A probe sitting still in a cup gives steady numbers.
  • Accuracy is how close the reading is to the true temperature. That is the ±0.5 °C.

A fine step does not make a reading true. A probe can show 22.3125 °C, steady to the last digit, and still be half a degree off. Two probes in the same cup can differ by up to 1 °C and both be in spec.

The ±0.5 °C promise only holds from −10 to 85 °C. Outside that band the datasheet (opens in a new tab) promises ±2 °C. A home freezer, which the US Food and Drug Administration's food storage advice (opens in a new tab) sets at 0 °F (−18 °C), sits outside the tight band. So a probe in a freezer could read anywhere from −20 to −16 °C and still meet its spec.

Because it is so much tighter than the DHT11's ±2 °C, the probe makes a good classroom reference. The DHT11 guide uses it to check a DHT11, and the DS18B20 vs DHT11 accuracy test compares the two side by side.

The DS18B20 on the MakerBuddy board

The MakerBuddy IoT Kit V1.0 includes the waterproof probe, which plugs into socket 26. The board comes in purple or green, and both colours are the same board. The firmware reads the probe on GPIO 26 with the OneWire and DallasTemperature libraries.

  • How often: once a second, the firmware takes the last result and starts the next measurement without waiting, so nothing else on the board stalls. Each reading is about a second old, and the dashboard card updates about every 2 seconds.
  • Where you see it: the Temperature (DS18B20) card, in °C to one decimal place. The rule form calls it Probe Temp (DS18B20).
  • Text screen: the {ds18b20} wildcard shows one decimal place, so Water {ds18b20}C at 24.5 °C uses 11 of the 16 columns, as the text screen details explain.
  • Servo mapping: the probe's −55 to 125 °C turns the servo across 0–180°, so the angle is the temperature plus 55. Water at 20 °C points the arm at 75°, and 30 °C at 85°. That is only 10° across a classroom's range, and the mapping ignores changes under 3°, as the servo mapping notes say. For a dial that swings further, use rules with servo steps.
  • One probe only: the firmware reads the first sensor it finds on GPIO 26.
  • When it fails: the card shows 0.0, which the fix a problem guide says is not a real temperature.

The board has no clock, so for a temperature diary take the times from your watch, or follow Lesson 16, the Data Logger. The MakerBuddy project idea library uses the probe in the Insulation Tester and the Compost Monitor, and one of its published step-by-step builds turns the reading into a dial. To put the reading on a screen of your own, build your own digital thermometer.

Build a no-code warm water watcher

This build turns the colour light into a water gauge: red when warm, green in a middle band, blue when cool, and purple if the probe stops answering. For the Insulation Tester, time how long each wrapped cup stays red. You need the board, USB power, 2.4 GHz Wi-Fi (a phone hotspot works) and a laptop, iPhone or iPad with the dashboard open; on an Android phone, use the free MakerBuddy app from Google Play. Use lukewarm water, no warmer than a comfortable bath.

Rule nameLoop modeConditionStep
Too warmConditionProbe Temp (DS18B20) greater than 30RGB Red
Just rightConditionProbe Temp greater or equal 20 AND less or equal 30RGB Green
Too coldConditionProbe Temp less than 20 AND greater than 1RGB Blue
Check probeConditionProbe Temp less or equal 1RGB Purple
Rule name
Too warm
Loop mode
Condition
Condition
Probe Temp (DS18B20) greater than 30
Step
RGB Red
Rule name
Just right
Loop mode
Condition
Condition
Probe Temp greater or equal 20 AND less or equal 30
Step
RGB Green
Rule name
Too cold
Loop mode
Condition
Condition
Probe Temp less than 20 AND greater than 1
Step
RGB Blue
Rule name
Check probe
Loop mode
Condition
Condition
Probe Temp less or equal 1
Step
RGB Purple

Step 1: make the four rules

  1. Open the Rule Engine tab, type Too warm as the Rule Name and choose the Condition loop mode.

  2. Set Sensor to Probe Temp (DS18B20), Operator to Greater than (>) and Threshold to 30.

  3. Click Add Step, choose RGB Red with a Delay (ms) of 1000, and click Save Rule.

  4. Make Just right the same way with Greater or equal (>=) and 20. Tick Use Range, choose AND, and set the second operator to Less or equal (<=) and the second threshold to 30. Its step is RGB Green.

  5. Make Too cold with Less than (<) and 20, then Use Range, AND, Greater than (>) and 1. Its step is RGB Blue.

  6. Make Check probe with Less or equal (<=) and 1. Its step is RGB Purple.

Step 2: test it

Put the probe's tip in the cup and wait. If the water starts above 30 °C, the light turns red, then green as the water cools past 30 °C, then blue below 20 °C. Rules read the probe once a second and run on the board, so they keep working after you close the dashboard. Move the thresholds to suit your water; the guide to picking sensor threshold values explains how.

Step 3: see why the 1 °C trick matters

Now unplug the USB cable, pull the probe out of socket 26 and power up again. The reading becomes 0.0, and a rule treats 0.0 like any other number. Without the "greater than 1" half, Too cold would light blue and tell you the water is cold when the probe is missing. With it, only Check probe matches, and the light turns purple.

The trick works because your water never gets near 1 °C. In a freezer it would fail, because a real 0.0 and a missing probe look the same. Lesson 27, Range Logic, teaches ranges like these, and the automation rules documentation lists every option.

A number line from 0 to 40 °C split by the four rules: purple Check probe at 1 °C or below, blue Too cold above 1 and below 20, green Just right from 20 to 30, red Too warm above 30. A cup cooling from 35 to 25 to 15 °C moves from red to green to blue, and a missing probe's 0.0 lands in purple, not blue.
A number line from 0 to 40 °C split by the four rules: purple Check probe at 1 °C or below, blue Too cold above 1 and below 20, green Just right from 20 to 30, red Too warm above 30. A cup cooling from 35 to 25 to 15 °C moves from red to green to blue, and a missing probe's 0.0 lands in purple, not blue.

Read the DS18B20 with Arduino code on an ESP32

This sketch reads the probe in socket 26 once a second, prints it in °C and °F, and prints the probe's 64-bit address at start-up. Add the boards package with the URL from Espressif's Arduino-ESP32 install guide (opens in a new tab), then install "OneWire" and "DallasTemperature" from the Library Manager. Choose the ESP32 Dev Module board and open the Serial Monitor at 115200 baud. The guide to programming an ESP32 with the Arduino IDE walks through each step.

cpp
// MakerBuddy board (ESP32 Dev Module): read the DS18B20 probe in socket 26.
// Uploading this replaces the MakerBuddy firmware until you upload that again.
// Needs "OneWire" and "DallasTemperature" from the Library Manager.

#include <OneWire.h>
#include <DallasTemperature.h>

const int PROBE_PIN = 26;            // the socket marked 26 on the board
OneWire oneWire(PROBE_PIN);          // the 1-Wire bus on that pin
DallasTemperature probes(&oneWire);  // talks DS18B20 over that bus

void setup() {
  Serial.begin(115200);              // match the Serial Monitor speed
  probes.begin();                    // search the bus for sensors
  Serial.printf("Found %d sensor(s) on GPIO %d\n", probes.getDeviceCount(), PROBE_PIN);

  DeviceAddress address;             // 8 bytes: family code, serial number, CRC
  if (probes.getAddress(address, 0)) {
    Serial.print("Address:");
    for (int i = 0; i < 8; i++) {
      Serial.printf(" %02X", address[i]);
    }
    Serial.println();
    Serial.printf("Resolution: %d bits\n", probes.getResolution(address));
  }
}

void loop() {
  probes.requestTemperatures();      // start a reading and wait (up to 750 ms at 12 bits)
  float tempC = probes.getTempCByIndex(0);  // the first sensor on the bus

  if (tempC == DEVICE_DISCONNECTED_C) {
    // The library returns -127 when no sensor answers. MakerBuddy shows this as 0.0.
    Serial.println("No probe. Check the plug in socket 26.");
  } else {
    float tempF = tempC * 9.0 / 5.0 + 32.0;
    Serial.printf("Probe %.2f C  (%.2f F)\n", tempC, tempF);
  }

  delay(1000);                       // one reading a second, like the dashboard
}

requestTemperatures() sends Convert T and, by default, waits for the result; the MakerBuddy firmware turns that wait off so the rest of the board keeps running. getTempCByIndex(0) reads the first sensor's bytes and does the worked example's sum for you. DEVICE_DISCONNECTED_C is −127 in the DallasTemperature library header (opens in a new tab), the value returned when no sensor answers.

Now look at the address line. The first byte should be 28, the family code. Petrich's study (opens in a new tab) says a sensor is a clone if its address does not follow the pattern 28-xx-xx-xx-xx-00-00-xx, that is, if the sixth and seventh bytes are not 00. Passing that test does not prove the chip is genuine, but failing it settles the question. When you finish, put the MakerBuddy firmware back with the install by USB steps.

DS18B20 vs DHT11: which temperature sensor to use

DS18B20 waterproof probeDS18B20 bare chip (TO-92)DHT11
MeasuresTemperatureTemperatureTemperature and humidity
Range−55 to 125 °C, cable under 100 °C−55 to 125 °C0 to 50 °C
Accuracy±0.5 °C from −10 to 85 °C±0.5 °C from −10 to 85 °C±2 °C
HumidityNoneNone20–80%, ±5%
Goes in water or soilYes, the tip and cableNoNo
Fastest readingUp to 750 ms at 12 bitsUp to 750 ms at 12 bitsOnce a second
Measures
DS18B20 waterproof probe
Temperature
DS18B20 bare chip (TO-92)
Temperature
DHT11
Temperature and humidity
Range
DS18B20 waterproof probe
−55 to 125 °C, cable under 100 °C
DS18B20 bare chip (TO-92)
−55 to 125 °C
DHT11
0 to 50 °C
Accuracy
DS18B20 waterproof probe
±0.5 °C from −10 to 85 °C
DS18B20 bare chip (TO-92)
±0.5 °C from −10 to 85 °C
DHT11
±2 °C
Humidity
DS18B20 waterproof probe
None
DS18B20 bare chip (TO-92)
None
DHT11
20–80%, ±5%
Goes in water or soil
DS18B20 waterproof probe
Yes, the tip and cable
DS18B20 bare chip (TO-92)
No
DHT11
No
Fastest reading
DS18B20 waterproof probe
Up to 750 ms at 12 bits
DS18B20 bare chip (TO-92)
Up to 750 ms at 12 bits
DHT11
Once a second

Figures from the DS18B20 datasheet (opens in a new tab), Adafruit's probe page (opens in a new tab) and Adafruit's DHT guide (opens in a new tab).

Pick the probe for liquids, soil, or any job where a degree matters. Pick the bare chip for air on a breadboard. Pick the DHT11 when you also need humidity; Lesson 10, Atmospheric Sensing, teaches it.

The probe is the wrong choice above about 100 °C, where its cable is the limit, in salt water, and wherever you need many readings a second. The MakerBuddy kit includes both the probe and the DHT11, so a class can compare them side by side.

Common DS18B20 mistakes and how to fix them

Each mistake below has a symptom you can see, the cause behind it and the fix.

The dashboard shows 0.0

  • Symptom: the Temperature (DS18B20) card reads 0.0 in a warm room.
  • Cause: no probe answered on GPIO 26, usually because the plug is loose or out. The firmware sends 0.0 in place of the library's −127.
  • Fix: unplug the USB cable, push the probe firmly into socket 26, power up and hold the tip in your hand. The number should climb.

Your sketch prints −127

  • Symptom: every reading in your own code is −127.
  • Cause: no presence pulse came back. In your own circuit this is usually a missing pull-up, a swapped wire or the wrong pin in the code.
  • Fix: check the colours against the seller's label, add a 4.7 kΩ pull-up from data to power as the datasheet (opens in a new tab) shows, and make sure the pin is not GPIO 34 to 39.

Your sketch prints 85.0 in a cool room

  • Symptom: the first reading, or every reading, is exactly 85.0.
  • Cause: the temperature register holds +85 °C at power-up, as the datasheet (opens in a new tab) notes. Your code read it before a measurement had finished, or the chip lost power during one, which happens in parasite mode without a strong pull-up.
  • Fix: send Convert T and wait up to 750 ms before reading, and use three wires with VDD on power.

The reading lags or will not settle

  • Symptom: the number creeps for a minute after the probe goes into the cup.
  • Cause: the steel tube and seal must reach the water's temperature before the chip can. An air bubble on the tip, or a tip only half in the water, slows it further.
  • Fix: put the whole metal tube under the surface, stir gently and wait until the number stops changing.

FAQ

What is the DS18B20 used for?

It measures temperature in places other sensors cannot go, such as water and soil. The DS18B20 datasheet (opens in a new tab) lists thermostats, industrial systems, consumer products and thermometers. In student projects it runs pool and fish-tank monitors, insulation tests, compost monitors and cooling-curve experiments.

How does the DS18B20 temperature sensor work?

A sensor inside the chip measures its own temperature and turns it into a 16-bit number. The microcontroller asks for a reading over the 1-Wire bus, waits up to 750 ms, then reads two temperature bytes and a check byte. Every chip has a unique 64-bit address, so several can share one data wire.

What is the accuracy of the DS18B20?

±0.5 °C from −10 to 85 °C, and ±2 °C across its full −55 to 125 °C range, according to the datasheet (opens in a new tab). Its resolution can be finer than that, down to 0.0625 °C, but a fine step does not make a reading true. Clone chips may not meet these figures.

What are the power requirements for the DS18B20?

It runs on 3.0 to 5.5 V. The datasheet (opens in a new tab) gives about 1 mA while it measures, at most 1.5 mA, and about 750 nA when idle. On an ESP32, power it from 3.3 V so the data line stays at 3.3 V.

Does the DS18B20 need a resistor?

Yes, the data line needs a pull-up to power. The datasheet's drawings show 4.7 kΩ, and Adafruit's probe page (opens in a new tab) calls its included 4.7 kΩ resistor required. Some ready-made modules and boards already include one, so check before you add a second.

Can a DS18B20 probe go in boiling water?

The chip is rated to 125 °C, but Adafruit (opens in a new tab) suggests keeping its PVC-jacketed probe under 100 °C, so boiling water is at the limit. It is also not for salt water or long-term use under pressure. In a classroom, use cool or lukewarm water only.

How many DS18B20 sensors can share one wire?

The datasheet (opens in a new tab) calls the number "virtually unlimited", because each chip has its own 64-bit address. In practice, long cables and many sensors need care with the pull-up and power. The MakerBuddy firmware reads only the first probe on socket 26.

Why does my DS18B20 read 85 or −127?

85.0 is the value the chip holds at power-up, so your code read it before a measurement finished. −127 is what the DallasTemperature library (opens in a new tab) returns when no sensor answers, which points to wiring, the pull-up or the pin. On the MakerBuddy dashboard a missing probe shows as 0.0 instead.

Sources

From the blog

Keep reading

Sensors Explained

MQ2 Gas Sensor: What It Detects, Warm-Up Time and Limits

The MQ-2 is a heated tin dioxide sensor that reacts to burnable gases and smoke. This guide covers what it detects, how long it needs to warm up, what a 0–100 gas reading means, and why it is a learning tool, never a real alarm.

20 min read

Sensors Explained

Soil Moisture Sensor: How It Works and How to Read It

A soil moisture sensor turns the water around its probe into a number. This guide explains how capacitive and resistive probes work, how to turn the raw number into a percentage, how to calibrate dry and wet, and how to use the reading in a plant rule.

19 min read

Sensors Explained

DHT11 Sensor Guide: Pinout, Accuracy and How It Measures Humidity

The DHT11 measures air temperature and relative humidity and sends both over one data wire. This guide covers its pinout, what its ±2 °C and ±5% accuracy really mean, how it senses humidity, and how to use it on the MakerBuddy board with no code or with Arduino code.

19 min read

Learn with MakerBuddy

Start building today.

Every part in these guides has its own lesson. Read them free, or get a kit for your class.