Temperature & Humidity
Interfacing DS18B20 Temperature & Humidity with Arduino Uno
What is the DS18B20?
The DS18B20 is a digital temperature sensor on the 1-Wire bus, packaged in a stainless-steel waterproof probe on a cable. Each chip has a unique factory-burned 64-bit ROM address, which is what makes 1-Wire special — you can chain dozens of these probes on a single data pin and read each one individually by address, no extra wiring per sensor.
It's the default choice for aquariums, sous-vide cookers, soil/outdoor temperature logging, and any project needing a sealed probe rather than a bare board. The catch that trips people up is the pull-up resistor: the DQ (data) line needs a 4.7kΩ resistor to VCC or the bus will float and reads will fail or return 85°C (the power-on reset value) or -127°C (a read error). There's also a rarely-needed "parasite power" mode (VCC tied to GND, power drawn from the data line) — stick to standard 3-wire power unless you have a specific reason to save a wire.
Specifications
| Interface | 1-Wire (Dallas/Maxim protocol), unique 64-bit ROM address per chip |
| Operating voltage | 3.0–5.5V |
| Temperature range | −55°C to 125°C |
| Accuracy | ±0.5°C (−10°C to 85°C range) |
| Resolution | 9–12 bit, configurable (0.5°C to 0.0625°C steps) |
| Conversion time | 750ms at 12-bit resolution (shorter at lower resolution) |
| Probe cable length | ~1m (common), stainless steel sheath, IP67-rated tip |
| Multi-drop capability | Multiple probes can share one data pin, addressed individually by ROM code |
DS18B20 Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground — black wire on waterproof probe versions |
| 2 | DQ | Data — yellow wire; needs a 4.7kΩ pull-up resistor to VCC |
| 3 | VCC | Power, 3.0–5.5V — red wire |
Standard (non-parasitic) wiring: VCC to 3.3V/5V, GND to ground, DQ to your data pin with a 4.7kΩ resistor between DQ and VCC. Multiple probes can share the same DQ line — the library discovers each one by its unique ROM address.
Setting Up DS18B20 with Arduino Uno
Library
OneWire + DallasTemperature by Paul Stoffregen / Miles Burton
Arduino IDE → Library Manager → install both "OneWire" and "DallasTemperature"
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | — |
| GND | GND | — |
| DQ | D2 (+ 4.7kΩ resistor to 5V) | — |
Example code
Any digital pin works for DQ. Don't forget the 4.7kΩ pull-up — this is the #1 cause of "85.00" or "-127.00" readings.
Related Guides & Projects

Arduino Uno R3 Pinout: Every Pin Explained (Digital, Analog, PWM, Power)
Complete Arduino Uno R3 pinout reference: all 14 digital pins, 6 analog inputs, PWM, UART, SPI, I2C, AREF, and power rails explained with wiring tips and common mistakes.

Ultimate Arduino Mega 2560 Pinout Guide: Complete Power & I/O Reference
Master the Arduino Mega 2560 pinout. Detailed reference for all 54 digital pins, 16 analog inputs, PWM, UARTs, SPI, I2C, interrupts, and power. Includes a printable table and practical wiring tips.

Interfacing HC-SR04 Ultrasonic Sensor with Arduino
Measure distance accurately using ultrasonic sound waves and an Arduino Uno — no complex math, no expensive hardware.
HC‑SR04 Ultrasound Distance Measurement with Arduino – Parking Alert (LCD & Buzzer)
Learn HC‑SR04 ultrasound distance measurement with Arduino Uno. Build a parking alert system with 16x2 LCD and buzzer – shows distance and beeps faster as you approach.