The 1-Wire is a registered trademark of Dallas Semiconductor Corp (now Maxim) for a serial communication protocol using a single data line and a ground reference. A 1-Wire Master (a microcontroller) initiates and controls the communication with one or more 1-Wire Slave devices (usually sensors). Each 1-Wire slave device has a unique, factory-programmed , 64-bit identifier, which serves as device address on the 1-Wire bus. This globally unique address is composed of eight bytes divided into three main sections. Starting with the LSB, the first byte stores the 8-bit family codes that identify the device type. The next six bytes store a customizable 48-bit individual address. The last byte, the most significant byte (MSB), contains a cyclic redundancy check (CRC) with a value based on the data contained in the first seven bytes. This allows the master to determine if an address was read without error. With a 248 serial number pool, conflicting or duplicate node addresses on the net are never a problem.
The 1-Wire protocol uses conventional CMOS/TTL logic levels (maximum 0.8V for logic “zero” and a minimum 2.2V for logic “one”) with operation specified over a supply voltage range of 2.8V to 6V.
A Typical 1-Wire Communication Flow
The first part of any communication involves the bus master issuing a reset, which synchronizes the entire bus. A slave device is then selected for subsequent communications. This can be done by selecting all slaves, selecting a specific slave (using the registration number of the device), or by discovering the next slave on the bus using a binary search algorithm. These commands are referred to collectively as network function or read-only-memory (ROM) commands. Once a specific device has been selected, all other devices drop out and ignore subsequent communications until the next reset is issued.
Once a device is isolated for bus communication, the master can issue device-specific commands to it, send data to it, or read data from it. Because each device type performs different functions and serves a different purpose, each type has a unique protocol once it has been selected. Even though each device type may have different protocols and features, they all have the same selection process and follow the command flow seen in the figure below.
Browse these links for more information on the 1-Wire Protocol.
Example: DS1820 Digital Temperature Sensor
I am going to show you how to connect a DS1820, a 1-Wire digital temperature sensor, to a PIC microcontroller.
The 1-Wire protocol uses conventional CMOS/TTL logic levels (maximum 0.8V for logic “zero” and a minimum 2.2V for logic “one”) with operation specified over a supply voltage range of 2.8V to 6V.
A Typical 1-Wire Communication Flow
The first part of any communication involves the bus master issuing a reset, which synchronizes the entire bus. A slave device is then selected for subsequent communications. This can be done by selecting all slaves, selecting a specific slave (using the registration number of the device), or by discovering the next slave on the bus using a binary search algorithm. These commands are referred to collectively as network function or read-only-memory (ROM) commands. Once a specific device has been selected, all other devices drop out and ignore subsequent communications until the next reset is issued.
Once a device is isolated for bus communication, the master can issue device-specific commands to it, send data to it, or read data from it. Because each device type performs different functions and serves a different purpose, each type has a unique protocol once it has been selected. Even though each device type may have different protocols and features, they all have the same selection process and follow the command flow seen in the figure below.
Browse these links for more information on the 1-Wire Protocol.
- Overview of 1-Wire Technology and its use (Maxim)
- 1-Wire (Wikipedia)
- 1-Wire Communication with PIC Microcontroller
Example: DS1820 Digital Temperature Sensor
I am going to show you how to connect a DS1820, a 1-Wire digital temperature sensor, to a PIC microcontroller.
We are now going to implement this circuit in our PIC16F628A development board. We will place a 3-pin female header to hold DS1820 and an additional single pin header for a jumper to connect the data pin to a PIC port. Here is the modified board after soldering the female header connections and a 4.7K resistor on the board.
A more closer look:
We will discuss about the 1-Wire built in library of mikroC for PIC 2009 compiler in the next article. Our next experiment is going to be about reading the temperature values from a DS1820 sensor using the 1-Wire communication protocol. Till then, good bye.
Hi,
ReplyDeletethank you very much for the clear info. I almost kill a day with DS1820. As an amateur its data sheet wasn't that helpfull. Lack of literatur.
Thanks again.
Is positive and negative coming from that 1 wire? Mine can. Albeit mine is a different 1 wire solution. Each phase is adjustable without loss. Can Maxim do that?
ReplyDelete