Wireless sensing modules for rural monitoring and precision agriculture applications

ABSTRACT In this work, a new design of wireless sensing modules for the wireless sensor network was proposed and the specifications were tested (Received Signal Strength Indicator – RSSI, Packet Reception Ratio – PRR, Link Quality Indicator – LQI) in comparison with some commercial products. Indeed, we focus on the design of wireless sensing nodes and programming of the data transfer protocol for wireless sensing nodes (from the PHYSICAL layer to MAC layer) Experimental results show that the designed wireless sensing modules have the potential for real-world application with read-range (over 150 m), RSSI (bigger than –80 dBm), LQI (bigger than 108) and PRR (over 99%) in the range between 0 and 150 m.


Introduction
The wireless sensor network (WSN) has been applied in many applications such as military (Atzori, Iera, & Morabito, 2010;Shelby and Bormann, 2009), healthcare (Alemdar & Ersoy, 2010;Holleman, Yeager, Prasad, Smith, & Otis, 2008), agriculture (Coates, Delwiche, Broad, & Holler, 2013;Xiaohong & Guodong, 2012), and environment (Ghini, Bettiol & Hamada, 2011;Romer & Mattern, 2004;Xufeng , Xiong, Hu, Xie, & Zhou, 2013). With the rapid growth of WSN in the recent years, Internet of Things (IoT) has attracted lot of researchers from both academic and industrial institutions (Atzori et al., 2010;Shelby & Bormann, 2009). In real-world applications, WSN is capable of working in a wide space for data collection to host centre and then decision support according to the change of environmental factors (Ghini et al., 2011;Romer & Mattern, 2004;Xufeng et al., 2013). WSN composes of many wireless devices (sensing nodes), with compact sensor and low energy consumption, communicate through the wireless connection. The data acquisition between sensing nodes is based on wireless communication from sensing nodes towards gateways to collect information from the environment or neighbour devices. Therefore, the main researches in WSN focus on hardware optimization for wireless sensing modules and gateway or improvement of network protocols for specific applications in real-world (Zhang, Yang, & Chen, 2010).
Currently, the price of commercial wireless sensing modules, MicaZ (http://www. memsic.com/userfiles/files/Datasheets/WSN/micaz_datasheet-t.pdf), TelosB (Http://www. memsic.com/userfiles/files/Datasheets/WSN/telosb_datasheet.pdf) or Zolertia http:// zolertia.sourceforge.net/wiki/images/e/e8/Z1_RevC_Datasheet.pdf Piyare & Lee, 2013) are still expensive, while their read-range (several tens of meters) has not been satisfied for long-range application, especially for rural areas (Halfbrodt & Kumar, 2010). Meanwhile, some applications such as precision agriculture or environmental monitoring often requires large amount of wireless sensing modules for accurate data collection and decision support. As the result, it leads to a significant increase in the cost of the final system (for both sensing nodes and gateways). Accordingly, the design of wireless sensing modules with low-power RF transceiver and high-speed processors is an interesting contribution for WSN and IoT applications (Figure 1).
In this work, we focus on the design of wireless sensing nodes and programming of the data transmission protocol for wireless sensing nodes (from the PHYSICAL layer to MAC layer) (Callaway, 2004;STM32L15xx6/8/B Datasheet). For this purpose, we used the microprocessor STM32L152 (MRF24J40Md/ME Datasheet) and wireless modules MRF24J40 (Shamanna, 2013), sensor SHT11 … will be programmed with Keil-C, then the performance parameters were measured (read-range, PER, RSSI, and LQI) in comparison with commercial products by the related method (Digital Sensor SHT1x Datsheet). This paper is organized as follows: Section 2 presents the method of design and data collection program for proposed wireless sensing modules. Then, the experimental results and discussion are presented in Section 3. Finally, the conclusions are presented in Section 4.

Design scheme
From the available context, the commercial wireless sensing modules such as TelosB® (Http://www.memsic.com/userfiles/files/Datasheets/WSN/telosb_datasheet.pdf) or Zolertia® http://zolertia.sourceforge.net/wiki/images/e/e8/Z1_RevC_Datasheet.pdf (Piyare & Lee, 2013), etc. are quite expensive for many applications. Furthermore, the Figure 1. Block diagram of a sensor node in WSN networks (Zhang et al., 2010). read-range is also another limitation for the wide expansion for these commercial modules. Therefore, the design of a new wireless sensing module for WSN with improved specifications and economic prices is an essential contribution to real-world application, especially in rural-area monitoring or precision agriculture. The main function of wireless sensing modules in WSN is to collect environmental data from an on-board sensor and then process in the microprocessor (MCU) before transferring to another sensing node towards the host computer.
All the components are surface-mount devices with compact sizes, however it leads to some difficulties in soldering the prototype boards (especially in connecting to the specific sensors such as temperature, humidity, pH, moisture content, and light intensity). In this work, we propose the new prototype of sensing nodes for WSN ( Figure 2) which are supported by different types of UART from MCU to actuators' standards (water pump, light bulbs, chiller, solar system, and PLC) in real-world applications.
After fabrication of prototypes (Figure 2), the firmware for wireless sensing modules is embedded in order to get the below functionality: . Read the signal from the specific sensor (temperature, humidity, light intensity, and pH) . Send collected data from sensors to other wireless sensing modules through radiofrequency signals. . Transfer data between the sensing modules by specific protocol to minimize power consumption and maximize the fidelity.
Embedded firmware controls the process of working with hardware components in order to check if the actuators execute properly the command from MCU as seen from the schematic blocks in Figure 3. The embedded firmware for MCU (in this work is STM32L152C8T6) is written in Keil-C compiler (Uvision 5.15), using the library for ST STM32L15x provided by the manufacturer. The Keil-C compiler allows the programmer to edit, compile and debug on the same interface and supports both C and Assembly programming languages. In real-world applications, there are three different kinds of sensing module as follows: . Sensor node (member node): in charge of data collection from the sensor, and regularly sends collected data towards the gateway node through the X-MAC protocol. When there is no data to send, sensor nodes will be switched to sleep mode to save energy. . Gateway node (cluster head): in charge of receiving data from the sensor nodes and transferring towards the controller node. Gateway nodes will also be in sleep mode during non-working with other nodes. . Controller node (Sink): is connected directly to the host computer, and is in charge of receiving data from gateway nodes. The data sent from controller nodes to the host computer will be processed to create appropriate commands for actuators. This node will always be in the active mode and waiting for data from sensor nodes and gateway nodes. The algorithms for each sensing module will be explained in the next section.

Algorithm for sensor nodes
The algorithm for sensor nodes is described in Figure 4: . Sensor nodes first wake up and check for idle channels by checking the RSSI values. If the RSSI value of a channel is higher than a certain threshold, i.e. it is a busy channel. If the channel is available for use (idle), then the sensor node sends the preamble to the gateway node. . Next, if the gateway node replies by Early-ack, the sensor node then starts sending data to it. Otherwise, sensor nodes will sleep and wait for receiving Data-ack. . After some cycles (normally three cycles) of Data-ack, if the sensor node does not receive Data-ack, it continues to send data again. Until 10 cycles of sending data and receiving Data-ack, the sensor node will automatically enter the sleep mode.
For specifications' test in the next section, the data frame of a sensor node includes the below fields (Table 1): . Zone_ID: Cluster address . Node_ID: Node address in the cluster . Temp_prefix: letter 'T', warning to start the value of air temperature . Temp_value: value of air temperature . Humi_prefix: letter 'H', warning to start the value of air humidity . Humi_value: value of air humidity . End: characters '#', define the end of data frame from sensor nodes

Algorithm for gateway nodes
The data frame structure of the gateway node is similar to the sensor node as shown in Table 1. The algorithm for gateway nodes is described in Figure 5.
. First, the gateway node wakes up and checks if the data packet has arrived. If yes, the gateway node then checks whether this is the preamble that was sent from sensor nodes. Otherwise, it sends its own data to the controller node and switches to the sleep mode. . If there is preamble sent to the gateway node, it will respond to sensor nodes by Earlyack and continue to wait for data. Then, the gateway node checks if the data received is correct. Otherwise, it waits for another data package. . If data package was received correctly, the gateway node will reply with Data-ack, then send the received data to the controller node. . For the next cycles, the gateway node continues to check the incoming data packets, and it will switch to sleep mode if no data packet.

Algorithm for controller nodes
The algorithm for controller nodes is described in Figure 6. Controller nodes are always in standby mode to receive data packets. When a packet arrived at the controller node, it will be checked if this packet is sent correctly to this node. If it is true, the controller node continues to test the checksum of packets and sends data to the host computer. Otherwise, the controller node continues to wait for data packets. As in Table 2, the data frame of a controller node sent to a host computer includes the below fields: . Data from the sensor node: the field of the data frame sent from sensor nodes to the gateway node (as in Table 1). . LQI_prefix: Letter 'L', warning to start the value of LQI from the gateway node to the controller node. . LQI_value: value of the LQI parameter . RSSI_prefix: the letter 'R', warning to start the value of RSSI from the gateway node to the controller node. . RSSI_value: value of the RSSI parameter . End_of_file: Letter '$', define the end of data frame from gateway nodes.  After running tests on designed sensing modules, the program achieved the requirements such as data collection (air temperature/humidity, soil moisture, light intensity and pH ) as well as exchange of data between nodes with the energy-saving protocol. With the proposed MAC-layer protocol by the authors, the sensing nodes automatically switch into 'sleep mode' in case of no data-exchange. As a result, this leads to significant energy saving, thereby increasing the lifetime of the sensing modules (with fixed battery) in real-world applications. However, the protocol and functionality still have some limitations and need to be improved for commercial products as explained in the next paragraphs.

Application layer: user interface design of data collection for WSN
As mentioned in the previous sections, the purpose of data collection and then data processing is to help the managers or farmers in decision making in real-time (in this work, we used an irrigation system as the demonstration). In Figure 7, the data collection program is written in C# on Visual Studio 2010® with database SQL 2008®.
From Figure 7, the data collection program from wireless sensing nodes includes the following components: . Serial Links: Connection between the program and the controller node through UART-USB connection modules. . Data Processing: Analysis of received data packet to determine the necessary information. . Display and Notification: the analysed data are displayed by dashboard visualization. The notification for the manager is based on collected data and compared with the reference dataset (which is imported by the manager or expert) to facilitate the decision support. In this work, a user interface for the irrigation system is demonstrated as in Figure 8. . Data Storage and Report: Collected data are stored in the SQL database and reported in real-time for troubleshooting.
From Figure 8, the user interface for data collection program for WSN is described with basic functionality (data storage and processing, display, report, notification, and connection to actuators such as water pump and light bulbs, etc ) and extension modules for future application. Furthermore, the program could be used to measure the specifications of sensing modules such as (RSSI, LQI, and PER) that is very useful for the characterization of designed modules in the next section. However, the program in this work is just tested for WSN with a simple topology (five sensing modules as shown in Figure 9). In fact, there could be some modifications of performance when the number of sensing modules increases in network topology. Some functions of embedded firmware in the physical layer are also linked to the data collection program: reading values from sensors such as SHT11 (air temperature and humidity) (5TM soil moisture and Temperature Sensor Datasheet) and 5TM (soil temperature and moisture content) (Buettner, Yee, Anderson, & Han, 2006). The collected data between sensing nodes are transferred through Zigbee-based wireless standards toward gateway and the host computer. With the data collection program, the user could also compare with the reference dataset, then send the command to actuators and set to sleep mode for energy saving. Furthermore, the data transmission protocol between the sensing modules is based on the X-MAC protocol, with some adjustments for optimizing performance parameters (Read-range, RSSI, LQI, and PRR ).

Experimental results and discussion
In this section, the characterization of designed sensing modules is described and their performances compared with available products (TelosB, Zolertia). The important specifications (RSSI, LQI, and PER) are presented and measured with the data collection program with the measurement method as described in Figure 10.

Theoretical background
Received Signal Strength Indicator (RSSI) is the total received signal power at the receiver (in this case it is the sensing module), calculated in mW or in dBm. Typically, RSSI of available  wireless sensing modules is in the range from −20 to −110 dBm. From theory, the average value of RSSI could be calculated as follows (Rajan & Soman, 2015): where RSSI_val is an average value of RSSI at a measured point, m is the number of samples, and RSSI i is the measured value of each sample. Normally, RSSI (in dBm) is presented by the 8-bit value in the range between 0 and 255. In the experiment, the received power (measured in dBm at the receiver) is considered as RSSI, and described in the conversion table from the manufacturer datasheet (Rajan & Soman, 2015).
Besides RSSI, Packet Reception Ratio (PRR) is another important parameter to characterize the performance of wireless sensing modules in real-world applications. PRR is calculated by the ratio between the number of successfully received packets on the receiver and total number of sent packets from the transmitter. This parameter represents the average percentage of received packets and can be calculated by the following formula: where TPR is the total received packets at the receiver and TPT the total sent packets from the transmitter. Next, Link Quality Indicator (LQI) is another index, that is, described in IEEE 802.15.4 standards. This parameter measures the error rate of modulation in the successfully received packets. LQI is the parameter of measuring the link quality (channel quality), and based on bit error rate (BER) and RSSI. Normally, the LQI value changes from 0 to 255, which represents link quality in wireless transmission and could only be estimated by experimental measurements (Texas Instrument CC2420 datasheet, http://www.ti.com/lit/ds/symlink/ cc2420.pdf).
From the datasheet from the CC2420 manufacturer (IEEE Standard 802.15.4-2003), LQI parameters could be calculated from PER (that is defined by 1-PRR). As in the datasheet (IEEE Standard 802.15.4-2003), the LQI value could be calculated from RSSI and the COR-RELATION value. During the experiments, we swept 'a' and 'b' parameters of the preamble in order to find the optimized Packet Error Rate − PER (PER = 1 − PRR). After fixing the optimized PER, this leads to an optimized 'CORRELATION value' as shown in Figure 11. Then, the LQI value could be defined from RSSI and CORRELATION values as the definition Figure 11. The data frame structure of CC2420 with RSSI, CORRELATION to calculate the LQI value.

Measurement method and experimental set-up
In Figure 12, the measurement set-up for this experiment includes both hardware and software requirements: . one host computer: with the data collection program (as described in the previous section) to receive data by serial transmission from on-board wireless module. . two prototypes of designed sensing modules: one for continuous data transmission and another one for continuous data receiving. . one sensing module (serial transmission to the host computer): for data transmission from the receiver to the host computer. . two source codes of embedded firmware for both transmitter and receiver modules. . Data collection program and display user interface for RSSI, PRR, and LQI. . Algorithm of the transmitter module: The transmitter module will send continuously 7000 data packets to the receiver module. Each packet is sent after the previous one by approximately 25 ms, without waiting for ACK. After sending all data packets, the transmitter module will exit the program. . Algorithm of the receiver module: The receiver module is always idle to receive data packets. After receiving a data packet, the counter of the receiver will increase by a Figure 12. Configuration of measurement for designed sensing modules.
value of 1 and calculate the parameters (RSSI, PRR, and LQI) before sending towards the host computer.
After finishing the hardware/software set-up, the procedure of measurement is as follows: . Environment for test: outdoor, no obstacle. . Load the embedded program for the transmitter (sensing module B) and receiver (sensing module A). . Connect the receiver to the host computer by a USB cable. . Put the receiver module on the support shelf (1 m above the ground), two modules are set in operation under the same channel (here is channel 11). . Check 2 modules again and make sure they are already connected together, then move the transmitter module far away from the receiver. . Transmission power of the sender is set to 9 dBm (7.94 mW) and could be increased to a maximum transmission power of 19 dBm (http://www.ti.com/lit/ds/symlink/cc2420. pdf). . During the test, the receiver module will analyse the received data packets to retrieve the values RSSI/LQI, which are then forwarded to the host computer and stored in the data collection program. . RSSI/LQI values are calculated from the mean value of 400 RSSI values at each measurement point. At each point, the value of PRR is calculated by the ratio between the received packets (at the receiver module) and the total sent packets (7000 packages, delay of 25 ms/each packet at the transmitter) with the counter on the data collection program. . The measurement for each point is repeated with a step of 5-10 m as the above procedure.

Experimental results and discussion
In this section, the experimental results of RSSI/LQI/PRR by the described method in the previous paragraph will be discussed. First, measured RSSI are shown in Figure 13. The Figure 13. Experimental RSSI (dBm) as a function of distance.
RSSI value describes the strength of the received signal. When the distance between transmitter/receiver increases, the RSSI value will proportionally decrease. However, there is some threshold of received signal, which is called receiver sensitivity, which the receiver could not receive from the transmitter. In reality, the power threshold of the incoming signal should be bigger than receiver sensitivity (−86 dBm) in taking into account the background noise level. Compared with commercial modules, RSSI values of the designed sensing module are much improved. As a result, it leads to a better read-range of the transceiver in the experimental test (more than 150 m in comparison to 60 m of TelosB Callaway, 2004 and 100 m of Zolertia Z1 STM32L15xx6/8/B Datasheet). From Figure 14, the measured LQI according to distance can be seen. Similar to experimental RSSI, LQI values also decrease proportionally to the distance between the transmitter and receiver. The LQIs are almost constant until a distance of 70 m, and then fluctuate after 100-110 m (similarly RSSI also decreases significantly from 110 m). The correlation between measured RSSI and LQI values as a function of distance between the transmitter and receiver can be noted from the RSSI and LQI values. In the measured range of distance (0-150 m) as shown in Figure 15, the experimental PRR also decreases as a function of  distance between the transmitter and receiver. The measured PRRs are always over 99%, but this result only determines the number of received data package. Indeed, the BER characterization of each received data packet is not feasible in this work. Therefore, this result should be improved with BER measurement to determine the number of packets received exactly for more scientific purposes.
The implemented wireless sensing modules in this work were designed and tested with important specifications and flexible for different types of commercial sensors in real-world applications. Furthermore, the important parameters (such as RSSI, LQI, and PRR) are very good in the measurement range between 0 and 150 m. But the BER characterization for these sensing modules should be executed in the next phases towards the commercial products. From Table 3 it can be noted that the current consumption of this work is rather good in comparison to the commercial products and the receiver sensitivity is around −94 dBm from the datasheet of manufacturer.

Conclusion
In this work, a new designed of wireless sensing modules for Wireless Sensor Network was proposed and tested in comparison to some commercial products. From experimental measurements, the designed wireless sensing modules have the potential for real-world application with read-range (over 150m), RSSI (bigger than -80dBm), LQI (bigger than 108) and PRR (over 99%) in the range between 0 and 150m. However, the BER test should be done in next steps toward improvement for transport and network layers. The perspective of this work is the applications for precision agriculture and then data analytics for energy consumption or pest/disease prediction for yield/quality improvement crop-by-crop in agriculture.