Hubbry Logo
logo
1-Wire
Community hub

1-Wire

logo
0 subscribers
Read side by side
from Wikipedia
An iButton in a plastic fob, as used for Istanbul Akbil smart ticket
A Java ring with an embedded iButton

1-Wire is a wired half-duplex serial bus designed by Dallas Semiconductor that provides low-speed (standard 16.3 kbit/s; "overdrive" at 10×[1]) data communication and supply voltage over a single conductor.[2]

1-Wire is similar in concept to I2C, but with lower data rates and longer range. It is typically used to communicate with small inexpensive devices such as digital thermometers and weather instruments. A network of 1-Wire devices with an associated master device is called a MicroLAN. The protocol is also used in small, 16 mm electronic keys known as a Dallas key or iButton.

One distinctive feature of the bus is the possibility of using only two conductors — data and ground. To accomplish this, 1-Wire devices integrate a small capacitor (~800 pF) to store charge, which powers the device during periods when the data line is active.

Usage example

[edit]

1-Wire devices are available in different packages: integrated circuits, a TO-92-style package (as typically used for transistors), and a portable form called an iButton or Dallas key which is a small stainless-steel package that resembles a watch battery. Manufacturers also produce devices more complex than a single component that use the 1-Wire bus to communicate.

1-Wire devices can fit in different places in a system. It might be one of many components on a circuit board within a product. It also might be a single component within a device such as a temperature probe. It could be attached to a device being monitored. Some laboratory systems connect to 1-Wire devices using cables with modular connectors or CAT-5 cable. In such systems, RJ11 (6P2C or 6P4C modular plugs, commonly used for telephones) are popular.

Systems of sensors and actuators can be built by wiring together many 1-Wire components. Each 1-Wire component contains all of the logic needed to operate on the 1-Wire bus. Examples include temperature loggers, timers, voltage and current sensors, battery monitors, and memory. These can be connected to a PC using a bus converter. USB, RS-232 serial, and parallel port interfaces are popular solutions for connecting a MicroLan to the host PC. 1-Wire devices can also be interfaced directly to microcontrollers from various vendors.

iButtons are connected to 1-Wire bus systems by means of sockets with contacts that touch the "lid" and "base" of the canister. Alternatively, the connection can be semi-permanent with a socket into which the iButton clips, but from which it is easily removed.

Each 1-Wire chip has a unique identifier code. This feature makes the chips, especially iButtons, suitable electronic keys. Some uses include locks, burglar alarms, computer systems, manufacturer-approved accessories, time clocks and courier and maintenance keys for smart safes.

iButtons have been used as Akbil smart tickets for the public transport in Istanbul. They can also run smartcard programs such as Java Card 2.0, as exemplified by the "Java Ring" of 1998.[3]

Power supplies

[edit]

Apple MagSafe- and MagSafe-2-connector–equipped power supplies, displays, and Mac laptops use the 1-Wire protocol to send and receive data to and from the connected Mac laptop, via the middle pin of the connector. Data include power supply model, wattage, and serial number; and laptop commands to send full power, and illuminate the red or green light-emitting diodes in the connector.[4]

Dell laptop power supplies use the 1-Wire protocol to send data via the third wire to the laptop computer about power, current and voltage ratings. The laptop will then refuse charging if the adapter does not meet requirements.[5]

Communication protocol

[edit]

In any MicroLan, there is always one master in overall charge, which may be a personal computer or a microcontroller. The master initiates activity on the bus, simplifying the avoidance of collisions on the bus. Protocols are built into the master's software to detect collisions. After a collision, the master retries the required communication.

A 1-Wire network is a single open drain wire with a single pull-up resistor. The pull-up resistor pulls the wire up to 3 or 5 volts. The master device and all the slaves each have a single open-drain connection to drive the wire, and a way to sense the state of the wire. Despite the "1-Wire" name, all devices must also have a second conductor for a ground connection to permit a return current to flow through the data wire.[6] Communication occurs when a master or slave briefly pulls the bus low, i.e., connects the pull-up resistor to ground through its output MOSFET. The data wire is high when idle, and so it can also power a limited number of slave devices. Data rates of 16.3 kbit/s can be achieved.[7]: 40  There is also an overdrive mode that speeds up the communication by a factor of 10.[7]: 39 

A short 1-Wire bus can be driven from a single digital I/O pin on a microcontroller. A universal asynchronous receiver-transmitter (UART) can also be used.[8] Specific 1-Wire driver and bridge chips are available. Universal Serial Bus "bridge" chips are also available. Bridge chips are particularly useful to drive cables longer than 100 m. Up to 300-meter twisted pairs, i.e., telephone cables, have been tested by the manufacturer. These extreme lengths require adjustments to the pull-up resistances from 5 to 1 kΩ.[7]: 40–41 

The master starts a transmission with a reset pulse, which pulls the wire to 0 volts for at least 480 μs. This resets every slave device on the bus. After that, any slave device, if present, shows that it exists with a "presence" pulse: it holds the bus low for at least 60 μs after the master releases the bus.

To send a binary number "1", the bus master sends a very brief (1–15 μs) low pulse. To send a binary number "0", the master sends a 60 μs low pulse. The falling (negative) edge of the pulse is used to start a monostable multivibrator in the slave device. The multivibrator in the slave reads the data line about 30 μs after the falling edge. The slave's internal timer is an inexpensive analog timer. It has analog tolerances that affect its timing accuracy. Therefore, the pulses are calculated to be within margins. Therefore, the "0" pulses have to be 60 μs long, and the "1" pulses can't be longer than 15 μs.

When receiving data, the master sends a 1–15 μs 0 volt pulse to start each bit. If the transmitting slave unit wants to send a "1", it does nothing, and the bus goes to the pulled-up voltage. If the transmitting slave wants to send a "0", it pulls the data line to ground for 60 μs.

The basic sequence is a reset pulse followed by an eight-bit command, and then data are sent or received in groups of eight bits.

When a sequence of data is being transferred, errors can be detected with an eight-bit CRC (weak data protection)..

Many devices can share the same bus. Each device on the bus has a 64-bit serial number, of which eight bits are used as a checksum, thus allowing a "universe" of 256 (over 7.2 × 1016) unique device identities. The least significant byte of the serial number is an eight-bit number that tells the type of the device. The most significant byte is a standard (for the 1-Wire bus) eight-bit CRC.[7]: 14 

There are several standard broadcast commands, as well as commands used to address a particular device. The master can send a selection command, then the address of a particular device. The next command is executed only by the addressed device.

The 1-Wire bus enumeration protocol, like other singulation protocols, is an algorithm the master uses to read the address of every device on the bus. Since the address includes the device type and a CRC, recovering the roster of addresses also produces a reliable inventory of the devices on the bus. To find the devices, the master broadcasts an enumeration command, and then an address, "listening" after each bit of an address. If a slave's address matches all the address bits sent so far, it returns a 0. The master uses this simple behavior to search systematically for valid sequences of address bits. The process is much faster than a brute force search of all possible 56-bit numbers, because as soon as an invalid bit is detected, all subsequent address bits are known to be invalid. The 56-bit address space is searched as a binary tree,[7]: 51  allowing up to 75 devices to be found per second.[7]: 53  The order in which device addresses are discovered by this enumeration protocol is deterministic and depends only on the device type and serial number. Bit-reversing these 56 bits yields the order of discovery for devices using Maxim's published algorithm (algorithm defined in Application Note 187[9]). The search algorithm can be implemented in an alternative form, initially searching paths with address bits equal to 1, rather than 0. In this case, inverting the 56 address bits and then reversing them yields the order of discovery.

The location of devices on the bus is sometimes significant. For these situations, a microcontroller can use several pins, or the manufacturer has a 1-Wire device that can switch the bus off or pass it on. Software can therefore explore sequential bus domains.[7]

ROM family codes

[edit]

Every 1-Wire device's 64-bit ROM ID ends with an 8-bit family code. In most cases this byte is assigned to a single part number, so reading it from the bus is usually enough to identify the device—for example, 0x10 (DS18S20 thermometer),[10] 0x01 (DS2401 silicon serial number),[11] or 0x2D (DS2431 1 kbit EEPROM).[12]

Various people have created online databases of family codes from the broad range of 1-Wire memory, authenticator, ID, and battery-monitor devices.[13]

Example communication with a device

[edit]

The following signals were generated by an FPGA, which was the master for the communication with a DS2432 (1 kbit EEPROM with SHA-1 Engine) chip, and measured with a logic analyzer. A logic high on the 1-Wire output, means the output of the FPGA is in tri-state mode and the 1-Wire device can pull the bus low. A low means the FPGA pulls down the bus. The 1-Wire input is the measured bus signal. On input sample time high, the FPGA samples the input for detecting the device response and receiving bits.

Development tools

[edit]

When developing and/or troubleshooting the 1-Wire bus, examination of hardware signals can be very important. Logic analyzers and bus analyzers are tools that collect, analyze, decode, and store signals to simplify viewing the high-speed waveforms.

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
1-Wire is a half-duplex, bidirectional serial communication protocol that uses a single data line plus ground reference to connect a master device to one or more slave devices, enabling low-speed data exchange in applications requiring minimal wiring.[1] Developed by Dallas Semiconductor in the early 1990s, the protocol was later advanced by Maxim Integrated following its acquisition of Dallas in 2001, and is now maintained by Analog Devices after Maxim's integration in 2021.[2] Each 1-Wire slave device features a unique 64-bit ROM code for individual addressing, consisting of an 8-bit family code, a 48-bit serial number, and an 8-bit CRC for error checking, allowing up to hundreds of devices on a single bus.[1] The protocol operates asynchronously with the master initiating all transactions, supporting standard speeds of 16.3 kbit/s and an overdrive mode up to 142 kbit/s for compatible devices, while utilizing open-drain signaling with a pull-up resistor on the bus.[2] Power delivery is achieved through parasitic powering from the data line via an internal diode and capacitor in slave devices, eliminating the need for a separate power supply in many cases, though external powering is possible for higher-performance needs.[1] This design supports voltage ranges from 1.71 V to 5.25 V depending on the device family, making it suitable for battery-powered and harsh environments with high ESD protection.[1] Key applications of 1-Wire include temperature sensing (e.g., DS18B20 sensors), secure authentication and identification (e.g., iButton devices for access control), data logging, and asset tracking in industries such as consumer electronics, medical devices, and industrial automation.[2] Its low pin-count advantage reduces system complexity and cost, particularly in scenarios involving momentary contacts or long cable runs up to 100 meters with proper design.[1] Over time, the ecosystem has expanded to include cryptographic features like SHA-256 and ECDSA for enhanced security in consumables verification and supply chain management.[1]

Introduction

History and Development

The 1-Wire protocol was invented by Dallas Semiconductor in 1989 as a proprietary single-wire interface designed to enable low-cost communication and power delivery for sensors and portable data modules, minimizing the need for multiple pins in microcontroller-based systems.[3][4] This innovation stemmed from the motivation to simplify wiring and reduce component costs in applications requiring minimal connectivity, such as remote sensing and identification devices, by combining data signaling and power over one line plus ground.[4] The foundational patent for the one-wire bus architecture was filed on May 15, 1989, and issued on May 11, 1993, to inventor Robert D. Lee and assignee Dallas Semiconductor Corporation.[3] Key milestones in the protocol's development include the introduction of the iButton in 1989, a durable, button-shaped device encapsulating 1-Wire chips for applications like access control and data storage, which popularized the technology for wearable and rugged environments.[5] Dallas Semiconductor was acquired by Maxim Integrated Products in 2001 for approximately $2.5 billion in stock, integrating 1-Wire into a broader portfolio of analog and mixed-signal semiconductors.[6][7] In 2021, Maxim Integrated was acquired by Analog Devices, which now maintains the 1-Wire technology.[8] In the early 2000s, Maxim released detailed specifications through resources like the Book of 1-Wire Standards, making the protocol more accessible for third-party development while maintaining proprietary device implementations.[9] The 1-Wire technology evolved from its initial focus on simple temperature sensing devices, such as the DS1820 introduced in the mid-1990s, to more advanced secure authentication chips supporting cryptographic functions for anti-counterfeiting in the 2000s.[10] By the 2010s, it saw widespread integration into embedded systems for IoT applications, driven by its low-pin-count advantages in battery-powered and space-constrained designs.[2] Patent expirations, including key ones around 2010 for pre-1995 filings and 2017 for related extensions like US6108751, further enabled broader adoption by removing licensing barriers for non-Maxim implementations.[3][11]

Overview and Key Features

The 1-Wire protocol is a half-duplex, bidirectional serial bus system that enables communication, device addressing, and power delivery over a single data line plus ground reference.[1] Developed by Dallas Semiconductor in the early 1990s and now maintained by Analog Devices following acquisitions, it supports master-slave architectures where a central controller manages multiple peripherals.[1] Key features include the ability to connect up to hundreds of devices on a single bus (limited primarily by total bus capacitance), each identified by a unique 64-bit ROM code, with standard data rates of 16.3 kbps and overdrive speeds up to 142 kbps for faster operations on compatible devices.[12] Many devices operate in parasitic power mode, deriving energy from the data line without needing a separate supply, which simplifies integration in remote or battery-constrained setups.[1] The protocol's timing is self-clocking, using voltage-level transitions for synchronization, and it accommodates cable runs up to 100 meters in typical configurations with proper termination.[13] Advantages of 1-Wire include its low cost, minimal wiring requirements (just one signal wire plus ground), and robustness for adding functionality to non-electronic objects, such as sensors in harsh environments.[1] However, its half-duplex nature limits simultaneous bidirectional throughput, resulting in low overall speeds unsuitable for high-bandwidth applications, and the single-line design makes it susceptible to electrical noise and reflections over longer distances.[13] Compared to multi-wire protocols like I²C or SPI, 1-Wire is simpler and more economical for infrequent, low-data-rate tasks such as temperature sensing or asset tracking, though it trades off speed and complexity for reduced pin count and wiring simplicity.[1]

Physical Interface

Wiring and Topology

The 1-Wire interface employs a simple physical connection consisting of a single open-drain bidirectional data line, denoted as DQ, and a shared ground reference, GND. The DQ line operates without a dedicated clock signal, relying instead on timing generated by the master device for communication. This configuration enables half-duplex bidirectional data transfer over just two wires.[14] The DQ line is pulled high to the supply voltage, typically in the range of 3.0 V to 5.5 V, using an external pull-up resistor connected between DQ and the positive supply. The recommended pull-up resistor value is generally 2.2 kΩ for short bus lengths, providing adequate current for fast rise times while minimizing power consumption; for longer buses or higher capacitance, lower values such as 500 Ω to 1 kΩ may be necessary to ensure fast rise times and maintain signal integrity, potentially requiring active pull-up circuits for extended lengths. To protect against electrostatic discharge (ESD), it is advisable to incorporate dedicated ESD protection devices, such as the DS9503, in series with the DQ line, which offers ESD protection greater than 27 kV (IEC 801-2 reference model) when used with circuits having strong ESD protection at their I/O ports, while introducing minimal capacitance.[1][12][15] The network topology for 1-Wire is fundamentally a multidrop bus, supporting multiple slave devices connected to a single master without addressing conflicts resolved via unique 64-bit ROM codes. A linear topology is preferred, where the bus forms a straight line from the master to the farthest slave, with any stubs or branches limited to under 3 meters to avoid signal reflections and ensure reliable communication. Star topologies, involving long branches from a central point, are discouraged unless segments are switched individually to simulate a linear path. The maximum bus length is approximately 100 meters at standard communication speed, though this is derated based on total bus capacitance, with practical limits extending to 200 meters using a simple resistor pull-up in low-capacitance setups.[13] Suitable cable types include unshielded twisted-pair (UTP) such as Category 5e, which has a typical capacitance of 50 pF per meter and helps reduce electromagnetic interference. In noise-prone environments, shielded twisted-pair cables are recommended to further minimize crosstalk and external noise pickup. Total bus capacitance, including contributions from cables, devices (typically 50–100 pF each), and PCB traces (about 24 pF per meter equivalent), must be managed to maintain signal integrity, with standard-speed operations tolerating up to several nanofarads depending on the pull-up strength and master drive capability.[13]

Power Supply Methods

1-Wire devices can be powered in two primary modes: standard mode, which uses a dedicated power supply pin, and parasitic mode, which derives power directly from the data line.[1] In standard mode, compatible devices feature a separate Vcc pin connected to an external power source, typically ranging from 3V to 5.5V, while the 1-Wire data line serves solely for bidirectional communication signaling.[1] This approach allows devices to maintain stable operation without relying on the data line for energy, making it suitable for applications requiring consistent power delivery independent of communication activity.[16] Parasitic power mode, employed by the majority of 1-Wire devices, eliminates the need for a separate power pin by sourcing energy from the 1-Wire bus during idle periods when the line is held high by a pull-up resistor, typically 2.2kΩ.[1] Devices charge internal capacitors through an on-chip diode and resistor network, with a minimum pull-up voltage (VPUP) of 2.8V required for reliable operation in most cases.[16] During communication, particularly write operations that pull the line low, the bus master must apply a strong pull-up (low-impedance bypass) to deliver pulsed power, ensuring the voltage does not drop below operational thresholds and preventing data corruption.[16] Power budgeting is essential in 1-Wire networks to manage current demands, as individual devices typically draw up to 1-4mA during active states, with the total bus current limited by the pull-up resistor and supply voltage.[1] The available current can be estimated as (V_PUP - V_PUP_min) / R_PUP, where V_PUP_min is the minimum operating voltage (typically 2.8 V), often yielding approximately 1 mA for a 5 V system with a 2 kΩ resistor; exceeding this risks voltage sags, especially in multi-device topologies or 3.3 V environments (V_IL, the input low voltage of 0.3 V to 0.8 V depending on the system, is relevant for logic level recognition but distinct from power considerations).[16] For systems operating at 3.3V versus 5V, a lower minimum pull-up resistor (e.g., 725Ω) may be necessary to maintain adequate current while respecting logic levels.[16] Certain 1-Wire devices, such as the DS18B20 temperature sensor, support both standard and parasitic modes, allowing flexibility in design by connecting the Vcc pin to ground for parasitic operation or to an external supply for standard mode.[1] However, common clones of the DS18B20 with Family code 0xD2 (e.g., MY18E20) do not function reliably in parasitic power mode, instead drawing the data line low, and thus require external power for operation.[17] Switching between modes enables optimization for specific scenarios, like battery-powered setups where parasitic mode reduces wiring complexity and quiescent current but demands careful timing of strong pull-ups to conserve energy during extended low-activity periods.[16] In battery-constrained applications, this dual-mode capability helps balance power efficiency with functionality, though parasitic operation may limit performance for power-intensive features like EEPROM writes without supplemental bypassing.[16]

Communication Protocol

Basic Communication Sequence

The 1-Wire protocol operates in a half-duplex manner over a single bidirectional data line, where the master device controls communication by initiating all transactions and slaves respond only during designated slots.[1] The master begins each communication sequence with a reset pulse, pulling the line low for a minimum of 480 μs (typically up to 960 μs) to alert connected slaves.[18] Upon detecting the rising edge as the master releases the line, each slave waits 15–60 μs before pulling the line low for 60–240 μs to signal its presence, confirming readiness for data exchange.[18] A recovery time of at least 1 μs follows the presence pulse before further signaling, though parasitic power modes may require additional time slots for slave capacitor charging to maintain signal integrity.[14] Data transmission occurs in fixed 60 μs time slots at standard speed (16.3 kbps), with the master driving the line low to start each slot and slaves responding during read operations. To write a logic 0, the master holds the line low for the full slot duration of 60–120 μs, ensuring the voltage remains below the threshold until the slot ends.[18] For a logic 1, the master pulls low briefly for 1–15 μs before releasing, allowing the line to rise high for the remainder of the 60 μs slot.[18] Read slots follow a similar pattern: the master initiates with a low pulse of 1–15 μs, then samples the line state 15 μs after the slot start (within a window up to 15 μs max), where slaves drive low for 0 bits or leave high for 1 bits.[18] These timings ensure reliable bit detection despite variations in pull-up resistors and cable capacitance.[19] For higher-speed operation at 142 kbps, 1-Wire supports an overdrive mode with shortened time slots of approximately 7.5 μs. Note that overdrive mode is supported only by compatible devices; others remain at standard speed or ignore the command.[1] Entry into overdrive mode is achieved by sending the Overdrive Skip ROM command (0x3C) or Overdrive Match ROM (0x69) at standard speed following a standard reset, after which subsequent communication uses faster overdrive timings (e.g., write 0 low for 6–16 μs, write 1 low for 1 μs, read sample at 2 μs) until a standard reset pulse (≥480 μs low) is issued. Overdrive reset pulses (48–80 μs low) can then be used for additional transactions in overdrive mode.[19][20] Exit from overdrive is achieved via a standard-speed reset pulse exceeding 80 μs low.[14] This mode accelerates bulk data transfers but demands precise timing control to avoid errors from noise or signal reflections.[19] To ensure data integrity amid potential noise-induced errors on the shared line, the protocol incorporates cyclic redundancy checks (CRC), typically 8-bit for short commands or 16-bit for longer data blocks, computed using the polynomial x8+x5+x4+1x^8 + x^5 + x^4 + 1.[18] The master verifies received data by recalculating the CRC and comparing it to the slave-provided value; mismatches trigger retries via a new reset sequence.[18] This mechanism provides robust error detection without complex acknowledgments, supporting reliable operation in noisy environments.[1]
ParameterDescriptionMin (μs)Max (μs)Source
tRSTLReset low time (standard)480[18]
tPDHPresence detect high time1560[18]
tPDLPresence detect low time60240[18]
tW0LWrite 0 low time (standard)60120[18]
tW1LWrite 1 low time (standard)115[18]
tRL/tMSRRead low/sample time (standard)115[18]

ROM Commands and Family Codes

The 1-Wire protocol employs a 64-bit read-only memory (ROM) code for each device to enable unique identification on a multi-device bus. This ROM consists of an 8-bit family code indicating the device type, a 48-bit unique serial number assigned during manufacturing for pseudo-unique global addressing, and an 8-bit cyclic redundancy check (CRC) computed over the preceding 56 bits to verify integrity.[18][12] ROM commands facilitate device selection and discovery following a bus reset and presence detection sequence. The Read ROM command (0x33) retrieves the full 64-bit ROM of a single device on the bus. The Match ROM command (0x55) selects a specific device by transmitting its complete 64-bit ROM, allowing subsequent function commands to target that device alone. The Skip ROM command (0xCC) bypasses ROM-level addressing to broadcast to all devices, useful for single-device networks. The Search ROM command (0xF0) enumerates all devices via a search algorithm, while the Alarm Search command (0xEC) performs a similar enumeration but only for devices with active alarm conditions, such as temperature thresholds in sensors.[18] The Search ROM and Alarm Search commands utilize a deterministic binary search algorithm to detect and list devices without collisions. This algorithm traverses a conceptual binary tree of the 64-bit ROM space by repeatedly reading a bit position from all responding devices and its complement; if both bits differ (a discrepancy), the master branches by writing a 0 or 1 to resolve the ternary state (all 0s, all 1s, or mixed). Discrepancies are recorded and revisited in subsequent passes until all devices are identified, ensuring efficient discovery even with up to dozens of devices. The pseudo-unique 48-bit serial numbers, combined with family codes, provide a 56-bit address space exceeding 72 quadrillion possibilities, minimizing collision risks in practical networks.[21] Family codes serve as the primary identifier for device capabilities and supported commands. The following table lists selected major family codes with representative device types:
Family Code (hex)Representative DevicesDevice Type Description
01DS1990A, DS2401, DS2411Address-only (silicon serial number)
04DS1994, DS24044 kb nonvolatile RAM with timers/alarms
05DS2405Single-channel addressable switch
09DS1982, DS25021 kb EPROM
10DS1920Temperature logger with alarms
12DS2406, DS2407Dual-channel switch with 1 kb EPROM
14DS1971, DS2430A256-bit EEPROM with OTP register
20DS2450Quad-channel analog-to-digital converter
23DS1973, DS24334 kb EEPROM
24DS1904, DS2415Real-time clock
27DS2417Real-time clock with interrupt
28DS18B20, DS18S20Digital thermometer
29DS24088-channel addressable switch
2DDS1972, DS24311 kb EEPROM
41DS1922, DS1923High-resolution temperature/humidity logger

Memory and Function Commands

After ROM selection via commands such as Match ROM, 1-Wire devices respond to memory and function commands that enable data read/write operations and specialized executions.[1] These commands operate on the device's non-volatile memory or functional registers, typically using a half-duplex serial protocol over the single data line.[14] Common memory commands include Read Memory (0xF0), which allows the master to specify a starting address (often two bytes) and sequentially read data bytes until the end of the page or memory, returning logic 1s to indicate completion.[20] Similarly, Read Page commands retrieve data from specific 32- or 64-byte pages in multi-page EEPROMs like the DS2433.[1] Writing to memory involves a two-step verification process to ensure data integrity. The Write Scratchpad command (0x0F) transfers data to a temporary 8- or 32-byte buffer, where the master provides the target address followed by the data bytes; the device then returns a CRC-16 value over the address and data for verification if the ending offset is specified correctly.[20] Following successful verification, the Copy Scratchpad command (0x55) copies the buffer contents to non-volatile EEPROM, requiring the master to resend the target address and ending offset as an authorization pattern; this operation, which takes up to 10 ms, often demands a strong pullup for sufficient power delivery.[14] A Read Scratchpad command (0xAA) can precede copying to confirm the buffer contents and offset.[20] Function commands execute device-specific operations beyond basic memory access. For temperature sensors like the DS18B20, the Convert T command (0x44) initiates a self-timed temperature-to-digital conversion, typically lasting 94 ms at 12-bit resolution, after which the master can read the result from the scratchpad.[1] In EEPROM devices such as the DS2431, the Recall Data command copies stored EEPROM data back to the scratchpad for reading, aiding in non-destructive access.[14] Protection features include Write Protect and Read Protect bits, often set via dedicated commands or during Copy Scratchpad; these bits lock specific pages against writes or reads, with write protection being permanent in some EPROM-style devices.[1] The typical command flow begins with a ROM command to select the target device, followed by the function command byte, address/data exchange using write/read time slots, and a recovery time before the next slot.[14] Error recovery relies on power-on reset mechanisms: if communication fails, removing power for at least 1.5 seconds or issuing a reset pulse returns the bus to idle, allowing reinitialization.[1] Security enhancements in memory commands include EPROM modes for one-time programmable devices, where bits can only transition from 1 to 0, using redirection bytes to simulate updates without altering original data.[1] Copy protection prevents unauthorized duplication by locking memory post-write, while certain device families, such as 0x23 for SHA-256 authenticators (e.g., DS28E15) and 0x40 for ECDSA (e.g., DS28E36), incorporate cryptography like SHA-256 or ECDSA for secure authentication during Read/Write operations.[1]

Devices and Applications

Common 1-Wire Devices

The 1-Wire protocol supports a diverse range of devices, each identified by a unique 8-bit family code within its 64-bit ROM, enabling the master to select and command specific functions like memory access or sensor conversion.[9] Common devices fall into categories such as sensors, memory storage, secure authentication, and interface peripherals, with operating voltages typically between 2.8 V and 5.25 V and quiescent currents under 1 µA to minimize power draw.[9] Packages vary from compact TO-92 or SOIC for sensors to rugged stainless-steel iButton cans for portable memory and authentication tokens.[22] Temperature Sensors
The DS18B20 is a widely used programmable-resolution digital thermometer offering 9- to 12-bit Celsius temperature measurement with a range of -55°C to +125°C and accuracy of ±0.5°C from -10°C to +85°C; it supports parasite power and uses the Convert T command for initiating measurements.[22][18] Its predecessor, the DS18S20, provides similar performance but fixed 9-bit resolution and is compatible as a drop-in replacement in many systems.[23][24] Both devices feature a unique 64-bit serial number and are available in TO-92, SOIC, or module packages, with conversion times from 93.75 ms at 9-bit to 750 ms at 12-bit resolution.[18]
Clones of the DS18B20, such as those with family code 0xD2 (e.g., MY18E20), have been identified through empirical testing. These devices function reliably in normal external power mode but fail in parasitic power mode, where they draw the data line low instead of operating correctly. Testing of 10 units in 2024 showed typical precision with small drift, including an average offset of -0.09°C at 0°C and variations ranging from -0.25°C to +0.44°C between units. They exhibit different conversion processes, with 12-bit conversion times of 462–523 ms, and non-standard behaviors such as initial readings of 25°C (compared to 85°C for genuine devices) and modifiable registers via undocumented commands (e.g., 0x8B to read the configuration register and 0xAB to update it, potentially affecting readings).[17] Memory Devices
The DS199x series of iButton memory devices provides non-volatile storage in durable metal-encased packages with touch or 1-Wire contacts, offering capacities from 1 Kb (DS1991/DS1992) to 64 Kb (DS1996) of EEPROM or NVRAM for data logging and portable storage.[25][14] These devices include a 256-bit scratchpad for verified writes and support up to 100,000 write cycles, with family codes like 0x81 for DS1991.[25] The DS2433 offers 4 Kb of 1-Wire EEPROM organized as 16 pages of 256 bits, suitable for product-specific data logging, featuring a 256-bit scratchpad and write protection via authorization data.[26][20] It operates in TO-92 or Flip Chip packages with a communication speed of 16.3 kbps standard or 142 kbps overdrive.[26]
Secure and Authentication Devices
The DS1961S iButton integrates 1 Kb of EEPROM with a SHA-1 cryptographic engine for challenge-response authentication, including a 64-bit secret and 1128 bits of user EEPROM, enabling secure transactions in F5 MicroCan packages.[27] It supports write-once secrets and up to 50,000 partial writes, with family code 0x33.[27] The DS28E04 provides 4 Kb (4096 bits) of addressable 1-Wire EEPROM with four programmable I/O (PIO) pins for status monitoring, organized as 16 pages of 32 bytes plus a scratchpad, in SOIC-16 packages.[28][29] PIO inputs feature activity latches and pullups, with family code 0x2D and support for seven address inputs mapped to the device ID.[29]
Other Devices
For environmental sensing, the DS1923 iButton logger records temperature and humidity data in 8 kB of nonvolatile SRAM, with integrated sensors for -20°C to +85°C temperature and 0% to 100% relative humidity, mission timestamps, and sampling intervals down to 1 minute.[30] The DS2450 quad A/D converter digitizes four analog inputs with 16-bit resolution and programmable ranges (2.56 V or 5.12 V full scale), using successive approximation and a 1-to-4 multiplexer in SOIC-8 packages.[31][12] The DS2408 serves as an 8-channel addressable switch with open-drain PIO outputs (100 Ω on-resistance) and flexible input configurations, including pullups and activity sensing, in SOIC-16 or PDIP-16 packages with family code 0x29.[32][33]
Device selection begins with the family code from the ROM search, matching application needs such as sensor precision, memory endurance (e.g., 100,000 cycles for EEPROM), or security features like SHA-1; resources like Analog Devices' device tables aid in identifying compatible commands and power requirements.[9][21]

Typical Use Cases

1-Wire technology finds prominent application in sensor networks, particularly for temperature monitoring in heating, ventilation, and air conditioning (HVAC) systems, where its simplicity enables efficient deployment of multiple probes. In agriculture, 1-Wire sensors facilitate soil moisture and temperature probing, supporting precision farming by allowing daisy-chained configurations that connect numerous devices over extended cabling without complex wiring. This multi-sensor daisy-chaining capability reduces installation costs and enhances scalability in distributed networks, as sensors share a single bus for data transmission.[34][35][36] Asset tracking leverages iButton devices, which utilize 1-Wire for secure identification in access control systems, such as electronic keys for building entry or vehicle authorization. These key fobs, embedded with unique 64-bit IDs, also support inventory management by tagging assets like tools or pallets, enabling quick RFID-like scanning in warehouses. In driver management, iButtons attached to key rings allow electronic assignment of vehicles, streamlining fleet operations without traditional keys.[37][38][39] In embedded systems and Internet of Things (IoT) setups, 1-Wire integrates seamlessly with microcontrollers like Arduino and Raspberry Pi for building weather stations that monitor environmental parameters over low-cost networks. Automotive electronic control units (ECUs) employ 1-Wire authenticators to secure endpoints against counterfeiting, ensuring data integrity in vehicle systems. The DS18B20 temperature sensor exemplifies this integration in monitoring applications. On the Raspberry Pi 3, the default 1-Wire pin for the DS18B20 is GPIO 4 (physical pin 7). Alternative GPIO pins can be configured by adding dtoverlay=w1-gpio,gpiopin=X (where X is the BCM GPIO number) to /boot/config.txt and rebooting. Common alternatives include GPIO 17 (physical pin 11) and GPIO 27 (physical pin 13). A 4.7kΩ pull-up resistor is required between the data line and 3.3V.[40][41][42][18][43] Industrial applications capitalize on 1-Wire for data logging in harsh environments, where stainless steel iButton packaging withstands extreme conditions like moisture, dust, and temperature fluctuations. Its low-power consumption and support for long-distance cabling—up to several hundred meters with proper design—make it ideal for remote monitoring in factories or oil fields, minimizing wiring complexity while maintaining reliability.[1][44][13] Early adoption of 1-Wire included Dallas Semiconductor's iButton in keyless entry systems for vehicles, where touch-based authentication replaced mechanical keys for secure access. In smart home contexts, custom integrations have paired 1-Wire sensors with thermostats via microcontrollers, such as auxiliary monitoring bridged to early Nest setups.[39][45]

Implementation and Tools

Hardware Development Tools

Hardware development tools for 1-Wire systems facilitate prototyping, interfacing, and debugging by providing physical connections between host computers, microcontrollers, and 1-Wire devices. These tools enable developers to test bus topology, verify signal integrity, and evaluate device functionality without custom hardware from the outset. Key categories include adapters for direct connectivity, evaluation kits for comprehensive testing, microcontroller integration components, and instruments for signal analysis. Adapters such as USB-to-1-Wire bridges simplify connection to personal computers, allowing enumeration and interaction with 1-Wire networks via standard ports. The DS9490R from Analog Devices (formerly Maxim Integrated) is a prominent example, featuring an RJ11 interface for accommodating 1-Wire receptacles and with a high-speed USB interface up to 12 Mbps, supporting standard and overdrive 1-Wire speeds, at 5 V supply.[46] iButton probes and readers, like the DS1402-RP3 cable, enable physical contact with iButton devices for reading serial numbers and data, often used in access control or asset tracking prototypes.[47] Evaluation kits provide integrated platforms for exploring 1-Wire masters and slaves. The DS9090K kit from Analog Devices includes hardware components and supporting software to operate 1-Wire products in a PC environment, facilitating ROM search functions to identify connected devices.[48] Logic analyzers equipped with 1-Wire protocol decoding, such as those from Saleae, capture and interpret bus signals for troubleshooting multi-device interactions.[49] Microcontroller interfaces typically leverage a single GPIO pin configured as open-drain with an external pull-up resistor (e.g., 4.7 kΩ to 5V) to implement the 1-Wire master protocol, as demonstrated in implementations with Microchip PICmicro devices.[50] For systems operating at mismatched voltages, level shifters ensure compatibility; for instance, a simple resistor divider or dedicated IC like the MAX14591 can translate between 3.3V microcontroller GPIO and 5V 1-Wire devices while preserving signal timing.[51] Debugging tools focus on electrical and timing verification. Oscilloscopes are essential for observing 1-Wire waveforms, confirming reset pulses (480–960 μs low), write-1 slots (1–15 μs low), and presence detect responses to ensure compliance with protocol timings.[52] Bus capacitance meters help quantify total line loading to ensure proper signal rise times; for extended topologies, capacitance can be managed up to several thousand pF with appropriate pull-up methods and cable selection to support long cable runs.[13] These tools connect via the standard 1-Wire topology of a single data line plus ground.

Software Support and Libraries

The 1-Wire protocol benefits from a range of official and community-developed software libraries that facilitate implementation across various platforms, particularly for embedded systems and personal computers. Analog Devices (formerly Maxim Integrated) provides the 1-Wire Public Domain Kit, a C-based API designed for portability across PC, handheld, and microcontroller environments.[53] This kit includes source code for low-level bus operations, over 20 sample applications, and assembly routines for resource-constrained microcontrollers without C compilers, supporting features like ROM search and device enumeration.[53] For higher-level development, the 1-Wire API for Java offers an object-oriented framework with classes for device containers and network management, enabling rapid prototyping on Java-compatible platforms.[54] Additionally, the Compact .NET 1-Wire API, written in C#, targets Windows CE and Mobile platforms, providing managed code access to 1-Wire functions via USB adapters like the DS9490.[55] Platform-specific support extends these core libraries. On Linux, the kernel's w1 subsystem handles 1-Wire master-slave communication through drivers such as w1-gpio for GPIO-based interfaces and w1_ds18b20 for temperature sensors, exposing devices via the sysfs filesystem for user-space access without custom drivers.[56] For Arduino microcontrollers, the OneWire library implements the protocol in C++, supporting reset, presence detection, and bit-level I/O, with compatibility for devices like the DS18B20 temperature sensor; it has been maintained and expanded since its initial release in 2007.[57] In Python, the onewire package serves as a wrapper for the OWFS (1-Wire File System) C-API, allowing filesystem-like access to 1-Wire networks on supported hardware, compatible with both Python 2.7 and 3.x.[58] Code examples in these libraries often demonstrate key operations like the ROM search algorithm, which enumerates all devices on the bus using a binary tree traversal. The algorithm begins with a Search ROM command (0xF0), then iteratively reads bit pairs from devices and writes a directing bit to branch the search, continuing until all 64-bit ROM codes are discovered or no devices remain; this is implemented in the Public Domain Kit's SearchROM function and Arduino's search method.[21][53] For reading temperature from a DS18B20, pseudocode typically involves: (1) reset and presence pulse; (2) Skip ROM (0xCC) or Match ROM (0x55) with the device address; (3) Convert T command (0x44); (4) wait for conversion (e.g., 750 ms at 12-bit resolution); (5) Read Scratchpad (0xBE) to retrieve the 16-bit temperature value, converting it to Celsius via (scratchpad[0] | (scratchpad[1] << 8)) / 16.0.[53][57] Best practices for 1-Wire software emphasize robust error handling, including timeout mechanisms during reset and slot detection to prevent hangs on noisy buses—typically setting a 500 µs limit for presence detect—and avoiding interrupts during critical timing windows like the 480 µs write-zero slot to ensure protocol compliance.[53] Open-source contributions since 2010, such as enhancements to the Arduino OneWire library for parasite power support, have improved reliability and performance in multi-device networks.[57][59]

References

User Avatar
No comments yet.