1 Wire1 PDF
1 Wire1 PDF
1 Wire1 PDF
ICEMI2007
Introduction
Feasible temperature is the most basic parameter for human and all animals and plants. Temperature monitor and control have significant interest in modern life. Unfortunately, the usually used temperature monitoring system has two kinds of shortcoming in current life. One is that it needs a lot of wires to transfer the sensor signal to data acquisition card and the implementation of linking signal wires is very troubling. Also, the cost is high. The other shortcoming is that the signal transferred in wire is analog signal. There will be a log of noise and loss. In order to overcome these shortcomings, a kind of digital 1-Wire bus technology emerges as the times require. Digital 1-Wire bus technology is implemented by adopting the new device of DALLAS Company.
According to this kind of technology, the address line, data line and control line used the same line. Hundreds of control and monitor objects could be connected to this line by using 1-Wire bus technology. The multi-drop 1-Wire bus measurement system will be constructed very well. All the chips used by control objects are provided by DALLAS Company. Analog signals can be digitalized in the checking position through 1-Wire bus protocol and transferred in 1-Wire bus. Therefore, digital signal will transfer in 1-Wire bus. The 1-Wire bus temperature measurement system introduced in this paper is built based on 1-Wire bus technology and its device. The 1-Wire bus monitoring system is connected to computer through serial communication port. It has the characteristics of high ratio of hardware performance to price, convenient for construction, good anti-jamming performance and simple software development. It is suitable for field monitor at open country, intelligent building and security alarming et al [1].
2 Hardware Design
2.1 Structure of 1-Wire bus temperature monitoring MicroLAN The field monitoring network can be constructed by adopting the 1-Wire bus technology of DALLAS Company. This kind network is called MicroLAN normally. It transfers the data, addresses signal and control signal through one line and provides power to devices on the bus through another line. It is different to the popular computer local area network by nature. The computers or peripheral equipments in LAN have their own power and only data information is transferred in the network line. However, the two lines in MicroLan not only transfer
3-722
ICEMI2007
data but also should provide power to devices connected to MicroLAn from their host. This kind of MicroLAN is a master-slave network. It takes PC or single chip computer as its network server and the master device. All other devices in MicorLAN are taken as slave device. They are managed by master device to implement the communication between master device and slave device. The network dimensions can be large or small. The devices counts may vary form several to thousands. There is almost no limit in theory. The structure of MicroLAN is simple and it can be constructed through one pair of twisted-pair. The slave device does not need to have power. Therefore, this kind of MicroLAN can be constructed rapidly and has low cost. It is fit for practical application. Figure 1 shows the temperature monitoring network constructed by 1-Wire bus temperature sensor DS18B20 and DS2480B used as the protocol transformer between computer serial communication port and 1-Wire bus
Fig. 1
2.2 1-Wire bus temperature sensor DS18B20[2 4] 2.2.1 Operation principle of DS18B20 DS18B20 is constituted of five main parts: 64-bit ROM, scratchpad memory, temperature sensor, 1-byte upper and lower alarm trigger registers and configuration registers. The 64-bit ROM stores the devices unique serial code. The scratchpad memory contains the 2-byte temperature register that stores the
3-723
digital output from the temperature sensor. In addition, the scratchpad provides access to the 1-byte upper and lower alarm trigger registers (TH and TL), and the 1-byte configuration register. The configuration register allows the user to set the resolution of the temperature-to-digital conversion to 9, 10, 11, or 12 bits. The TH, TL and configuration registers are nonvolatile (EEPROM), so they will retain data when the device is powered down. The DS18B20 uses Dallas exclusive 1-Wire bus protocol that implements bus communication using one control signal. The control line requires a weak pullup resistor since all devices are linked to the bus via a 3-state or open-drain port (the DQ pin in the case of the DS18B20). In this bus system, the microprocessor (the master device) identifies and addresses devices on the bus using each devices unique 64-bit code. Because each device has a unique code, the number of devices that can be addressed on one bus is virtually unlimited. Another feature of the DS18B20 is the ability to operate without an external power supply. Power is instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. The high bus signal also charges an internal capacitor (CPP), which then supplies power to the device when the bus is low. As an alternative, the DS18B20 may also be powered by an external supply on VDD. 2.2.2 Working flow of DS18B20 The transaction sequence for accessing the DS18B20 is as follows: step 1, Initialization, step 2, ROM Command, step 3, DS18B20 Function Command. All transactions on the 1-Wire bus begin with an initialization sequence. The initialization sequence consists of a reset pulse transmitted by the bus master followed by presence pulse(s) transmitted by the slave(s). The presence pulse lets the bus master know that slave devices (such as the DS18B20) are on the bus and are ready to operate. After the bus master has detected a presence pulse, it can issue a ROM command. These commands operate on the unique 64-bit ROM codes
ICEMI2007
of each slave device and allow the master to single out a specific device if many are present on the 1-Wire bus. These commands also allow the master to determine how many and what types of devices are present on the bus or if any device has experienced an alarm condition. There are five ROM commands, and each command is 8 bits long. These commands are SEARCH ROM [F0h], READ ROM [33h], MATCH ROM [55h], SKIP ROM [CCh] and ALARM SEARCH [ECh]. The master device must issue an appropriate ROM command before issuing a DS18B20 function command. After the bus master has used a ROM command to address the DS18B20 with which it wishes to communicate, the master can issue one of the DS18B20 function commands. These commands allow the master to write to and read from the DS18B20s scratchpad memory, initiate temperature conversions and determine the power supply mode. The DS18B20 function commands are CONVERT T
Interfacing to RS232C ( 12V levels) requires a passive clamping circuit and one 5V to 12V level translator. Internal timers relieve the host of the burden of generating the time-critical 1-Wire communication waveforms. In contrast to the DS9097(E) where a full character must be sent by the host for each 1-Wire time slot, the DS2480B can translate each character into eight 1-Wire time slots, thereby increasing the data throughput significantly. In addition, the DS2480B can be set to communicate at four different data rates, including 115.2 kbps, 57.6 kbps and 19.2 kbps. Command codes received from the hosts crystal controlled UART serve as a reference to continuously calibrate the on-chip timing generator. The DS2480B uses a unique protocol that merges data and control information without requiring control pins. This approach maintains compatibility to off-the-shelf serial to wireless converters, allowing easy realization of 1-Wire media jumpers. The various control functions of the DS2480B are optimized for
Fig. 2
Interface Circuit
[44h], WRITE SCRATCHPAD [4Eh], READ SCRATCHPAD [BEh], COPY SCRATCHPAD [48h], RECALL E2 [B8h] and READ POWER SUPPLY [B4h]. 2.3 Protocol transform chip DS2480B[5] The DS2480B is a serial port to 1-Wire interface chip that supports regular and Overdrive speeds. It connects directly to UARTs and 5V RS232 systems.
3-724
MicroLAN 1-Wire networks and support the special needs of all current 1-Wire devices including the crypto iButton, EPROM-based Add-Only Memories, EEPROM devices and 1-Wire Thermometers. 2.4 Interface circuit between DS2480B and RS232 COM port In this paper, the connection between 1-Wire bus device DS18B20 and computer COM port is
ICEMI2007
implemented through DS2480B. Therefore, the hardware design is based on the interface between DS2480B and RS232 COM port. To protect the 1-Wire port of the DS2480B from electrostatic discharge a low capacitance ESD protection diode, DS9503, is used. For 5V operation a single device is sufficient. The interface circuit is shown is Figure 2.
session begin TMTouchByte(session_handle,$B8); calling EEPROM (B8H) if (TMAccess(session_handle,@StateBuf) = 1) then begin TMOneWireLevel(session_handle,LEVEL_SET,LEVEL_ STRONG_PULL_UP,PRIMED_BYTE); //set the communication level of 1-Wire bus TMTouchByte(session_handle,$44); convert command (44H) st := GetTickCount + 1000; //config convert tiem 1S While (GetTickCount < st) do TMValidSession(Session_handle); TMOneWireLevel(session_handle, LEVEL_SET,LEVEL_NORMAL,PRIMED_NONE); //set communication level if (TMTouchBit(session_handle,$01) = $01) then //check if the convert is ended or not begin If (TMAccess(session_handle,@StateBuf) = 1 ) then begin TMTouchByte(session_handle,$BE); //send command of read DS18B20 scratch pad (BEH) for i := 0 to 8 do //send temperature //send command of
Software Design
The software of 1-Wire bus temperature monitoring network is developed with Delphi. It calls the API functions in the dynamic link library provided by the software developing tool kits, TMEX SDK, of DALLAS Company. The ROM commands and function commands is called by the API functions. Since the computer COM port is selected, the applied DLL is IB97U32.DLL. the value of communication port type, DefaultPortType, is 5. The value of communication port number, DefaultPortNum, is 1. The designed operation interface is shown in Figure 3. When expected measuring node is selected, temperature sense will begin and the temperature monitoring curve can be plotted dynamically. At the same time, the temperature value will be stored in SQL Server database for analyses and control.
Fig. 3
Software Operating Interface rbuf[i]:= TMTouchByte(session_handle, $FF);//read temperature value in DS18B20 memory //dealing temperature 3-725
The following is the main program for accessing DS18B20 and measuring temperature.
if (TMAccess(session_handle,@StateBuf)= 1) then //build a
ICEMI2007
Conclusion
The 1-Wire bus temperature monitoring system is preferable to the traditional data acquisition system. It can be used in the field of multi-drop temperature monitoring However, the reliability to drive the bus is not stable when the network is too large. Therefore, the load driven ability should be enhanced with bus coupler. References
[1] YU Kelong, BI Xiaolong, QIU Lijun. The Application of Digital Chinese) [2] Jiang Taihui, Deng Zhanwei. Character and application of digital temperature sensor DS18B20, Electronic Technology. No 12, pp46-49, 2003 (In Chinese) [3] Li Nong. Realization of communication between FPGA and DS18B20, International Electronic Elements. No.2, pp48-51, 2006 (In Chinese) [4] ZHao Hongqi, Wang Yujing. Application of DS18B20 in 16-channel Chinese) [5] Ming Degang. The Application of DS18B20 at the MCU System of Temperature Measure and Control, Journal of Guizhou University(Natural Science). Vol. 23, No 1, pp106-110, 2006 (In Chinese) Temperature Measuring System, Instrumentation Technology. No 1, pp69-71,2006 (In Thermometer DS18B20, Jiangsu Machine Building & Automation. Vol.33, No 2, pp47-49, 2004 (In
Author Biography
Wang Jingzhuo: Male(1971-), Han nationality, Born in Linshu county, Shandong province, Working in Dept. of Electronic Engineering, Huaihai Institute of Technology as a teacher, Main research directions are MIS, EDA, Measurement and Control, Instruments and meters.
3-726