1-wire in the enterprise, physical layer

    image

    The first article of this cycle is here.
    The second part of this cycle is here.
    The third part of this cycle is here.

    Formulation of the problem


    To begin with, I got a job in an organization involved in the production of medical components. This organization works with a large amount of biological material: serums, viruses, solutions and other ... In order to store the initial components and manufactured products, it is necessary to withstand strict temperature and humidity conditions, otherwise it will all go bad, so a lot of refrigerators, freezers and cold rooms \ warehouses.

    The following approach is used to control the temperature: a thermometer is hanging on each control refrigerator (as a rule, an ordinary Chinese home thermometer); and every two hours, a special responsible person in each unit bypasses and writes in a special journal the current temperature in the refrigerators belonging to this unit; if this is not working time (evening, weekend), then this tour is performed by the duty officer on the case.


    In order to roughly represent the scale of this action, I will explain what the organization is: these are two own buildings, 4 and 7 floors, geographically spaced about 20-25 km away and two more rented non-adjacent floors in the third building. In these rooms, approximately 200, 100 and 30 units of refrigeration equipment, respectively.

    The chief engineer of the organization thought and decided that it was not rational in our age of information technology and total automation and ordered the whole thing to be somehow automated. More specifically: I wanted to see in some form on the screen the current temperature of all objects, as well as somehow signal when going beyond the specified boundary values, also be able to archive and view archived data for different periods of time.

    Design


    After some discussion, it was decided to use Dallas Semiconductor solutions based on the 1-Wire microlan bus \ protocol.

    Based on what such a decision was made?
    • First of all, DS has the remarkable small-sized digital temperature sensors DS18b20.
    • Secondly, for the same bus there are a number of other sensors and devices (in particular humidity sensors, humidity control is also relevant), which implies the possibility of a good further expansion.
    • Thirdly, this is a relatively small number of wires that will have to be pulled along all the cases.
    • Fourth, a sufficiently large diameter of the network segment is up to 300 meters, and the ability to change the network configuration on the fly.


    Stage One. Physical level


    In this section I will talk about the organization of the physical SCS proper, what kind of rake we stepped on and how and why it turned out that in different buildings we have slightly different physics.

    The central cable was stretched from the top floor to the basement along the low-voltage riser and, on each floor, from the edge of the left wing to the opposite edge of the right wing, they threw it through the cable, because this is a common bus then all conductors are connected in parallel and anywhere, in the future, bends from different rooms were connected to this tree-like frame of cables.


    As a cable we used a 4-core twisted-pair cable of category 5e, in the rooms next to the refrigerators we put RJ-11 \ RJ-12 sockets (standard telephone sockets 4 \ 6 contacts), we hang our sensor in the refrigerator (it is a piece of a flat telephone cable with a pacifier on one side and a soldered microcircuit DS18B20 on the other). Photo .

    Of the four cable cores, three are used: ground, power \ data, and an additional power core. The fourth vein remained in reserve for the future.

    So on the first building (where the largest number of objects) we laid and connected all this, put outlets in each room, connected sensors and ...
    and it turned out that all this together did not work.

    Each floor separately worked perfectly, but not together. We started to understand, it turned out that:
    • Firstly: on parasitic power (this is when the external sensor power is not connected, and only two conductors are used), then no more than 10-15 sensors can work at a time. They do not have enough power and time to charge the internal capacitor, we rejected the decision about a slower poll.
    • Secondly: even if there is external power, then no more than 50 sensors can work on one bus, they looked at it with an oscilloscope - because of long and highly branched lines, fronts collapse, reflections arise, and the result is confusion.


    Here it’s worth to step back a bit and talk about how we checked this whole thing.
    We used a laptop with various adapters:
    adapter1 image
    adapter2 image
    adapter3image

    depending on the adapter, the maximum number of working sensors on the line also changed.
    adapter3 showed itself to be the best. (which by the way is not an official PC adapter from DS, but our domestic fake link collected on a PIC controller )

    then we decided: it is to split our network into segments by floors using the DS2409 chip , this is also a 1-wire chip, which It works as a switch or multiplexer, it has one input and two outputs, its own address and understands the commands to connect the input to output1 or output2.
    It turned out something like this:
    image
    Each branch is a separate floor, on that floor in the attic, an adapter connected to the serial port of the server, on which a special program is running that issues commands to switch branches and sequentially polls all the sensors in each branch.

    And so there are three buildings.

    To date, we have three buildings working and being interrogated according to this scheme. If you have questions, I will be happy to answer and supplement this note.

    About the applied programs and about the software part separately, in the next article. If of course this is interesting to someone;)

    Related Links


    Dallas Semiconductor aka Maxim
    Elin. a lot of useful information
    and thanks to Siemens for the picture :)

    Also popular now: