Temperature probe fault hunt
Build it step by step
0 of 7 doneWire the working circuit
Red to 5V, black to GND, yellow to D2 with 4.7 kilohms to 5V.
Install the libraries
OneWire and DallasTemperature.
Upload and read
A sensible room temperature appears.
Look away while the helper removes the pull-up
The reading becomes minus 127.
Diagnose
Measure the data pin, which should sit near 5 V when idle.
Restore, then the helper moves the data wire
Again minus 127, and a continuity check finds it.
Restore, then the helper pulls the red wire
The reading may be 85 or minus 127.
How do you build a temperature probe fault hunt?
A DS18B20 probe shows minus 127 or exactly 85 degrees when something is wrong. Build it working, have a helper plant two safe faults, and learn what each strange reading means and how to find the cause. You need Arduino Nano, DS18B20 waterproof probe, Resistor 4.7 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 50 minutes.
- Level
- Beginner
- Time
- About 50 min
- Parts
- 5
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 4.7 kΩ × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DS18B20 red wire (VDD) | Nano 5V | Power |
| DS18B20 black wire (GND) | Nano GND | Common ground |
| DS18B20 yellow wire (DATA) | Nano D2 | One-wire data line |
| 4.7 kilohm resistor | Between D2 and 5V | The pull-up that the one-wire bus needs |
Code
The DS18B20 talks on a single data wire that must be held high by a pull-up resistor of about 4.7 kilohms. When the sketch cannot find the sensor, the library returns minus 127. A reading of exactly 85 degrees is the chip's power-on value, which appears when the chip answers but has not completed a measurement, usually because its power is poor or the read came too soon. The sketch prints a plain-language explanation for each case. Fault hunt: build it working first and note the readings, then ask a helper to plant one fault at a time while you look away. Safe faults are taking out the pull-up resistor, moving the data wire to another pin, and pulling out the red power wire so the chip runs on the data line alone. Never plant a reversed power and ground fault on this sensor, because a DS18B20 connected backwards can become very hot and fail. Work out each fault from the symptom and a meter reading on the data pin, and fix them one at a time.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire oneWire(2); // data on D2
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(9600);
sensors.begin();
Serial.print("Sensors found: ");
Serial.println(sensors.getDeviceCount());
}
void loop() {
sensors.requestTemperatures();
float t = sensors.getTempCByIndex(0);
if (t == DEVICE_DISCONNECTED_C) { // -127.00
Serial.println("-127: no sensor answering. Check the data wire, the pull-up and the power.");
} else if (t == 85.0) {
Serial.println("85: the power-on value. The sensor has not finished a conversion. Check the power and wires.");
} else {
Serial.print("Temperature: ");
Serial.print(t, 1);
Serial.println(" C");
}
delay(1000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Sensors found: 1 Temperature: 24.5 C
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Working circuit | Room temperature to about one degree |
| No pull-up | -127 with the explanation line |
| Data wire on the wrong pin | -127, and zero sensors found |
| Power wire removed | 85 or -127 |
| Warm the probe in your hand | The reading rises steadily |
If it does not work
Always -127 even when wired correctly
Check the sensor is the 3-wire probe and the wire colours match yours.
Reading stuck at 85
Check the power wire and keep the data wire short.
Sensor gets hot
Disconnect at once and check the power is the right way round.
No serial text
Set 9600 baud in the monitor.
Library errors
Install both libraries.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the temperature probe fault hunt?
Arduino Nano, DS18B20 waterproof probe, Resistor 4.7 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the temperature probe fault hunt take to build?
About 50 minutes for a beginner maker, in 7 steps.
How do I know the temperature probe fault hunt works?
Working circuit: Room temperature to about one degree. No pull-up: -127 with the explanation line. Data wire on the wrong pin: -127, and zero sensors found.
Always -127 even when wired correctly: what should I check?
Check the sensor is the 3-wire probe and the wire colours match yours.
Reading stuck at 85: what should I check?
Check the power wire and keep the data wire short.
Sensor gets hot: what should I check?
Disconnect at once and check the power is the right way round.
No serial text: what should I check?
Set 9600 baud in the monitor.
