A new gateway node for wireless sensor network applications

Wireless sensor network based applications have gained a significant importance in recent years. However, it creates problems when sending the detected data over distant stations even though establishment of sensor networks by means of ZigBee communication modules as the communication range of these modules are limited. For this reason, in this study, design of a gateway node which can be used in the sensor network applications was developed. The gateway node developed consists of a CC2530 ZigBee Module, an MSP430G2553 ultra low power microcontroller and a SIM900 GSM/GPRS module. As a result of this node, the sudden changes can be sent as data packets (SMS), also, the data can easily be monitored on web based and mobile platforms. It is anticipated that the study will be useful for the researchers conducting sensor network applications.


INTRODUCTION
The wireless networks using sensors for monitoring physical or environmental conditions in diversified locations such as temperature, humidity, light, pressure, pollution, soil constituents, noise level, vibration and object movements in a cooperative way and containing devices working independently from each other are called "wireless sensor networks" (Akyildiz et al., 2002).
As for the nodes that are used in wireless sensor networks and that have the capabilities of calculation, perceptual data collection and communication with the other connected sensors in the network are called sensor nodes (Chong and Kumar, 2003).
Sensor nodes fundamentally consist of the main constituents of a microcontroller, a transceiver, an external memory, a power source and a sensor (Gupta et al., 2013). applications containing locating doctors in a hospital, monitoring of conditions of patients, guarding of the elderly and monitoring of various medical parameters; in commercial applications containing monitoring and locating vehicles, monitoring of power lines, tracking of young children by their parents, lighting control, control of traffic lights and fire systems; and in home automation applications containing smart home environments and building security systems (Carlos et al., 2007). But, existing sensor nodes like TelosB, MicaZ, Mica2 etc, have no gateway node for sending information to distant stations. These nodes senses data and can send data only in a PC which is connected to a USB cable and to each other. For example, if you have a wireless sensor network in your farm, you can monitor obtained datas with these nodes only in same farm. If you are in the home, this place is far from your farm, you cannot monitor the values. Therefore, these nodes cannot be used in many applications which require you to send your data to distant stations.
In this study, a gateway node was developed for ZigBee networks. Through the gateway node developed, the data detected from the sensor nodes in the medium can be sent to the distant stations with the help of GSM/GPRS technologies. This rest of the paper is organized as follows. The general structure of the sensor networks is given in the 2nd part. In part 3, the related works are explained. While the hardware design of the sensor node developed is presented in part 4, the software design of the sensor node is presented in part 5. Testing and results are presented in part 6. The conclusions of the study are given in part 7.

OVERALL STRUCTURE OF WIRELESS SENSOR NETWORK SYSTEM
Wireless Sensor Networks consist of small-sized sensor nodes installed on the environment. These nodes carry, by collaborating in a physical ground, what they learn from the physical world to the virtual world platform (Mayank, 2005). This is shown in Figure 1.
The data obtained from the physical environment by various sensors in sensor networks are wirelessly transferred onto their target data processing network by means of a collaboration method called from ear to ear. The gateway to the data processing network is called a gateway node. This node is a special node which is able to communication with the sensor nodes as well as with the communication network. The node is considered to be a static node with no energy issues and with a high calculation capability.
As for the sensor nodes, they are general units with limited energy and calculation capabilities that communicate through radio technology. These units are automatically placed and installed with a purpose to detect and monitor some conditions and phenomena in the detecting zone. The numbers can be from hundreds to thousands depending on the application. On Wireless Sensor Networks, the wireless communication between the sensor nodes in the environment is generally carried out via a ZigBee Module.
ZigBee (ZigBee Alliance, 2005) is a technology based on 802.15.4 standard that has been developed for Personal Area Networks consuming low power which is suitable for high level communication protocols. ZigBee is suitable for short ranged applications requiring low data transfer rates. ZigBee standard was designed for M2M applications and provides simple, secured communication means with low failure rate for M2M applications. As the data packet sizes, power consumption and complexity of technologies such as Wi-Fi and Bluetooth are too large, they are more prone to failures as compared to ZigBee networks. There are 3 tasks of devices in ZigBee networks.
1. Gateway: There is only one in a given network. It is responsible for the arrangement of the network structure of the network. Gateway needs to be started first in ZigBee networks. It is the node in which memory, RAM and processing capacity features are the most advanced. 2. Router: It is responsible for relaying messages that have been sent to it to the other nodes (gateway or end devices) in the network. It does not process the data; it is just used as a router and for extending the range. 3. End device: It is installed on the sensors in the network and its task is to transfer the measurements it makes to the router or the gateway nodes.
As is known, the range of the sensor nodes in the ZigBee networks is limited. Thus, there is a limited communication range in ZigBee sensor networks. In the existing sensor nodes (TelosB,Mica2,MicaZ,etc.), the gateway node is formed by means of connecting it to a personal computer in the laboratory or the classroom and the applications are carried out this way. Therefore, the existing nodes are not usable in the applications containing hundreds of sensors distributed in the environment.
In this study, all issues were overcome and a new gateway node was developed for Wireless Sensor Networks.

RELATED WORKS
There are limited numbers of studies on gateway nodes that can be used for Wireless Sensor Networks. And most of the studies conducted consist of designs only. Yepeng et al. (2013) designed a gateway for the communication between ZigBee networks and the Internet in Smart Home technologies. They used an S3C2440 microprocessor, a JN5148 ZigBee module and a VT6656 as a WiFi Module. They converted the ZigBee Protocol data into WiFi protocol data. This way a gateway that can be used in a smart home technology was formed. Despite the fact that the node developed is used in smart homes, it cannot be used in different terrains where there would be no WiFi communication and other applications of the sensor networks. Thus, the scope of the study is limited. Zhixiang and Jinxiang (2002) designed a gateway based on S3C2410 processor. They designed a new data sending protocol and degraded the differences between the ZigBee and the TCP/IP protocol; also, they designed a data sending management module. But the study conducted remained a theory. It was not put into implementation. Zennaro et al. (2008) (2009) designed a gateway node based on STM32W108 radio chip and embedded WiFi. All these studies consist of designs only. However, in this study, a gateway node having a GSM and GPRS infrastructure which can be used with the existing sensor nodes was developed.

HARDWARE DESIGN
The gateway node is intended for reaching out to the sensor nodes available in the medium through distant stations and to control them. In the design of the sensor node CC2530 ZigBee module and MSP430G2553 processor was used. RXD, TXD and GND connections are established between the sensor node and the SIM900 GSM/GPRS node and the gateway node is thus obtained. The circuit diagram of the sensor node and SIM900 GSM/GPRS node is given in Figures 2 and 3.
The GSM/GPRS module is connected to the UART pin of the microcontroller through the pin J2. Thus, the communication of the GSM/GPRS module with the sensor node through serial communication protocol UART at 9600 baud speed will be established. The gateway node possesses all the features the sensor node possess. In addition to the codes of the sensor node codes for communicating with the GSM/GPRS module is added and sending of the data over the distant stations can be established.
The gateway node consists of four units: the power unit, transceiver, processing unit and GSM/GPRS Modem.

Power unit
The gateway node was designed in a way to be fed through a 12V/1A Adaptor. The feeding unit contains transformers for 4.2 V max. 2A GSM voltage and 3.3 V 100 mA RF unit voltage needed for 12 V entrance voltage. LM2576 Series, SIMPLE SWITCHER 3A Step-Down voltage regulator was used for 12 -4.3 V transformer. Working with a 52 kHz Internal Fixed Frequency oscillator high level voltage regulation was obtained. LM1117-3.3 800 mA Low-Dropout Linear Regulator numbered LM1 was used for 4.2 -3.3 V transformer. The feeding of the medium node connected is obtained through J3 terminal.

Transceiver
RF unit was designed in IEEE 802.15.4 standard used for personal domain networks using small low-power digital radio to support the typical networks such as wireless star topology and tree topology and the general mesh networks. Data security was aimed to be established by customising with high level communication protocols. The 3.3 V supply voltage is provided by LM1117-3.3 800 mA Low-Dropout Linear Regulator numbered LM1. In the RF unit of the gateway node IEEE 802.15.4 CC2530 ZigBee module was used. The working frequency is 2.4 GHz. The data transmission rate varies between 20 and 900 kilobit/second. The active running is 28 mA in RX mode, 68 mA in TX mode and varies between 1 and 200 A in Sleep Mode. It completes its transition from sleep mode to active mode in just 30 ms. The task of the RF unit is to transmit  the data it collects from the sensor nodes in the environment over the network structure through the Serial UART module to the GSM/GPRS unit at a speed of 9600 baud from the J2 connector.

Processing unit
As it is known, the microcontrollers are micro-computers containing a microprocessor, a data and program memory, digital (Logical) inputs and outputs (I/O), analogue entries and other peripherals that add more power and functionality such as timers, counters, switches, analogue-to-digital converters put together on a single silicon chip. On the node, the MSP430G2553 model of the Texas Instruments company was used. The 3.3 V supply voltage is provided by LM1117-3.3 800 mA Low-Dropout Linear Regulator numbered LM1 on the circuit. Its task is to provide the coordinated working between the RF unit and the GSM/GPRS unit and to provide the transfer outside the sensor data it receives from the RF unit by means of the GSM/GPRS modem. Quad-Band 850, 900, 1800, 1900 MHz frequency at 1 W 1800/1900 MHz power was used. There is one SIM card connection. The supply voltage of Max. 2A, in the range of 3,4 V to 4,5V is provided by the SIMPLE LM2576 series SWITCHER 3A

SIM900 GSM/GPRS module of SIMCom Company in
Step-Down Voltage regulator as nominal 4.2 V 3A. Its task however, is to collect the data accumulated in the network structure in the central server via mobile data transfer over the Internet, in other words, it is the door of the sensor networks opening outwards.

Operation
Out of the 12 V, 1 A, 12 W input voltage 4 V SIM900 supply voltage is formed by SIMPLE SWITCHER 3A Step-Down Voltage Regulator. And gateway node voltage is formed by LM1117-3.3 800 mA Low-Dropout Linear Regulator. Through J1 terminal voltage is sent to the gateway node, and through J2 terminal serial data transfer is carried out at a speed of 9600 baud and the GSM and GPRS functions are conducted by means of AT commands. The on/off signal sent is strengthened over R4, R3 and Q1 by the MSP-PWRKEY pin and applied on the SIM900 Power Key input. CR2032 was used for the battery and the 1N4148 as well as the SIM900 memory. As for the StatusLED; the signal for turning on LED sent from the SIM900 is strengthened by the members R8, R7 and Q3 and the Status LED is turned on with the R10 current-limiting resistor. For NetLightLED, the signal for turning on the LED sent from the SIM900 is strengthened by the members R6, R5 and Q2 and the NetLight LED is turned on with the R9 current-limiting resistor. The SIM card of the relevant GSM operator is inserted into the SIM card slot connected into the circuit in order to establish communication in 800-900 and 1800-1900 MHz network frequencies. The circuit diagram of the SIM900 GSM/GPRS node is given in Figure 4. The gateway node designed can be used with other sensor nodes by means of connecting relevant ends into the SIM900 GSM/GPRS module.

SOFTWARE DESIGN
The software was developed in Code Composer Studio provided freely by the Texas Instrument company. The data coming from the sensor nodes in the environment arrive at the CC2530 ZigBee module available in the gateway node. The data arrived is processed by the MSP430 processor and sent to the GSM/GPRS Dener. 217 module. The MSP430 being used as a microcontroller communicates with the CC2530 ZigBee module being used as a transceiver over SPI line. It communicates with the GSM/GPRS module over the UART line. There are 2 conditions on the data coming to this GSM/GPRS module: 1. For standard applications where there is no threshold value, the data is directly saved on the database. 2. For critical application where there is a threshold value however, the data is saved on the data base as well as transactions such as sending a message/making a call to the registered numbers are performed. These situations are described in Figure 5. PostgreSQL was used as the database. The data that come to the database however, can be transiently monitored and tracked over the web or mobile based application in real time. This was described in Figure 6. Data limitation on the general protocol run on ZigBee networks is shown in Table 1. Due to the fact that the gateway node developed is programmable, this packet structure can be customised. The network table created by the network addresses assigned to the devices in the ZigBee network is given in the Figure 7.
By means of carrying out Channel and Address adjustments on the gateway node designed, the gateway node can even be used together with different sensor nodes.

TESTING AND RESULTS
In order to evaluate the performance of the gateway node, two tests were run: 1. CPU usage. 2. Power consumption.
Results are given below.
1. The CPU usage was very small in all conditions. Approximately, it was 1%. 2. Power supply ratings of the gateway node depend on factors like configuration and load on the node. The gateway with a 12V power supply and measured current consumption in 6 scenarios were powered: 1. Gateway Node is POWER DOWN mode 2. Gateway Node is SLEEP mode 3. Gateway Node is IDLE mode 4. Gateway Node is TALK mode 5. Gateway Node is DATA mode, GPRS (3 Rx, 2Tx) 6. Gateway Node is DATA mode, GPRS (4 Rx, 1 Tx) Average supply currents are given in Figure 8. Figure 8 indicates that the average supply current is as follows: Scenario 1 -0.03 mA, Scenario 2 -1.5 mA, Scenario 3 -200 mA, Scenario 4 -235 mA, Scenario 5 -435 mA, Scenario 6 -266 mA. Therefore, this gateway node can be used in wireless sensor network applications.

CONCLUSIONS
The study is on a development made on a gateway node      network structure can be established. This way, unnecessary power losses and program complications can be eliminated and new algorithms and techniques can be developed in terms of speed. Also, as a result of the gateway nodes being programmable: 1. An environment in which researches can be made in Wireless Sensor Networks was established 2. It was ensured that the theoretical knowledge applied in the Wireless Sensor Networks was reduced to a level that can be used in the daily life.
Thus, with the gateway node which is the subject for this study, a gateway node can be used in the areas requiring wireless sensor networks to be used such as smart home systems, building security systems, vehicle tracking systems, monitoring of power transmission lines, control of illumination systems, fire tracking systems, monitoring of patients, monitoring of medical parameters, earlier prediction of natural disasters, monitoring of agricultural activities, guarding of battle grounds and locating mobile targets. However, there is no such comprehensive and trouble-free solution in the known condition of the technique.
With the production of gateway node, rational, cheap, easy-to-use sensor nodes have been put into practise for people conducting researches in Wireless Sensor Networks and for Wireless Sensor Network applications in the field of application.

Conflict of Interests
The author has not declared any conflict of interests.