One-Wire is a simple communication protocol designed to transfer data and power over a single data line. It is commonly used for temperature sensors, identification chips and small embedded devices where minimal wiring is important.
Compared with I2C, SPI or UART, One-Wire is slower but extremely simple and efficient for specific use cases.
What Is One-Wire?
One-Wire is a serial communication protocol developed for devices that require very simple connections.
A typical One-Wire connection uses:
- One data line
- Ground
In many cases, the same data line is also used to supply power to the device. This is called parasitic power mode.
How One-Wire Works
One-Wire communication is controlled by a master device, usually a microcontroller.
The master:
- Generates timing signals
- Initiates communication
- Reads and writes data
Devices on the bus respond to commands from the master.
Device Addressing
Each One-Wire device has a unique 64-bit address.
This allows:
- Multiple devices on the same wire
- No address conflicts
- Easy identification of individual sensors
The master can scan the bus to detect all connected devices.
Pull-Up Resistor
The One-Wire bus requires a pull-up resistor on the data line.
Typical values:
- 4.7kΩ is commonly used
The line is normally high, and devices pull it low to transmit data.
Parasitic Power Mode
One-Wire devices can operate without a dedicated power supply.
In parasitic mode:
- Power is taken from the data line
- A capacitor inside the device stores energy
This reduces wiring but can limit performance and reliability.
Speed
One-Wire is relatively slow compared with other communication protocols.
Typical speeds:
- Standard speed: around 16 kbps
- Overdrive mode: higher speed for supported devices
This is sufficient for sensors but not suitable for large data transfers.
Typical One-Wire Devices
- DS18B20 temperature sensor
- iButton identification devices
- Memory chips
- Battery monitoring devices
Bus Length and Wiring
One-Wire can work over moderate distances, but wiring quality matters.
- Short cables are most reliable
- Long cables can introduce timing issues
- Star wiring can cause reflections
For longer cables, careful design and sometimes stronger pull-up circuits are required.
Common One-Wire Problems
- Missing or incorrect pull-up resistor
- Too long cables
- Parasitic power instability
- Timing issues with certain microcontrollers
One-Wire vs I2C
| Feature | One-Wire | I2C |
|---|---|---|
| Wires | 1 data line | 2 lines |
| Speed | Low | Higher |
| Addressing | Unique 64-bit ID | 7-bit or 10-bit |
| Complexity | Low wiring | More flexible |
When to Use One-Wire
- Minimal wiring is required
- Multiple identical sensors are needed
- Unique device identification is useful
When Not to Use One-Wire
- High-speed communication is needed
- Large amounts of data must be transferred
- Many different device types must share a bus
Conclusion
One-Wire is a simple and efficient communication protocol for specific applications such as temperature sensing and device identification. Its main advantage is minimal wiring, while its main limitation is low speed.
For many sensor applications, especially with DS18B20 temperature sensors, One-Wire remains a practical and widely used solution.
