Home IoT Hub Series · 08
[Part 8] Is the boiler actually running? Pipe-temperature monitoring with DS18B20
Monitor boiler operation and hot water pipe temperature with two DS18B20 sensors.
This node uses two DS18B20 probes: one for boiler operation and one for hot-water pipe temperature. It lets the hub understand whether heat is actually moving.
Multiple DS18B20 sensors can share the same data pin. The key is to identify each sensor address once and then assign the right value to the right slot.
![[Part 8] Is the boiler actually running? Pipe-temperature monitoring with DS18B20 hero image](/iot-lab/assets/boiler-hot-water-temperature-hero.png)
This article is part of the Home IoT Hub system connected to the central NodeMCU server built in Part 2: Building the Brain. Two DS18B20 probes report heating-water and hot-water pipe temperatures so the hub can distinguish heating, hot-water use, and freeze risk. The collected data is sent over the local
IoT_Hub_Net network and updates slot 5 for boiler pipe temperature and slot 17 for hot-water pipe temperature on the central server (/set?no5=boiler&no17=hotwater), becoming part of the decision pipeline for the 20-channel smart-home controller.Parts and cost
| Part | Qty | Unit price |
|---|---|---|
| Wemos D1 Mini | 1 pc | $1.50 |
| DS18B20 waterproof type | 2 pc | $3 |
| 4.7kΩ resistor | 1 pc | $0.10 |
| Jumper wires | 4 pc | — |
| Total | $4.40 |
Pin wiring
Full code
#include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <OneWire.h> #include <DallasTemperature.h> const char* ssid = "IoT_Hub_Net"; const char* password = "iothub1234"; const char* hubURL = "http://192.168.1.1"; #define ONE_WIRE_BUS 5 #define INTERVAL 15000 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); void setup() { Serial.begin(115200); sensors.begin(); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.print("Connecting to IoT_Hub_Net"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected! " + WiFi.localIP().toString()); } void loop() { sensors.requestTemperatures(); // index 0 = first detected sensor, 1 = later detected sensor // distinguish boiler and hot water by temperature value float t0 = sensors.getTempCByIndex(0); float t1 = sensors.getTempCByIndex(1); // note float boiler = (t0 > t1) ? t0 : t1; float hotWater = (t0 > t1) ? t1 : t0; if (boiler < -50 || hotWater < -50) { Serial.println("Sensor error, retry..."); delay(2000); return; } Serial.printf("Boiler: %.1f C, HotWater: %.1f C\n", boiler, hotWater); WiFiClient client; HTTPClient http; String url = String(hubURL) + "/set?no5=" + String(boiler) + "&no17=" + String(hotWater); http.begin(client, url); int code = http.GET(); http.end(); Serial.print("HTTP "); Serial.print(code); Serial.print(" -> "); Serial.println(url); Serial.println(); delay(INTERVAL); }
Upload and check
Connect the Wemos D1 Mini to the PC with a USB data cable, select the ESP8266 board and port in the Arduino IDE, upload the sketch, then open Tools → Serial Monitor and set the baud rate to 115200.
Serial Monitor
After uploading, open Tools → Serial Monitor in the Arduino IDE and set the baud rate to 115200. The following is an example Serial Monitor flow for checking normal operation. This is not a real screenshot. It shows how boiler and hot-water pipe temperatures update slots 5 and 17.
[BOOT] Home IoT Node #08 - Boiler and hot-water pipes [1-WIRE] boiler sensor OK, hot-water sensor OK [SENSOR] boiler_pipe=43.7C hot_water_pipe=51.2C [FILTER] thermal_lag=stable, offset=0.0C [HTTP] GET /set?no5=43.7&no17=51.2 [HUB] 200 OK - slots no5/no17 updated [STATE] heating=ON, hot_water=ON
- If
Connectedorconnectedappears, the Wi-Fi step passed. - If
HTTP 200or200 OKappears, the value reached the brain server. - If the value does not update, check both the slot number in the URL and the sensor wiring.
Build notes
- Warm the pipe briefly and confirm only the intended value rises. If the two readings are swapped, switch the sensor address mapping in code.
- Power on the hub brain first so the node can join
IoT_Hub_Net. - Use the same slot number written in the source code.
- Open the serial monitor at 115200 baud and confirm
HTTP 200. - If the value does not appear on the hub, recheck wiring, GPIO number, and Wi-Fi connection.
What Boiler + Hot-Water Pipe Temperature Can Do
By putting two DS18B20 sensors on a single OneWire bus to read the heating (radiant) pipe and the hot-water pipe at the same time, you go beyond raw numbers and see your home's energy flow in real time.
Troubleshooting checkpoints
The node code can look short, but real home installation is affected by placement, power, Wi-Fi quality, and sensor noise. Check these points before letting the node become a decision input for the brain server.
| Symptom | Likely cause | Field fix |
|---|---|---|
| Pipe temperature reads too low | The probe is not tightly coupled to the pipe and also reads room air | Apply thermal grease to the metal probe, fasten it with a cable tie, and cover it with aluminum and insulation tape. |
| Boiler and hot-water labels swap | OneWire sensor order changes or temperature-based detection is ambiguous | Record each sensor address before installation and hard-map labels in code; verify with a temporary heating test. |
| Values rise with a delayed step pattern | There is thermal lag between pipe surface and water inside | Use 3-5 minute trend and supply/return temperature difference rather than one instant value. |
| Freeze-risk alerts are late in winter | Poor insulation around the probe mixes outside air and pipe temperature | Insulate the probe with multiple layers and alert before the pipe approaches 3°C. |
Practical Uses
- Confirm the boiler is running: if pipe temperature climbs above 40°C within 5-10 minutes it ignited normally; if it stays flat you can remotely detect a failed ignition or a gas cutoff.
- Heating and hot-water efficiency: logging the temperature difference (ΔT) between the outgoing and returning pipes tells you how much the boiler is actually heating the water and whether circulation is healthy.
- Freeze-prevention alerts: when an outdoor pipe drops below 3°C, push a phone alert so you can trickle hot water or fire the boiler before it freezes.
- Away-mode heating check: verify the pipes stay above the minimum anti-freeze temperature while you're out, and run the boiler only briefly when needed to avoid waste.
- Cut gas bills: spot wasteful re-firing when the hot-water pipe is already hot, or nighttime overheating, then adjust settings — winter bills drop noticeably.
Recommended Install Spots
- Tight to the pipe surface: apply a thin film of thermal grease to the sensor's metal face, press it onto the pipe with aluminum tape, then wrap insulating tape over it to shut out room air.
- Separate inflow and outflow: attach one sensor to the pipe leaving the boiler (outflow, hot) and one to the returning pipe (inflow, lukewarm) to compute ΔT.
- Outdoor freeze points: put the outdoor sensor where things freeze first — the meter box, exposed pipe running up an outer wall, or a cold corner of the boiler room.
Field Tips and Cautions
- Surface vs internal error: surface temperature usually reads 3-8°C lower than the water inside. Judge by trend and ΔT rather than absolute value.
- Distinguish multiple sensors: each sensor has a unique 64-bit address, so connect them one at a time before install, record the addresses, and label them "boiler/hot-water" in code.
- Heat-rated cable: hot-water pipes easily exceed 60°C, so use silicone or Teflon heat-resistant cable instead of ordinary PVC and finish the joints cleanly at the pipe.
- Insulation finish: poor insulation over the sensor lets room temperature drag the reading around. Wrap at least 2-3 layers to stabilize it.
FAQ
- Q. Is surface mounting (without cutting the pipe) actually useful? Yes. The absolute reading is just slightly low; surface mounting is plenty for run/stop detection and ΔT analysis.
- Q. My two sensors report swapped values. The address mapping in your code is likely reversed. Warm one sensor by hand, see which label rises, and correct the address assignment.
- Q. How do I weatherproof the outdoor sensor? Use a stainless waterproof DS18B20 and double-seal the cable entry with heat-shrink tube and butyl tape — it stays reliable all winter.
This article is part of the 20-channel Home IoT system built from the Part 2 central brain server and the distributed edge nodes in Parts 3-19. Use this map to check the slot and sensor flow across the series.
[Part 1] Home IoT Hub overview[Part 2] Central brain server · slots 1-20[Part 3] Stop guessing room comfort · slots 1/2[Part 4] Did I close the door? · slots 9[Part 5] Is the fridge really cooling? · slots 12[Part 6] Should I open the window? · slots 3[Part 7] Stop bathroom mold before it starts · slots 19[Part 8] Is the boiler actually running? · slots 5/17[Part 9] Did I leave the gas stove on? · slots 6[Part 10] Get warned before gas smell becomes obvious · slots 7[Part 11] Catch flame signs while away from home · slots 8[Part 12] Is bad air making you foggy? · slots 13/14[Part 13] Why is the power bill so high? · slots 15[Part 14] Is water leaking, and how much are we using? · slots 16[Part 15] Do not leave windows open in the rain · slots 18[Part 16] Are the lights off and the door locked? · slots 11/10[Part 17] Control the air conditioner from the IoT hub · slots 4[Part 18] Is the dog bowl empty? · slots 20[Part 19] Cool the room only when someone is there · slots 1/4[Part 20] The house finally fits on one screen · slots all