Introduction to 1-Wire Technology
1-Wire devices are a powerful, yet very cost-effective way to add electronic functionality to non-electronic objects for identification, authentication, and delivery of calibration data or manufacturing information.
Contrary to the name, a 1-Wire device actually uses 2 wires – data and ground, for half-duplex bidirectional communication. It is a serial protocol designed by Dallas Semiconductor Corp., which provides low-speed data, signaling, and power over a single signal.
The 1-Wire master controls the communications with one or more slave devices. Each of them has a unique 64-bit ID on the 1-Wire bus. Its subset, a 8-bit family code identifies the device type and functionality.
There are two types of 1-Wire devices:
- Single component or one of many components in integrated circuit and TO92 packaging.
- iButton, a portable device that looks like a watch battery. It is used in alarm system, in computer and many other things for user authentication.
1-Wire components can be integrated into sensors and actuators that operate on 1-Wirebus, such as temperature loggers, battery monitors and so on. These can be connected to a PC through a bus converter. To connect the MicroLan to the host PC, USB, RS-232 serial and parallel port interfaces are frequently used.
CAS 1-Wire Gateway to BACnet, Modbus…
The CAS-2700-26 Gateway with 1-Wire (AKA 1Wire/OneWire) serial driver translates data between a 1-Wire bus and popular building automation protocols such as BACnet, Modbus, and VeederRoot. For example translating a network of DS18B20 1-Wire temperature sensors to BACnet points for a JCI controller to read, or allowing a controller to interact with a DS2408 1-Wire relay device as if they were a Modbus outputs.
1-Wire Data Client/Logger Diagram
1-Wire device discovery occurs automatically at a configurable period. The Gateway has an internal record of sensor data which is periodically updated by reading the 1-Wire bus. The frequency at which each data point is read is configurable through the web interface. The driver retries on errors or timeouts. If the data cannot be read or fails the 1-Wire checks it’s marked as out of date or unreliable. When a client protocol makes a read request the gateway serves up its data using the appropriate conversion. When a client protocol makes a write request (for 1-Wire output devices) the Gateway updates its internal records as well as writing the data to the appropriate 1-Wire device and performing a verification.
The driver generates an HTML page which allows status to be checked and setting to be altered from a web browser.
The CAS Gateway supports discovery and self-configuration of 1-Wire devices. A routine to discover new 1-Wire devices is executed at a regular period to be selected by the user.
When a new 1-Wire device is discovered a new task is created for this device and its value is added to the end of the database. This task periodically reads/writes information from the1-Wire device at a user defined period.
The gateway supports BACnet IP, Modbus RTU, Modbus TCP protocols simultaneously.
Sufficient functions have been added to the product to read/write data and status from 1-Wire devices. Other functions can be added on request.
This driver was developed by Chipkin Automation Systems (CAS). CAS are proud to provide support for the driver. For support please call CAS at (866) 383-1657.
1-Wire Frequently Asked Questions
Does 1-Wire really use One Wire?
A 1-Wire bus has at least two wires. The data and power lines are integrated (parasitic power) but a ground connection is still necessary. Integrating the power and data line puts some limitations on the network so some 1-Wire buses will have three wires (Vcc, Gnd, Data)
What is CRC?
A Cyclic Redundancy Check (CRC) ensures that data read from from a 1-Wire bus is not corrupted. 1-Wire uses an 8-bit CRC. When transmitting message through 1-Wire an additional byte is sent which is computed by XORing all other bytes together. The host and client both generate this value and compare. If it does not match an error has occurred.
What is a 1-Wire Lasered ROM code.
A 1-Wire rom code consists of a unique 6-byte serial number, a 1-byte family code (see family code table), and 1-byte CRC. These values are defined in manufacturing, they can not be changed. During the discovery stage a 1-Wire controller generates a list of the ROM codes of all devices on the bus. Subsequent read and write operations are sent to specific 1-Wire devices by addressing their ROM codes.
What is Parasitic Power?
Parasitic power allows a device to receive data and power over the same line. When the line is not transmitting data it goes to a high state. 1-Wire devices charge an internal capacitor (typically 800pf) from this source. Many 1-wire devices support an external power supply in addition to parasitic power.
What are Parasitic Power design constraints.
You must check the maximum current output of the 1-Wire bus controller and the maximum combined instantaneous current consumption of all devices on it. When a DS18B20?s capacitor is completely drained it will draw close to 1.5 mAs from the OneWire bus. If a 1-Wire controller can supply no more than 15the voltage will become unstable if more than 10 DS18B20 devices charge at the same time. There can be more than 10 DS18B20 devices on the bus, but they can not all charge at the same time.
Circuits like this one can be used to increase the available current on a 1-Wire bus.
The capacitor of a 1-wire device holds a limited charge (typically 800pf). Devices need to rest between operations to recharge it. High frequency polling of one-wire sensors is not possible. Device dartasheets will indicate the required rest periods.
How long can a 1-wire bus be?
The limiting factor is the bus capacitance. If capacitance is too high the signal line can not rise and fall fast enough to transmit data properly. The capacitance of a 1-Wire bus can not exceed 10 nanofarads (nf) aka 10,000 picofarads (pf). Twisted pair Cat5 wires have a typical capacitance of 50 pF per meter. Flat Phone cable has a typical capacitance of 60 pF per meter. PCB traces have a typical capacitance of 24p pF per meter. Every 1-wire slave device adds 30pF to the bus.
Example: A 1-Wire bus has 20 devices and uses phone cable. What is it’s maximum length? (10,000 pf – 20 devices * (30pf / device)) / (60pf / meter) = 156.67 meters
What pull up resistor value should I use on the 1-Wire bus?
Pull up resistance must be low enough that there is sufficient current to charge any parasitic power devices, but high enough that the line can be pulled low for data communication. 1k – 5k is normally used.
What is an iButton?
An iButton is a special package for 1-Wire devices resembling a watch battery. It takes advantage of the fact that a parasitic powered 1-Wire device only needs two contacts to make an extremely simple and reliable connection to a terminal. The steel cases are extremely durable making iButtons suitable for transit passes, building keys and industrial equipment tagging.
How many devices can exist on a 1-wire bus?
What is MicroLAN.
MicroLAN is the former brand name of 1-Wire.