Skip to main content

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.

Connections

Bus PirateDirectionCircuitDescription
OWDOWD1-Wire Data
GNDGNDSignal Ground

Syntax

CommandDescription
{ or [Issue 1-Wire reset, detect device presence.
rRead one byte. (r:1…255 for bulk reads)
0bWrite this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0xWrite this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255Write this decimal value. Any number not preceded by 0x or 0b is interpreted as a decimal value.
spaceValue 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.

Commands

Bus Pirate 5 has global commands available everywhere, and mode commands specific to the currently selected mode. Type help to see all commands in every mode, or help mode for the currently available mode commands.

tip

Most Bus Pirate commands have help. Add the -h flag to any command to see the latest available options and usage examples.

scan

scan performs a 1-Wire ROM search. Find all connected device IDs.

help

Bus Pirate [/dev/ttyS0]
1-WIRE> scan -h
usage:
scan [-h(elp)]
Scan 1-Wire address space: scan

scan for 1-Wire devices
-h Get additional help

1-WIRE>

use

Bus Pirate [/dev/ttyS0]
1-WIRE> scan
1-Wire ROM search:
1: 28 5c aa 13 0a 00 00 19

1-WIRE>

scan 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.

ds18b20

ds18b20 reads the temperature from a single 18B20 sensor.

help

Bus Pirate [/dev/ttyS0]
1-WIRE> ds18b20 -h
usage:
ds18b20 [-h(elp)]
measure temperature (single sensor bus only): ds18b20

Query DS18B20 temperature sensor
-h Get additional help

1-WIRE>

use

Bus Pirate [/dev/ttyS0]
1-WIRE> ds18b20
RX: 1a 01 00 00 7f ff 06 10 12 Temperature: 17.625

1-WIRE>

Macro ds18b20 reads the temperature from a single 18B20 temperature sensor. The macro uses the skip ROM command, so it will only work with a single DS18B20 device connected.