Developing a Hybrid Irrigation System for Smart Agriculture Using IoT Sensors and Machine Learning in Sri Ganganagar, Rajasthan

,


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.

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 cloudbased 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 lowcost 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 decisionmaking 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 2 Journal of Sensors S. no.

Proposed system
Future recommendations

References
1.This study has built a system that can get real-time data and use it to compute the appropriate amount of water to be utilized in a garden.By using sensor data from temperature, humidity, and soil moisture, this method has the capacity to save up to 34% of water or up to 26% when just relying on temperature variables The project aims to use machine learning to predict future garden conditions and prepare for droughts and environmental conditions.It also aims to extend its application to agriculture, where multiple crops with varying water needs affect irrigation times [20] 2. This article provides a thorough analysis of the most recent developments and technologies in the field of IoT-based smart farming.The commercial IoT-based devices created for smart farming are also discussed in this article IoT devices for smart farming are typically put in outlying areas.Therefore, it is important to guarantee the stability and dependability of the communication channels.Each piece of equipment used in smart farming should be robust enough to survive the severe conditions found in rural regions, such as dust, wetness from animals, etc. [21] 3. The objective of this research is to examine the various efforts and progress achieved in enhancing water utilization efficiency, water preservation, and food security via the use of Internet of Things 6.The study uses secondary data-gathering techniques and a qualitative methodology as its foundation.Automated irrigation systems are crucial for water conservation; this development may significantly reduce water use.IoT and automation are coupled with agriculture and agricultural practices to improve the effectiveness and efficiency of the entire operation One of the suggestions is related to the intensive R&D undertaken to pinpoint the present inefficiencies in processes and techniques and to build a new method for improved outcomes.Significant gains from R&D may enable the firm to guarantee long-term effectiveness.As a result, the company may be given the chance to pinpoint areas where IoT and WSN procedures need to be improved [25] 7.
A microdrip irrigation model is developed for multiple cash crops like cotton, jute, and groundnuts Geographical circumstances and resource accessibility are the primary determinants of irrigation.The selection of an irrigation system requires a careful evaluation of geographical factors [26] Journal of Sensors 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.

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.

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 4 Journal of Sensors Naïve Bayes, and random forest This research utilized six traditional classifiers-decision tree (DT), logistic regression (LR), K-nearest neighbor (KNN), support vector machine (SVM), Naïve Bayes (NB), and random forest (RF)-as well as an ensemble of six classifiers to build the machine learning model.According to the study, classification accuracy using DT, KNN, SVM, and RF is good.With six ensemble classifiers, the model also discovers the greatest accuracy of 100%.The System Usability Scale (SUS), which measures user satisfaction among frequent users, is also provided for the study.The suggested system's SUS score is 82% [30] 2. SVM, random forest, and Naïve Bayes The smart irrigation system described in this article makes use of the cloud and the Internet of Things.In this framework, machine learning algorithms were used to predict how much fresh water would be needed to develop a crop.Thus, a sizable volume of fresh water is conserved.The use of intelligent irrigation will alter the agriculture industry.SVM's accuracy result is greater than 80%; however, random forest and Naïve Bayes accuracy scores are both less than 77.5% [13] 3. SVM, KNN, and ANN The study forecasts irrigation needs using a database compiled from multiple sensors, utilizing data from various sensors.
Accuracy: KNN 91%, SVM 87%, and ANN 96.87% [31] 4. KNN, SVM LR, NB, and NN This research presents a machine learning-based irrigation strategy for smart agriculture, utilizing sensors like soil humidity, temperature, and rain.The node-RED platform and MongoDB are used to collect data, with K-nearest neighbors achieving 98.3% accuracy and 0.12 root mean square error.A web application visualizes and supervises the environment, combining sensor data, and model predictions [12] 5. KNN, SVM, GNB, and ANN The suggested method encourages efficient irrigation by conserving irrigation water while maintaining crop output.We assess the accuracy of three machine learning techniques for determining ET0: Gaussian Naïve Bays (GNB), K-nearest neighbor (KNN), support vector machine (SVM), and artificial neural network (ANN).It has been demonstrated that KNN is more accurate than SVM and GNB models, with 92% accuracy, high precision, recall, and f-measure [32] 6. LR, LDA, KNN, CART, NB, and SVM The paper describes an intelligent system for the Internet of Things, LoRa-based wireless sensor networks, and machine learning for scheduling and monitoring precise irrigation.The technology forecasts crop water needs based on soil and meteorological variables.There were six different machine learning methods employed, with the linear discriminant analysis technique having the highest prediction accuracy (91.25%).The system's capabilities enable efficient irrigation scheduling and monitoring of crop water requirements [33] 7. SVM, random forest, and logistic regression This article proposes a methodology for detecting and categorizing unauthorized access to Internet of Things (IoT) networks in agricultural regions.The precision of random forest is 85%, while the precision of logistic regression is 78%.On the other hand, SVM has an accuracy above 98% [34] 8. 9.

KNN
KNN The article presents a smart irrigation system using wireless sensor networks, drip techniques, and https://Thingspeak.com,an open-source cloud computing platform.The system uses online resources like weather predictions and soil tests to decide when to irrigate crops.The system achieves 89% accuracy, a 10% misclassification rate, 79% sensitivity, 93% specificity, and 81% precision in threshold metrics classification evaluation.The system's 97% and 98% prediction accuracy indicate reliable and efficient irrigation and water resource management, potentially boosting agricultural production in rural areas [36] Journal of Sensors 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.

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.Journal of Sensors (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.

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 Ushape 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.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.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.

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,…, x n ) 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.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.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.

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.

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 Journal of Sensors 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.
Smart irrigation methods are developed to meet global sweet water needs, ensuring frugal water consumption.A professional technique employing ontology and sensor data values determines 50% of the choice, and sensor data values are used for the other 50%.A machine learning algorithm (KNN) that combines the sensor data and ontology determines the final decision[35]

FIGURE 1 :
FIGURE 1: Proposed architecture for smart irrigation.

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.

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

FIGURE 7 :
FIGURE 7: Graph displays training and test data.

TABLE 1 :
Previous research work and future recommendations on automated irrigation system.

TABLE 2 :
Previous research on supervised machine learning models for automated irrigation system.

TABLE 3 :
Analysis data set.
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.Figure7represents the training data and test data in a graphical view.