# DS18B20 reads -127 or 85 degrees: pull-up and wiring fixes

> Fix a DS18B20 temperature sensor that reads -127 or 85 degrees C: the 4.7k pull-up, wiring, parasite power and read timing.

Canonical: https://roboticsengineering.in/fix/ds18b20-reads-minus-127-or-85/ | Published: 2026-11-03 | Updated: 2026-11-03

**-127 means the sensor is not answering, and 85 is the power-on value before a real reading.** Check the pull-up resistor and wiring first.

## What the message means

The DS18B20 uses a one-wire data line that needs a pull-up resistor to the supply. Libraries return -127 when no device responds. The sensor outputs 85 C until a conversion finishes.

## Fix it in this order

1. Fit a 4.7 kohm resistor between the data line and 3.3 V or 5 V.
2. Check the three wires: ground, data and supply. Swapped ground and supply can damage the sensor.
3. Use the correct pin number in the sketch and the OneWire and DallasTemperature libraries.
4. Request the temperature after the conversion finishes. Call requestTemperatures() and read afterwards.
5. Shorten long wires or use a lower pull-up value for long runs.
6. Try a second sensor. Counterfeit parts are common.

## If you see this, do this

| You see | Do this |
| --- | --- |
| -127 always | No response: pull-up, wiring or pin. |
| 85 sometimes | You read before the conversion finished. |

## Related

[I2C device not found](https://roboticsengineering.in/fix/i2c-device-not-found-arduino-esp32/), [resistor calculators](https://roboticsengineering.in/led-resistor-voltage-divider-calculator/).

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
