A Novel Algorithm Based on LoRa Technology for Open-Field and Protected Agriculture Smart Irrigation System Mohammed , TS, Khan, O & Al Bazi, A Author post-print (accepted) deposited by Coventry University’s Repository Original citation & hyperlink: Mohammed , TS, Khan, O & Al Bazi, A 2020, A Novel Algorithm Based on LoRa Technology for Open-Field and Protected Agriculture Smart Irrigation System. in 2019 2nd IEEE Middle East and North Africa COMMunications Conference (MENACOMM). IEEE, 2019 2nd IEEE Middle East and North Africa COMMunications Conference , Manama, Bahrain, 19/11/19 ] Publisher: IEEE © 2019 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. Copyright © and Moral Rights are retained by the author(s) and/ or other copyright owners. A copy can be downloaded for personal non-commercial research or study, without prior permission or charge. This item cannot be reproduced or quoted extensively from without first obtaining permission in writing from the copyright holder(s). The content must not be changed in any way or sold commercially in any format or medium without the formal permission of the copyright holders. This document is the author’s post-print version, incorporating any revisions agreed during the peer-review process. Some differences between the published version and this version may remain and you are advised to consult the published version if you wish to cite from it. A Novel Algorithm Based on LoRa Technology for Open-Field and Protected Agriculture Smart Irrigation System Thabit Sultan Mohammed Omer F. Khan Ammar Al-Bazi ECE Department, ECE Department, Institute of Future Transport and Cities, Dhofar University, Dhofar University, Coventry University, Salalah, Oman. Salalah, Oman. Coventry, UK.
[email protected]/
[email protected] [email protected] [email protected]Abstract— A novel algorithm for smart irrigation system due to effects of many static and dynamic parameters such as adaptable for both open-field and protected agriculture based on field train and climate conditions. LoRa technology is proposed in this paper. The algorithm suits a networked architecture, in which a central controller is Many irrigation systems have been developed and used to communicating with distributed units of sensors and actuators. achieve water savings with various crops. In [3], for instance, Communication within the system units use LoRa devices, where a system utilizing thermal imaging to monitor an irrigation a LoRa is an IoT based technology providing low-power and schedule is proposed. While in [4], a preplanned irrigation long-range radio connectivity. Within an agricultural farm, the schedule based on water optimization is adopted. Wireless system can be configured such that it can suit the control of Sensor Networks (WSN) architecture was implemented in environmental conditions applicable for either an open-field another system to achieve the effectiveness of water and/or a protected (e.g. greenhouse) agricultures. A database has been developed and designed to comply with the system management [5]. architecture. The collected data is analyzed and used by the In general, irrigation systems, which are proposed in system for automatically adjusting itself to an optimal or semi- literature, and designed to automate the irrigation process, are optimal performance. At the central control, the user interface mostly composed of three main components: (i) offer system monitoring capability, statistics, as well as report environmental sensors; (ii) the control unit as a decision- generation. maker; and (iii) the actuator component [6]. The advancement Keywords—smart irrigation, IoT, LoRa technology, smart of the Internet of Things (IoT) has highly facilitated its monitoring, soil sensor, greenhouse, and climate conditions. implementation in various industries and sectors including smart agriculture and smart irrigation. Systems in these fields I. INTRODUCTION intend to utilize water efficiently, in terms of place, time, and amount [7]. Further, such systems may also optimize labor Obtaining a good crop yield requires careful surveillance costs as well as the consumption of electricity. for the crop in line with following a set of common sense With respect to IoT related technologies, a long range, low- observations to ensure fruitful results. A number of power IoT communications is offered by adopting LoRa, continuously changing and effective factors are related and which is a radio modulation technology licensed by Semtech important to consider. Such factors may include; temperature, Corporation [8]. LoRa represents the physical layer of the humidity, the soil condition, wind and the stage of wireless modulation and it is designed specifically to provide development of the crop. Among the set of factors, the long-range connectivity operating at the industrial, scientific irrigation is one of the most important to get right. and medical (ISM) radio bands of 433 MHz, 868 MHz, and In addition to the worldwide challenge of water scarcity 915 MHz [9]. and seasonal shortage, farming nowadays is facing additional A LoRa Wide Area Network (LoRaWAN) can be a suitable challenges affecting both quantity and quality [1], which technology to use in various applications including smart makes it necessary to keep up with technology to make better irrigation systems, where it is possible to cover 20 km in rural product. Crops can either grow in open-field farms or as a area and around 8 km in urban areas. Further advantage of a protected agriculture [2]. A protected field is an indoor LoRa device is the possibility of long term operation with up agriculture that is commonly referred to as a greenhouse. In to ten years on battery because of low power consumption. both cases, adopting technologies may help in getting more More features can also be emphasized in a smart irrigation control over the growing conditions, including the irrigation system utilizing LoRa technology are water-saving, and lower water, and hence achieving better yields and more profit. costs of maintenance and deployment. Therefore, a novel algorithm for smart irrigation system based on LoRa A broad measure of performance for modern irrigation technology is proposed in this paper. An experimental systems is their ability to minimize water consumption, while prototype of the system, adopting the proposed algorithm, is maximizing crop productivity. This performance measure is also developed intending to make use of the features offered in fact critical and may require compromise between the two by adopting the LoRa technology to suit both indoor and factors (i.e. water supply and gross crop production). An outdoor agriculture (i.e. open-fields and greenhouse). optimal point is normally hard to determine The next section of this paper introduces an overview of analyzed. The unit is mainly equipped with a LoRa the system for which the algorithm is proposed. In section III, hub, a master controller, and a user interface. the system database is described. Section IV, explains the Irrigation Unit: In this unit, two irrigation methods proposed algorithm in terms of principle of operation, are assumed and hence interfaced to the LoRa and formulas and their main assumptions. A short description of microcontroller devices. Irrigation using sprinklers the system hardware implementation is outlined in section and drip irrigation systems can be both controlled. V. Section VI, however, presents results and calculations Certain crop type related factors will decide on which with a case study for a possible scenario of algorithm irrigation method is used at a certain time. implementation using a set of different sensor readings. Some concluding remarks about the paper are mentioned in section Heating, Ventilation, and Air Conditioning (HVAC) VII. Unit: There are two sub-units attached to HVAC, II. OVERVIEW OF THE PROPOSED SYSTEM namely; heating unit, and ventilation and cooling The layout of our system for which the algorithm is unit. The LoRa and microcontroller devices in the proposed, is illustrated in the block diagram of Fig. 1. ventilation and cooling unit are interfaced to four types of actuators (Fans, Exhausts, Water Pump, and Shade Winch), while the LoRa and microcontroller devices in the heating unit are responsible for activation and deactivation of heating units. This unit is applicable for protected farms. III. DATABASE DESIGN In addition to the algorithm that will be presented in the next section, a database has been developed. The structure of this database is shown in Fig. 2. It is composed of 14 tables representing the hierarchy of the data within a generalized farming system. Tables are named based on their intended purpose and functionality with their names having the prefix iot. Following is a definition of the tables comprising the database. 13 1 9 14 10 5 11 3 4 2 8 Fig. 1. Overview of the smart irrigation system based on LoRa technology. The system is mainly composed of four major units: 12 Data Acquisition Unit: In this unit, a microcontroller 6 is interfaced with necessary sensors (e.g. temperature, humidity, soil moisture, etc.). The collected data will be prepared in the suitable format 7 and sent via the LoRa device to the central control unit. The number and types of sensors will Fig. 2. The database structure. necessarily vary depending on the type of farming. Central Control Unit: In this unit, the collected data 1) iot_subject: Each subject is a farming related from remote sensors are processed and process, e.g. Irrigation, Poultry, and Fish. 2) iot_plant: Each subject has multiple process plants within or below the threshold range, it is replaced with a (e.g. Irrigation subject has one or more plants called logical “0”. Note that threshold range can vary depending on as Field 1, Field 2, etc.) crop type and climate conditions. 3) iot_controller: A controller is an identity that has a set of sensors. TABLE I. RULE FOR REPLACEMENT OF (x_val) WITH LOGICAL VALUES 4) iot_controller_sensors: A controller has a set of Assignment Rule related sensors identified by this table. Label for 5) iot_controller_plant: This table is used to identify Threshold If (x_val > If (x_val If(x_val ≥ Sensor max(th) ) < min(th) && Range (th) controllers according to the process plant in which Threshold min(th) ) x_val ≤ they are installed. max(th)) 6) iot_actuator: This table has identities of actuators. ah_th 28-30 1 0 0 7) iot_actuator_plant: This table identifies the link to t_th 25-27 1 0 0 sm_th 15-20 1 0 0 those actuators which are operating in a plant as a co2_th 30-35 1 0 0 standalone device. s_th 45-50 1 0 0 8) iot_controller_actuator: This table has identities of those actuators which are operating through a In Table II, examples of value assignments based on the controller. rule of Table I is illustrated, where a sample (x_val) corresponding to a sensor reading (e.g. air humidity sensor 9) iot_actuator_readings: This table has readings on (ah)) is replaced with a logical “1” because it is less than the actuators. threshold (ah_th). 10) iot_sensor: Identities of sensors used in the system are available in this table. 11) iot_sensor_plant: This table identifies the link to TABLE II. EXAMPLE OF REPLACEMENT OF SENSOR SAMPLE (x_val) WITH A those sensors which are operating in a plant as LOGICAL VALUE standalone devices. Threshold 12) iot_sensor_readings: This table is used to save ah_th t_th sm_th co2_th s_th Designation sensors readings. Threshold (th[n]) 28-30 25-27 15-17 30-32 45-47 13) iot_controller_readings: In this table, a controller can Sample Value (x_val) 27 28 16 40 47 save its own dedicated readings. Readings may (x_val > max(th[n]) = ? no yes no yes no Logic Assignment 0 1 0 1 0 include power consumptions or deduced parameters from multiple sensors or algorithms. C. Demarcation of Samples 14) iot_subject_plant: This table assigns the plant to the The algorithm assumes that the threshold range (th), is an system’s subject under process. array of size n, consisting of real numbers within a threshold range. For example, in case of ah_th the threshold is set as IV. THE PROPOSED ALGORITHM (28-30). This means that ah_th = {28, 29, 30} with minimum A. Principle of System Operation value represented at th[0] = min(th[n]), and maximum value represented by th[2] = max (th[n]). Divergence from For a given crop, there are number of parameters that need minimum and maximum values are named as “below to be controlled. These targeted parameters have to be threshold” and “above threshold”, respectively. The maintained within certain allowable limits (threshold range) “distance” of x_val (sample) from minimum and maximum is through a supervised real-time feedback (e.g. PID - represented with d_min and d_max respectively. This Proportional Integral Derivative). The values to control may assumptions leads to two distinct conditions to deal with. vary among crops and even from time to time for a certain crop [10]. The system is assumed to save a set of reference D. Dealing with “Below Threshold” Values information about different crops for comparison and hence assessing periodic sensor readings. For a sample value below the minimum of threshold, the At the central control, sensor readings are continuously following condition is true: (x_val < min (th[n])) received from data acquisition units. Processing of these In response to analyzing any sensor data value, it is expected readings will result in the central control issuing proper to have relevant actuators to be activated/deactivated commands, which are mostly either to activate or deactivate (triggered) in order to normalize the parameters of the crop. relevant actuators to reach the desired optimal set point. The To illustrate this part, consider the air humidity parameter, status of all actuators (activated/deactivated) are saved in a with the threshold range ah_th = {28, 29, 30}. If (x_val = ah record together with a time stamp. These records of sensor = 20), then the distance readings are utilized to help in system monitoring, system optimization, preparing statistical data, and generating (1) performance reports. Therefore = 8. The value d_min = 8 B. Rule for Deriving Logical Values for a Data Sample will be used for the strategy of actuators operation. In the algorithm, actuators’ operation is divided into four In Table I, the sensor data sample (x_val) is assigned with a states (namely; “00”, “01”, “10”, and “11”). The state “00” is binary value in reference to a threshold range (th). The rule off state, “01” refers to the low, “10” is the medium, and “11” states that, if the data sample value is above the threshold is high. Based on this consideration, there will be three range, it is replaced with a logical “1”, and if the value is TABLE IV. ACTUATORS’ OPERATION LEVELS BASED ON THREE SUB- level settings. The heater used for temperature control in LEVELS INTERVAL RANGE ABOVE THRESHOLD protected fields, for example, will be operating at highest Actuators’ Operation Levels when the state is “11”, and lowest at “01” setting. The power sub_interval Le- consumption [watt/h] for the heater will be divided into three si [3]_ Pump vel Heater Level Fan Level levels accordingly. If a (90 watts) heater is used, then it will 36-34 0 0 Off 1 1 High 1 1 High operate at three equally divided levels (i.e. 30 watts each). In 34-32 0 0 Off 1 0 Med 1 0 Med autonomous mode for the system to reach the set point within 32-30.001 0 0 Off 0 1 Low 0 1 Low the threshold, the actuator states will be auto set according to the distance of current sample deviation from the threshold We emphasize our previous note, that if ( x_val ) is equal to range. one of the values in the threshold range, the “distance’ is always 0. For further illustration, lets recall the sensor reading ( x_val =ah = 20), which has d_min = 8. State switching It's worth mentioning that a main objective for the control interval is obtained by dividing d_min by three fixed levels strategy in the system is to maintain the climate conditions, (i.e. 8/3 = 2.6). The value 2.6 is called an “interval”, and it such as air temperature, at their threshold range. This relates to 3 states of actuator operation, and three trigger objective is achievable and easier to attain when considering points. The “trigger point” is the value at which the state of protected architecture. the actuator shifts to another level. V. SYSTEM IMPLEMENTATION In Table III, the actuators’ states are derived along with the interval range during which the level stays the same. The An experimental prototype of the system, whose overview algorithm has a function ah (p, h, f), where the air humidity is was presented in Section II is implemented using suitable considered effected by the operation of the water pump (p), hardware components. the heater (h), and the fan (f). While below the threshold, air The microcontroller units used are built with Arduino humidity can be increased by pumping more water, while Uno. The LoRa devices are of type E32-TTL-100 SX1278 keeping other actuators off. The state of the pump operation LoRA Module, the LoRa hub is LG01 LoRa Open W IoT (i.e. High, Med., and Low) can be changed according to the Gateway, and number of sensors and actuators are used too. required level. The calculated intervals are stored in an array Fig. 3 is showing the main hardware devices used in the called sub_interval array si[ ] = si[0], si[1], si[2]. prototype implementation. TABLE III. ACTUATORS’ OPERATION LEVELS BASED ON THREE SUB- LEVELS INTERVAL RANGE BELOW THRESHOLD Actuators’ Operation Levels sub_interval si [3] Le- Le- Pump Heater Fan Level vel vel 20.001-22.666 1 1 High 0 0 Off 0 0 Off 22.666-25.332 1 0 Med 0 0 Off 0 0 Off 25.332-27.999 0 1 Low 0 0 Off 0 0 Off If x_val is equal to one of the values in the threshold range, the “distance’ is always 0. E. Dealing with “Above Threshold” Values As the sample value is found to be above the maximum of threshold, the condition is denoted by: (x_val > max(th[n])) Fig. 3. The hardware system implementation. We consider an extension to our case study about the air humidity parameter in which the threshold is set as ah_th = VI. RESULTS AND CALCULATIONS [28, 29, and 30]. Assume now an “above threshold value” is received from air humidity sensor (say x_val = 36), then the distance d_max is calculated based on the formula; A. Gathering and Analysis of Sensors’ Readings In addition to controlling the irrigation system (2) intelligently, the application of the algorithm can be implemented for continuous and effective monitoring. The therefore = 6. analyzed data can offer statistics and may be utilized for optimizing the system performance in terms of power The states of actuators’ operation corresponding to (x_val = consumption and in adjusting, and hence offering the most ah = 36), with a distance above the threshold d_max = 6, are suitable climate parameters for various crops. In Table V, illustrated in Table IV. The interval for state switching of the sensor readings from five sensors (namely; air humidity, concerned actuators (i.e. pump, heater, and fan) is similarly temperature, soil moisture, co2 gas, and sun) for a period of 11 obtained by dividing the d_max by the fixed operation levels (i.e. 6/3 = 2). The interval considered, therefore has 3 trigger minutes, are considered. The distances of each sample from points at increment of 2. the closest boundary to threshold range is calculated. Distance calculations for readings from the five sensors are plotted in the graph of Fig. 4. Based on the value of the distance, the algorithm calculates an interval value to asses about how far the climate conditions are from their B. Calculation of the Power consumption normalized values in the threshold range (set point). Considering now both Tables V, and IV, where the relevant According to this interval, the operation level for concerned actuators used in the system for climate parameters’ control actuators is applied. These calculated levels of actuators are fan, water pump, air exhaust, heater, and shade winch. operation are also illustrated in in Table VI. Their factory power ratings are (90, 750, 90, 5000, and 80 In Table VI, the actuator has to work harder in case of level watts) respectively. Based on the level of operation shown in 3, while lowest in case of level 1. An actuator is off in case of Table IV, the power consumption measured in Kw/min is 0 level. We can replace duplicate levels with a single level calculated and illustrated in Fig. 5. Higher power that is required at current distance of combined samples from consumption for the level 3, while minimum for level 1. The each sensors (e.g. 3-3 or 3-3-3 can be replaced with 3). power consumption [KW/min] is obtained using the Whereas, level with 2-3 indication shows the option for the estimation: controller to select either of the two operation levels of the actuator to attain the required set point. (3) TABLE V. DISTANCE OF SAMPLES FROM THRESHOLD Time Distance d_x stamp d_ah d_t d_sm d_co2 d_s 1:00 8.00 4.00 4.00 4.00 4.00 1:01 7.00 3.00 3.00 3.00 3.00 1:02 5.00 2.00 2.00 2.00 2.00 1:03 2.00 1.00 1.00 1.00 1.00 1:04 0.00 0.00 0.00 0.00 0.00 1:05 0.00 0.00 0.00 0.00 0.00 1:06 0.00 0.00 0.00 0.00 0.00 1:07 1.00 1.00 1.00 1.00 1.00 1:08 3.00 2.00 2.00 2.00 2.00 1:09 4.00 3.00 3.00 3.00 3.00 1:10 5.00 3.00 4.00 3.00 3.00 1:11 2.00 0.00 0.00 0.00 0.00 TABLE VI. LEVELS OF OPERATION FOR THE ACTUATORS Fig. 5. Power consumption of system actuators. Time stamp Actuator Operation Level In fact these analyzed data can be offered for users to f_lvl e_lvl p_lvl h_lvl s_lvl monitor the system status, and for designers to study the 1:00 3-3 3-3 3-3 3-3 3 behavior of the system and for making decisions leading to 1:01 3-3 3-3 3-3 3-3 3 better system performance. Further, these data analysis and 1:02 2-2 2-2 2-2 2-2 2 calculations can be fed back to the system to allow for 1:03 1-1 1-1 1-1 1-1 1 1:04 0 0 0 0 0 automatic adjustments. All the parameters used in the 1:05 0 0 0 0 0 proposed algorithm are defined in Table VII. 1:06 0 0 0 0 0 1:07 2-3 1-1-1 0 1-3 0 TABLE VII. NOMENCLATURE 1:08 2-2 2-2-2 0 2-2 0 Abbrev. Meaning 1:09 1-3 3-3-3 0 1-3 0 x_val Sensor Value 1:10 1-3 3-3-3 0 1-3 0 th Threshold 1:11 2 0 0 2 0 ah Air humidity value sm Soil moisture value co2 Carbon dioxide value s Sun Light value ah_th Air Humidity Threshold Range t_th Temperature Threshold Range sm_th Soil Moisture Threshold Range co2_th Carbon dioxide Threshold Range s_th Sun Light Threshold Range f Fan status e Exhaust status p Pump status h Heat Source status sh Shade status VII. CONCLUSION A novel algorithm for smart irrigation system based on LoRa technology is proposed in this paper. An experimental prototype of the system, adopting the proposed algorithm, is Fig. 4. Sensor readings distance from threshold. also developed with a main objective of making use of the features offered by considering the LoRa technology. The proposed algorithm and its relevant system can be implemented in both indoor and outdoor agriculture farming (i.e. open-fields and greenhouse). A database is designed to accommodate the big amount of data that is expected to be gathered from the set of distributed sensors in various farms. Local units within a farm (open-field and/or greenhouse) communicate with a central control by continuously sending sensor readings via the LoRa device, while receiving response about their actuator control. Since we are working with big data, improvement to resource utilization becomes vital. We observed that data storage consumption in the system database can be reduced if data points for the time duration for which sensors readings (x_val) stays within the threshold range, is discarded as it will not be needed in actuators’ control. REFERENCES [1] W. Jury and H. Vaux, “The emerging global water crisis: Managing scarcity and conflict between water users,” Advanced Agronomy, vol. 95, pp. 1–76, Sep. 2007. [2] P. Muñoz et al ,“Comparing the Environmental Impacts of Greenhouse versus Open-Field Tomato Production in the Mediterranean Region”, Int. Symp. on High Tech. for Greenhouse System Manag.: Greensys2007, Naples, Italy, October 4, 2007. [3] X. Wang, W. Yang, A. Wheaton, N. Cooley, and B. Moran, “Efficient registration of optical and IR images for automatic plant water stress assessment,” Comput. Electron. Agricult., vol. 74, no. 2, pp. 230– 237,Nov. 2010. [4] G. Yuan, Y. Luo, X. Sun, and D. Tang, “Evaluation of a crop water stress index for detecting water stress in winter wheat in the North ChinaPlain,” Agricul. Water Mag., vol. 64, no. 1, pp. 29–40, 2004. [5] Y. Kim, J. D. Jabro, and R. G. Evans, “Wireless lysimeters for real-time online soil water monitoring,” Irrigation Sci, vol. 29, no. 5, pp. 423– 430, Sep. 2011. [6] C. Brouwer, A. Goffeau, and M. Heibloem, “Irrigation Water Management: Training Manual No. 1—Introduction to Irrigation”, http://www.fao.org/docrep/r4082e/r4082e00.html, [Accessed 30/4/2019] [7] K. Raju and G. Varma, “Knowledge based real time monitoring system for aquaculture using IoT,” IEEE 7th Int. Advance Comp. Conf., July 2017. [8] Semtech Corporation, “LoRa™ Modulation Basics”, https://www.semtech.com/uploads/documents/an1200.22.pdf [Accessed 17/2/2019]. [9] LoRa® Alliance Technical Marketing Workgroup, “A technical overview of LoRa® and LoRaWAN”, Nov, 2015, https://www.tuv.com/media/corporate/products_1/electronic_compon ents_and_lasers/TUeV_Rheinland_Overview_LoRa_and_LoRaWANt mp.pdf [Accessed 17/2/2019]. [10] P. Sharma, M. Kothari, and S.Lakhawat,” Water requirement on drip irrigated tomatoes grown under shade net house”, Eng. and Tech. in India, Vol. 6, Issue 1, Apr, 2015, pp. 12-18.