# Low-Cost Wireless Sensing System for Precision Agriculture Applications in Orchards
## 3 Results and Discussion
### Programming Features  
Recent advances in electronics have made available components and microcontrollers with considerably low power consumption. Efficient programming of each part of the system (e.g., set in sleep mode until measurement, how often to acquire measurements or send data packages to the cloud etc.) can guarantee feasibility and sustainability of the wireless sensors network in agricultural operations. Since the goal of this project was to develop a simple, low cost, and low energy wireless system, dummy devices were selected as the core hardware and great emphasis was given to their programming. Special attention was provided to achieve low energy consumption. Reducing energy consumption is the primary technique to enhance a network's lifetime [1].  
For the sake of simplicity and in order to minimize energy demands, the End-nodes and the Coordinator were not synchronized. Because the End-nodes were sending the data packets asynchronously, the Coordinator was programmed to remain continuously operated, to avoid missing information from the nodes. A programming feature for limiting energy consumption of the Coordinator was the 4G module operation optimization. According to this script, the 4G module, which is one of the most energy consuming components, was set by default to off mode and turned on only to make the link and send the packets to the cloud via 4G cellular network.  
In addition, in case any of the End-nodes lost connection or were unable to communicate, e.g., due to traffic, it repeated the call until there was a successful packet delivery. For safety purposes, all data packets were also recorded in an external micro-SD card installed in each node, allowing manual acquisition of the acquired datasets, in case of connection failure. A star topology was followed, which means that each End-node was exclusively \"talking\" to the Coordinator. Thus, the Coordinator was responsible for a demanding task, receiving, transforming, and uploading the data packets from the End-nodes. Therefore, it was relieved from the task of collecting measurements for itself, so it was able to accommodate as many End-nodes as possible.  
The End-nodes were programmed to stay in sleep mode, \"wake up\" to acquire the measurements from the sensors and send the data packet to the Coordinator. In case of raining conditions, all the nodes were programmed to automatically set to operation mode, record the event and the total amount of precipitation, and go back to sleep after the event finishes. Duty cycling is a well-known effective method to extend the lifetime of the batteries powering the system [19]. Adjusting the duty cycle, setting the operation of the nodes in sleep mode according to the sensing and communication needs, can significantly reduce the energy consumption of the nodes by optimizing the trans-receiver operation [1].  
A second programming option was also evaluated. In this setup, the coordinator was programmed in full operational mode, which apart from the End-nodes data handling tasks, was also receiving full measurements packets for itself. This type of network was even more economical, and based on the tests results, it was proved a viable option. However, this network configuration had only three nodes, including the Coordinator and two End-nodes. Therefore, this programming option is preferable when small networks covering up to three measurement locations in the field of interest are considered. Due to the small number of end nodes, the Coordinator in this programming option was set to go to sleep after receiving and sending to the cloud all data packets of each cycle. This way, extra energy saving could be achieved to compensate for the energy required to acquire measurements from the sensors attached to it.