• No se han encontrado resultados

CAPÍTULO VI . Caso Practico

IV. RESULTADOS

Faculty of Electrical and Electronics

Engineering Ho Chi Minh City University of Technology [email protected]

Abstract  — This paper introduces the wireless sensor network routi ng algori thm - AODV, the TCP Socket server and their appli cation in Smart H ome. In t hi s paper, the main focu s is to put on a general system which wil l be a basement for developin g Smart H ome in the fu tur e. There are thr ee mai n part s of t he system, incl udi ng H ome Zi gbee Network , TCP Server Center and User Application for Android smart phone and personal computer.

Keywords  — smart homes, Zigbee, TCPIP, Sockets.

I. I NTRODUCTION

Contemporarily, science and technology are being applied widely and practically to improve human living standard. In numerous fields of technology, researchers are giving attention on helping people to have more convenient and more efficient life. Therefore, there is a huge demand for systems which can support people to control their houses effectively. As a result,  projects which focus on building houses with the application of

high-technology are named “Smart Home Projects”.

A general Smart Home includes four main parts: home network , application,  server center   and user application. The home network includes: sensors, electric devices, actuators and cameras. The application  includes: applications that can be integrated from the home network  and is the interface of home network   to server so that the server center   only cares for the data provided by Applications. Server center  is responsible for controlling applications  and communication to user application. User application  is responsible for receiving the requests from users and updating the Smart Home’s condition.

Fig. 1. Smart Home’s General structure

This paper will focus on building a basic Smart Home system. There are three mainly discussed parts, including Home Network, Server Center and User Application.

Therefore, this paper will be organized in the following order:

Section II: System design will describe solutions and functions of the System that our team built.

Section III: Home Network will discuss the algorithm for Home Network, some bugs happening while developing and solutions.

Section IV TCP Socket –   Server & User Application will concentrate on the frame-work used in Server and User Application. Furthermore, there will be some instructions for  building Server on BeagleBone Black.

II. SYSTEMDESIGN System mentioned in the Introduction. This system has 3 main  parts: Zigbee Network, Server Center and User Application.

Zigbee is new high level communication protocol which is applied in RF Communication that needs Low Power. It is  based on the IEEE 802.15 standard. Zigbee has its own  protocol, easy to setup and appropriate cost. Therefore, Zigbee is chosen, due to its mentioned advantages. The Home  Network takes the responsibility of capturing and updating data for Server, such as light and temperature, receiving commands from Server to control electric devices, such as lamp or fan. In this System, Zigbee Network is routed with AODV Algorithm.

Server Center concerns on receiving and analyzing the data receiving from Zigbee Network. In addition, Server Center is also responsible for communicating with User connecting to Server. The Server will be programmed in Java and connection of Server and User Application is TCP Socket Communication standard. Furthermore, the mini server running the Server Software is BeagleBone Black.

User Application is application on Android Smart Phone or Personal Computer. It provides the friendliest environment for user s to update house’s condition or control house’s devices.

III. HOME NETWORK  routing groups of Ad hoc including Proactive and Reactive.

Proactive Routing protocols:

The advantage of this protocol is that at any moment, at any node in network, transceiver information is always prepared to response. It leads to the reduction of delay for an a pplication in which people need the high speed in communication. When using this protocol, each node has a number of routing tables to reserve the routing path to the rest of nodes. However, the serious backward of this method is the significant increase of updating due to many nodes or unbalanced location of nodes.

Furthermore, because of reserving other nodes’ data, the  processing process is possibly slowed.

Reactive Routing protocols:

The reactive protocols only route to nodes in network in necessary condition. Each nodes control its routing table in which the routing path to suitable nodes is reserved. When the routing path is required from Application layer, the routing  process will be established if in routing table, there is no entry

for this path. The characteristics of the reactive protocols are:

Path Discovery

Path maintenance

Path deletion

The process of finding path depends on request and reply cycles. The source nodes need to send data to give out a request for path and broadcast it to network. There is definitely one reply at least that receives the data and replies to coordinator node. The maintenance process depends on its condition. If path is not used in a period or due to disconnection, the routing step will be done again. In many cases, the transmitting/receiving path will be deleted if not used.

AODV is a reactive protocol that has components:

RREQ package

TYPE = 0x01 (1 byte) : identify package RREQ.

ID (1 byte) : mark the number order of RREQ to avoid infinitive broadcast.

Destination IP (2 byte): the address of required node.

Destination Sequence (2 byte) : the sequence value of required node.

Original IP (2 byte) : the address of node which orders.

Original Sequence (2 byte) : the sequence value of node which orders.

RREP (Route Reply)

TYPE Destination IP Destination

Sequence Original IP Where:

TYPE =0x02 (1 byte) identify package RREP

Destination IP (2 byte) : ): the address of required node.

Destination Sequence (2 byte) : the sequence value of required node

Original IP (2 byte) : the address of node which orders.

RRER (Route Error)

TYPE Unreached Destination IP Original IP Where:

TYPE =0x02 (1 byte) identify package RRER Unreached Destination IP (2 byte) node’s address is unreachable

Original IP (2 byte) the address of node which orders.

Routing Table

Destination IP Status Next Hop Node Next Hopß Previous Node N

Check Des IP in Routing Table (5) N

Check Dest Ip in Routing Table? (2) Y

Node Seq < Des Seq

Node Seqß  De s Seq Node Next Hopß Previous Hop

Y

IV. TCPSOCKET – SERVER& USERAPPLICATION

 A. Home Server Center Design:

The general process:

Firstly, the HomeAutoServer initiates 2 objes HomeAutoSocketHandler and HomeAutoUartHandler. Next, each objects will initiate HomeAutoDataStream and HomeAutoUartStream to control input and output data of Server and User Application or Server and Zigbee Network.

After that, through HomeAutoDataStreamListener and HomeAutoUartStreamListener, object controlling data will  bring received data to objects which controls connection.

 B. User Application:

START

Open Socket to Server

Socket Opened ??

N  Y 

Socket Opened??

Process Data Log In Success??

N

 Y  Listen Mode

N Open Socket to Server Write Control

Command to Server

Time out ??

Close Socket  Y 

N Control Action from User

(1)

Receive Data from Server (2)

 Y 

Fig. 6. User ApplicationGeneral process

Fig. 5. Server Center General process

The User Application has the same frame-work as Server Center. Thus, the most important thing in User Application is friendly user interface to user.

ACKNOWLEDGMENT

Great thanks for my advisors, Dr. Trương Quang Vinh and Mr. Tạ Trí Nghĩa, lecturers of Department of Electronics Engineering for graduation thesis for their Invaluable Dedication and suggestions. Also, we want to send our thanks to “Pay It Forward Research Club” for this precious Student Research Conference.

EFERENCES

[1] An Overview of Mobile Ad Hoc Networks: Applications and Challenges

[2] ZigBee for wireless networking

[3] Elliotte Rusty Harold (2005).  Java™ Network Programming , Third Edition. O’Reilly Media.

[4]  Ad hoc On-Demand Distance Vector (AODV) Routing . Available:http://www.ietf.org/rfc/rfc3561.txt

[5]  Java SE Tutorial.  Available :

http://docs.oracle.com/javase/tutorial/index.html

[6]  BeagleBone Black System Reference Manual. Available : http://elinux.org/Beagleboard:BeagleBoneBlack#LATES T_PRODUCTION_FILES_.28A6.29.

Display video on LED Matrix RGB 64x128 using kit