IEEE 802.11 AND LORAWAN FOR WIRELESS SENSOR NETWORK DATA TRANSACTION IN NON-INFRASTRUCTURE AREA

ABSTRACT


INTRODUCTION
Wireless Sensor Networks (WSNs) constitute several sensor nodes that gather the physical information of their environment and report the information to a sink. The sink is a node with a connection to the outside network to be able to deliver the information to the designated users. Early disaster detection system, such as forest fire detection [1,2], land sliding detection [3], and tsunami detection [4], is among the most common WSN application. With the emergence of smart and precision farming systems, WSN has been implemented to monitor farming parameters such as temperature, soil humidity, and air humidity [5]. Both the early disaster detection and the smart farming WSNs usually are located in areas where there is no public telecommunication infrastructure. Datalink protocol used in WSNs such as IEEE 802.11 [6], IEEE 802.15.4 [7], and S-MAC [8] commonly has a short transmission range (up to 100 m) which is far from enough for transmitting the information frame to the designated user or the nearest location served by public infrastructure. Utilizing satellite transmission enables the sink to deliver the data to any location, however, it is costly. Long-range wide area network (LoRa WAN) technology enables low-rate data transmission up to 30 km of transmission range [9]. Many recent studies have implemented LoRa in developing IoT and WSN systems, such as smart agriculture [10,11], flooding detection [12], and land sliding [13]. In the studies, the nodes communicate to a central server using the LoRa network to achieve a long-range transmission. There are several drawbacks to implementing LoRa in sensor nodes. Having a long transmission range causes many nodes can interfere with each other, which increases the probability of data collision. Moreover, LoRa WAN implements an ALOHAlike channel access mechanism, which does not support carrier sense mechanism and ack-based data transmission. This makes the nodes have no mechanism to prevent a frame collision or to know whether a frame is delivered successfully or not. Economically, providing every node with a LoRa module is also quite costly because commonly a microcontroller (e.g., Arduino or ESP series) is not equipped with the LoRa module. A study in [14] proposes the use of Lora in the gateway (sink) of an IoT system. In this study, as soon as the gateway receives a frame, it forward the frame to the outside network. A study in [15] developed a system where a gateway pools all the nodes in a network for their data, combines the data into a LoRa payload and sends the data to the outside network using LoRaWAN. In our work, we develop a system that integrates the IEEE 802.11 network and LoRa WAN for a WSN located in an area without an internet connection but has a steady supply of electricity, either by connecting to a power grid or using solar panels. Such a condition usually suits the farming field located in a rural area. For communication within the WSN, we use IEEE 802.11 network since many microcontrollers are already equipped with IEEE 802.11 modules. The sink uses LoRaWAN to send the data to the outside network. The frames carrying regular information are forwarded in a group of frames similar to the work in [15], meanwhile, the frames of time-critical information are forwarded immediately to reduce the time delay similar to the work in [14]. The rest of the paper is organized as follows. In section 2 the method of developing the system is described. Section 3 discusses the implementation and testing of the system. In section 4 we summarize the work.

System Design
This research considered a wireless sensor network (WSN) located in an area with no public communication infrastructure. The sensor nodes communicate with the sink via IEEE 802.11n network. Since there is no internet in the area, the sink is connected to a gateway in the nearest area with internet access using Long Range Wide Area Network (LoRaWAN). The block diagram of the system is shown in Figure 1.

Figure 1 Block Diagram System
Periodically, nodes sent sensing data to the sink to be stored in a database. In our implementation, when there was no critical event detected, the node sent the regular sensing data every t 1 unit time, otherwise, the node sent the sensing data every t 2 unit time. The payload of the sensing data consists of node id (2 bytes), sensing data (10 bytes), and frame status (1 byte). The frame status is either regular (character '1') or critical (character '2'). The sink stored the data in a database after adding the date and the time when the data was received. The format of the stored data is shown in figure 2.

Figure 2 Format of Stored Data in Sink Database
The sink queried the database periodically (in our implementation every 1 second) to check the number of unsent data. The regular data was only forwarded to the internet gateway when the combined size of each data reached 256 bytes ( the maximum payload size of LoRaWAN). In our implementation, as the size of a single data was 23 bytes, each LoRaWAN frame can send up to 10 regular data. Since in some countries, the maximal duty cycle of LoRaWAN is regulated [16], sending regular frames which have a flexible delivery time in a group of 10 frames reduces the number of frames sent in LoRaWAN. When critical data was found, the sink immediately sent all the critical data and the remaining regular data to the internet gateway.  The QoS parameter used in the testing are • Delay Delay was defined as the difference between the time a data frame is received in the sink and the time a data frame is received by the internet gateway. The delay was measured separately for the regular data and the critical data. • Packet delivery rate (PDR).
PDR was defined as the percentage of data received by the internet gateway to data sent by the sensor nodes.

RESULT AND DISCUSSION
This section is divided into three parts, namely system implementation, QoS Measurement, and discussion and analysis

System Implementation
The first stage in implementing the system is to develop communication between the sensor node and the sink via IEEE 802.11 (WLAN) protocol using ESP8266WIFI and ESP8266 HTTP libraries.
There are three types of sensing data sent by the nodes, namely temperature, air humidity, and soil humidity. Besides that, the nodes also send their id and the type of the frame (regular or critical). The code for sending the frame from ESP8266 (sensor node) to the sink is shown in Figure 4.

Figure 4 Code for Sending Frames from Nodes to Sink
In the sink, a PHP script stores the data in the frame in a MySQL database. The PHP script is shown in Figure 5.  Figure 6 shows a successful critical frame transmission from a node to the sink.

Figure 6 A Successful Frame Transmission
In the sink, a Phyton program is running to check the number of unsent frames in the database and combine the frame to form a LoRa payload. The configuration of the LoRa module is shown in Figure 7.

Figure 7 LoRa Configuration
A payload of regular data consists of 10 frames, i.e., the program waits for 10 unsent frames before forming and sending a LoRa payload. When the program detects at least an unsent critical frame, the program immediately forms a payload. It then sends the frame(s) along with the remaining regular frame(s) given there is still free space in the payload (the maximum size of a payload is 255 bytes). The critical frames take priority over the regular frames. The program to form and send LoRa payload is shown in Figure 8  The result of a successful LoRa Transmission is shown in Figure 9. When there is no critical frame, the payload is only formed and transmitted when there are at least 10 frames. As soon as there is 1 critical frame, the payload can immediately be formed and transmitted.
(a) regular frame (b) critical frame

QoS Measurement
Considering the small size of each frame (23 bytes) and the data rate of the IEEE 802.11 (54 Mbps) network, the major factors contributing to the delay are the processing delay in the sink and the transmission delay in LoRa Network. The processing delay in the sink is the time needed to form the payload. In the case of only the regular frame received, it takes some time to form a payload of 10 frames. The transmission delay of the LoRa network depends on the bandwidth, the coding rate, and the spreading factor used. In our configuration, the data rate is around 7 kbps [17] which gives the transmission delay about 0.026 s to 0.26 s. Figure 11 shows the average delay of each frame in a network sending solely regular data frames. The interarrival time between frames varies from 30 seconds to 5 minutes. The number of sensor nodes in the network varies from 2 to 5 nodes. The result shows that the more the number of nodes in a network the smaller the delays of the network, given the same interarrival time. This is dues to the fact that with a bigger number of nodes, it is faster to reach 10 frames requirement in the sink to form a LoRa payload.

Figure 11
Delay of Regular Frames Figure 12 the average delay of a network of 2,3, and 4 nodes sending the solely critical frame. The result shows that the network with 2 nodes and a 5interarrival time gives the best delay since most frames reach the internet gateway in the same second, they were sent by sensor nodes. As the number of nodes and the frequency of each node sending its frame increases, more frames reach the internet gateway 1 second after they were sent by the sensor nodes hence the delay increases.

Figure 12 Delay of Critical Frames
Next, we consider a network where some of the nodes send regular frames, and some other nodes send critical frames. We use the interarrival time of the critical frames equal to 3 s and the interarrival time of regular frames equal to 60 s. Figure 13 shows the delay of a network of 5 nodes when the number of critical nodes increases.

Figure 13 Delay of Regular Frame in WSN sensing critical and Regular Frames
The packet delivery rate (PDR) is defined as the percentage of the frames received by the internet gateway to the number of frames sent by the sensor nodes. In our system, all the frames sent by the sensor nodes are successfully received by the internet gateway, thus giving the PDR of 100%.

Discussion
In the previous works of developing WSNs with LoRa gateway, the gateway either forwarded the frames sent by the sensor nodes immediately after they are received by the sink [14] or gathered the sensing data frames from all the nodes and send them as a group [15] to minimize the duty cycle of LoRa network as the requirement in [16]. Waiting for all the sensor nodes to send their frames before forwarding them to the outside network causes the system to have large latency. In [15], the polling time increases from 975 ms to 5518 ms when the number of nodes in the network increases from 1 to 5 nodes. When there are more nodes in the networks, the polling time can be further increased. It would not be a problem when the frame contains regular information and there is no immediate action required (e.g., temperature when there is no fire detected). However, when the frame contains time-critical information, postponing the delivery of the frame can cause serious consequences.
Our system differentiates the frames sent in WSN as the frames containing regular information and the frames containing time-critical information. When there is no critical event detected, the information gathered by the sensor nodes does not change rapidly over time. For example, when there is no fire detected, the temperature change between 5 minutes of sampling time is subtle. Delaying the delivery of the information to maximize the use LoRa payload will not be a problem. When an event is detected, the sensing frames need to be delivered immediately so the users of the system can take the required action.
The measurement of our system shows that the delay of the critical frames is much smaller (0.3 -1 s) than the delay of regular frames (up to 600 s). This satisfies the balance of minimizing the number of packets sent in LoRaWAN for regular packets while still having a small delay for the critical frames.

SUMMARY
In this work, we have developed a data transaction model of WSN located in an area without public telecommunication infrastructure by integrating the IEEE 802.11 network and LoRaWAN. The frames transmitted by the sensor nodes are classified into a regular frame and a critical frame. In our system, the regular frames are transmitted by the sink to the nearest location with internet access in a group of 10 frames, meanwhile, the critical frames are transmitted immediately. The measurement of the system shows that the time delay of regular frames varies from 16 to 602 seconds and the delay of critical frames varies from 0.3 to 1 s. Moreover, the packet delivery rate of the system is 100%. Based on the measurement, our system successfully maintained the QoS of the system, i.e., the delay of critical frames and the PDR while reducing the number of frames transmitted in LoRaWAN.