Skip to main content

ds18b20

Read temperature from DS18B20 digital temperature sensors over 1-Wire bus.

Overview

The ds18b20 node reads temperature from DS18B20 digital temperature sensors. These waterproof, precise sensors use the 1-Wire protocol, allowing multiple sensors on a single GPIO pin. Perfect for environmental monitoring, HVAC, and liquid temperature measurement.

±0.5°C
Accuracy
-55 to +125°C
Range
12-bit
Resolution
750ms
Conversion

Wiring

Connection

VCC (Red) → 3.3V

GND (Black) → GND

DATA (Yellow) → GPIO 4

Add 4.7kΩ pull-up resistor between DATA and VCC

Enable 1-Wire

# Add to /boot/config.txt
dtoverlay=w1-gpio

# Then reboot
sudo reboot

Properties

Property Type Default Description
sensorId string "" (all) Specific sensor ID or empty for all sensors
interval number 10 Reading interval in seconds
unit string "C" Temperature unit: "C", "F", or "K"
precision number 2 Decimal places in output

Output

{
  "payload": 23.5,
  "sensorId": "28-00000abcdef1",
  "unit": "°C",
  "timestamp": 1640000000000,
  "raw": 23500
}

Example: Multi-Sensor Temperature Monitor

Monitor temperatures from multiple DS18B20 sensors and display on dashboard.

ds18b20 switch (by ID) gauge
[
  {
    "id": "ds18b20-all",
    "type": "ds18b20",
    "sensorId": "",
    "interval": 10,
    "unit": "C"
  },
  {
    "id": "route-sensors",
    "type": "switch",
    "property": "sensorId",
    "rules": [
      { "v": "28-00000abcdef1" },
      { "v": "28-00000abcdef2" }
    ]
  },
  {
    "id": "gauge-indoor",
    "type": "ui_gauge",
    "name": "Indoor Temp",
    "min": 0,
    "max": 50
  }
]

Related Nodes