Skip to content
UPEEC

One-Wire

A single data line (plus ground) that carries both data and, optionally, power — used by DS18B20 sensors.

Easy
Comments 0

Each device has a unique 64-bit ROM ID, so many sensors can share one pin. The line needs a 4.7 kΩ pull-up. Timing is strict (microsecond-level slots), so use a library:

#include <OneWire.h>
#include <DallasTemperature.h>
OneWire bus(4);
DallasTemperature sensors(&bus);
sensors.requestTemperatures();
float t = sensors.getTempCByIndex(0);

Not to be confused with single-wire protocols such as the DHT11/DHT22 or WS2812 LEDs, which are proprietary.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.