1 wire pressure sensors. Connecting temperature sensors to the Loxone smart home. Unique Device ID

Digital temperature and relative humidity sensors and autonomous temperature and relative humidity recorders, as well as all expansion modules, are connected to the 1-wire sensor line of the HYGROTERMON device in parallel using 3 wires: “DQ” (1-wire data bus), “GND” (common) and "+5V" (power). However, for reliability, all pins of the 6P6C (RJ12) connector must be used. Attention: it is important that the pins "DQ" (1-wire) and "GND 1-wire" (pins 3 and 4 in the figure below) are one twisted pair, for example, green and white-green. The appearance of the 6P6C connector, as well as the purpose of the contacts and the recommended wire colors, see fig. below.

For reliable connection of the device with the sensors and to achieve the maximum length of the 1-wire sensor line, it is recommended to connect digital sensors and expansion modules according to the “garland” scheme: the cable from the HYGROTERMON device must go to the first sensor (or expansion module), from the first to the second, etc. so that all sensors and modules are on the same line, without branches. See fig. below.

The recommended maximum length of a 1-wire line when using a category 5E twisted-pair cable is no more than 100 meters. If the actual cable length is more than 100 meters, it is recommended to split the line into two small ones using the additional device HYGROTERMON. For ease of connection and installation, all expansion modules and digital sensors and adapters for digital standalone recorders have at least 2 6P6C (RJ12) connectors - 1-wire input/output.

The appearance of the digital sensor board 1w-2/3

Appearance of the expansion module for discrete sensors "1wio2"

External view of the expansion module board for unified (analogue) signals "HIHx2"

Table 1. Test results of the communication line of temperature (and relative humidity) recorders for the maximum length,
at which there is a stable connection of the recorders with the Hygrothermon device

Cable length, m Type of temperature and humidity recorders / availability of communication (yes / no)
Temperature recorders
DS1921G-F5, DS1921Z-F5
Temperature and relative humidity recorders DS1923-F5, DS1922L-F5
350 yes (with 5V pull-up)
no (no pull-up 5V)
300 yes (with 5V pull-up)
no (no pull-up 5V)
250 yes (with 5V pull-up) no (with 5V pull-up)
no (no pull-up 5V) no (no pull-up 5V)
200 yes (with 5V pull-up) yes (with 5V pull-up)
no (no pull-up 5V) no (no pull-up 5V)
150 yes (with 5V pull-up) yes (with 5V pull-up)
Yes yes (no pull-up 5V)
100 yes (with 5V pull-up) yes (with 5V pull-up)
Yes yes (no pull-up 5V)
  • "yes" - the presence of a stable connection between the sensor and the Hygrothermon device
  • "no" - lack of stable connection between the sensor and the Hygrothermon device
  • "with pull-up" - use of a passive pull-up circuit for the +5V signal at the end of the line. http://gigrotermon.ru/imag/shop.product_details/8/flypage.tpl/198.html

Table 2. Test results of the communication line of combined sensors** 2RJ11-HIH5031E-DS18S20
to the maximum length at which a stable connection with the Hygrothermon device is observed

Cable length, m Measured parameter / communication (yes / no)
Temperature Relative Humidity
100 yes (no brace) yes (no brace)
125 yes (with pull-up) yes (with pull-up)
150 yes (with pull-up) yes (with pull-up)
175 yes (with pull-up) yes (with pull-up)
200 yes (with pull-up) no (with pull-up)
300 yes (with pull-up) no (with pull-up)

**) In the tests, 10 sets of combined (temperature + humidity) sensors 2RJ11-HIH5031E-DS18S20 were used, connected simultaneously at the end of the line.

Data obtained under "ideal" laboratory conditions using NIKOLAN NKL 4200A-GY F/UTP 4 pair cat.5e, 24 AWG cable. Therefore, in real production conditions, the length values ​​may differ downwards due to the presence of electromagnetic interference or the use of a different type of cable used.

  • tutorial

We have a containment area for 4 rows with 16 open racks in each row.
Air conditioning scheme: hot-cold aisles, indoor air conditioners with external evaporators, 3 air conditioners per row, i.e. 6 air conditioners per cold aisle.

Task: to build a containment temperature monitoring system with the ability to prevent the failure of air conditioners.

To solve this problem, it was decided to use a network of 1-wire temperature sensors and the Zabbix 2 monitoring system.

Building a 1-wire network.

We need:

1. 1-Wire network controller DS9490R

2. Temperature sensors DS18B20, in quantity, we calculate: 4 rows * 16 racks in a row * 2 sensors per rack (cold and hot aisles), that is, 128 sensors.

3. For convenient installation of the sensor, we used this adapter RJ45 to RJ45, cat. 5e GCT11-8p8c, also in the amount of 128 pieces

4. And for each sensor, 2 patch cords, that is, 128 * 2 = 256, the length of the patch cord is half the width of the server rack

We assemble the sensor, select any three wires in the adapter, make 3 holes in the adapter, solder the sensor and so on 128 times :)
It is recommended to fill the place of solder with glue from a thermal gun, it turns out something like this:

It is recommended to immediately check the sensors for operation by direct connection to the 1-wire network controller and reading information from it. It is also recommended to number the sensors: stick the numbers from 1 to 128 in sequence. The initialization of the 1-wire network will be described below.

This is what it looks like when it's mounted on a stand.

Since the controller has an RJ11 connector, not RJ45, I recommend making a zero adapter sensor, its serial number will be zero, and the rack numbers will start from 1, which is more usual.

IMPORTANT!
The length of our network was about 140 meters, since the server was in the 2nd row.
During testing, it turned out that the power supply of the USB port is not enough for such a long network, the controller simply cannot poll the sensors, more than half of the network, so I recommend buying a USB hub, always with external power, and connect the controller to it. After connecting the hub, the speed of polling sensors increased, and errors stopped appearing in the network, all sensors were read.
I failed to split the network into two segments, since the program that reads data from the sensors could not figure out which controller to work with, at least I could not force it.

Initialize 1-wire network and get sensor values.

So let's start setting up the software part.

The server to which the USB 1-wire network controller is connected is running FreeBSD 9.1, Zabbix 2.0.8 is installed from the ports.

The DigiTemp program is used to obtain sensor values.

Download the DigiTemp sources and compile, the compiled programs I have are located: /usr/local/etc/digitemp/new/digitemp-3.6.0/

To work with our controller, we use the program digitemp_DS2490

# cd /usr/local/etc/digitemp/new/digitemp-3.6.0/
# ./digitemp_DS2490 -i

DigiTemp needs to be run as root so that it can read data from the device.
It is necessary to run the program only from its directory, since the network configuration file is stored there.

./digitemp_DS2490 -i - the result of the execution will be a 1-wire network configuration file with the name .digitemprc, in the program's home directory.
At the same time, digitemp will output 64-bit sensor IDs, which will be written to a file.

Example.digitemprc
TTY USB
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F"
CNT_FORMAT "%b %d %H:%M:%S Sensor %s #%n %C"
HUM_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F H: %h%%"
SENSORS 133


ROM 5 0x28 0xCB 0xE2 0x19 0x03 0x00 0x00 0x6F

IMPORTANT
ROM counter number 0 0x28 0x62 0xB5 0x19 0x03 0x00 0x00 0x61, IS NOT its physically sequential number in the network, this number was obtained during network initialization, that is, whoever answered first was written to the file.
Therefore, at the stage of soldering sensors and checking them, I recommend forming a serial network right away. That is, we take the sensor, soldered it, connected it immediately to the controller, launched it. /digitemp_DS2490 -i got its ID, copied it to an Excel table and also added the ROM number ... in series to the table.
They disconnected the sensor, stuck a serial number on it, and hung it on a garland, connecting it with patch cards. I do not recommend connecting the garland to the controller and starting the test, firstly, it will take much longer, and secondly, in the light of the foregoing, due to the fact that the responses from the sensors do not come sequentially, it will be more difficult to search for the ID of a new sensor.

After you have tested all the sensors, connect the string to the controller and run ./digitemp_DS2490 -i

Your network configuration file will be generated.digitemprc

You need to replace
ROM 0 0x28 0x62 0xB5 0x19 0x03 0x00 0x00 0x61
ROM 1 0x28 0x29 0xD5 0x19 0x03 0x00 0x00 0xFD
ROM 2 0x28 0x59 0xDE 0x19 0x03 0x00 0x00 0x15
ROM 3 0x28 0xDA 0xD6 0x19 0x03 0x00 0x00 0x98
ROM 4 0x28 0xFD 0xBE 0x19 0x03 0x00 0x00 0x84

On the one in sequence that you got in an Excel file in the same format.

Save the resulting .digitemprc file in another folder, because if you suddenly run ./digitemp_DS2490 -i again, your file will be overwritten, and then the physical address will most likely be incorrect.

After the 1-wire network is configured, you can read the sensor values, run ./digitemp_DS2490 -q -a -r1 -n1 , the program will display the sensor values.

Check if the serial connection in the network is correct, e.g. heat the 5th sensor and run the program, the temperature should increase by 4 (because the numbering starts from 0)

Let's move on to configuring Zabbix.

The server on which Zabbix is ​​installed in zabbix is ​​called ZabbixServer.
We create 129 data elements in it, that is, for each temperature sensor, one data element.

It is important for us to understand here:
gmz.temp.t17 is the element key, it is used to send the sensor value
and the element type must be “Zabbix trapper”, since the values ​​will be sent through the zabbix_sender program.

We also create 12 additional data items, for each of the 12 air conditioners. The sensors are located so that 3 sensors are located under the cold air outlet of the air conditioner, so we calculate the average of these three sensors, then the data item will be calculated.

Pay attention to the formula, that is, the last received sensor values ​​\u200b\u200bare summed up and divided by three.

In the crontab of the root user, add the task:
*/1 * * * * /usr/local/etc/digitemp/digitemp_cron.sh > /dev/null 2>&1

That is, we run the script digitemp_cron.sh once a minute
cat /usr/local/etc/digitemp/digitemp_cron.sh

#!/usr/local/bin/bash
cd /usr/local/etc/digitemp/new/digitemp-3.6.0/
./digitemp_DS2490 -q -a -r1 -n1 -o"ZabbixServer gmz.temp.t%s %N %.2C" | /usr/local/bin/zabbix_sender -vv -z 127.0.0.1 -I 127.0.0.1 -T -i -

O"ZabbixServer gmz.temp.t%s %N %.2C" - this string defines the data output format.

IMPORTANT!
ZabbixServer is the name of the host with Zabbix server installed in Zabbix.

Run ./digitemp_DS2490 -q -a -r1 -n1 -o"ZabbixServer gmz.temp.t%s %N %.2C" | /usr/local/bin/zabbix_sender -vv -z 127.0.0.1 -I 127.0.0.1 -T -i -

As a result of the work of zabbix_sender, it should be that all lines are sent and received:

Info from server: "Processed 133 Failed 0 Total133 Seconds spent 0.000540"
sent: 133; skipped: 0; total: 133

If so, then you can add charts and triggers, and set up alerts.

1-Wire temperature sensors are used with terminals that support 1-Wire DS18b20 devices.
1-Wire Temperature Sensors does not require calibration, easy to install, low cost.
1-Wire Temperature Sensors have an external power supply, which significantly increases the length of the route from the sensor to the terminal, and makes it possible to use a large number of devices on one 1-Wire bus.
1-Wire Temperature Sensors can work with any voltage on the 1-Wire bus(from 3.3 V to 5.5 V).
1-Wire Temperature Sensors They have comfortable attachments.

1-Wire Temperature Sensors available in two versions:
– 1. For operation in the temperature range from -40°C up to +80°C . The length of the shielded wire is 10 meters.
– 2. For operation in the temperature range from -55
°C up to +125°C . The length of the shielded heat-resistant wire is 1 meter. (Any wire length under the order. +120 rubles for each additional meter).

Prices

Quantity from 100 from 75 to 99 from 60 to 74 from 45 to 59 from 30 to 44 from 15 to 29 up to 14

Price 1-Wire -40 °C up to +80°C(rub).
The length of the shielded wire is 10 meters.

700 730 760 790 820 850 880

Price 1-Wire -55 °C up to +125 °C (rub).
The length of the shielded heat-resistant wire is 1 meter.
Any wire length on request. +120 rubles for each additional meter.

700 730 760 790 820 850 880

Specifications for 1-Wire temperature sensor

Measuring temperature range

from – 55 to + 125 °C
Operating temperature
from – 40 to + 80 °C
or
from – 55 to + 125 °C​

Measurement error

-10°C to +85°C – ±0.5 °C
-30°C to +100°C – ±1°C
-55°C to +125°C – ±2 °C​

1-Wire bus voltage

3.3 to 5.5 V

Sensor supply voltage

9-36V

Current consumption in standby mode

0.1 mA

Current consumption in measurement mode

1mA
Length of the connecting cable included with the sensor
(depending on the selected modification)
10 meters +/- 2%
or
1 meter +/- 2%

Encoder sensor protection class

IP68

Manufacturer's Warranty

18 months

1-Wire sensor connection. Modification No. 1 (from -40 °C to +80°C)

Wire colors in braided cable

Sensor leads Description
Red White Red
Braided cable shield "Mass" (minus power)
White To 1-Wire bus
Red Blue Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Blue To 1-Wire bus
Red Yellow Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Yellow To 1-Wire bus
Red-Grey Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Grey To 1-Wire bus
Red Black Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Black To 1-Wire bus
Orange-Green Orange Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Green To 1-Wire bus
Yellow-Blue Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Blue To 1-Wire bus
Yellow green Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Green To 1-Wire bus
Yellow-Grey Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Grey To 1-Wire bus
Yellow-Black Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Black To 1-Wire bus
Yellow-White Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
White To 1-Wire bus
Transparent-Green Transparent Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Green To 1-Wire bus
Yellow orange Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Orange To 1-Wire bus
Yellow-Brown Yellow Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Brown To 1-Wire bus
Red-Transparent Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Transparent To 1-Wire bus

1-Wire sensor connection. Modification No. 2 (from -55 °C to +125°C)

Colors of wires in a heat-resistant cable
with braided shield

Sensor leads Description
Red Black Red Power plus (via 1A fuse)
Braided cable shield "Mass" (minus power)
Black To 1-Wire bus

Information interaction with "tablets"? iButton loggers and any support for them is carried out through the so-called. 1-Wire interface, developed in the late 90s by Dallas Semiconductor, which has been part of Maxim Integrated since 2001. This interface is regulated by developers for use in four main areas? Applications:

  • maintenance of devices packaged in special cases can F# (formerly MicroCAN), to solve the problems of identification, authentication, authorization, information protection, access control, electronic payments, transfer or transformation of information (iButton technology),
  • programming the built-in memory of integrated components,
  • identification of equipment elements and protection of access to electronic equipment resources,
  • elements and automation systems (technology 1-Wire-networks).

The first of these areas, including the maintenance of "tablets"? iButton loggers, is very widespread in the world, as are the iButton devices themselves (for more details, see here). The second successfully provides the ability to easily reconfigure the functions of semiconductor components manufactured by Maxim Integrated and having a small number of external pins. The third makes it possible to provide inexpensive, but quite effective identification and reliable protection of a wide variety of equipment. As for the fourth application, the implementation of local distributed systems based on 1-Wire networks is optimal for many practical automation tasks.

So what is special about this network standard? After all, it is most often possible to use an ordinary telephone cable as a medium for transmitting information over a 1-Wire trunk, and, therefore, the exchange rate in this case is low. However, if we carefully analyze most of the real objects that require automation, then for more than 60% of them the maximum service rate of 16.3 Kbps will be more than satisfactory. And other advantages of 1-Wire technology, such as:

  • simple and original solution for addressability of subscribers,
  • simple protocol,
  • simple highway structure,
  • low consumption of components,
  • easy change of network configuration,
  • considerable length of the highway,
  • exceptional low cost of the whole technology as a whole,
reflect the obvious rationality and high efficiency of this tool in solving complex automation problems in various fields of activity.

Basic principles

1-Wire-net is an information network that uses a 1-Wire-backbone for digital communication, consisting of a data bus (DATA) and a return bus (RET). Thus, to implement the exchange environment of this network, available cables containing unshielded twisted pair of one category or another, and even an ordinary telephone cord, can be used. When laying such cables, they do not require any special equipment, and the limitation on the maximum length of a 1-Wire-backbone cable is regulated by the developers at the level of 300 m.

The basis of the architecture of 1-Wire networks is the topology of a common bus, when each of the subscribers is connected directly to a single trunk, without any cascading connections or branches. In this case, the network structure with one master or master and numerous slave subscribers is used as the basic one (for more details, see here).

The configuration of any 1-Wire network can change arbitrarily during its operation, without interfering with further operation and performance of the entire system as a whole, if the principles of organizing a 1-Wire interface are observed during these changes. This possibility is achieved due to the presence in the 1-Wire-interface protocol of a special command for searching for slave devices (Search for ROM), which allows you to quickly identify new participants in information exchange. The standard processing speed for such a command is ~75 network nodes per second.

[Each of the 1-Wire-components has a unique number (address), like banknotes] Due to the presence in the composition of any device equipped with a 1-Wire-interface, an individual address that is as unique as the banknote number (no address matching for components ever produced by Maxim Integrated is guaranteed by the manufacturer), such a network has a virtually unlimited address space. At the same time, each of the 1-Wire components is immediately ready for use as part of a 1-Wire network, without any additional hardware and software modifications.

1-Wire-components are self-clocked semiconductor devices, the basis of the exchange of information between which is the control of the duration of pulse signals transmitted over the 1-Wire-line, and their measurement. Signaling for the 1-Wire interface is asynchronous and half-duplex, and all information circulating in the network is perceived by subscribers either as commands or as data. Network commands are generated by the master and provide various options for searching and addressing slave devices, determine activity on a 1-Wire trunk even without direct addressing of individual subscribers, control data exchange in the network, etc.

[1-Wire Master Port Diagram] The standard 1-Wire network speed, originally rated at 16.3 Kbps, was chosen, firstly, based on ensuring maximum reliability of data transmission over long distances, and, secondly, taking into account the speed of the most widespread types of universal microcontrollers, which should mainly be used in the implementation of master devices of a 1-Wire network. This exchange rate can be reduced to any possible, due to the introduction of a forced delay in the transmission of individual data bits along the highway (i.e., stretching the protocol time slots). However, an increase in the exchange rate in a 1-Wire network with a trunk cable length of more than 1 m above the value of 16.3 Kbps leads to failures and errors. If the length of the 1-Wire-line does not exceed 0.5 m, then the exchange rate can be significantly increased by switching to a special accelerated transmission mode (Overdrive? up to 125 Kbps), which is allowed for certain types of 1-Wire components . As a rule, such an exchange mode is implemented in hardware for 1-Wire components with a large amount of built-in memory, intended for operation as part of a small but high-quality 1-Wire network that is not overloaded with other devices. A typical example of such components are chips of the iButton family.

[View of the OneWireViewer package shell (left-click for a more detailed view)] Perhaps the most attractive quality of 1-Wire technology is the exceptional ease of setting up, debugging and maintaining a network of almost any configuration built according to this standard. Indeed, to get started, any personal computer, an inexpensive 1-Wire interface adapter, and the OneWireViewer developer test software package freely distributed by Maxim Integrated are enough. With this small number of components, the organization of the functioning of a 1-Wire network of almost any complexity, built on the basis of standard 1-Wire components, is implemented literally within a few minutes. The capabilities provided by the OneWireViewer software package allow, with maximum comfort for the developer, to identify any 1-Wire component connected to a 1-Wire-line driven by a computer through an adapter, and to check in full the correctness of its functioning as part of a configured 1-Wire network . Organization of leading

Maxim Integrated manufactures several types of adapters that allow you to equip any personal computer with the functions of a 1-Wire network master. These include adapters of the DS9097U family for the COM port and adapters of the DS9490R family for the USB port. And the adapter type DS9481R provides the ability to implement a computer-based master 1-Wire-network according to the USB 2.0 specification. These devices have a variety of functionalities and design features, which provides the designer with maximum design freedom.

Often, the host of the 1-Wire network is not a computer, but a simple universal microcontroller. Various software and hardware methods are used to organize its interface with a 1-Wire-trunk. From the simplest, when the controller's control program fully implements the 1-Wire interface protocol on one of its functional bidirectional outputs connected to the 1-Wire bus data bus, to options that free up significant controller resources, thanks to the use of specialized chips to support interaction with 1 -Wire network. Such microcircuits are connected to the processor, which plays the role of the leading 1-Wire network, through peripheral I / O nodes that are part of any universal microcontroller. For example, the DS2482 family of drivers allows you to control a 1-Wire network using the popular I2C microcontroller interface. If the 1-Wire network master must be organized on the basis of a typical microcontroller UART serial interface node, the DS2480B chip is used. This microcircuit, like the DS2482 and DS2483 microcircuits, implements the so-called programmable active pull-up mechanism for the 1-Wire data bus. The use of an active pullup guarantees high-quality signal transmission in problematic 1-Wire networks with an extended backbone. Also, the use of an active pull-up provides an increase in the load capacity of the leader in terms of the number of slave network subscribers served by him. By the way, adapters of the DS9097U family for the COM port of a personal computer are also built on the basis of the DS2480B chip. Moreover, taking into account the peculiarities of modern Windows operating environments, it is the use of the DS2480B driver chip, which is essentially a serial-controlled digital machine that can take on a significant part of the network protocol implementation functions, and provides full-scale service for a 1-Wire network in real time.

1-Wire Slave Components

[1-Wire chip in a MicroCAN package] [This is what the 1-Wire components look like] Slave 1-Wire components containing a 1-Wire interface node in their circuit are available in two different types. Either in MicroCAN packages, similar in appearance to a disk metal battery, or in conventional PCB mount packages. The MicroCAN case is hollow inside. It performs the function of protecting the semiconductor chip contained in it with a 1-Wire interface node, which is connected to the outside world only through two, isolated from each other, halves of a metal case, which are, in essence, contact pads for connecting a 1-Wire-main . iButton devices are supplied in similar "tablet" cases. Components that are intended for use in 1-Wire networks are packaged in plastic cases used to make transistors and integrated circuits. This approach is explained by the fact that, unlike iButton devices, components specially designed for use in 1-Wire networks often have more than two pins. In addition to the outputs that are required for data exchange over a 1-Wire trunk, they have additional outputs necessary to provide them with power and organize external circuits connecting such devices with automation objects, such as sensors or actuators.

The simplest 1-Wire slave components are the silicon serial number DS2401 (or a modified version of this device with external power supply DS2411) and the dongle DS2413P controlled by 1-Wire interface. The first of these devices is often used as an electronic label that allows you to identify the state of, for example, a mechanical switch that switches the 1-Wire data bus. Using the DS2413P, you can remotely implement the simplest functions of switching external equipment by changing the state of the controlled key relative to the return bus of the 1-Wire trunk (currently, the DS2405 key is no longer available, since a more functionally perfect replacement is available - DS2413P).

[Thermometers with 1-Wire interface are used in many laboratories around the world] However, the most popular 1-Wire slave components, on the basis of which perhaps the largest number of practical applications are implemented, are, of course, digital thermometers of the DS18S20 type (better known until 2001 under the designation for the long-discontinued DS1820 device, which managed to become an international brand). The advantages of these digital thermometers in terms of the organization of the highway, in comparison with any other integrated temperature sensors, as well as good metrological characteristics and good noise immunity, have consistently brought them to the forefront in the construction of multipoint temperature control systems in the range from – 55°С to +125°С. Such sensors allow not only direct monitoring of temperature in real time, but also due to the presence of a built-in non-volatile memory of temperature settings, they can provide priority operational alarm in a 1-Wire network about the fact that the controlled parameter goes beyond the specified values. More advanced thermometers DS18В20 are also supplied, in which the conversion rate is determined by the bit depth of the result, which is programmed directly via the 1-Wire interface. The digital code read from such a thermometer is a direct result of the measured temperature value and does not require additional conversions. An uncalibrated, but at the same time, cheaper version of the DS18B20 chip under the designation DS1822 seems to be the best solution for developers of low-cost multipoint temperature control systems.

Until 2010, Maxim Integrated also supplied a whole range of discrete microcircuits equipped with a 1-Wire interface and implementing the functions of individual elements of automation systems. Among them: a four-channel 16-bit ADC type DS2450, a two-channel counter combined with a buffer memory, type DS2423, a digital potentiometer for 256 gradations of type DS2890, real-time clock and calendar units of type DS2415 and type DS2417, the latter device through a special interrupt pin, provided time-controlled switching of external equipment. However, as a decade of experience in the development of 1-Wire networks has shown, for real automation objects, 1-Wire components that perform individual functions [Microsystems containing many functional nodes provide effective support for power management of many portable devices] are less in demand compared to devices focused on the implementation of several functions at once on a single chip. Such solutions are called 1-Wire microsystems. The most characteristic representative of a 1-Wire microsystem is the DS2438 chip, which, in addition to the 1-Wire interface node, also contains the following nodes: a digital thermometer, an ADC with a non-differential input, a current ADC with a differential input, a programmable timer, Flash memory, a set of registers for storing data general purpose. All this arsenal as part of one 1-Wire component makes it easy to solve, for example, the problem of efficient maintenance and maintenance of various types of energy batteries. Currently, Maxim Integrated is releasing more efficient 1-Wire microsystems: DS2760, DS2775, DS2776, DS2777, DS2781, etc.

[The DS2406 dual switch is the most versatile and sought-after element of 1-Wire networks] Nevertheless, the most irreplaceable "bricks" underlying the foundation of 1-Wire automation networks turned out to be universal dual addressable transistor switches like DS2406P. On the basis of these devices, a lot of applications can be implemented, and, first of all, control units for logical states (levels) and circuits for servicing "dry contact" sensors, as well as various key circuits. Thus, it is thanks to the use of these components that discrete information is collected from geographically dispersed sensors (door monitors, valve position contactors, any sensors that have a YES / NO output, such as position, passage, presence, fire and security alarm sensors, etc. .d.).

[The DS2408 universal bidirectional port greatly expands the possibilities of 1-Wire networks] However, with all the variety of 1-Wire components, the most versatile of them is the unique DS2408 chip. This is a bi-directional 8-bit freely bit-programmable 1-Wire I/O port that allows you to implement any interface between any digital device and a 1-Wire network. The use of the DS2408 port allows, through a 1-Wire interface, to provide simple and flexible I / O control over 8 independent channels. Thus, on the basis of this device, it is possible to organize a drive for light-dynamic or liquid crystal indicators and displays of various types, to scan matrix keyboards and discrete sensors of various types.

If the operation of a 1-Wire network or any other electronic equipment that has a minimum of outputs for the implementation of data exchange requires the storage of additional amounts of information, the developer has at his disposal special 1-Wire components containing only EPROM nodes (DS2502 / DS2505 / DS2506) or EEPROM (DS2431/ DS2432/ DS2433/ DS28E02/ DS28E04/ DS28EC20) of various capacities. Moreover, some of these microcircuits have special nodes of the SHA encryption mechanism, which makes it quite easy to provide a fairly high level of cryptographic data protection, both during their transmission and during their storage. "Pills" iButton and 1-Wire-network

[It is also possible to build 1-Wire networks on the basis of iButton devices] information transfer. For example, to implement the identification procedure in industrial automation systems, it is usually sufficient to use common wearable electronic tags DS1990A. A more sophisticated DS1904 device allows you to synchronize the operation of the clock / calendar nodes of microprocessor systems. [The THERMOCRON DS1921 is a convenient and secure stand-alone logger] And multi-point temperature control can be performed by a network of several DS1920 “pills”. If, however, “tablets”-loggers DS1921/DS1922/DS1923/DS1925 or, otherwise, the THERMOCHRON devices and the HYGROCHRON devices are used, each of which registers either temperature values ​​or temperature and relative humidity values ​​measured at certain pre-set intervals of time and saves the received information in its own non-volatile memory, it is easy to build a geographically distributed microclimate monitoring system of any complexity.

To solve the problem of transferring data accumulated by a territorially remote autonomous 1-Wire system to a stationary personal computer, various types of memory chips from the iButton family are convenient, which in this case play the role of the so-called "transport tablets". Such devices include, first of all, non-volatile memory devices that include a lithium battery in their design. This is a whole series of “tablets”: DS1992L (1 Kbps), DS1993L (4 Kbps), DS1995L (16 Kbps), DS1996L (64 Kbps). In addition, for the purposes of information transport, devices with EEPROM memory of modifications DS1971 (32 bytes), DS1972 (128 bytes), DS1973 (512 bytes) and DS1977 (32 Kbytes) can be used. "Transport tablets" included in the family of chips iButton EPROM?memory? DS1982 (1Kbps), DS1985 (16Kbps), DS1986 (64Kbps), ? are convenient for filling the memory of microprocessor systems (for example, with calibration constants or initial settings).

To interface devices in MicroCAN cases with 1-Wire busses, special latches like DS9100 or DS9098P are used, or simpler clips like DS9094. However, it should be borne in mind that when organizing a 1-Wire network based on iButton “tablets” with the help of such devices, all meaning in the super-protective properties of their case is lost. Since such options for including these “tablets” in the composition of 1-Wire-network subscribers make the connection vulnerable to external influences (water, dust, dirt, frost, etc.) in any case. Therefore, the issue of organizing 1-Wire networks protected from external influences, implemented on the basis of iButton devices, requires a special approach.

Backbone and topology of a 1-Wire network

An important role in the construction of 1-Wire networks is played by the execution of the 1-Wire backbone. As a rule, extended 1-Wire lines have a structure consisting of three main conductors: DATA ? data bus, RET (GND) - return bus or ground wire, EXT_POWER - external power supply not only for served slave subscribers, but also for external circuits of sensors and controls. Depending on the cable laying technology, the way it is paired with slave subscribers, the features of the installation methods used and the quality of the materials used, in accordance with the following Table, there are four main options for organizing 1-Wire networks, each of which involves the use of special technology and accessories for highway implementation.

1-Wire network classification Trunk cable length Number of slave subscribers Type of cable used Topology 1-Wire Network Master
miniature up to 5 m Up to 10 pcs Any free Any lead with passive pullup (resistor to power)
short up to 30 m Up to 50 pcs 4-wire telephone Common tire with patches up to 0.5 m Adapters based on discrete components DS9097E, DS1410E
Medium up to 100 m Up to 100 pcs Twisted pair category 3 Strict common bus Active pull-up (DS2480B, DS2482, DS2483 or custom circuitry (MAX6314))
Long up to 300 m Up to 250 pcs Category 5 twisted pair or IEEE1394 (Firewire) Common tire without barrel break Link or software modification of 1-Wire protocol timeslots

[LinkUSB adapter is the most effective drive for problematic 1-Wire networks] If the organization of a 1-Wire network based on a personal computer is associated with special difficulties (long backbone cable length, a large number of slave subscribers, poor cable quality or complex topology, many interference, etc.), then it is most optimal to use an intelligent adapter for a Link-type COM port or its equivalent for the USB port of a LinkUSB adapter. The basis of any of these adapters is a microprocessor equipped with a specialized control program. At the same time, all devices implemented using Link technology fully emulate the operation of the popular DS9097U adapter manufactured by Maxim Integrated from the serial port side. Therefore, all software previously developed to support DS9097U adapters is also suitable for interfacing with any of the Link adapters. But the main thing is that, thanks to their own intellectual resources, Link and LinkUSB adapters provide preferential operation of slave subscribers as part of problematic 1-Wire networks, in a difficult interference environment. Link and LinkUSB adapters greatly improve the active pull-up mechanism of the 1-Wire data bus, which allows you to really get ideal exchange signals with cable lengths up to 300 meters and the number of slave subscribers up to 250 pcs. In addition, the use of special digital filtering algorithms by the Link? adapter processor greatly improves the resistance of the 1-Wire network it serves to electromagnetic interference, noise, and signal reflections.

Now let's move on to the simplest platform for creating a smart home - 1-WIRE. The platform was developed from the late 80s to the late 90s by Dallas Semiconductor (since 2001 - Maxim Integrated) and was intended for contact identification of objects, incl. with the functions of measuring and recording temperature, humidity, autonomous power supply parameters, as well as with the functions of retrieving, storing and transferring data. Perhaps the most famous example of the use of this platform is iButton - a tablet key for an intercom:

In this case, the 1-Wire component is housed inside a small stainless steel "pill" and is connected to the 1-Wire bus systems via receptacles with pins that touch the "lid" and "bottom" of the pellet. However, in the future, thanks to the ability to work with temperature, the tire began to be used to create a smart home, primarily in microclimate control systems.

Ability to connect devices« hot» mode

The 1-Wire protocol provides for the issuance of a pulse by a device connected to the trunk in the "hot" mode, announcing the appearance of a new device on the trunk. In other words, new devices can be added to the network and they will immediately be able to work.

Unique Device ID

Each 1-Wire chip contains a unique 64-bit code that is written during production. This code allows you to individualize all manufactured 1-Wire devices, for which the manufacturer guarantees that there are no identical codes (similar to the MAC addresses of network adapters). When connected to the trunk, this code is read by the controller and used to identify the object associated with this device, as well as to determine the type of device. When several devices are connected to the backbone, their codes can be used as their addresses, which makes it possible to build technological networks called MicroLAN.

Topology

The network must have a central master controller, through which information is exchanged, and an adapter to coordinate the controller with the backbone. All other slave devices (slave) are connected to two wires, signal and common:


Since the bus is bidirectional, if there is one controller, the topology (the principle of the network device) is a line, that is, all devices are strung on one common cable. However, if there are several interconnected controllers, it is possible to make a branching tree structure.

The main parameters of the 1-Wire interface are as follows:

  • maximum trunk length when using twisted pair - up to 300 m;
  • the maximum number of subscribers on the trunk of maximum length - up to 250;
  • exchange rate on the trunk of maximum length - up to 16.3 kbps.
How the network works

Data exchange on the backbone includes three phases:

  • a reset phase including a reset pulse from the controller and a presence confirmation response pulse from the subscriber(s);
  • the device fetch phase, which includes its fetch command (by code, without code, group, search) and its code, if it is provided by the command;
  • a data writing/reading phase including a command code and data.

The logic of all devices is clocked by the negative edge of the controller signals both in write mode and in read mode. Bits are encoded by the duration of a positive pulse: "1" is transmitted in a long pulse, and "0" in a short one. In write mode, all data pulses are generated by the controller. In read mode, the controller generates a sequence of ones, and the subscriber imposes his mask of zeros on them:

In other words, the controller sends a sequence of ones to the network, the device connected to the network changes 1 to 0 in the right place (thus providing itself with power), and the controller receives a sequence of zeros and ones - a response from the slave.

Software

Maxim Integrated (the creator of the 1-WIRE bus) provides API and SDK libraries for programming systems based on 1-Wire for a wide range of platforms - PCs running Windows/Linux/MacOS, mobile devices, microcontrollers, .NET and JAVA. It also offers a software network scanner OneWire Viewer, which allows you to find and identify devices connected to the network and display a complete list of their parameters and data. Of the third-party developments, the following are of greatest interest:

  • OWFS - One Wire File System. Freely distributed under the GPLv2 license. Designed for UNIX platforms, but when using the cygWin UNIX emulator, it can also work in a Windows environment. It has a web interface, which makes it possible to access remotely, for example, via the Internet. OWFS is the most popular home automation software framework based on the 1-Wire platform.
  • Benux is a software environment for various automation tasks. It is a commercial product. Allows you to interact with the automation system through various channels, incl. using the web interface and SMS. Provides automated scripting management capabilities.
  • jHomeNet is a free software package for the 1-Wire server in Java.