-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
- Fit a 4.7 kohm resistor between the data line and 3.3 V or 5 V.
- Check the three wires: ground, data and supply. Swapped ground and supply can damage the sensor.
- Use the correct pin number in the sketch and the OneWire and DallasTemperature libraries.
- Request the temperature after the conversion finishes. Call requestTemperatures() and read afterwards.
- Shorten long wires or use a lower pull-up value for long runs.
- 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, resistor calculators.
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.