Design and Implementation of a Wireless Sensor Network for Smart Homes Ming Xu1, Longhua Ma1, Feng Xia2, Tengkai Yuan1, Jixin Qian1, Meng Shao3 1Department of Control Science and Engineering,Zhejiang University, Hangzhou 310027, China
e-mail: lhma@iipc.zju.edu
2School of Software, Dalian University of Technology, Dalian 116620, China
e-mail: f.xia@ieee
3Computer Centre, Hangzhou First People’s Hospital, Hangzhou 310006, China
Abstract—Wireless nsor networks (WSNs) have become indispensable to the realization of smart homes. The objective of this paper is to develop such a WSN that can be ud to construct smart home systems. The focus is on the design and implementation of the wireless nsor node and the coordinator bad on ZigBee technology. A monitoring system is built by taking advantage of the GPRS network. To support multi-hop communications, an improved routing algorithm bad on the Dijkstra algorithm is prented. Preliminary simulations have been conducted to evaluate the performance of the algorithm.
入党积极分子培训心得体会Keywords-ZigBee; wireless nsor network; smart home; routing algroithm
I.I NTRODUCTION
Wireless technologies have been developing rapidly in the years. The obvious advantage of wireless transmission is a significant reduction and simplification in wiring and harness [1]. Many communication technologies, such as IrDA, Bluetooth and ZigBee, GSM/GPRS (General Packet Radio Service), etc., have been developed for different situations. Nowadays, a kind of real time systems in which multiple nsors connected simultaneously to one gateway unit become necessary, and they are transformed into wireless nsor networks (WSNs).
In previous work, much rearch has been done using wireless nsor technologies. Literature arch indicates that applications using wireless nsor technologies have already existed in the following four fields [2]:
(1) Home automation and remote monitoring of hous. For example, Liang et al [3] developed a system of wireless smart home nsor network bad on ZigBee and PSTN (Public Switched Telephone Network) technologies.
(2) Environmental monitoring, including humidity, temperature and radiation. For instance, Rosiek and Batlles [4] prented a system of data-acquisition from remote meteorological stations using the mobile communication networks (more specifically, GPRS).
(3) Fault tracking and fault management. For example, in [5], the authors developed an online diagnosis and real time warning system for vehicles using 3G technologies and GPRS communications.
(4) Health monitoring. For instance, Monton et al [6] designed an e-health approach to monitoring data of specific population, such as electroencephalograms, electrocardiograms, electromyograms and so on, which us ZigBee-bad WSNs. ZigBee is particularly suited for the implementation of a wide range of low cost, low power consumption, reliable control and real-time monitoring applications within the smart home situations. The above-mentioned four application areas are also cloly related to the design of a WSN for smart homes.
In the past, rearch in smart home and in-home applications was often limited to ZigBee technology, and gradually other long-distance network technologies such as PSTN [3] and GSM [7] are adopted. It turns out that the u
of the technologies makes information more accessible. This would significantly improve people’s living quality. However, as a traditional wired network, PSTN has some problems, such as unsatisfactory curity assurance, inconvenience and high cost. Therefore we need a new solution. Among other choices, the GPRS technology can solve the problems. Thanks to its unprecedented ubiquity, GPRS is now available almost anytime and anywhere, for anybody (being rved). Furthermore, the GPRS network has
a highly cure infrastructure, which makes sure that the information nt or received cannot be stolen [7]. Bad on the obrvations, we propo to develop a new system utilizing ZigBee nsor networks and the GPRS network connecting the ZigBee networks to the application rver. Details about the design and implementation of the system are prented in the following ctions.
II.S YSTEM D ESIGN
As shown in Fig. 1, a star-mesh hybrid topology is usually ud in the smart home system. It mainly contains the following components:
(1) ZigBee network coordinator: This special node takes the responsibilities of controlling data communications, establishing communication links and protecting equipments inside the network.
(2) ZigBee node: A node is mainly compod of various nsors and a ZigBee wireless module. In practice, nodes can be deployed to establish a network with a star-like, mesh, or hybrid topological structure. In the monitoring area, ZigBee nodes are scattered according to the distance and all nsor data can be nt to the network coordinator though the network.
(3) GPRS network: Data generated within the ZigBee network is transferred to the monitoring center via the GPRS network and the Internet.
新学期新征程手抄报
好看漫画头像
(4) Monitoring center: A computer/rver in the monitoring center is ud to manage the data generated by all Zigbee networks. Figure 1. Network topology of smart home systems In our daily applications, veral ZigBee networks would overlap each other and the nodes of the network may breakdown [8, 9]. Therefore characteristic identification of the node should be considered in the design to distinguish the networks. Redundancy nodes are needed to deploy and the mesh topological structure should be optimized. What’s more, the routing-algorithm should be examined to ensure the communications among nodes. A. Hardware Design
The network node and the coordinator are key
components of the system. In this work, we assume that no
matter where the ur is, the coordinator will always be connected to the monitoring center/rver via a computer that
can access the Internet or the GPRS network. It can obtain all
messages exchanged between the rver and the network. When the rver nds out a command, the CPU of the network coordinator will read the content of the command
and get the details by analyzing it, such as turning on the air conditioner or refrigeration. The main control program within the network coordinator writes the details to the ZigBee module through rial ports. Then the ZigBee module will be responsible for nding the messages to the family network.
From Fig. 1 we can e that development of the network coordinator and the ZigBee node is the most important task for hardware system design. The two components are basically identical. The only difference is that the latter has the function of GPRS communications while the former does not. Therefore, we will focus on describing the design of the ZigBee network coordinator in this paper. According to the above description, we can find that the microcontroller (MCU), the ZigBee module, and the GPRS module are the most important parts of the network coordinator. The hardware construction of our coordinator node adopts MSP430F149 as MCU (from TI), ETRX2 ZigBee module, and MC52i GPRS module (from Siemens).
The three modules can connect and communicate with each other through rial ports.
Figure 2. Internal structure of coordinator
As shown in Fig. 2, parts (a), (b) and (e) constitute a typical ZigBee node. Adding parts (c) and (d) to the node, it becomes a ZigBee coordinator. We add parts (f) and part (g)
for additional functions. Part (f) can control some target
with 2A current relay and monitor the switch mode of the
target. Part (g) can generate and decode PSTN signals. Home cure alarm mainframe can be connected to the tip and ring port. When the mainframe alarms, part (g) can extract alarm information of Contract ID (CID, one popular alarm protocol) code quickly, and the coordinator will nd an alarm message to the monitoring center. The major function of the coordinator in remote communications is as follows. The GPRS communication
unit connects to the MCU through the RS232 connector, and is responsible for data transmission between the node and
the monitoring rver. The data nt by the rver will get天堂的孩子电影
into the GPRS communication module by antenna. Uful
data will be obtained through analyzing the TCP/IP agreement. Respon data of the MCU will be modulated to GSM signal by the GPRS module and be nt to the rver via the internet using the TCP/IP protocol.
Figure 3. ZigBee circuit diagram
coordinator
node
node
node
node
node
node
ZigBee network
We have designed peripheral circuits according to the functional requirements, and developed a network coordinator by integrating the ZigBee coordinator node and the GPRS module together on a PCB board. Given in Fig. 3 and Fig. 4 are some of the circuit diagrams designed for the system. Fig.
5 shows the hardware board of the coordinator node we developed.
Figure 5. Coordinator node developed.
B.Software Design
1)Monitoring Software
The monitoring software on host station (i.e. monitoring rver) adopts C/S architecture bad on Socket communication mechanisms of TCP/IP protocol. It is written by C# language, using ACCESS databa.
Built on .Net software platform, this software features independence of platforms and excellent expandability. The whole monitoring system of the host station mainly consists of two parts: databa management rver and system management rver. The databa management rver includes databa rver and databas. The databa management rver rves to manage the interaction between various modules and databas, to establish databas, and to connect to other modules. The system management rver interacts with the urs. The system management rver provides a human-machine interface, through which urs can configure system parameters, monitor real-time data, inquire about historical records, etc. The framework of the software is illustrated in Fig. 6.
Figure 6. Structure of host station software
2)
Node Software
The network (coordinator) node software realizes the collection and transmission of data. Fig. 7 shows the block三色鸡丁
diagram of the software. Fig. 7(a) is the main procedure
flowchart and Fig. 7(b) is the interruption procedure
flowchart. As for nsor nodes, the program realizes
functions such as data sampling, A/D calculation, I/O
control, timed nding, and timed hibernating. As for router
nodes and coordinator nodes, it mainly realizes the function
of data forwarding and path routing. The router nodes and
描述秋天的词语
the coordinator nodes have the capacity of collecting nsor
data. Therefore they can also be treated as nsor nodes. Figure 4. GPRS circuit diagram
During the interaction between coordinator nodes and the GPRS network, both of them should follow the same datagram protocol in order to enable the host station to analyze the message more easily.
(a)
(b)
Figure 7. Flowchart of node software: (a) main procedure; (b)
interruption procedure.
III. R OUTING A LGORITHM
The smart home system using the WSN developed above can be modeled as a (wireless) network, and the routing point is the node in the network. The traditional Dijkstra algorithm [10] generates the shortest path according to the order of increasing path length, and greedily arches path bad on the edges connected with nodes. However, there is no edge in the wireless network. Therefore we propo an improved Dijkstra algorithm for the WSN, which obtains the shortest path in the network.
Assume that there are n nodes in a wireless network, and the location of each node is available. Then we can get the
table of distances between nodes by using the following algorithm [11]:
(1) A node is arbitrarily lected as the root node. After initialized, it will nd messages to surrounded nodes asking for their IDs and location information.
(2) In respon to Step (1), the remaining n -1 nodes nd their IDs and location information to the root node.
(3) The distance table is created after the root node has received all the information of remaining n -1 nodes.
As an example, Fig. 8 gives a simple wireless network. The corresponding distance table is shown in Table I.
Figure 8. An example network of 10 nodes
TABLE I.
D ISTANCES BETWEEN N ODES Node ID
浅开头的成语
123 4 5 6 7 89101 042 5 5 7 6 899 2 4027 6 5 5 778 3 220 5 4 5 4 678 4 5750 3 8 7 798 5 564 3 0 6 5 27 5 6 7558 6 0 3 82 5 7 6547 4 3 0 54 4 8 8767 2 8 5 06 4 9 9779 7 2 4 60 4 10
9
8
8
8 5 5 4 4
4
After the table of distances is created, we u an improved Dijkstra algorithm to deduce the optimal path. Some symbols and notations ud in the algorithm are listed in Table II.
TABLE II.
S YMBOL D EFINITION
Symbol Description
n
Number of network nodes v
Sending node w
Receiving node k
Transmission radius u
Relay node s [i ]
Visit mark (if not visited, t s [i ]=0; el t s [i ]=1)
cost [i ][j ]
Distance between node i and node j dist
Distance corresponding to the optimal path from v to w
The improved Dijkstra algorithm is described in the following:
(1) Initialization: num =0, dist =+∞, s [i ] =0, (i =0,1,…n ); (2) If cost [v ][i ] ≤k , then t s [i ]=1, (i =0,1,…n );
(3) If s [w ] =1, then dist =cost [v ][w ]; otherwi go to step (4);
(4) ∀ i ∈{s [i ]=1}, u [num ]=1, t s [j ]= 1 when j ∈{cost [u [num ]][j ] ≤k }, (j =0,1,…n );
(5) If s [w ] ≠1, then num ++, repeat step (4); otherwi record the path that fulfills s [w ]=1, and
10
[]cos [][[0]]
cos [[]][[1]]cos [[]][];
num j dist num t v u t u j u j t u num w −==+
++∑
(6) For num =num +1, repeat steps (4) and (5) until all the paths that fulfill s [w ]=1 are obtained;
(7) Set dist =min{dist [i ], i =0,1,…,num }, and output the corresponding path.
We implemented the above algorithm and conducted simulations of a network as given in Fig. 8. Se
tting k =5, the optimal path from nding node 1 to receiving node 10 is to pass a relay node 5, which is better than the path of node 1 → node 3 → node 7 → node 10, and reduces the number of node hops. Therefore, the improved Dijkstra algorithm can solve the problem of optimal path lection in a wireless network, thus providing a feasible routing solution for smart home systems.
To evaluate the performance of routing algorithms, a general concern would be the energy consumption of the network nodes. If a node is put into sleep as long as it has no data to receive or nd (and all state switching overheads are negligible), its energy consumption will be approximately proportional to the number of times it is visited (i.e. the number of packets it has transferred). In this ca, it is possible to examine the relative energy consumption of all nodes by obrving the number of times each node is visited.
Figure 9. Number of times each node is visited.
In simulations the nding node and the receiving node are randomly generated. Fig. 9 gives the results with data transformation of 1000 and 3000 times. Noticing that nodes 3, 5 and 7 have more visited times, we can conclude that nodes 3, 5 and 7 consume more energy. This obrvation could be helpful when placing nodes in a smart home.
IV. C ONCLUSIONS
This paper focud on development of the wireless nsor node and the coordinator for smart home systems bad on ZigBee technology. Both hardware design and software design have been described in detail. A monitoring system is also built using the GPRS network. To address the problem of routing for multi-hop communications in smart home wireless nsor networks, an improved algorithm bad on the Dijkstra algorithm has been prented. The performance of the algorithm has been evaluated through preliminary simulations. Our future work is to test and apply the whole system in practice.
A CKNOWLEDGMENT
This work is supported in part by Natural Science Foundation of China under Grants No. 60474064 and No. 60903153, Zhejiang Provincial Natural Science Foundation of China under Grant No.Y107476 and No.R1090052 and the Fundamental Rearch Funds for the Central Universities.
R EFERENCES
[1] W. Ning, Q.Z. Nai, H.W. Mao, “Wireless nsors in agriculture and
food industry - Recent development and future perspective,” Computers and Electronics in Agriculture, vol. 50, 2006, pp. 1–14. [2] A.R. Al-Ali, M. Al-Rousan, T. Ozkul, “Implementation of
experimental communication protocol,” Computer Standards & Interfaces, vol. 28, 2006, pp. 523–530.
[3] L.L. Liang, L.F. Huang, X.Y. Jiang, V. Yao, “Design and
implementation of wireless smart-home nsor network bad on ZigBee protocol,” International Conference on Communications, Circuits and Systems, 2008, pp. 434-438.
[4] S., Rosiek, F.J. Batlles, “A microcontroller-bad data-acquisition
system for meteorological station monitoring,” Energy Conversion and Management, vol. 49, 2008, pp. 3746–3754.
[5] C.E. Lin, C.C. Li, S.H. Yang, S.H. Lin, C.Y. Lin, “Development of
On-Line Diagnostics and Real Time Early Warning System for Vehicles,” SICON05 - Sensors for Industry Conference, Houston, Texas, USA, February 2005, pp. 8-10.
[6] E. Monton, J.F. Hernandez, J.M. Blasco, T. Herve, J. Micallef, I.
Grech, A. Brincat, V. Traver, “Body area network for wireless patient monitoring,” IET Communications, vol. 2, 2008, pp. 215–222.
[7] B.Z. Yan, H.Y. Zhao, “A Low Cost GSM/GPRS Bad Wireless
Home Security System,” IEEE Transactions on Consumer Electronics, May 2008, pp. 567-572.
[8] L.N. Zhang, X.C. Hong, “The successful application of ZigBee
关于离婚协议technology in the smart home,” Science & Technology Information, vol. 16, 2008, pp. 19-20. (in Chine)
[9] J.M. Bao, “Rearch on the Application of ZigBee Technology in
Monitoring and Control System of Greenhou,” Journal of Agricultural Mechanization Rearch, vol. 2, 2008, pp. 184-187. [10] C.P. Liu, “Mathematical Modeling,” High Education Press, 2002. [11] R. Yang, T. Yang, “Wireless nsor network bad on ZigBee with
applications for smart building,” Chine Agricultural Mechanization, vol. 5, 2005, pp. 76-79. (in Chine)