RSSI BASED INDOOR POSITION MONITORING USING WSN IN A HOME AUTOMATION APPLICATION

Wireless Sensor Network (WSN) technology has become the key technology to all innovative and novel wireless applications because of its low cost and deployment simplicity. This paper presents a low cost ZigBee based WSN implementation for indoor position monitoring in a home automation application. The real-time knowledge of the location of personnel, assets, and portable instruments can increase home automation control efficiency. Position monitoring otherwise called as location estimation is the process of obtaining location information of a node with respect to a set of known reference positions. Different radio propagation models and localization techniques are discussed. Low cost Digi XBee PRO modules are deployed for location estimation using trilateration method inside a home and mean displacement error value is reported for the same. The application programs have been developed in python language using simple AT commands. The hardware and software framework and related programming are discussed in this paper.


INTRODUCTION 1.Wireless Sensor Network
WSN has become a vital research topic in computing and automation.Low cost and low power sensor nodes are used widely in all application areas.WSNs enable connectivity without use of wires to sensors and actuators in general.Sensor networks can be classified according to the kind of application (industrial, medical, home, etc.), network parameters (topology, range, etc.) and the control (centralized, distributed, etc.) [1].The WSN uses IEEE 802.15.4 and ZigBee standard for short range wireless communication between sensor nodes.IEEE 802.15.4 is a wireless standard that defines the physical (PHY) and medium access control (MAC) layers while ZigBee standard adds network (NWK) and application (APL) layer specifications on top of 802.15.4 to form a ZigBee stack.In a WSN, each device can communicate directly or through neighbor devices with other devices in the network.Connections between nodes are dynamically updated and optimized.Ad hoc On Demand Distance Vector (AODV) routing protocol, provides greater stability in changing conditions (self-forming) or when nodes fail (self-healing).
A WSN can adapt to one of the three topologies: Star, Tree and Mesh.There are three types of devices in it: ZigBee coordinator (ZC), ZigBee router (ZR) and ZigBee end device (ZED).ZC forms the root of the network tree and might bridge to other networks.There is exactly one ZC in each network since it is the device that starts the network communication.The ZR acts as an intermediate router, passing data from other devices as well as running an application function.The ZED contains just enough functionality to talk to the parent node (either the coordinator or a router) and it cannot relay data from other devices.This relationship allows the node to be asleep a significant amount of the time thereby giving long battery life.ZC and ZR are defined as Full Function Devices (FFD), which are AC main powered.ZED is defined as Reduced Function Device (RFD), which is battery powered and is not involved in routing.[2,3]

Radio propagation models
The radio propagation models commonly used for wireless sensor network that predict signal-strength loss with increase in distance are discussed below [4]: Free space propagation model is built on the assumption that the transmitter and receiver are in the line of sight, and there are no obstacles between them.The received signal power r P in free space at distance d from the transmitter is given as where t P is the transmitted signal power, t G and r G are the antenna gains of the transmitter and the receiver respectively.L is the system loss, and λ is the wavelength.The free space model basically represents the communication range as a circle around the transmitter.If a receiver is within the circle, it receives all packets.Otherwise, it loses all packets.
Two-Ray ground reflection model includes reflection to the previous model.A two-ray ground model receiver receives two rays: direct communication ray and reflected ray.This model gives more accurate prediction for long distance measurements.The received power at distance d is predicted as where t h and r h are the heights of the transmit and receive antennas respectively.However, the two-ray model does not give a good result for a short distance due to the oscillation caused by the constructive and destructive combination of the two rays.
The shadowing model The free space model and the two-ray ground reflection model calculate the received power as a deterministic function of distance.They both represent the communication range as an ideal circle.In reality, the received power at certain distance is a random variable due to multipath propagation effects, which is also known as fading effects.A widely-used indoor model (100m coverage distance) is called the log normal shadowing model which has been derived from analytical and empirical methods.
where RSS is received signal strength, d is the distance, n is propagation constant and A is the received signal strength at 1 m unit distance.

RSSI and Location estimation methods
Received Signal Strength Indicator (RSSI) which indicates the signal power at receiving end, is used to estimate distance between two WSN nodes.In DIGI XBee PRO modules, absolute values are reported in -dBm of the last received packet.It is possible to measure the received signal strength on a device using the DB command.The RSSI value is determined in hardware using RSSI module pin.The RSSI range for XBee PRO module is specified in dBm (-39 to -100) i.e. -39dBm is reported when the distance between two nodes is minimum (0m) and -100dBm is reported with maximum distance between them (200m).The RSSI can be used to develop a coarse but simple method of location estimation without the need for any additional hardware.
A location monitoring system can be developed with moderate performance with a WSN.The fundamental idea of localization can be summarized as follows.A tracked node with unknown location emits a signal called beacon, which is received by the fixed anchor nodes.The anchor nodes measure one of the following parameters, the received signal strength (RSS), the time of arrival (ToA), or the angle of arrival (AoA) of the received signal [5].These measurements are used as inputs to an algorithm that determines the approximate location of the tracked node.Measuring RSSI is very simple and the ZigBee nodes are capable of measuring RSSI for last received packet.Determining the precise time of arrival requires a very accurate real time clock.Finding the angle of arrival requires more number of antennae, hardware modification and can increase the complexity and the cost.Hence majority of the RF-based locationing algorithms use only the RSSI to estimate the location because of its simplicity and minimum or no hardware requirement [6][7][8][9].
In a centralized approach, a central node is dedicated to execute the location-estimation algorithm.All other nodes in the network only gather the location related information and send it to the central location processing node.In a decentralized approach all nodes have to execute the algorithm to locate.Location sensing is an obvious parameter for context aware computing.

EXPERIMENT TEST BED SETUP
DIGI Corporation-ZigBee mesh network is deployed here to build a low cost and user friendly indoor position monitoring for a home automation application which is shown in Fig. 1.It comprises of a gateway coordinator which acts as beacon node as well as centralized processing node and three XBee PRO nodes which act as anchor nodes.The ZC sends beacon signals to three fixed reference nodes and receives RSSI value from them.The ZC runs the trilateration algorithm using the three RSSI values read from three anchor nodes and gives position estimation.

Hardware configuration
The DIGI ZigBee modules interface to an internal microcontroller based host device through UART.The ZigBee modules have small buffer registers to store serial data which arrives from the host and RF data which originates from other modules.The ZigBee modules operate in ISM (Industrial Scientific and Medical) 2.4 GHz band at 250 kbps baud rate using Q-PSK modulation.The firmware installed in the sensor module supports AT commands for their wireless operation.ZNet 2.5 firmware used in the kit is based on Ember's proprietary "designed for ZigBee mesh stack".To form a WSN network, a coordinator selects an unused operating channel among 16 frequency channels and assigns a personal area network (PAN) -ID.To perform RSSI based position monitoring ZC device is used as beacon node.Three XBee PRO RF series-2 modules with whip antenna (wire antenna) serve as anchor nodes.The whip antenna is like single piece of wire sticking up from the body of the radio module and offers Omni-directional radiation.It features the maximum transmission distance in all directions when its wire is straight and perpendicular to the module.Since RSSI value only is needed for localization processing no additional hardware circuitry is needed [10].

Software configuration
The WSN test bed provides a simple user interface to be used with the gateway coordinator for configuring the network, writing application programs, managing the network services and utilizing all resources.Also it has provisions to build custom web interface for the user requirements.Once the gateway coordinator is connected to either laptop or network switch, it can be detected by running Device Discovery software tool which displays the gateway coordinator IP address.The gateway coordinator sends RSSI request using simple AT commands to the three anchor nodes using their 64 bit MAC address for this localization work.The anchor nodes respond to ZC with their RSSI values of the last received packet.The control program fused in the coordinator gateway is written in python since DIGI gateway supports python interpreter and python based device drivers.More over python is a powerful object oriented language which results in concise executable code.

Measurement configuration
The three fixed anchor nodes with known 2D coordinates and moving beacon node whose 2D coordinate is to be estimated are placed in a square hall of a home of size 12m x 12m as shown in Fig. 2. It appears like a triangle within a square.The distance between the coordinates is fixed as 3m to reduce the iteration complexity (order of computation) in embedding the code and also because there is incremental change in RSSI for every 3m increase in distance.The radio propagation models discussed in section 1.2 are not found suitable for very short distance measurements inside a home i.e. less than 15m.Hence a lookup table method has been used.RSSI values are read between ZC and ZigBee PRO node for different distances, multiple numbers of times and mean values are entered as shown in Table 1.
From the table the linearity between RSSI and distance can be observed and the following simple equation can be derived to convert RSSI value into distance value: Distance = (RSSI -39) * 3

RESULTS AND DISCUSSION
The DIGI WSN test bed has a few restrictions like the program cannot be fused inside the end devices.Hence for this localization study, the XBee gateway coordinator connected with a laptop has been used as the beacon node and three XBee PRO end devices have been used as anchor devices.The programs are written in python language using remote AT commands and are executed inside the coordinator.The coordinator collects the RSSI values of the three anchor nodes periodically and estimates the position.The RSSI measurement data is collected five times and the average value is taken for calculation.The average RSSI value received from all three anchor nodes are first converted to distance using the linear equation.The resulting three distance values correspond to the distances between the three anchor nodes and the Beacon node.
The next phase of the computation is iterative trilateration which is an example of classic optimization problem.Finally the algorithm iterates in finding the minimum square error and outputs the corresponding coordinate of the unknown beacon node.The entire execution process is represented in Fig. 3 flowchart in brief.The estimated location of the tagged node can be stored in a python file and using a custom web interface, it can also be accessed through internet.The pseudo code for the position estimation is also given in Fig. 4.
The program execution takes approximately 1 second time which is acceptable for position tracking applications where speed of tracking is not a big constraint.Increasing the RSSI measurement more number of times can reduce the error rate at the cost of increasing execution time and reducing the location update rate.
To realize the inaccuracy during estimation of measured coordinates, the displacement error is calculated using the formula where X a , Y a are actual coordinates and X m, Y m are measured coordinates.The displacement error for the DIGI XBee test bed results in four different values 0, 1 and 1.

CONCLUSION
The application determines the estimated physical location of objects at any given time if a WSN node is tagged with them.The real-time knowledge of the location of personnel, assets, and portable instruments can increase home management efficiency.The knowledge of the location of the nodes is useful in providing locationdependent services and authentication process.The same location estimation concept can be extended to threedimensional (3D) space as well at the cost of increase in computation.In the present prototype work, the measurement and analysis have been done in indoor environment in the absence of any kind of obstacles and interferences.The program results in average displacement error of 2.4 m which is good enough in indoor localization for context aware computing, pet monitoring etc.

4 .
When multiplied with 3, the unit distance of measurement test bed, values become 0m, 3m and 4.2m.When the program is run at different times, the change in RSSI changes the error values.The program results in average displacement error of 2.4 m.The program does not include advanced filter mechanisms in the RSSI measurements in order to cope up with the spatial requirements in embedded coding.

Fig. 4
Fig.4 Pseudo-code for simple Localization algorithm

Table 1
RSSI vs. Distance The RSSI readings for the present work are tabulated with Minimum Square Error, estimated coordinate and displacement error of iterative trilateration in Table2.

Table 2
RSSI values and Displacement error