Abstract

The agriculture sector is one of the largest consumers of fresh water. Different types of irrigation systems are available, including center pivot, drip and sprinkler systems, and linear motion systems. However, the complex structure of existing irrigation systems and their high maintenance costs encourage Indian farmers to continue using these methods. Due to its ease of use and low energy consumption, surface irrigation is one of the most popular irrigation techniques. Although the main reasons for poor irrigation application efficiency are uneven irrigation water distribution and deep absorption, using a variety of technologies, countries are trying to increase the sustainability of agriculture. Automated irrigation systems contribute significantly to water conservation. The combination of automation and Internet of Things (IoT) improves agricultural practices. These technologies help farmers understand their crops, minimize their impact on the environment, and preserve resources. They also enable efficient monitoring of the weather, water resources, and soil. This research proposes an intelligent, low-cost field irrigation system. The proposed prototype can measure soil moisture, rain status, wind speed, water level, temperature, and humidity using a hardware sensor and unit. To decide whether to turn on or off the motor, a variety of sensors are used to get a range of readings and conclusions. They enable automatic watering when soil moisture levels are below a certain threshold, and if soil moisture is equal to the required moisture, then the irrigation process stops. Every few minutes, the sensors measure the environmental factors. Data are collected and stored on a ThingSpeak cloud server for analysis. To evaluate the data we collected, we used a variety of models, such as K-nearest neighbors (KNN), Naïve Bayes, random forest, and logistic regression. Compared to other Naïve Bayes and random forest models, the accuracy rate was 98.8%, the mean square error was 0.16, and the results of logistic regression, KNN, and SVM were in order: (98.3%/1.66), (99.3%/0.66), and (99.5%/0.5), respectively. In the end, an automated irrigation system run on IoT applications gives farmers access to remote monitoring and control, as well as information about the specifics of the irrigation field.

1. Introduction

Agriculture significantly impacts GDP in both developed and developing countries. By 2050, the world’s population is expected to reach 10 billion, requiring a 70% increase in food production. Sustainable agriculture principles must be followed to ensure food security for this growing population [1, 2]. The objectives of sustainable agriculture are to enhance agricultural productivity and reduce the negative effects of outdated farming methods on the environment. Developing advanced agricultural practices necessitates substantial research and development, especially in the field of irrigation, which accounts for 70% of the total freshwater resources. Internet of Things (IoT) and machine learning (ML) systems can help monitor, control, and plan irrigation for agricultural regions, ensuring efficient use of freshwater resources [3, 4]. Smart agriculture systems utilize IoT and artificial intelligence to collect and transmit autonomous data to data centers. Artificial neural networks and clustering evaluate data to make informed decisions, improving the efficiency of agricultural systems [5, 6]. A range of IoT and ML irrigation systems have been created with the aim of monitoring and controlling irrigation systems. An irrigation system prototype has been designed that integrates sensors and an energy module at the top of the sprinkler [7]. Another example connects a soil moisture sensor to the Internet to track soil moisture, while a different irrigation system uses ML to assess data on air quality, temperature, and humidity to schedule irrigation [8]. The management of water is extremely important due to its scarcity. As a substantial portion of fresh water is needed for irrigation, this influences agriculture as well [9]. There are many different types of irrigation methods available, such as flood irrigation, trickle irrigation, drip irrigation, and spray irrigation [10]. Irrigation planning involves monitoring agricultural factors such as temperature, humidity, and soil moisture. Open-source platforms, such as Arduino UNO, are used in irrigation management systems. Efficient management of water resources is crucial for increasing yields and meeting future food demand in areas with limited resources [11]. We can irrigate more areas with the same amount of water if we use a controlled irrigation system. In this study, we develop a method for irrigation prediction to effectively control intelligent autonomous irrigation. To estimate the amount of irrigation required for each crop, the suggested method uses the IoT. We took the following four steps:(1)Install the sensors for water, rain, temperature, soil moisture, wind, etc.(2)Connecting the sensor set to a data collection system.(3)Using an IoT server to transfer data to an application after storing it on a ThingSpeak cloud server.(4)Various algorithms, including K-nearest neighbors (KNN), Naïve Bayes (NB), random forest (RF), SVM, and logistic regression (LR), are used to analyze the data.

This automated irrigation method will be extremely useful for large-scale irrigation systems. This will both simplify the labor-intensive process of irrigation for plants and improve water management. The concept of a related study and the proposed automated irrigation system are presented in the article. Section 2 presents a state-of-the-art study on ML, precision irrigation, automated irrigation systems, and ML algorithms for irrigation prediction, along with comparisons with previous research. Section 3 presents the proposed irrigation system design. Section 4 displays the results of the system testing and analysis. Future work recommendations are provided in Section 5. The conclusions of the suggested study are finally summarized in Section 6.

2. Literature Review

This section covers the contributions of several researchers in the fields of IoT and ML for automated irrigation systems for agriculture.

In this research, a ML algorithm-based, intelligent, adaptable irrigation technique for smart agriculture is presented. For the best possible plant development, it uses sensors for temperature, moisture content in the soil, and rainfall. A variety of models, including KNN, LR, neural networks, SVM, and NB, are utilized to evaluate the data collected using the node-RED platform and MongoDB [12]. The IoT and cloud-based architecture are used to analyze a smart irrigation system in this article. The device detects the humidity and moisture content of the soil; ML methods are used to analyze the data. The system uses ML algorithms to forecast the ideal amount of fresh water for crop production, which results in significant water savings. The agricultural industry is predicted to change due to this technology [13]. To solve irrigation-related problems, the researcher developed a solution that uses ML and the IoT. Pressure, pH, temperature, humidity, and other sensor types are included in the hardware. The pH sensor measures the pH of the soil and forecasts water requirements. The aim is to develop automated irrigation systems and save water for future usage. Improvements in agricultural water efficiency and conservation are the objectives of the initiative [14]. In this, a low-cost and intelligent agricultural irrigation system is presented. The constructed prototype uses a hardware sensor and a unit to monitor temperature, humidity, and water level. To determine whether to turn on or off the motor, the study uses a variety of sensors to collect various readings and values. The IoT-based automated system uses applications to establish an independent irrigation system. It also sends SMS messages to our mobile devices, providing us with remote updates on irrigation field details [15]. Research has developed a smart irrigation system that estimates the depth of crop water (WUD) for tomato planting based on real-time soil moisture data. A central irrigation controller was used to collect the data, guaranteeing an accurate irrigation depth at every irrigation event. The experiment was carried out in a Northern Chinese greenhouse [16]. This research suggests that instead of using physical sensors in a smart irrigation system, neural networks based on long–short-term memory (LSTM) should be used. The system computes transpiration in each field by transmitting temperature, humidity, and soil moisture data via physical sensors. LM35 is used for temperature, DHT-22 is used for humidity, and a bespoke sensor is used for moisture readings. Real-time data were collected. The findings indicate that the neural sensor suggested based on deep learning has a high degree of accuracy when predicting real-time data, especially those related to wetness, temperature, and humidity. This shows that a neural network can improve the performance of physical sensors in agricultural settings, increasing the dependability of smart irrigation systems [17]. In the research, the researcher developed a framework that combines IoT with various metrics and methodologies to monitor data related to temperature, humidity, and soil moisture. This approach offers farmers the ability to analyze data in real-time, allowing them to monitor soil moisture, temperature, and automated irrigation systems more efficiently, with reduced use of time and energy, and in decision-making analysis specifically designed for farmers [18]. A method was developed to increase the efficiency of irrigation for cotton crops. Researchers have examined a variety of data sets to calculate the exact amount of water required for a particular soil combination. A mobile application makes the results of analytical research accessible to farmers or other users [19]. Table 1 illustrates some more previous research on automated irrigation systems for smart agriculture.

This article focuses on research on an autonomous irrigation management system for agricultural fields. The system uses a mobile application for data consultation and analysis in real-time, as well as a wireless sensor and actuator network. RF produced the best results with an accuracy of 84.6% when ML techniques were employed to estimate the optimal timing for water administration. An approach is also included in the system to figure out how much water is required for field management. Water management technology that is both effective and efficient, as shown by the ability of the system to save up to 60% of the water used [27]. ML and deep learning technologies can be used to improve crop yield and manage irrigation in agriculture. These approaches exemplify the fast progress of artificial intelligence in the agricultural industry. The concept of smart farming encompasses monitoring all agricultural processes, predicting diseases, managing agricultural pests, and automated irrigation [28]. The article presents a machine-learning and IoT-based irrigation system that improves efficiency. Sensors on a Raspberry Pi measure soil temperature and moisture content using the serial peripheral interface protocol. The NB technique is used to train a ML model that regulates the irrigation system with an accuracy of 98.33%. A prototype project with a water pump and relay is also built to demonstrate the precise operation of the system [29]. Table 2 illustrates previous research on the automated irrigation system for smart agriculture using ML.

3. Proposed Hybrid Irrigation System

One of the essential stages in the production of agricultural products is irrigation. Agricultural uses account for around 80% of the entire water supply, although the amount of water available varies considerably from region to region. The adoption of microirrigation technology takes an hour. But farmers still adhere to an old irrigation pattern, which causes a huge loss of water. Existing sprinkler systems are not suitable for all crops. The height of the sprinkler irrigation is 4 feet, so it cannot irrigate crops greater than 4 feet. In drip and sprinkler irrigation systems, the pipe structure of the system spreads throughout the field, making intercultural operations difficult. Binding up the system during harvesting and sawing new crops leads to damage to pipes as well as to crops and to a highly labor-consuming process. Damage due to rodents is more common in fixed-set irrigation systems. The center pivot irrigation system and the linear move irrigation system are constructed of heavy pipes and are complex structured. They are not suitable for fields of unusual shapes because of their high capital and maintenance requirements. Related research and findings are discussed in the literature review, and future work recommendations are shown in Table 1. To overcome these problems, we proposed a hybrid irrigation system that would be able to automatically irrigate different crops from a remote location. The objective of the proposed hybrid irrigation system is to overcome the problems of existing systems. The suggested smart irrigation architecture is shown in Figure 1.

This research has developed a smart irrigation system that automatically waters crops without human involvement. As a center pivot and linear move irrigation system, it also irrigates crops with vertical sprinkles, but in a center pivot and linear move irrigation system, farmers need heavy machinery, power supply, or human resources to move the system in the field to meet the irrigation requirements. The proposed irrigation system is a stable and user-friendly model. It is designed in a T shape, which is fixed in the field with some distance, and irrigates the field with sprinklers. The system uses moisture sensors to measure the moisture content of the soil in fields. When the moisture levels drop below the minimum level, the NodeMCU board activates the water pump, providing water to the crop. The water sensor also monitors the conditions of the water reservoir, sending signals to the NodeMCU when the reservoir is empty. Wind speed sensors measure the wind speed on the farm, while rain sensors detect the rain status in the field. The data from soil moisture sensors are displayed on an LCD screen. Solenoid valves are embedded to control water flow in different farms. If soil moisture drops below the threshold value for farm field A, the solenoid valves are activated, while the remaining valves remain off. This irrigation system helps farmers irrigate their fields with less labor and time. The hybrid irrigation system is built with the ability to automatically irrigate crops, considering factors such as weather conditions, temperature, humidity, and soil moisture. Taxonomy is used to consider the choice of climatic and soil conditions, while our sensor network keeps track of factors, such as temperature, humidity, and soil moisture. In contrast to the three levels of conventional IoT design (application layer, network layer, and perception layer), our proposed IoT architecture comprises four layers: application layer, processing layer, transport layer, and perception layer.

Sensors are included in the physical layer, often referred to as the perception layer, to collect data such as soil moisture level, air humidity and temperature, rainfall level and wind speed. Using networks like Wi-Fi, 2G, 3G, and LAN, sensing data that has already been acquired is sent from the transport layer to the processing layer. The transport layer sends massive amounts of data to the processing layer, which stores, analyzes, and processes it. It uses modern tools, such as cloud servers and the IoT. The main goal of the application layer is to provide user-specific application services. Our system manages the sensors, GSM module, ThingSpeak cloud server, IoT server, Android application (Blynk application), and other components. We have been able to prepare our system for complete autonomy thanks to these technologies.

3.1. Architecture of the Proposed System and Working Principals

This research developed a method for automatic watering by measuring ground moisture values. This smart irrigation system allows farmers to control and adjust irrigation with fewer human resources. Figure 2 shows the block diagram of the hybrid irrigation system.

The NodeMCU is an open-source platform that utilizes the ESP8266 to facilitate the connection of devices and enable the transmission of data via the Wi-Fi protocol. Different types of sensors are used to control the irrigation system and monitor the field. Sensors such as soil moisture sensor, wind sensor, water level sensor, rain detection sensor, temperature, and humidity sensor, etc., node MCU 8266 is used in this prototype as main board. A soil moisture sensor is used to measure soil moisture content in the field. The required soil moisture threshold value is described, and if soil moisture exceeds or decreases from the threshold value, the soil moisture sensor will send the current soil moisture value to the server through the node MCU. The updated current soil moisture value is sent to the application, and the farmer can start irrigation according to the minimum water requirements of the crops from a remote location automatically. Water sensor is utilized to monitor the water status at the dam. If the water dam is empty, then it will send the empty signals to the application, and at the same time, a buzzer is used to indicate an empty water dam if someone is around the field to shut down the motor manual. A wind speed sensor is used to measure the wind speed. Wind speed plays an important role in sprinkler water, so if wind speed is high, the farmer can turn off the motor to reduce water waste. Solenoid valves control water flow on different farms. If soil moisture decreases below the threshold value for a farm field, solenoid valves activate for that farm, while the remaining valves remain off for other farms. An LCD screen is used to display soil moisture from all fields for quick review of soil moisture at field level. This innovative approach benefits farmers who struggle to irrigate crops. After the sensors were attached to the board, we started programing the board to control the sensors in a way that made it possible for different types of data to be collected and transferred in real-time. Then, we utilized the ThingSpeak cloud server to ensure data storage, and we used the application to monitor and operate the irrigation system. We then aggregated several months of data so that we could train it to anticipate when to start or stop pumping and close the valve.

3.2. System Working Flowchart

The flowchart of the proposed system provides the basic principles of the system and an overview, as shown in Figure 3.

The working steps are as follows:(1)In Step 2, the system analyzes the sensor data.(2)In Step 3, the node MCU esp8266 may be used to initialize the system.(3)Step 4: The server/application gets information from numerous sensors deployed in the agricultural field, including the soil moisture sensor, wind sensor, humidity sensor, rain sensor, and water level sensor.(4)In Step 5, the soil moisture sensor continuously measures the soil moisture content. If the soil moisture is below the required threshold level, the signals are sent to the application and the node MCU. The solenoid valves attached to that soil moisture sensor will turn on when the update is transmitted to the node MCU, but the solenoid valves connected to other sensors will stay optimal.(5)In Step 6, the motor that is attached to the relay will be turned on either through the application or manually.(6)In Step 7, when the amount of soil moisture reaches the required threshold level, the relay will automatically turn the motor off and the solenoid valves off.(7)In Step 8, the other sensors continuously read the data and transmit it to the server or application. For example, a water level sensor monitors the water level in the dam; if the dam is empty, the application is updated with an empty status, and the buzzer starts beeping. The wind speed sensor and the temperature sensor continuously monitor the wind speed and temperature of the field because both factors play an important role in irrigation. High temperatures and wind speeds cause water loss during irrigation. By monitoring the field, irrigation can be scheduled according to temperature and wind speed.(8)In Step 9, once Steps 7 and 8 have been completed, the system will go to Step 2.(9)In Step 10, the system reads the data from the field and transmits it to the application. This operation will continue until the system’s input power is turned off.

3.3. Hybrid Irrigation System Design
3.3.1. Hardware Implementation

To develop the hybrid irrigation system, few steps are performed: Hybrid irrigation model structure is shown in Figure 4.

(1)The material is cut into the desired length dimension of the structure is 1.2 into 0.17 into 0.4 m.(2)The project structure is designed in upside down U-shape structure and T-shape hybrid irrigation system.(3)Eight millimeters water pipe is used as a main supply pipe. Six millimeters water pipe is used for subpipeline for supply the water to field.(4)T and L shape pipe connectors are used to connect the subpipe with main pipes and solenoid valves.

3.3.2. Software Implementation

As mentioned previously, the NodeMCU requires a supply voltage of 5 V DC to operate the circuit components. The DHT 11 sensor data pin is connected to the node MCU pin D2 and GND and VCC to (ground, 3.3 V), soil moisture sensor connected to the A0 pin of the Arduino Uno and connected with the D4 pin of the node MCU, and GND, VCC pin connected with the ground pin, 3.3 V, soil moisture sensor b, connected to the A1 pin of the Arduino Uno and connected with the D8 pin of the node MCU, and GND, VCC pin connected with the pin ground, 3.3 V. The rain detection sensor is linked to the node MCU via pin D5. The water sensor is connected to that digital pin of node MCU D6 and the buzzer is connected to the digital pin of node MCU D7. If the water level is low, the D7 pin gets a signal and the buzzer will beep out. LCD display connected with the digital pins of the Arduino Uno RS = 7, EN = 6, D4 = 5, D5 = 4, D6 = 3, D7 = 2. Wind speed sensor connected to the analog pin of node MCU A0. To connect the water pump motor and the solenoid valves, we will need a relay module. Relay 1 will take the signal input value from soil moisture sensor 1 and relay 2 will take the signal from soil moisture sensor2. Relay 1 is connected to the digital pin of Arduino D8 and relay 2 is connected to the digital pin of Arduino Uno D9. Relay 1 will control the two solenoid valves, solenoid valve 1A and solenoid valve 1B, and relay will control the two solenoid valves called solenoid valves 2A and 2B. The motor is connected to the third relay and the relay is connected to the digital pin D1 of the node MCU. Transistors and resistors are used to regulate the voltage within a range of 3-5 volts to safeguard sensors and equipment from excessive voltage fluctuations. For the operation of the system, we used 5 volts of DC power for the node MCU and 2 volts of power for the Arduino Uno, along with one USB cable to complete the power supply to the Arduino Uno. Twelve volt power supply is connected with the solenoid valves and motor and with the relays. To establish the communication between hardware and the blink application, we need to establish the communication between the hardware and the blink application. We need to set the virtual connection between the sensors and the blink application. Data from DHT 11 sensors were sent to the blynk server using the virtual connection V0, V1, and V2. The rain sensor connected to the virtual pin V6 and the water sensor is connected to the virtual pin V7 soil moisture one connected to the virtual and pin V8 8 and the soil moisture sensor 2 connected to the virtual pin V9. Wind speed sensor pin is connected to the virtual pin V4 and V5, and the water pump relay is connected with the virtual V3 pin to control the water motor. Sensor’s connectivity with node MCU and Arduino Uno R3 is represented in Figure 5. Several tools are included in the software design method that are necessary for the system to function properly. A few of them are as follows:

(1)Firmware developed using C/C++ with the Arduino IDE.(2)The ThingSpeak cloud server was used to collect and store data for further analysis.(3)Data visualization for field control and monitoring is done using the Blynk application.(4)Real-time data are collected and sent to the ThingSpeak cloud server after the same code is updated to send data to the Blynk application to control and monitor sensor data automatically through the application.(5)To simplify the access and control of the system, a Wi-Fi or Internet service provider is used.(6)For data analysis, Jupiter Notebook and Anaconda are used.

3.3.3. Hybrid Irrigation System Working Application

An Android application is being developed for farmers to monitor and control the hybrid irrigation system. Input parameters such as soil moisture, wind speed, rain status, water, temperature, and humidity are displayed in an application. The farmer will be able to monitor and control field conditions at any time and from anywhere. With the help of this application, the farmer will control the motor switch and irrigate the crop according to the requirements and availability of water. The mobile application is shown in Figure 6.

4. Machine Learning Analysis Algorithms

This section presents supervised machine learning algorithms to analyze the performance of the automated irrigation system. Supervised learning is a method where models are trained on a training data set to produce the desired output. This process involves acquiring knowledge and improving performance over time. The model’s precision is evaluated using a loss function, and adjustments are made until the error is reduced. This research utilizes a set of supervised machine learning algorithms such as LR, KNN, support vector machine (SVM), NB, and RF classifiers. Table 2 presents the results of previous research studies that utilized supervised machine learning techniques to analyze a smart irrigation system. The research presents a machine learning-based irrigation strategy for smart agriculture using sensors like soil humidity, temperature, and rain. The node-RED platform and MongoDB collect data, with KNN achieving 98.3% accuracy. A web application visualizes and supervises the environment [12]. This study examines a smart irrigation system that utilizes the IoT and a cloud-based architecture. This technology is developed to monitor the moisture and humidity content of the soil and then use several machine learning algorithms for analyzing the data in the cloud. Farmers receive accurate information on water content requirements. Intelligent irrigation may help farmers use less water [13]. In this research, we proposed a new irrigation model (T-shaped sprinkler irrigation). Different types of sensors are used to collect data from the field, like soil moisture sensors, wind sensors, temperature sensors, rain sensors, water level sensors, etc. All sensors are connected to the node MCU and UNO to control and collect data from the field. Data collected from the agriculture field is stored on the ThingsSpeak cloud server. A total of 3,000 lines of data are collected for analysis using machine learning algorithms to calculate the accuracy of the working automated irrigation system. From the collected data, 80% was used for training purposes, and 20% was used for testing the algorithms. After collecting the data for analysis, we developed an application for monitoring and controlling the irrigation. The algorithms used for the classification of automated hybrid irrigation systems are described below.

4.1. Support Vector Machine

SVM is a machine learning technique that is used for classification and regression tasks and is specifically designed to identify objects within given data sets. This method effectively divides n-dimensional spaces into various classes, making data entry efficient. The research used the kernel trick mechanism of SVMs for classification purposes. This technique includes the transformation of 2D nonlinear separable data sets into higher dimensions, such as three, four, or 10 dimensions [30]:

4.2. Naïve Bayes

Thomas Bayes (1702–1761) developed the Naïve Bayesian approach to probabilistic machine learning, which is based on the Bayes theorem. The likelihood of A occurring given that B has already happened can be used to describe this theorem. Considering X = (x1,…, xn) is the features, and Y is the class variable, in this sentence. The NB algorithm is unique in that it assumes that each characteristic is independent of the others and that modifying one feature will not affect any other. Despite appearing straightforward, NB has turned out to be a useful classification system:

4.3. Logistic Regression

LR is a supervised machine-learning method used for classification tasks. This method is used to determine the probability of the dependent variable. The target variable has a binary nature, indicating that it may only assume one of two potential classes: success (represented by 1 or yes) or failure (represented by 0 or no). The classification of this may be categorized into three main types: binary or binomial, multinomial, and ordinal.

The equation for linear regression may be expressed as the equation of a straight line:

4.4. K-Nearest Neighbors

The KNN method is a supervised learning approach often used in machine learning. The algorithm operates on the assumption that there exists a degree of similarity between the newly acquired data and the data that are already accessible. When assigning the newly acquired data to the category that exhibits the highest degree of similarity with the existing categories, the KNN algorithm uses the Manhattan equation to calculate the distance within this framework. The formula for the Manhattan distance is shown in Equation (4) [12]:

4.5. Random Forest

Ensemble learning is a powerful teaching strategy. For categorization purposes, RF is commonly used. Each decision tree’s planned output is represented by the forest’s output, and the categorization is based on the information gathered from the many decision trees created during training. Random forest decreases variance in the final model, improves performance, and controls overfitting by building decision trees using random samples of the training data [8].

4.6. Collecting and Storing Data

Automated modeling and continuous collection of real-time measurements of environmental factors, such as soil moisture levels, temperature, humidity, and pump activity, were taken into consideration when developing the hybrid smart irrigation system based on the IoT. To perform the analysis, the ThingSpeak cloud server is used to collect data from all sensors. We began implementing these devices in various environments with various soil conditions in the mass collection process using IoT technologies, which are made up of many autonomous devices in the form of sensors capable of self-organization and working to collect information. It was built to distribute the data using an algorithm to provide an essential interface during the project. This was a practically complete implementation of our data set.

Data collected from different sensors with different ranges are discussed below.(1)Soil moisture data: As shown in Table 3, these data are generated by an analog sensor over a range of values between 0 and 1,023. We can see that the smallest value is 314.51 and the maximum value is 984.82, meaning that the average value is 654.5.(2)Temperature data: A DHT11 temperature sensor was used to collect air temperature data from the environment in the form of Celsius. We can observe that the average temperature throughout the collected months was 26.24, exceeding both its upper and lower limitations. The minimum value during this time was 18.00, and the highest temperature during this time was 38.99.(3)Data on air humidity: We were able to acquire data on air humidity using the same temperature sensor that helped with collecting air temperature values, and the following is an analysis of those data. The average was 66.4% while collecting the massive amount of data, with the lowest value being 38% and the highest value being 81.26%.

The study suggests an automated design based on the peer-to-peer concept, using data that can be classified with values that vary from 0 to 1. The final design was implemented to show its feasibility and prevent major problems. The data collected from all sensors are shown in Table 3.

4.7. Results and Analysis of Machine Learning Algorithms

Any machine learning method, including KNN, NB, LR, RF, and SVMs, which are all classification dilemma handling algorithms, can forecast the degree of irrigation demand. In this paper, all the abovementioned techniques are used to analyze the collected data. For experimental analysis, a collection of 3,000 data recordings was collected. These factors include soil moisture, temperature, humidity, and the water pump for irrigation decision-making. Five machine learning algorithms, KNN, NB, LR, RF, and SVMs, were utilized in an experimental investigation. Two different colors are used to represent the graph. Red colors are used to represent 0, and blue colors represent 1. To achieve better accuracy and application modeling, the data available on soil moisture, air temperature, humidity, and motor working status are divided into two sets: the training data set and the testing data set. The training set contains 80% of the data, and 20% is used for testing and validation. The training data set is used to train the different machine learning algorithms, and the testing data set is used to test the models, which will help to find the accuracy of their workings and the best machine learning algorithm. Figure 7 represents the training data and test data in a graphical view.

The real-time collected data from field are stored for analysis using different machine learning algorithms. The data collection process is done on a ThingSpeak cloud server and published on Mendeley Data [37]. Table 3 shows the data for making training predictions, looking at presorted data, and showing outcomes. After analyzing all five machine learning algorithms, the results from the models used in this study are shown together with their accuracy and mean square error (RMSE) in Table 4. The same outcome is shown in Figure 8, as in a graph.

(1)The output of the KNN model is shown in Line 1, where the corresponding red and blue colors of the training and testing sets stand in for the pumping points between “0” and “1.” All the data points supplied in red and green are shown to be integrated into their surroundings by the model, respectively. The model’s rate of accuracy in describing the outcomes is 98.3%.(2)Line 2 displays a 99.8% accuracy rate and a 0.16 means-square error for the RF model.(3)Line 3 shows the results of the NB model with a 98.8% accuracy rate and a 0.16 means-square error.(4)In Line 4, where the SVM model’s results are displayed and as a result, the mean square error is 0.66 and the accuracy rate is 99.3%.(5)Finally, a LR model with a mean square error that is very nearly 0.5 and a rate of accuracy of 99.5%.

The accuracy of ML algorithms is determined through training and validation processes. Various machine learning algorithms provide satisfactory results after performing analysis of the collected data. As we can see, the accuracy rates of the NB and RF model of 98.8% and the MSE of 0.16 are higher compared to KNN, SVM, and LR with successive results: (98.3%/1.66), (99.3%/0.66), and (99.5%/0.5), respectively.

5. Future Work Recommendations

To increase the efficiency of the system, some recommendations are listed for future research work:(1)To maintain the soil quality, there is a need to monitor soil salt rate and pH level of the soil.(2)To increase the crop production to fulfill the future needs, controlling and monitoring of the fertilization process are required to be utilized with the existing smart irrigation process.(3)Improvement of the system is done by adding new controllers and sensors to increase the stability, reliability, structure, and working efficiency of the system.(4)Artificial intelligent system will be installed with the irrigation system to predict the user action, rainfall condition patterns, and time to harvest extra.(5)To estimate the water requirement for irrigation process, water meter can be installed in the irrigation systems.(6)In this project, motor is controlled from mobile application, fully automated motor system should be installed.(7)Cameras can be used for detecting the deeds and for controlling and monitoring the plant growth.(8)Alarm system can be installed in the smart agriculture system for alerting the farmers regarding the fire and the any movement in the agriculture field. This can be achieved using the fire sensor and motion detector sensor.(9)Decision making can be done using the big data and artificial intelligent technologies. These technologies will help the smart irrigation for past and future data prediction in the IoT system.

6. Conclusion

Increased production is an important first step since it will be necessary to meet the projected 70% rise in global food consumption by 2050. The management of water consumption for irrigation is another aspect of it. In this research, a hybrid irrigation system is suggested. Three modules make up our suggested approach to smart irrigation: As the first module, the sensor network identifies variables affecting the requirement for water. We use sensors such as DHT11, a capacitive soil moisture sensor, a wind sensor, a rain sensor, and a water level sensor to measure temperature, soil moisture, temperature, humidity in the air, wind speed, rain status, and reservoir water level. In the second module, we utilize the ThingSpeak cloud server and the Bylnk cloud server as IoT servers to send and receive data. In the third module, we used machine learning algorithms to analyze the data and determine how accurate the decision-making process was to determine the need for irrigation. KNN, NB, LR, and RF were just a few of the models we used to analyze the data we collected. When comparing the accuracy rates and mean squared errors of different models, the NB and RF models have an accuracy rate of 98.8% and MSE of 0.16. In comparison, the KNN, SVM, and logistic regression models have accuracy rates of 98.3%, 99.3%, and 99.5%, with corresponding MSE values of 1.66, 0.66, and 0.5, respectively.

Data Availability

The data used to support the findings of this study have been published in the (MENDELEY DATA) repository (https://data.mendeley.com/datasets/fpdwmm7nrb/1).

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Authors’ Contributions

All authors contributed significantly to this research study.