Wireless Sensor Network Synchronization for Precision Agriculture Applications

: The advent of Internet of Things has propelled the agricultural domain through the integration of sensory devices, capable of monitoring and wirelessly propagating information to producers; thus, they employ Wireless Sensor Networks (WSNs). These WSNs allow real time monitoring, enabling intelligent decision-making to maximize yields and minimize cost. Designing and deploying a WSN is a challenging and multivariate task, dependent on the considered environment. For example, a need for network synchronization arises in such networks to correlate acquired measurements. This work focuses on the design and installation of a WSN that is capable of facilitating the sensing aspects of smart and precision agriculture applications. A system is designed and implemented to address speciﬁc design requirements that are brought about by the considered environment. A simple synchronization scheme is described to provide time-correlated measurements using the sink node’s clock as reference. The proposed system was installed on an olive grove to assess its effectiveness in providing a low-cost system, capable of acquiring synchronized measurements. The obtained results indicate the system’s overall effectiveness, revealing a small but expected difference in the acquired measurements’ time correlation, caused mostly by serial transmission delays, while yielding a plethora of relevant environmental conditions.


Introduction
Rapid advances in technology observed in recent times have positively affected most facets of everyday life, allowing for new possibilities in expressing human creativity and becoming an integral part of most professions. Innovation has become an integral aspect of agriculture, with the ulterior goal of maximizing productivity and yields. A testament to the integration of technological means in the agricultural domain constitutes precision agriculture [1]. According to precision agriculture, real time monitoring is utilized to inform decisions centered around crops and provide immediate and appropriate response.
Such an undertaking would be hardly feasible without the capability of remotely monitoring environmental, crop and soil conditions. This process is enabled by the deployment of a wide implementation-specific feedback, regarding the synchronization results, which mostly focus on serial communication delays. Results acquired from the experiments indicate that the system is effective in accomplishing the specified goals, while parameters are identified for the serial communication interface to minimize synchronization delay.
The rest of this paper is structured in the following manner. Previous work related to the subject at hand is presented in Section 2. Design requirements and the system put together to address them is discussed in Section 3. The utilized scheme for acquiring synchronized measurements is described in Section 4. The conditions present in the olive grove, the experiments that were conducted on it and the corresponding results are detailed in Section 5. Finally, conclusions are drawn in Section 6.

Related Work
The vast majority of IoT, and by extension WSN, research revolves around their appliances in smart city environments [21][22][23]. This is especially true for IoT environments that are realized through WSNs [24]. More specifically, the abundance of small but powerful smart devices, which act as sensors and are equipped with high processing and network functionalities, has led to the formation of flexible and scalable WSNs with high accuracy and quality performance in many fields of modern life [25]. Characteristic examples refer to their adoption in domains such as healthcare [26], industrial infrastructures [27,28], marine environments [29], underwater [30,31] and air [32,33] pollution detection systems, structural health monitoring systems [34], unmanned aerial vehicles [35] and even the military [36]. Nevertheless, a popular trend nowadays refers to WSNs' application in the agricultural sector. This section lists past related research in the field focusing on modern challenges, one of the most crucial being time synchronization. It also provides insight regarding various past and ongoing projects in precision agriculture.

WSNs in the Agricultural Domain
There exists an increasing research volume [37][38][39][40][41][42] investigating WSNs' potential in smart farming and precision agriculture [11]. Until recently, these domains faced many challenges, mainly due to the lack of wide-area connectivity, energy resources and sometimes harsh environmental conditions that made difficult or even impossible the deployment of WSNs. Innovative and cutting-edge technological advances, however, have paved the way for new low-cost wireless technologies, e.g., ZigBee [43], that take us to places previously unexplored, allowing us to test, administrate and record the dynamics of such systems in secure and credible ways [44].
As such, many systems have been developed that focus not only on classical agricultural applications [45], such as crop monitoring [40], disease countermeasures [46] and pest detection [47], but also on various other aspects of farming, as stated in [4], where the needs of future agriculture are determined. These include (but are not limited to) management of underground planting [48], modern drone spraying and control techniques [49,50], robotic enhancements [28,51], security and privacy matters regarding the sensed data [52,53] and of course food safety and quality issues [9,10,37].
One of the current trends, however, focuses on the integration of cloud technologies to manage the huge volume of procured data. Cloud technologies free the end users, in this case the farmers, from the necessity of owning specialized equipment (hardware and software) in order to embed new services in their production lines, as indicated by Mekala and Viswanathan [54], who surveyed solutions that migrate cloud information and communication technologies, with the aim of building sustainable and remotely controlled agricultural applications. In a similar approach, Mekala and Viswanathan [55] in their project adopted the cloud computing paradigm to offer real-time services comprised of spraying, weeding, bird and animal scaring, keeping vigilance, moisture sensing, etc., while providing a data storage system for facilitating all the generated data in a smart and organized manner.
Due to their high customization capabilities, a popular WSN configuration, uses Arduino sensors [56] to generate environmental measurements and utilizes the ZigBee module for communication purposes, as described by Satyanarayana and Mazaruddin [57] and Papamichail et al. [58], whilst extensively documented by Kooijman [59]. However, with the coming of IoT, more microcontrollers have come to light in order to support or even remotely control the Arduino processes, such as Raspberry Pis [60,61], which can be setup to act as sensors [62], gateways [63], databases [64], servers [65] or fog devices [66].
Dwelling deeper into developed prototypes, that also find relevance to current work, the authors of [67] presented a WSN testbed to monitor the micro-climate of grapevine in Sicily, with the aim of managing spring period hazards. The WSN was then compared to a traditional fixed meteorological station and was proven to be more efficient in monitoring the local environmental conditions. On the other hand, Jeličić et al. [68], similarly to the current work, focused on olive groves. Olive trees, similar to grapevines, are very susceptible to diseases and weather changes and require continuous care in order to produce high quality products (mainly olive oil). Therefore, the authors described the design and deployment of a prototype, named MasliNET, that utilizes low-power sensors to keep watch over the olive groves in an energy optimized way. However, the proposed prototype is connected to the Internet, thus synchronization issues are not considered.

WSNs Challenges and Opportunities
One of the great benefits of employing WSNs for smart agriculture, as already mentioned, is the opportunities they offer through the use of low-cost mobile devices, microcontrollers and sensors, as discussed extensively in [69]. The abundance of such devices has triggered new methods that provide increased land coverage, reliable transmissions, flexibility and scalability, even under harsh environmental conditions. For example, the authors of [63] reported the design and development of an end-to-end system in Northern Wales comprising Arduino sensors and incorporating Raspberry Pis, used as gateways for interconnection with a cloud server.
To support the main cloud infrastructure and achieve reduced response time and even distribution of the network load, a subject of critical importance for system success, especially with the future coming of 5G technologies, the research community has turned to alternative solutions that take advantage of the fog computing paradigm to propose new hybrid cloud/fog models. For instance, Castillo-Cara et al. [70] proposed a scalable network architecture for monitoring and managing farms in rural areas that embeds fog computing capabilities to increase coverage and throughput. To even further enhance agricultural automation and remote sensing, these systems require processing of enormous amounts of remotely sensed data from different platforms and, therefore, greater attention is currently being devoted to machine learning methods and artificial intelligence algorithms [71,72].
Another crucial part of WSNs relates to energy consumption, which must be kept at minimum and manageable levels in order to prolong their lifetime. Many works have been reported in literature that attempt to tackle this challenge, like the ones found in [39,73]. At the same time, for efficient power management, many works analyze the role of the sink node, i.e., the node ultimately responsible for collecting all the sensed data. In [74], the authors proposed an analytical model for tackling the energy hole problem, by solving a facility location problem for selecting the optimum position for placing the sink node.

Synchronization in WSNs
In the agricultural context, the temporal variability of acquired measurements is an essential aspect that needs to be taken into account for effective monitoring and decision-making [75]. Thus, it is necessary to know the point in time that a measurement is made or an event occurs. The timestamp associated with each such measurement is usually acquired by the device carrying it out. In traditional computing environments, time issues are tackled by being connected to the Internet, which is generally not an option in WSNs due to strict cost, size and energy restrictions.
As such, the problem of synchronization arises in WSNs for multiple reasons [12]. Generally, each node is equipped with a local clock capable of tracking time locally with a certain degree of precision, determined by manufacturing parameters of the device responsible for keeping track of time. As a rule of thumb, the more expensive is the time-keeping device, the higher is the accuracy it provides and the more energy it requires [76]. In the case of Arduino boards, this clock keeps track of how long the device has been powered-on for.
Since each device maintains its own local clock and no other means of physically keeping track of time or correlation to a certain time zone are provided, it is necessary to somehow associate these timestamps to an actual point in physical time interpretable by humans. After all, if timestamp indications that are taken at the same point in physical time are completely disparate, the timestamps might as well be meaningless. Consider the case where a WSN consisting of a large number of nodes is deployed to cover a particular area. It is nigh impossible for all nodes to start operating simultaneously; consequently, their initial clocks are different and supplementing measurements with these clocks is pointless.
Correlation to physical time is often accomplished using GPS modules [13], which provide time-correlated measurements through a satellite connection. However, equipping each node with these modules can tremendously increase deployment cost, while other issues can arise, such as signal loss in suburban areas, etc. The correlation of a local timestamp to a physical point in time can be accomplished on the external device receiving the measurements, such as a laptop or remote server.
Typically, in WSNs, a single node is responsible for delivering the entire network's measurements to the outside world, known as the sink node. Because the sink node is responsible for data collection across the entire network, a reasonable choice is to instead correlate the remote nodes' clocks to that of the sink's [77], which is then associated with a physical point in time. This is a form of network synchronization that avoids the need for each individual node's clock to be associated with physical time.
Furthermore, time-keeping devices are known to drift apart, especially when subjected to harsh environmental conditions [78], which showcases the need for effective communication-based synchronization [79]. For reference, under normal conditions, the resonator of an Arduino Uno or Mega, operating at 16 MHz, lose 10s of seconds per day, a performance that is fairly poor [80] for time-critical applications. The significance of this deviation might not impact that many agricultural applications, but it is clear that even if the clocks of two nodes are synchronized at a certain point in time, their indications will eventually drift apart, creating the need for regular repeats of the synchronization process.
Another element that makes synchronization a challenging task is the fact that most applications usually only have access to the operating protocol's upper networking layers. Thus, while approaches, such as MAC layer timestamping [81] are effective, a large number of applications are not capable of utilizing them. Similarly, other approaches may require multiple rounds of communication to increase precision [82], which further drains the nodes' energy, reducing the network's lifetime and, as such, its sustainability and monitoring capacity.

System Setup
In this section, a comprehensive overview of the design requirements is procured, specifying an accessible, energy efficient and versatile system, designed for applications revolving around agriculture. Additionally, a system, along with its various components, is proposed to satisfy these requirements.

Design Requirements
According to Akyildiz et al. [25], a node in WSNs must comprise at minimum a processing unit, a transceiver, a set of sensors and a power unit. For any agriculture-based WSN, the selection of relevant environmental conditions to monitor is a fundamental preparatory step. Consequently, the set of sensors that can accurately measure these conditions, while keeping the cost and complexity of the resulting system as low as possible is equally important. Regardless of the choice of specific technologies, it is crucial for the deployed WSN to be capable of operating for extended periods of time before the need for recharging arises.
To enable wireless communication among the network's nodes, a transceiver is required. The suitability of the communication protocol is a key factor, especially when considering the system's energy efficiency and transmission delays. For the development of versatile and capable WSNs, a processing unit (typically a microcontroller) is required. This unit brings the whole system together, integrating the sensory components with the communication device and providing more fine-grained control of the system. When considering a power supply method, a primary consideration is its capacity, so that the network's lifetime is prolonged. Moreover, it would be optimal if the batteries could draw part of their energy from the environment [83], e.g., through solar panels, ultimately prolonging the WSN operation.
The equipment's size is also important in some cases. For example, when monitoring crops, some information might need to be gathered from the plants' leaves, in which case longer wires might be considered the optimal solution, in order to avoid housing the node close to the leaves where its weight can cause damage to the plant; therefore, the nodes' size and dimensions need to be carefully considered prior to field installation. Finally, it is worth pointing out that means of preventing and detecting malfunctions or external interference are worth considering, including sensors and protective cases.

Proposed System
The system proposed in this paper capitalizes on the Arduino prototyping board and XBee transceivers, which can be integrated along with sensory devices to form a versatile system, capable of serving as a WSN node. These components, along with relevant specifications, are discussed in the sequel.

Arduino Board
There is a wide variety of available Arduino boards, each featuring a different set of specifications in terms of both hardware and software, rendering them suitable for different applications. The most widespread board is the Arduino Uno [18], known to be a well-rounded board, which is heavily tailored towards new-comers in the world of electronics. Other boards worth mentioning include the Arduino Mega 2560 [19] (or just Arduino Mega), which boasts higher SRAM, more pins and a faster microcontroller, as well as the Arduino Nano [84], a much smaller board that can be customized according to an application's requirements, also boasting lower energy consumption, aimed at more experienced users.
Overall, selecting an appropriate processing unit is highly application-specific and, thus, the more generic and versatile boards are preferred in the context of this study. As such, the boards that have been used include Arduino Unos and a single Arduino Mega, serving as the sink node. While the Nano model could be considered the optimal choice for simple, real-world applications, the aforementioned boards form a fast and accessible prototyping system, which can be more easily augmented (compared to the Nano model) if the need arises, facilitating a wider variety of projects.

XBee Modules and Arduino Wireless SD Shield
XBee-PRO S2C [20] [85]. However, for the current study, ZigBee is the protocol of choice, providing high level, mesh networking and self-healing capabilities, all while boasting high levels of energy efficiency [64].
ZigBee additionally defines, according to Farahani [86], three distinct device types: (i) the Coordinator; (ii) the Router; and (iii) the End Device. Each of these types provides different functionality to address specific application needs as follows.
Routers and Coordinators are more generic device types, constantly having to be powered-on, as they are essential for establishing multi-hop wireless communication. Routers are responsible for propagating messages among nodes that are too far away to communicate directly, while the Coordinator sets up the necessary conditions and parameters for the network's operation. Only a single Coordinator may exist in a network.
In comparison, the only nodes that are able to utilize sleep mode are End Devices, which may occasionally power off to preserve their energy levels. However, End Devices are restricted in that they may only communicate with a single node, referred to as their parent. End Device parents are responsible for buffering messages until their associated End Devices "wake up" to receive them. Even though End Devices can significantly aid in decreasing energy consumption, they are not used for the purposes of the present study, as the setup needs to remain as simple as possible.
To accommodate the interfacing between the Arduino boards and the XBee modules, the Arduino Wireless Secure Digital (SD) Shields [87] are incorporated. Shields are used to augment an Arduino board's capabilities. The XBee module can be attached to the shield using a designated slot, which is attached to the board's pins. Thus, the module is able to exchange data and commands with the board via serial connection. This particular shield also features an SD memory card slot, which can prove useful as a secondary form of storage for measurements. In this case, the Coordinator is the only node of the system utilizing an SD memory card [88], in order to store measurements to be further analyzed.
Serial communication between the Arduino and the XBee module takes place in one of two modes: Transparent and Application Programming Interface (API). When utilizing the Transparent mode of operation, the XBee module functions based on its preconfigured settings; these cannot be changed during runtime, making Transparent mode too basic for most applications. On the other hand, in the API mode of operation, communication between the two devices is established by arranging data into frames. Overall, XBee modules operating in API mode are much more capable and powerful networking units and, as such, they are well-suited for the proposed system's requirements. Forming the API frames manually is a painstaking process, however, which can be simplified using external libraries. In this instance, the Arduino library by GitHub user "Andrew Rapp" [89] has been utilized.

Sensors
Related work [38] indicates that environmental parameters necessary for the monitoring of agriculture include, but are not limited to: soil moisture, temperature, humidity and ultraviolet (UV) radiation. Additionally, means of detecting unanticipated node movement, which may occur due to intervention from humans and animals, or even natural disasters, should be set up preemptively.
Accordingly, a set of sensors has been selected for the purposes of this study, which satisfy the aforementioned requirements. The RHT-03 sensor [90] is responsible for monitoring temperature and humidity. To measure UV radiation, the VEML-6070 [91] UV light sensor is incorporated into the system, providing unitless measurements, based on how much UV light is sensed. Complementary is the YL-69 sensor [92], being responsible for measuring soil moisture, while the MPU [93] accelerometer is incorporated in order to estimate node movement by indicating sudden displacements.

Power Supply
To maximize network lifetime and provide a reliable and durable source of power, a heavy duty power bank with the capability of recharging through solar energy would be optimal. In this case, Sandberg Outdoor Solar Powerbanks [94] have been utilized, which are designed to be maximally resilient and even rain proof. Moreover, they feature two USB ports each, a capacity of 16,000 mAh and built-in solar cells in order to permit energy harvesting.

Design Summary and Realistic Deployment
Putting everything together, a node is made up of either an Arduino Uno or Mega, playing the role of the microcontroller, equipped with an arsenal of sensors for monitoring UV radiation, temperature, humidity and soil moisture. XBee-PRO S2C modules, operating with ZigBee as the protocol of choice, interact with the Arduinos through an Arduino Wireless SD Shield, so as to provide energy efficient wireless communication.
A single node, along with a power bank, is stored in a protective case, which aims to prevent any malfunctions that may occur due to weather conditions, human intervention or any other external factors. A fully assembled node is depicted in Figure 1. Unfortunately, the particular protective cases being used block incoming light, affecting the UV radiation sensor's measurements. Some of the decisions made for the system's design aim to simplify its scope to more accurately evaluate its effectiveness in an experimental setup, without compromising the system's capabilities in actual deployment. The study's primary concern is to recommend a realistic system capable of providing accurate and synchronized measurements of environmental conditions. Optimizing a system for real-world deployment is highly specific to the environment and application under consideration, which is outside the scope of this study. However, a few suggestions are made when considering deployment of WSNs for real applications.
Regarding development boards, the sensing and networking aspects considered in this paper have very trivial computational requirements. Sink nodes do need more resources, especially so for memory, as they need to handle incoming messages and store the collected measurements in an SD memory card; thus, the use of a more powerful board, such as the Mega, is recommended. For reference, an Arduino Uno program merely including the library for managing the SD memory card requires about 82% of its available memory. Furthermore, the higher energy requirements for the Mega model are alleviated, as it is always connected to a computer to offload the measurements. However, fully-fledged applications can be much more computationally demanding, as they may employ Machine Learning models, advanced constructs to facilitate information dissemination and routing, such as Connected Dominating Sets [95], etc. Overall, a balance must be stricken among computational resources, price and energy consumption depending on the application's requirements.
With respect to ZigBee device types, the use of End Devices is optimal. In this case, they have been discarded to minimize factors that might interfere with the synchronization's experimental assessment, as delays brought about by devices sleeping would be hard to account for. The impact of End Devices in terms of energy consumption cannot be understated, making them essential for real applications, without significantly affecting the synchronization's effectiveness.

Proposed Measurement Synchronization Scheme
Under the strict restrictions imposed by WSNs, a simple synchronization scheme, capable of operating at the application layer, is imperative. The approach studied in this paper aims at providing the sink node's clock to the entire network, so that it may be used as a point of reference. Having received and stored a reference clock, the rest of the nodes have sufficient information to estimate the sink's clock, whenever it is needed. It should be clear that this approach does not provide any correlation to real time, but merely a means of synchronizing acquired measurements to a common point of reference.
To define things more formally, let t s and t n be the clock indications at a given point in time of the network's sink s and node n, respectively. Assume for simplicity's sake that t n > t s . At any future instance t n = t n + r, where r > 0 is the time elapsed since t n , it may be assumed that the sink's clock will correspondingly be t s = t s + r. Thus, it follows that t s − t s = t n − t n or equivalently t s = t s + (t n − t n ). Therefore, if node n is aware of t s at a local point in time t n , it is possible to estimate the sink's clock t s at any future point in time t n .
However, there are a few things that complicate this process. First, due to the jitter inherent in the nodes' clocks, in reality, there will be a small deviation for r between the sink's and the node's clock. This is not necessarily a problem, if the timeframe between t n and t n is not too large, as clock inaccuracies will not have accumulated as much in shorter time spans. Additionally, in order for the sink to inform node n of its clock, a transmission is required, which introduces additional time cost that needs to be taken into consideration.
Moreover, miscellaneous delays t m occur due to other parameters, including the serial interface between Arduino and XBee devices, ZigBee MAC layer retransmissions for collision avoidance, etc. Such delays accumulate on a hop-by-hop basis and are hard to estimate, without extensive experimentation. These miscellaneous delays are also largely hardware and implementation-specific, which are not always easily portable across different architectures and devices.
In the current system, transmitting a frame can roughly be broken down into the following steps: (i) Arduino writes the frame to serial buffer; (ii) XBee transmitter reads the message from serial buffer; (iii) XBee transmitter attempts to transmit read frame; (iv) remote XBee receives message; (v) remote XBee writes frame to serial buffer; and (vi) Arduino reads frame from serial buffer. Since the Arduino microcontroller is involved only in the first and final steps, the intermediate steps cannot be accurately timed.
However, since transmission time over the air is incredibly fast, compared to serial data exchange, only the latter is worth accounting for. The rate by which data are transmitted over a serial connection on the Arduino platform is determined by the baud rate, which by default is equal to 9600. Similarly, using the default serial settings, each transmitted byte requires 10 bits to be transmitted over serial, due to start and stop bits being added. As such, the overall transmission rate is equal to 960 bytes per second, or, equivalently, it takes about 1.041 ms to transmit a byte of data.
When measurements are transmitted in the present system, they are converted to a string datatype. Using the current string format, each measurement message is on average 91 bytes long. Therefore, its transmission from the Arduino microcontroller to the XBee module is supposed to take approximately 94.73 ms, without considering frame headers. Similarly, when this measurement message is received, it will take equally long for the module to transmit it to the Arduino over serial. Therefore, a minimum deviation of approximately 190 ms is expected between the clocks of a remote node and the sink. In the experiments conducted in this study, the acquired data were expected to provide feedback about the correctness of these calculations, enabling future optimizations and parameter-tweaking. Furthermore, the experiments could provide an indication of the delays that the ZigBee protocol introduces and how these may affect synchronization applications.
Nevertheless, such delays are not preemptively accounted for at this stage in the present system, due to the fact that additional transmissions and calculations are required to approximate them during operation. Consequently, the resulting software (and potentially hardware) becomes harder to reason about, while demanding further resources from the already constrained system and thereby limiting the application's scope. Therefore, it is expected that the synchronization's precision will diminish across larger networks, which is not deemed impactful for the purposes of the present study's system or experiments, but should be considered in actual deployment scenarios.
In summary, the deployed synchronization scheme is depicted in Figure 2. The sink node initially transmits its clock indication at time t s to all of the network's nodes. Remote nodes, upon being switched on, periodically transmit to the sink, including their time estimation, which is calculated as the initially received t s , offset by the duration r since it is first received. Since miscellaneous delays t m are not accounted for, the synchronization's precision will be off by at least 2t m , which is further increased by distance in hops between sensing and sink node. The synchronization process is repeated at regular intervals, so that jitter among the nodes' clocks is accounted for. In a real world situation, the frequency of data collection would have to be selected depending on the appropriate frequency for the considered application. Unnecessarily high frequency of data collection leads to higher energy consumption and nodes needing to be recharged sooner, while too low frequency could lead to less effective decision-making, resulting in lost yields, crop damage, etc. In the case of olive groves, for instance, environmental condition fluctuations within a ten second (10 s) time span are unlikely to influence decision-making much. There are a few cases where measurement collection frequency might need to be significantly increased, as synchronization accuracy is extremely important. These include wildfire monitoring, as wildfires can spread at incredibly high velocity and unpredictable directions [96]; controlled-environment farming, such as hydroponic cultivations [97,98]; and finally olive grove irrigation scheduling [99], which can also be used in wildfire prevention [100]. Such strict requirements define the presented work's objective for precise synchronization even in time-critical applications.
Regarding the frequency of synchronization messages, it is entirely dependent on the synchronization accuracy requirements imposed by application-specific needs and the time-keeping device's accuracy. Each time-keeping device of the same model exhibits slightly different behavior as a result of manufacturing, while different models and types of devices (e.g., crystal vs. ceramic resonators) widely differ in their performance. Additionally, under varying environmental conditions, it may be beneficial to dynamically adjust this parameter to accurately match the required precision. Another parameter to keep in mind is the potential loss of synchronization messages, as the clocks of nodes that do not successfully receive this message will not be as accurate, which may have an impact on certain applications.

Experiments and Results
This section presents the results obtained from experiments conducted in an olive grove, where the proposed system was deployed to monitor environmental conditions. These experiments aimed to evaluate the system's effectiveness, not only in terms of networking efficiency, but also on the accuracy and aptness of the sensory devices.

Test Environment
The contribution of this study was mostly in the sensing aspect of smart agriculture, i.e., the technical decisions that allowed the proposed system to deliver accurate and, in particular, time correlated measurements, so that they may be of use to the later stages of decision-making and action-taking. Therefore, determining an appropriate environment to conduct the experiments was a challenge in and of itself, as the conditions under which the WSN would operate needed to be representative of the final system, in order to identify potential malfunctions and evaluate the system's overall effectiveness. Conducting the experiments in an outdoor environment was important, due to node clock accuracy varying significantly in different environmental conditions, with temperature being especially important [78].
While olive trees are very resilient and require little care, they can be affected by shifts in environmental conditions and diseases, as well as pest infestations and fungal diseases [101]. The environmental conditions that affect them are fairly generic, with temperature and relative humidity being particularly relevant to the health of a tree's trunk, leaves and fruit, while also influencing the development of fungal diseases and pests [102,103]. The fact that olive trees require little human intervention in a short time span, while also potentially gaining from the benefits provided by smart agriculture applications utilizing WSNs, makes olive groves an ideal testing ground in the context of this study, focusing on the sensing, rather than the decision-making, aspects.
Additionally, the employed set of sensors is capable of monitoring these conditions, allowing for potential applications to identify factors affecting their health, while also taking advantage of a WSN's full breadth of capabilities in agricultural applications, such as maximizing yields. For instance, trees that may not be as exposed to the sun or spots in the ground that are particularly moist-both factors that can influence an olive tree's growth-can be identified through the relevant acquired measurements.
Thus, the proposed system was deployed in an olive grove located in Chalidiata, Corfu, Greece. The olive grove's location is pinpointed in Figure 3a. Experiments took place in February 2019. This particular olive grove is adjacent to a road, which facilitates transportation of the equipment. Its premises, spanning approximately 1000 m 2 , partly lay on a hill facing away from the road, which hinders visibility. In combination with the fact that the area is surrounded by a wire fence, it can be presumed that unauthorized human interference would be minimized. For the purpose of the experiments, a network consisting of 30 nodes made up of Arduino Unos and a single Mega board was deployed on the selected olive grove. Up to three nodes were placed at a single installation site, generally placed close to an olive tree, and all nodes were enclosed in their protective cases to protect them from potential harm or exposure to weather elements. The soil moisture sensor was connected via wires and remained outside the case, next to roots of olive trees. Installation sites were typically up to 10 m away from one another. Do note that the employed XBee modules have a communication radius of close to 100 m, thus installation sites could be further spread out. An example of an installation site is shown in Figure 3b.

Results
The experiments conducted aimed to provide an indication of the synchronization scheme's and the proposed system's effectiveness. The network consisted of a single Coordinator, which was connected to a laptop and carried no sensors, as well as 29 Routers, which were supplied with all sensors described in Section 3.
The experimentation procedure was organized in the following way. The Coordinator broadcasted its clock to all nodes at an 150 s fixed interval, upon being switched on. The Routers, on the other hand, upon being powered on, delivered messages to the Coordinator at a fixed interval of 10 s; these messages were not sent (or received) simultaneously, but were dependent on each node's switch-on time. These messages contained a set of current measurements from all attached sensors, accompanied by the sender's synchronized clock. When the Coordinator received a node's measurement, it was printed through the serial connection to the laptop's monitor and saved to an SD memory card for future examination.
The system was left to run for approximately 17 min, during the afternoon, to evaluate how the synchronization scheme fairs in the passage of time. The overall lifetime of the system turned out to be approximately three days, under normal conditions. Although the intervals of 10 and 150 s for measurement and synchronization messages, respectively, might seem excessively short, they were selected as a proof-of-concept to more accurately evaluate the synchronization scheme's effectiveness, even though a higher energy cost was incurred. These parameters should be optimized for specific applications, if real-world deployment is a consideration.
There are a few things worth mentioning regarding the experiments. Firstly, all of the required networking functionality was handled by ZigBee, utilizing most of the upper layers' capabilities, including network discovery, addressing, broadcasting and routing of messages. Secondly, although no information regarding the topology was available, the placement of the nodes effectively guaranteed that all nodes were a single hop away from the Coordinator. Thirdly, some of the nodes' protective cases were not sealed during the experiments, which was reflected in the relevant acquired measurements, such as UV radiation. This did not impact the system's capability of monitoring the relevant environmental parameters, which was the focal point of the experiments.
First, the synchronization's effectiveness is showcased from the acquired results. It is evident that the clocks received from remote Router nodes t n are fairly close to that of the Coordinator t s . More specifically, the difference ∆t = t s − t n , where t s and t n are the clocks of the Coordinator and remote Router, respectively, has a mean value of 208.29 ms, standard deviation equal to 76.91 ms and 95% confidence interval of [205.39 ms, 211.20 ms]. Given that wildfire can spread from 0.29 to 1.95 ms −1 [104], the provided synchronization precision is considered to be effective, even for extremely time-critical applications.
The clocks are depicted in Figure 4 for the first and last 50 measurements collected (Figure 4a,b, respectively), where in each data point the received clock indication from each node is compared to that of the sink's. For the first 50 measurements, the clocks of remote nodes are very close to that of the sink's. It is evident that the clocks are still heavily correlated in the last 50 measurements, even after the system has been active for a non-trivial amount of time. In fact, the window of the first 50 measurements has a difference in time between remote nodes and the sink ∆t equal to 219.84 ms, whereas, for the last 50 measurements, the mean ∆t is 211.54 ms. According to this metric, the last 50 estimations of the sink's clock are, on average, more accurate than the first 50 estimations.  Additionally, all ∆t values along with the histogram of those values are presented in Figure 5 for all of the network's nodes, where each measurement corresponds to a Router clock indication received by the sink and ∆t corresponds to the latter less the former's clock. The histogram shown in Figure 5b underlines the consistency of the proposed synchronization scheme, as most values are concentrated in the interval [200 ms, 300 ms]. There is an interesting trend worth pointing out that can be observed in Figure 5a: although occasional spikes in the values occur seemingly at random, there is a consistent downward slope. These slopes periodically reset, which would suggest that the Coordinator's synchronization message is the culprit, which is confirmed by the data. However, this downward trend occasionally continues, which might be caused by a remote node not receiving the synchronization message. As for the factors contributing to this delay, do recall from Section 4 that serial transmissions should account for approximately 190 ms. Given that the observed delay has a mean value of 208.29 ms, serial transmission takes up more than 90% of the miscellaneous delays t m that were not accounted for. Considering frame headers are not taken into account in these calculations, it is clear that serial transmission forms a bottleneck for the entire transmission process. This also showcases that the ZigBee protocol introduces fairly low latency, when compared to the overhead introduced by the serial communication interface. Thus, increasing the serial baud rate is deemed essential for future applications, as a baud rate of 115,200 would reduce serial transmission time to 16 ms. Minimizing message length is equally important in reducing transmission time.
Moreover, the environmental conditions gathered during the experiment's measurements are jointly presented in Figure 6 with respect to time. Each data point in this figure represents a time window of 10 s, including a single measurement from all nodes. For each measurement in this time window, the mean value is displayed, along with a 95% confidence interval, as a means of showcasing variance of the measured environmental metrics, with respect to both space and time. Since most metrics are within reasonable ranges for the date and time the experiments were conducted, while also considering that they exhibit a relatively tight confidence interval, the system's effectiveness in providing accurate and synchronized measurements is showcased.

Conclusions
Smart agriculture is a field that has drawn heavy interest from the scientific community, especially through the contribution of WSNs. The measurements acquired from sensory devices are pinpoint accurate in addressing the challenges and requirements of crop cultivation on an individual basis, which is significantly affected by temporal variation of environmental, crop and soil conditions. A primary factor in the utility of the acquired measurements is the ability to correlate them with respect to physical time, aided by the use of network synchronization approaches. Additionally, imperative for the accuracy of the yielded sensory indications is the utilization of appropriate equipment. The integration of both efficient software and proper hardware is conducive to the system's accountability, durability and overall effectiveness, so that later stages of precision agriculture, including data analysis, decision-making and taking action, can take place effectively.
Accordingly, in the current work, the design requirements of a WSN system facilitating agricultural applications are presented. A system setup is proposed to meet these design requirements, providing an accessible and energy efficient configuration that can be extended to accommodate beyond basic needs. A synchronization scheme is also described, which aims at providing time correlated measurements that are gathered by the network's sink node.
The proposed system configuration was experimentally evaluated in a selected olive grove, which was used as a testing ground representative of other agricultural applications. More specifically, the system operated in real conditions for a certain time period to assess the synchronization scheme's effectiveness in providing measurements that are time-correlated to the sink node's clock. Feedback from the conducted experiments indicates that, for this particular implementation, serial data transmission is to be blamed for most of the synchronization's inaccuracy. This inaccuracy can be addressed by maximizing serial baud rate, while minimizing the transmitted message's length.
Overall, the assembled system's hardware proved to be effective in monitoring relevant environmental conditions, while the developed software is effective in delivering the acquired measurements to the sink node with adequate accuracy. Therefore, the system in its entirety is deemed appropriate in accomplishing its goals of efficiently monitoring agricultural environments.

Abbreviations
The following abbreviations are used in this manuscript:

5G
Fifth Generation of Cellular Network Technology API Application Programming Interface AT Attention IoT Internet of Things WSN Wireless Sensor Network SD Secure Digital UV Ultraviolet