1-Wire Protocol Commands
Overview
- Bus: 1-Wire
- Connections: one pin (OWD) and ground
- Output type: open drain/open collector
- Pull-up resistors: always required (2K - 10K ohms)
- Maximum voltage: 5volts
1-Wire is a common bus for low speed interfaces.
Configuration options
- None
Pull-up resistors
1-Wire is an open-collector bus, it requires pull-up resistors to hold the data line high and create the data '1'. 1-Wire parts don't output high, they only pull low, without pull-up resistors there can never be a '1'.
Enable the Bus Pirate onboard pull-up resistors with the P
command.
tip
- 1-Wire requires a pull-up resistor to hold the data line high.
- 1-Wire parts don't output high, they only pull low.
- Without pull-up resistors there can never be a '1'.
- Enable the Bus Pirate onboard pull-up resistors with the
P
command.
Syntax
Command | Description |
---|---|
{ or [ | Issue 1-Wire reset, detect device presence. |
r | Read one byte. (r:1…255 for bulk reads) |
0b | Write this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001. |
0x | Write this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters. |
0-255 | Write this decimal value. Any number not preceded by 0x or 0b is interpreted as a decimal value. |
space | Value delimiter. Use a space to separate numbers. No delimiter is required between non-number values: {0xa6 0 0 16 5 0b111 0xaF rrrr}. |
(#) | Run macro, (0) for macro list. |
Macro
Number | Description |
---|---|
0 | Macro menu |
1 | 1-Wire ROM search. Find all connected device IDs. |
2 | Read temperature from a single 18B20 sensor. |
1-Wire ROM search macro
Bus Pirate [/dev/ttyS0]
1-WIRE> (1)
1-Wire ROM search:
1: 28 5c aa 13 0a 00 00 19
1-WIRE>
1-Wire ROM search:
1: 28 5c aa 13 0a 00 00 19
1-WIRE>
Macro (1)
performs a 1-Wire ROM search to detect the ID of every connected 1-Wire device. They type of device is shown if the family ID is known.
Read 18B20 temperature
Bus Pirate [/dev/ttyS0]
1-WIRE> (2)
RX: 1a 01 00 00 7f ff 06 10 12 Temperature: 17.625
1-WIRE>
RX: 1a 01 00 00 7f ff 06 10 12 Temperature: 17.625
1-WIRE>
Macro (2)
reads the temperature from a single 18B20 temperature sensor. The macro uses the skip ROM command, so it will only work when the DS18B20 is the only device connected.
Connections
Bus Pirate | Direction | Circuit | Description |
---|---|---|---|
OWD | ↔ | OWD | 1-Wire Data |
GND | ⏚ | GND | Signal Ground |