* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download ii. 1-wire interface
Universal Plug and Play wikipedia , lookup
Airborne Networking wikipedia , lookup
Wireless USB wikipedia , lookup
Network tap wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Bus (computing) wikipedia , lookup
Serial port wikipedia , lookup
Low Pin Count wikipedia , lookup
An Identifying and Authorizing Application Using 1-Wire® Technology Eugen DIACONESCU, PhD Cristian SPIRLEANU University of Pitesti Pitesti, Romania [email protected] General Serv IT Pitesti, Romania [email protected] Abstract—This paper presents a hardware and software application using the 1-wire technology. The application has several components: 1-wire network of iButton® type devices, addressable switches, serial EEPROM memories, the software package developed for Windows operating system. The application achieves several goals: 1-wire network interrogation, data processing, implementation of several control functions of identification and authorizing type. The solutions given have advantage of the hardware simplicity, which is specific to the 1wire technology, and high efficiency in building complex network architectures. The practical usefulness of the application presented is to be found in the industrial field, in intelligent building, in alarm and anti-burglary systems, in sensor networks, etc. Keywords - 1-wire network, iButton®, addressable switch I. INTRODUCTION In the domain of identification traditional technologies are used, such as the bar codes applied on surfaces, the magnetic stripes, the chip cards, and the RFID labels. To these technologies can be added another successful one, which is based on the 1-wire communication network. The 1-wire technology has emerged from the evolution of the semiconductor technology. It was designated to some specific applications to substitute the identification by paper label based on bar codes for the electronic circuits. Dallas Semiconductor was the first producer which developed a large used automated identification through attached chips to objects or persons. The iButton® technology belongs to the category of the technologies of identification by touching. The simplest identification method can be realized by using a microsystem with two external electrical wire connexions: signal and ground. The general advantages of iButton® versus others systems are: the reading without expensive optical devices, the hundredfold increased storage of data as compared to a bar code, the identification through a unique serial number (which can represent a node in a global network of a practically unlimited dimension), the content of the iButton® chip can be modified while it is attached to the object, it can allow over 1 milion programming cycles of EEPROM memory, it has a good adaptation to hard environments (corrosion, shocks, vibrations, etc.), reading and writing are done by means of small-sized portable having a reduced energy consumption, it has multifunctionality by integrating, into the same device, another functions (temperature and humidity sensors, etc.). II. 1-WIRE INTERFACE The 1-wire concept links the master initiating comunication and the slave autosincronising with master signals. The time logic of master and slave must measure and generate digital pulses of diferent lengths. In the idle state, the 1-wire bus is in ”1” logical state and presents a way of high impedance for the applied operating signals. Any connected device to bus must capable to pull down 1-wire bus in the ”0” state at the desired time using an output of type open-colector. To stop a data transfer in progress, the bus must to pass in idle state from which the transaction can continues later. A. Operating tension levels The most 1-wire slave devices work in [2,8V – 5,25V] range. With few exceptions, the 1-wire device do not have supply pins; they take the energy from the 1-wire bus (so call “parasitic supply”) or from an embedded battery (at some iButton® devices). Parasitic supply uses an on-chip capacitor (≥ 800pF) and a diode serialized with a resistor for the take of energy from 1-wire bus when tension on bus is higher as the tension on capacitor. For a correct functioning of “parasitic energy”, some conditions specified in data sheets (VPUP, RPUP, tREC, etc.) must realized. The values of restoration time are given for a network with one slave. For networks with more slaves, the restoration time need to be extended, or the value of pull up resistor can be reduced [AN3829]. B. Additional energy As a rule, “parasitic energy” assures enough energy for communication (addressing, reading, and writing). More energy is necessary for writing in some devices, among which iButton® devices with EEPROM memory. This energy must be delivered at specified times from protocol, when 1-wire bus is idle [AN4225]. C. 1-wire® transmission speed The former 1-wire devices and the master UART based circuits communicate at the 16.3kbps speed, named now “standard speed”. The module “overdrive” (142kbps for iButton®) was added at almost any produced devices. It reduces the necessary time for reading memories of type 64kbiButon by multiplying 10 times the speed performances. D. 1-wire® bus synchronization The technical documentation use two styles for the description of realized time sequences on the bus: traditional and new, with small particularities. In the next we will referee to the new style. The communication 1-wire® start with a reset cycle (or “presence detection”), figure 1 [1, 2]. To determine the output from idle state, the tension on 1-wire bus must to move down from VPUP below threshold level VTL. To pass from active state into idle state, the voltage must increase from VIL MAX over the VTH threshold. The necessary time for this increasing is noted in figure 2 with “ε”, and his duration depends on the pull-up resistor RPUP and the attached capacitor to the 1-wire network. The VILMAX tension has significance for slave when determines a logical level, and not for shareholding any event. A duration of 480μs or larger of tRSTL makes device to leave Overdrive Mode and to return at standard speed. If a slave is in the Overdrive Mode and tRSTL is between 80μs and 480μs, the device will reset, but communication speed is undetermined. tMSP Reset Impuls MASTER Tx Presence Impuls MASTER Rx ε VPUP VIHMASTER VTH VTL VILMAX 0V tF tRSTL tPDH Resistor Master Slave tPDL tREC tRSTH Fig. 1 The master reset the bus and detect the possible connected slaves The master enters in receiving mode after it releases the line. As a consequence, the 1-wire bus is pulled down at VPUP by the pull-up resistor. After passing the threshold VTH, the slave waits a time tPDH and then sends a presence pulse by pull-down of the line for a time tPDL. To detect a presence pulse, the master must test the logical state of 1-wire line after a minimum elapsed time tMSP. The window tRSTH must be at lest the sum of tPDHMAX, tPDLMAX and tRECMIN. Immediately, after elapsed time tRSTH, the slave will be ready for data communication. E. Read/Write time frames After the ending of reset/presence detection cycle, a 1-wire slave will be ready for communication using the time frames. Every time frame carries on a single bit. Time frame for writing carry on the data from a master to a slave, and the time frames for reading carry transfers data from a slave to a master. The definitions of reading and writing frames are better understand from figures 2 and 3. A time frame begins with the master pulling down of data line. Immediately that the voltage level on the 1-wire line decreases below the threshold VTL, the slave starts its internal generator, which determines when there is a sampling of data line while writing frame and the long data validation while reading time frame. F. Master to slave For a time frame of writing “1”, the voltage on data line must cross in descending the lower threshold V TH before exceeding the time tW1MAX (figure 2 [1, 2]). For a writing “0” time frame (figure 4), the tension on the data line must state below the threshold VTL a time greater than tW0LMIN. At returning on a high level, after ascending traversing of the level VTH, a slave needs of a restoring time, tREC, before will be ready for the next time frame. Time frame Write - One tW1L VPUP VIHMASTER VTH VTL VILMAX 0V ε tF tRSTL tSLOT Resistor Master Slave Fig. 2 The master writes “1” on line G. Slave to master A time frame of data reading by master begins in the same way as a “writing 1” time frame, (figure 3 [1, 2]). The voltage of low level, on the data line, must remains below V TL until the reading time tRL will be exceeded. When respond with a “0”, the slave starts ever since the window time tRL, keeping data line low; its internal time generator sets when starts this pulling down and then does to increase again the tension. When respond with a “1”, a slave don’t keep down the data line, the tension begins to increase immediately after t RL exceeding. The sum tRL + δ (rising time) on the one hand, and tMSR Time frame Read-Data VPUP VIHMASTER VTH the internal time generator on the other hand, defines the sample window of the master, tMSRMIN until tMSRMAX. From clarity reasons of explanations, the rise time and descendant time in figures 3÷6 were been presented as having an exaggerated duration. In reality, as it could be observed from obtained signal pattern at scope in laboratory for the DS18X20 device, for the “writing 0” and “writing 1” sequences, the duration of fronts is more reduced, figure 4. tRL Master sampling window VTL VILMAX 0V δ tF tREC tSLOT Resistor Master Slave Fig. 3 The slave writes data on line, “0” or “1”. The master reads the received data from slave - port microcontroller pins. This pins can be dedicated or commons (as example a GPIO pin for PIC16F Microchip). The functioning is at the standard or overdrive speed. - UART interfaces. They are obsolete in general, but a new convertor (DS2480B) permits enhancement of transfer efficiency at the overdrive speed. - I2C ports of microcontrollers. More types of “bridge” chips are utilized: DS2482-100,-101,-800 (1 to 8 1-wire ports). III. Fig. 4 Waves patterns of the signals in line H. Transmission improvement in network In 1-wire environment, it is possible to have different noise sources. Depending of physical dimension and network topology, the reflexions from of ends of wires and ramifications can ones to others sum or cancel. Such reflected signals are visible as parasitic impulses (glitches) or oscillations on 1-wire line. As a consequence, for improving the performance in applications of the network, it was realized a new interface (front-end) which is less sensible at noise, and it was embedded in the new generation of devices. Added methods are the filtration and the using of level detection/threshold with hysteresis. I. Attachment at hardware interfaces 1-wire interfaces can be attached to the following types of interfaces: DESCRIPTION OF A TYPICAL COMMUNICATION 1-WIRE The general sequence of signals crossing a communication line of 1-wire type is presented in figure 5. The master device sends the Reset sequence connecting data line to logical “0” for at lest 480μs, then it releases the line and waits to receive a Presence pulse from the any of subordinate devices. If a Presence pulse was detected as response, the master will call the slave address using “writing 0” and “writing 1” sequences. ID ROM Code Reset sequence command ROM Read/write Data Code Function Reset sequence Fig. 5 Typical sequence of signals in 1-wire line MSB CRC (8 bits) Serial Number (48 bits) 64bits Type Product Code (48 bits) LSB Fig. 6. The identification code of the structure of a device IV. RESULTS The fundamental diagram of a 1-wire network with the length L in reduced (L<5m) and extended (5<L<125m) variants are presented in figure 7 and the testbed in figure 8. 1-wire network with maximum length 5m 1-wire network with maximum length 125m Local Power Master Master Master Master Local Power Master Fig. 7 The structure and the dimensions of a 1 - wire network Fig. 8 The testbed The identification and control devices have been connected and interrogated in a 1-wire network by mean of a program developed using Visual Studio Net environment. The application was realised around evaluation kit DS9090 and its graphical interface is presented in figure 9; it has the following functions: Get device, Poll devices, Get switches, Poll switches, Get temps, Poll temps, Stop polling. Starting the application ”1-wire PC App”, in figure 9 appears the detection of adapter DS9090 connected to an USB port. Fig. 9 The launching screen of the application after port recognition To search all devices from 1-wire network, the button „Get devices” is pressed. In the left window wil be displayed the founded devices (partial in figure 10), with the following field information of information for each device: - Adress, unique code for each device. - Name, family of the device. - Description, a summary about type of device, technical characteristics, and the device functions. In our application, the following devices are detected in the 1-wire network: Fig. 10 1. A temperature measuring digital sensor with a unique code (270000801CDE47810), from family DS1920, having the following characteristics: - measured temperature interval: -55 1000C; - measuring precision 0.50C in the [00-700C] range; - displayed resolution 0.50C. For a resolution of 0.10C a interpolation method is used; - an auxiliary function permits the setting of temperature level (max/min) for the generation of alarms in the case of exceeding of the limits. 2. 1-wire addressable evaluation circuit (unique code 98000003C9E36B1C) from family DS28E4 has an EEPROM memory of 4k bits and two generating signal channels. 3. An addressable switch (code unique F4000000664F2412) from family DS2406. The physical control of an output is realized by intermediate of this type of device. The characteristic of output channel are 0.4V, 50mA. The EEPROM memory has 1024 bits. 4. A device of type “reader” from the same family DS1990 as iButton devices (unique code EB0000002C8D2681 has the role of valuators for adapter to permit the using of the evaluating kit DS9090K). The “Poll devices” command launches the control routine which interrogates all the connected devices, detects the authentication type iButton devices and validates the input code. When the button “Poll device” is pressed, in the application window will appear the devices of 1-wire network, interrogated at the 0.5s period, with the address field device family (unique code). For the devices of switchaddressable type, the states of channel will be supplementary displayed (status Ch.0: OFF or ON), and also the signal level at the channel output. It can be observed that for the output type addressable switch having connected a load (even for non-activated output), the detected level is logical “1” (High). In our application, the logical level of channel 0 of device DS2406 is “High” because a load (a LED) is connected to this output. The period of interrogation is displayed with the green indicator which intermittently lights controlled by the interrogation routine, figure 11. Fig. 11 The working devices after "Poll devices" In figure 12 is showed the detection of the coupling of a iButton device by the reading device iButton. In the left window, a device iButton type is detected, showing his unique code (7D00000ECB181001) and its family (DS1990A). Fig. 12 The display with iButton® devices at the moment of key connecting The other device from the same family (Ds1990A) having the unique code (EB0000002C8D2681) is already included in the list because it is located into USB adapter, prior to activation. When detecting iButton device, the software takes no decision because the detected serial number differs from the authentication serial number (written into text-box, below the “1-wire iButton” label, 1900001044A08301). In the following, a practical exercise is presented. The button “Stop polling” is pushed, and the existent authentication serial number is changed with that displayed, at the detection of iButton device (7D00000ECB181001). After writing the new serial number, the iButton “Poll device” is pushed and the software decision is presented in figure 13. One will observe that if the serial number of the authentication device iButton is the same with serial number inserted in the text-box, a timed action of the channel 0 output of DS2406 device will be launched (3s). Fig. 13 The result of “Poll devices” action The following actions will be realized: - an activation command of channel 0 will be launched; - a software timer is started; - at the end of delay (after 3s) a new command for unactivation of the channel 0 is launched. Visual effects are: the validation code box lights for a short time, and the button “Ch.0” lights green for 3 sec. In the same time, the connected LED at the output of Ch.0 of DS2406 circuit follows the state of software button “Ch.0”. For any of “Poll” By pushing button “Stop polling” button types, the interrogation loop is stopped. This example can be applied in an application of access control in buildings. By pressing the button “Get Switch”, the program interrogates the 1-wire network and searches only the devices that apart to device category of “addressableswitch” type. The figure 14 shows the two devices of addressable switch identified (DS28E04) and (DS2406) having un-activated channels (OFF). For monitoring the state of channel 0 (with an interrogation rate of 0.5sec), the button “Poll switch” is pressed, so as it is observed in figure 15. Fig. 14 The result of "Get switch" action Each device is described by the address/family/number of channels fields, the state of channel and the logical level at output. use of iButton® devices, addressable switches and also temperature sensors devices. Fig. 15 The result of “Poll switch” action In the application has been presented only the state of channel 0, because the addressable-switch devices with three pins (TO92) have only one channel (0). Channel 0 is activated/deactivated with button “Ch.0”. The command is send for all switches of “switchaddressable” type. Pushing button “Ch.0”, it will be tracked the LED-state (hardware implementation), the state of button “ch.0” (software monitoring at distance) and the state of channel from the list with 1-Wire devices, figure 16. It will be observed that a delay time (<1s) exists between the moment of launching a command (action of button ”Ch.0”) and execution of command (turn on/off of greenLED) because of too large interrogation gap (0.5s), and also necessary time space for processing and transmitting command to 1 wire device, DS2406. Fig. 17 The sensor temperature device The iButton® devices are ideals for applications where the information is transported by a person or an object. This is the case of the building access, vehicle, equipment or even PC computer. The device can be easily attached to another mobile piece. Some variant of iButton® may be used as payment tools for parking, automatons for consume products, transit or small volume acquisition systems. Other diverse applications of iButton® can be discovered by searching on the internet. The 1-wire network tested in our application is intended to be used at the intelligent buildings (monitoring and control temperature, humidity, ventilation, open/close status of access ways, access cards, etc.). Also there are many other domains for using this 1-wire network: meteorology, parameter control in embedded systems, vehicle security, banking cards, sensor networks, etc.). VI. [1] [2] [3] [4] Fig 16 The effect of the pressing button “Ch.0” Temperature control. The button “Get temp” interrogates the 1-wire loop searching the device of “temperature” type, figure 17. A sensor temperature device is identified with the following fields: address: 27 000801CDE47B10; name: DS1920; description: digital thermometer for temperature measuring -55 1000C, etc. The temperature is registered at the moment of searching device. The temperature is measured with a resolution of 0.50C, and by an interpolation method it can be displayed with a 0.10C resolution, figure 17. V. CONCLUSIONS This article describes our hardware and software application of the 1-wire technology which referrers to the [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] REFERENCES E. Diaconescu, C. Spirleanu, Utilizarea dispozitivelor şi reţelei 1-wire în automatizarea clădirilor inteligente, Automatizări şi instrumentaţie, nr. 2, 2010, pag. 24-26 MAXIM, Reading and Writing 1-Wire® Devices Through Serial Interfaces, AN74, jun 2009 MAXIM, OneWireViewer User's Guide, Version 1.4, AN3358, sep 2009 MAXIM, Overview of iButton® Sensors and Temperature/Humidity Dataloggers, AN3892, aug 2006 MAXIM, What Is an iButton?, AN3808, may 2006 MAXIM, Determining the recovery time for multiple-slave 1-Wire networks, AN3829, jun 2006 Bernhard Linke, Overview of 1-Wire® Technology and Its Use, MAXIM, AN1796, jun 2008 MAXIM, Building a 1-Wire Temperature Logger Using the MAXQ3210, AN3769, may 2006 Bernhard Linke, Choosing the Right 1-Wire® Master for Embedded Applications, MAXIM, AN4206, may 2008 MAXIM, Temperature iButton, DS1920, 2009 MAXIM, 256-Bit EEPROM iButton®, DS1971, 2009 MAXIM, Serial Number iButton, DS1990A, 2008 MAXIM, 1Kb/4Kb Memory iButton®, DS1992/DS1993, 2009 MAXIM, Interfacing the DS18X20/DS1822 1-Wire® temperature sensor in a microcontroller Environment, AN162, mar 2002 MAXIM, 1-Wire Search Algorithm, AN187, mar 2002 MAXIM, Creating Global Identifiers Using 1-Wire® Devices, AN186, ian 2002