Development of a Model and Sensor Based Smart Irrigation System

Water availability is a critical variable for virtually every economic activity, including agriculture and industry, the energy sector and public use. Specifically, Farmers could waste thousands of cubic meters of water daily through Irrigation. This project developed a smart irrigation system capable of making autonomous decision of irrigating the soil with an appropriate amount of water required through monitoring of soil irrigation factors. The soil moisture level and the rainfall status were the soil irrigation factors considered. The threshold values of the irrigation factors required for soil to be irrigated were established. Subsequently, a system was developed to sense the soil irrigation factors and monitor when the threshold values are reached so that necessary information is communicated to switch on or off a water pump designed for irrigation purpose. The system is implemented with a PIC16f876A microcontroller. The results of performance evaluation conducted on the system revealed that the system is able to monitor and estimate the soil irrigation factors with good accuracy. Also, the system is able to start the water pump to irrigate soil and stop it as appropriate depending on whether the soil irrigation factors value indicates need for irrigation or not. DOI: https://dx.doi.org/10.4314/jasem.v24i5.28 Copyright: Copyright © 2020 Ogedengbe et al. This is an open access article distributed under the Creative Commons Attribution License (CCL), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Dates: Received: 15 March 2020; Revised: 19 April 2020; Accepted: 25 May 2020

Water is required for the basic growth and maintenance of plants. When the amount of water available for plants need is not adequate, stress can occur. This could ultimately lead to reduced quality or death of such plants. Hence, during the dry season when adequate natural rain water is not readily available planned supply of water to plants to ensure they grow well becomes inevitable (Majumdar, 2001). Irrigation must be appropriately scheduled to ensure that available water, which may not be surplus, is judiciously used. Implementation of irrigation activities could be done manually or automatically. Irrigation controlled automatically is referred to as smart irrigation system (SIS) (Ojha et al., 2016). Recent studies on SIS include Shen et al. (2007), Yang et al. (2010), Muhammad and Usman (2010), Huang et al. (2011), Kestikar and Bhavsar (2012), Jaichandran et al. (2013), Manoj and Udupa (2015), Avatade and Danure (2015) and Nagothu (2016). Shen et al. (2007) designed a GSM-SMS (Global System Mobile-Short Message Services) remote measurement and control system for irrigation purpose. Yang et al. (2010) designed a GSM based automatic irrigation system, with radio communication technology which receives regular signal of prevailing weather conditions through a radio from a local weather station and updates the current evapo-transpiration rate to the controller. The device was based on wireless network (GSM and radio communication). Information such as temperature, soil moisture and air humidity sampled by the controller and utilized for irrigation decision. Huang et al. (2011) designed a remote monitoring and control irrigation Systems based on GSM. Two stations were made use of in the study: a remote monitoring station which gathered data with the aid of sensors and a central monitoring station which received and processed the sent data as well as give the directive to the system to irrigate or not. The transfer of data was aided by a GSM wireless communication module TC35.741. Also, Kestikar and Bhavsar (2012) designed a user friendly automated wireless watering system which can also be operated in manual mode. When the manual mode of operation is selected, the system will work just as the traditional watering system. The user decides when to start watering and when to stop it according to the moisture level values as decided by the system. Jaichandran et al. (2013) developed a prototype automatically controlled irrigation system. The sensor node was deployed in irrigation field for sensing soil moisture value and the sensed data was sent to controller node. On receiving the soil moisture value, the controller node checks it with required soil moisture value and takes the necessary irrigation action. Mobile phone was used for sending request SMS to get soil moisture value in irrigation field. The experimental results showed that the prototype was capable of automatic control and remote access of irrigation motor based on the feedback of soil moisture sensor. Manoj and Udupa (2015) developed an arduino board based soil moisture sensor irrigation system which proved to be a real time response control system which monitors and wheel all the activities of irrigation system. There two functional hardware in this work: are the motor/water pump and the moisture sensor. The arduino board was programmed using the Arduino IDE software. The moisture sensor determines the level of moisture in the soil and informs the controller to switch ON//OFF the water pump. Avatade and Dhanure (2015) developed an irrigation system using a wireless Sensor Network and General Packet Radio Services (GPRS) and it is ardunio based. The system utilized integrated circuits to harness irrigation information through temperature and soil moisture sensors to estimate the water amount present in the soil and to decide the water need of such soil. Also, Nagothu (2016) developed a smart watering system which uses soil moisture sensors and weather report to arrive at irrigation decision.
Generally, the existing SISs have been found to either use information obtained solely from soil moisture sensors or to combine such information with the information obtained from weather reports to make irrigation decision. Also, ANN approach was used for making irrigation decision by Muhammad and Usman (2010). This approach which was considered to replace weather report is good but most of the weather report stations also generate their data based on a combination of forecasting models which can be optimized to give reliable and consistent data. Hence, consideration of weather report is yet very important in taking irrigation decision.
However, the data report can be support locally by a model for predicting rainfall status as one of the major challenge of connecting with the weather report data station is the possible loss of radio communication and /or network which can affect appropriate prediction. At this point the model takes up the responsibility of appropriately predicting the rainfall status. This is the focus of this study. Hence, the smart irrigation system developed herein utilizes not only sensors feedback and weather report but also a developed rainfall predictive model to make irrigation decisions.

Determination of Gross Depth:
The simple calculation method which is based on the estimated depth of irrigation application was chosen. This method involves the estimation of the net and gross irrigation depth (d) in mm. This is best determined locally by checking how much water is given per irrigation application with the local irrigation method and practice. If no local data are easily available. Tables 1  and 2 can be used to estimate, by selection, the net irrigation depth (d net), in mm with respect to the root depth of the crop and the soil type, while Table 2 gives an indication of the root depth of the major field crops.  Consequently, the gross irrigation depth ( ), in mm, which takes into account the water loss during the irrigation application is determined using equation (1).
is the net irrigation depth in mm, and is the field application efficiency in percent. If reliable local data are available on the field application efficiency, these should be used. Otherwise, could be taken as 0.6, 0.75 and 0.9 for surface, sprinkler and drip irrigation respectively (FAO, 2018). The gross irrigation depth determined is then utilized to know the appropriate soil water depth, the amount of water required to adequately irrigate a particular field and the positioning of the moisture sensor.

Design and Selection of Water Pump:
The need of the plant determines the flow rate of water from the pump and consequently, the choice of pump. This flow rate is obtained by multiplying the size of the field by the amount of water in inches that must be applied. The OGEDENGBE, TI; ETA, OM, OGUNBIYI, AA result is then converted to gallons per minute (gpm), and this number determines the size of the pump. The water pump rating was obtained using equations (2) to (6). The crop water requirement, , is obtained using equation (2): Where, is the Crop Factor and is the Evapotranspiration Potential or Crop Evapotranspiration. and can be obtained from crop factors and evapotranspiration potential Tables respectively. These Tables which are dependent on the climatic zone and the type of crop respectively are available in FAO (2018).
Subsequently, the gallons of water required for irrigation per minute (Q) is obtained from equation (3).
Thereafter, the pumping lift which is the height the water would travel from top of water table to the final destination (i.e discharge point) designated as is obtained from the configuration of the water pipe system as designed for the irrigation purpose.
Also, the friction loss ( ), from the piping configuration is obtained using equation (4) = + Where is the friction loss in pipe and is the friction loss in fittings obtainable from charts (SR 2018). The Total Dynamic Head ( ), is then obtained through equation (5) = − Where represents the pump lift and represents the friction loss Consequently, the Water Horse Power ( ) is calculated using equation (6).
Where SG is the specific gravity of water As a case study, for irrigating maize in a sub humid climatic zone at 25 o C over a growing session on one acre of land, the WHP is calculated as 0.3 HP, a 0.5 hp pump was therefore selected. Consequently, a 1" water flow pipe, 50 m pump lift and 6gpm flow rate was used for the flow line.

Modeling Rainfall Prediction Using ANN Model:
Rainfall data were obtained from the Department of Meteorology of the Federal University of Technology, Akure (MET FUTA), Ondo State, Nigeria. The data consist record of values of rainfall factors (i.e. Temperature and humidity) and value of rainfall, collected on a daily basis in Akure, for a period of 5 years (2013)(2014)(2015)(2016)(2017)(2018). The dataset was divided into three for model training, validation and testing purpose. The training set which should be relatively big for adequate training of the ANN model was set as 70% of the data while 15% of the data is used as the validation set to evaluate the generalization ability of the trained network while avoiding overtraining the network. Finally, the remaining 15% of the data is used as the testing set to check the performance of the trained network. Thereafter, the network topology, which includes the input nodes, hidden layers and nodes and the output nodes, was determined. The two factors considered in the ANN model to influence evapotranspiration are air temperature and air humidity. The most common method for determining the hidden layers and nodes, which is by experimentation using one hidden layer while varying the number of hidden nodes in the layer, was adopted. One output node which corresponds to the forecasting horizon i.e. the rainfall value was used. The gradient descent back propagation algorithm training method was used to train the network. The interconnection weights were initialized randomly taking values between 0 and 1 and the maximum number of epochs was set to 1000 epochs. Several simulations were performed to determine the best combination of learning rate, momentum, transfer function and training function. The hyperbolic tangent sigmoid transfer function was used. The performance of the network is measured in terms of its Mean Square Error given in equation (7) and this forms the basis for choosing the best model. Once the optimal model of the neural network is obtained, it was utilized within the controller for prediction of rainfall as an alternative to the prediction obtained based on the weather report feedback.
Where n is the numbers of predicted value − is the prediction error for the ith predicted value.

The Developed Smart Irrigation System and Its
Evaluation: Fig. 1 shows the components of the developed system. It consists of a PIC16F876A micro controller enclosed within a protective housing, a LCD screen, a sim module, a soil moisture sensor, a water reservoir, a pumping machine, piping system, water hose and a sprinkler. All components were connected to communicate with one another and the microcontroller as appropriate. The micro controller is powered by a 220 v AC mains.
The controller was designed to be able to retrieve information from weather database through a THINGSPEAK channel (cloud storage) incorporated to connect the controller to Internet of Thing (IoT).
THINGSPEAK is an open data platform and Application programming Interface (API) for the Internet of Things that enables collection, analysis and visualization of data from sensors using the HTTP and MQTT protocol over the Internet or via a Local Area Network.
Sensors for acquisition of air temperature and air humidity were integrated with the controller as an input to the ANN model implemented on the controller. Water is transported from the water reservoir to the sprinkler with the aid of a piping and hose system. Control was achieved by setting a lower threshold Value (LTV) and an Upper Threshold Value (UTV) for soil moisture content to 30% and 70% respectively. Soil moisture content values below the LTV indicate the need for irrigation while values above the UTV indicate no need for irrigation. Also, the system was configured to check the weather database through the THINGSPEAK API to confirm rainfall status (RS) to know whether it will rain or not. This information is displayed on the LCD as RS=NIL when rainfall is not expected or RS = YES when rainfall is expected. Hence, even if the soil moisture content is below the LTV, the pump will not be activated to irrigate if rainfall is expected. Also, the developed ANN model was implemented on the controller for rainfall status prediction to support and compliment the determination of the rainfall status in scenario when information is not retrievable from available weather station due to breakdown in internet communication.
Data from temperature and humidity sensors are integrated with the controller to monitor the respective rainfall prediction factors, within the location, which are communicated to the controller as inputs to the ANN model, using the sim module, located in the controller. The soil moisture value measured by the moisture sensor is also send to the controller via the sim Module. In order to evaluate the developed system, the soil moisture sensor was inserted into a soil sample, made available in a bucket. The system was activated and allowed to run for a period of seven hours to evaluate its functionality. Its data logging capability was validated by comparing the system logged and/or predicted data ( ) (i.e. temperature, humidity and soil moisture content) with those measured by external devices ( ) namely: thermometer, hygrometer and soil moisture sensor meter respectively. The data collected by the system and that of the external devices were compared using a line graph. Also, an average classification error designated as was obtained using equations (8) to quantify the agreement between the data (Ogedengbe, 2014). The average classification error provides a more robust metric for assessing data prediction/classification accuracy and should be sufficiently small i.e. close to zero.

= (8)
Where , which can be obtained using Equation (9) for n dataset, represents the root mean square value of the vector difference between the actual measured data and the data logged and/or predicted by the developed system. = ∑ (9) Also, Arms, obtained using equation (9), represents the root mean square value of the actual measured data.

RESULTS AND DISCUSSION
Classification Accuracy of the ANN Model for Rainfall Prediction: The optimal ANN model for the rainfall data set returned a minimum corresponding MSE of 47.46. The ANN network takes the average daily temperature and humidity of the location as input which it utilizes to predict the rainfall value. A comparison of the actual rainfall value available from the data used for testing and the value predicted by the optimal ANN model for some selected days show that the model is adequate for predicting the rainfall value (status) within the target location (see Fig. 2). The average classification error of the rainfall value as predicted by the ANN model, estimated using equations (8-10), is 0.04194. This is very low thereby making the model acceptable for the rainfall prediction purpose. Also, the correlation coefficient between the predicted rainfall value and the actual rainfall value is very high with a value of 0.9976. Hence the ANN model was implemented on the controller for estimation of rainfall status whenever the internet is not available and the system cannot communicate with the weather station.

Performance of the Developed Smart Irrigation
System: The evaluation result confirmed that the developed system does monitor the weather database, predicted the rainfall status with good accuracy and, with the help of the microcontroller, make the required decision to irrigate the soil depending on the soil moisture content value and the rainfall status. The system, when powered, was found to activate the sensor and sim module appropriately. It checked the weather database and returned the rainfall status. Also, the soil moisture content, the temperature and the humidity of the air was displayed on the LCD. When the soil moisture content was below 30% and the system reported that rainfall is not expected (i.e. rainfall status is NIL) the system activated the pump and initiated the irrigation process. The water pump therefore commenced and continued to irrigate the soil with the water pumped through the sprinkler until the UTV of the soil moisture content was reached.
Thereafter the system deactivated the pump thereby terminating the irrigation process. When the soil moisture sensor was placed in a wet soil and the soil moisture content value measured was 35% as indicated on the LCD, the system didn't activate the pump. The developed SIS successfully logged the air temperature, the air humidity and of the surrounding as measured and as obtained from the weather database. Also, the soil moisture content as measured by the soil moisture sensor was accurately logged. These data, successfully acquired and logged on the data platform utilized by the system, were found to be reliable (Figs. 3, 4 and 5). Fig. 3 depicts the readings of the average air temperature acquired by the system over a period of seven hours (2 pm (14:00) -9 pm (21:00)) as compared with the ones obtained as measured by a thermometer. These readings were respectively measured, transmitted and logged at intervals of 30 minutes. As shown in Fig. 3, the temperature as logged by the system when compared with the air temperature measured using a standard indoor/outdoor digital thermometer was found to have the same trend. Both readings decreased as the sun went down. The drop in both measuring system's temperature as evening approached proves that the system logged data is correct. Fig. 3: Comparison of the air temperature as measured by the developed system and a thermometer. Fig. 4 shows the readings of the soil moisture content logged by the system, taken over a period of seven hours (14:00-21:00) and that measured by a standard soil moisture sensor meter. These readings were logged at intervals of 30 minutes. The graph reveals that both readings follow similar trend as the values reduces. When the sun was still high, the moisture content of the soil slightly reduced (this is due to Evapo-transpiration), but as the sun went down, it maintained a steady reading of 33% and 34% recorded Air Temperature (oC) hr Actual Air temperature SIS Air temperature by the system and the moisture meter respectively. Also, Figure 5 depicts the readings of humidity logged by the developed system, taken over a period of seven hours (14:00-21.00) and that as measured by a standard indoor/outdoor Hygrometer. These readings were acquired and logged at an interval of 30 minutes.  5 shows the graph of humidity as logged by the system compared to that of a standard digital hygrometer. The graph reveals that for both the logged data and that obtained from the hygrometer, the humidity of the air increased as the sun went down i.e. the water vapour in the air increased during the cool of the day. Using equations (8-10), an average classification error, Ea, of 0.08019, 0.02866, and 0.06391 was obtained for the prediction of air temperature, soil moisture content and air humidity respectively. These value are sufficiently small to imply that the values of the parameters predicted are highly accurate. These results reveal that the developed smart irrigation system is reliable and accurate. It does monitor the soil irrigation determining conditions/parameters appropriately and with the help of the PIC16f876A Microcontroller, makes the required decision to irrigate the soil depending on the soil moisture content and the information gathered from the weather database and/or the model. It can also be observed that the system logging function works effectively. The system functioned effectively when powered on. It acquired and reported accurately, the rainfall status, the air temperature, the soil moisture and the air humidity, on the LCD either from the weather station or from the sensors and the model. The pump effectively delivered water to the system when required and deactivated it when the higher threshold value was reached. The system can be characterized as quite effective, reliable and accurate.
Conclusion: A smart irrigation system, which is able to autonomously switch on/off water sprinkler for irrigation purpose, was developed and evaluated. The system uses soil moisture status obtained from soil moisture sensors and daily rainfall status obtained from weather database or from a developed ANN model to arrive at the decision to irrigate the soil. The results obtained from evaluation of the system showed that its performance is quite reliable and accurate.