IoT Framework for Measurement and Precision Agriculture: Predicting the Crop Using Machine Learning Algorithms

: IoT architectures facilitate us to generate data for large and remote agriculture areas and the same can be utilized for Crop predictions using this machine learning algorithm. Recommendations are based on the following N, P, K, pH, Temperature, Humidity, and Rainfall these attributes decide the crop to be recommended. The data set has 2200 instances and 8 attributes. Nearly 22 different crops are recommended for a different combination of 8 attributes. Using the supervised learning method, the optimum model is attained using selected machine learning algorithms in WEKA. The Machine learning algorithm selected for classifying is multilayer perceptron rules-based classiﬁer JRip, and decision table classiﬁer. The main objective of this case study is to end up with a model which predicts the high yield crop and precision agriculture. The proposed system modeling incorporates the trending technology, IoT, and Agriculture needy measurements. The performance assessed by the selected classiﬁers is 98.2273%, the Weighted average Receiver Operator Characteristics is 1 with the maximum time taken to build the model being 8.05 s.


Introduction
India ranks second in the world in farm output but 64% of cultivated land depends on the monsoons. Irrigation accounts for nearly 85% of water and nearly 60% of water is wasted during irrigation. Precision agriculture can be defined as "the application of modern information technologies to provide, process, and analyze multi-source data of high spatial and temporal resolution for decision making and operations in the management of crop production. This Precise agriculture may give rise to enhance productivity, Soil degradation, Efficient water usage, reduction in chemical usage for cultivation, dissemination of modern farm practices to improve quality, quantity, and cost of production in crops. By incorporating Agriculture IoT solutions are focused on helping farmers close the supply-demand gap, by ensuring high yields, profitability, and protection of the environment. The approach of using IoT technology to ensure optimum application of resources to achieve high crop yields and reduce operational costs is called precision agriculture [1][2][3]. IoT application in Precision Agriculture is focused on crop water management, Pest control and management, Precise detection and nutrients management and safely storing management.
Historical development of sensors shows the progress in measuring various parameters like temperature, pH, Humidity, Analytical parameters like potassium, phosphorous, Nitrogen measurements from a remote location and the data acquisition is possible to attain all the measurements using sensors thereby the data is stored in the cloud or network server for further processing as shown in Figure 1.
Technologies 2022, 10, x FOR PEER REVIEW 2 of 12 management, Pest control and management, Precise detection and nutrients management and safely storing management. Historical development of sensors shows the progress in measuring various parameters like temperature, pH, Humidity, Analytical parameters like potassium, phosphorous, Nitrogen measurements from a remote location and the data acquisition is possible to attain all the measurements using sensors thereby the data is stored in the cloud or network server for further processing as shown in Figure 1. Sensors are combined to form a network that can be accessed or linked by cloud/backend where the sensor responses in a different geographical area are linked by the cloud [4][5][6]. There are four different phases from smart things without connectivity next progression was a local exchange of information and distributed control systems with programmable logic controllers, the network of things. The next phase includes internet-based communication for monitoring and control, things on the internet. The final phase is regional, global, and open control loops and IoT [7,8]. Examples Seamless internet of things supply chain management and product life cycle management [9][10][11].
Organization of the paper: The article is composed of five sections and started from strengthening the concept to deploy a module to recommend the crop for irrigation and attain maximum yield with the recommended crop. The next section is related to works from IoT in the Agriculture sector and precision agriculture using machine learning algorithms. This is followed by the methodology, proposed block diagram, and experimental setup. Then the experimental analysis and discussion end with references.

Literature Review
Machine learning is a major source of technological trending revolutions. With recent developments in the process control industry, expectations on both the client and server sides suggest when recommending specific crops using the Internet, reputable magazine articles, and machine learning algorithms of choice. It is detailed from the available resources, such as the conferences that support the system. Online web journals provide important information and generally provide tips and solutions in the event of a malfunction. It is essential to anticipate such problems and deceptions that can lead to serious consequences of failure.  Sensors are combined to form a network that can be accessed or linked by cloud/ backend where the sensor responses in a different geographical area are linked by the cloud [4][5][6]. There are four different phases from smart things without connectivity next progression was a local exchange of information and distributed control systems with programmable logic controllers, the network of things. The next phase includes internetbased communication for monitoring and control, things on the internet. The final phase is regional, global, and open control loops and IoT [7,8]. Examples Seamless internet of things supply chain management and product life cycle management [9][10][11].
Organization of the paper: The article is composed of five sections and started from strengthening the concept to deploy a module to recommend the crop for irrigation and attain maximum yield with the recommended crop. The next section is related to works from IoT in the Agriculture sector and precision agriculture using machine learning algorithms. This is followed by the methodology, proposed block diagram, and experimental setup. Then the experimental analysis and discussion end with references.

Literature Review
Machine learning is a major source of technological trending revolutions. With recent developments in the process control industry, expectations on both the client and server sides suggest when recommending specific crops using the Internet, reputable magazine articles, and machine learning algorithms of choice. It is detailed from the available resources, such as the conferences that support the system. Online web journals provide important information and generally provide tips and solutions in the event of a malfunction. It is essential to anticipate such problems and deceptions that can lead to serious consequences of failure.  [14] best utilization of technology for farmers through IoT and with some chip, embedded sensors, and smartphone applications farmers can monitor the soil fertility, temperature, rainfall, recommendations on plantation crops. Vadapalli et al. (2020) [15] productivity is based on acquiring data from the sensors using modern electronic gadgets to do smart agriculture using IoT. J. Gubbi et al. (2013) [16] present innovation in IoT using ubiquitous computing web sharing information from all over present sensors sensing enabled by WSN across many areas of modern habitation. M. Stoes et al. (2016) [17] IoT has driven agriculture using separate 3 layer architecture which uses a low power LoRaWAN, the gateways connecting all devices through IoT and the cloud forms the final layer. This article has driven agriculture to the trending techniques in agriculture which is the backbone for forming a sustainable environment for developing countries. Liu et al. (2018) [18] traditional neural network and ARIMA methods are used to predict the temperature with the help of IoT of varying granularities concerning time.
S. Pudumalar et al. (2017) [19] modern farming methodologies is incorporated by research data of soil characteristics, soil types with crop yield data collection. Ensemble model with voting technique using tree category algorithm, CHAID, KNN, and functionbased Naïve Bayes as machine learners to recommend crop. R. Katarya et al. (2020) [20] different approaches using modern methods like to present crop recommender systems using algorithms like Similarity-based models, Ensemble-based models, neural networks, KNN are used. Parameters chosen are meteorological data, temperature and soil profile and texture has given the best crop recommendations. Laurens Klerkx et al. (2019) [21] 5 thematic clusters are declared like digitization of farming, digitizing skills and farm work, ethics consideration in agriculture production systems, knowledge and innovation systems implementation in agriculture. Value chain maintenance against economics and for managing digitized agriculture. Future research agenda was suggested for smart farming and Agriculture4.0. Shadrin et al. (2019) [22] AI-enabled monitoring system for predicting the growth dynamics of plant leaves. Embedded system incorporated with low-powered sensors, GPU which runs NN based AI System. RNN cum LSTM is the core of the AI system whose operation is guaranteed for 180 days using a Li-ion battery. Kumar et al. (2018) [23] integrated information technology in Agriculture, WSN plays a vital role in data collection, monitoring, and analyzing the data from the agricultural field. The result establishes that crop productivity and quality have greatly improved. The article has surveyed the effect of wireless sensor networks for remote monitoring of the crop.
Tanha Talaviya et al. (2020) [24] revolution in Agriculture is by the implementation of AI for irrigation, weeding, fertilizing with the help of sensor networks and Drone i.e., unmanned aerial vehicles. The outcomes have proven that productivity cum quality has improved, this article is also a survey report by various researchers giving automation in agriculture in recent trends using Drones for spraying and monitoring. Anitha, P. et al. (2018) [25] Agriculture done by predicting before the occurrence anticipatory control using a feed-forward algorithm and ANN in yield predictions. P. Rekha et al. (2017) [26] a primitive method for irrigation, fertilization that leads to a decrease in crop yield eventually less income for farmers. IoT framework helped farmers to improvise their yield cum income. RF and WSN including sensor networks are used to transmit and receive data, optimum usage of fertilizers, monitoring the crop round the clock by using an android mobile application to predict the weather forecast. Rehman [29] estimating the crop water requirement and incorporating IoT, Cloud computing, and CPS-Cyber-physical systems which plays a vital role in improving productivity, feeding the world, and preventing starvation. Ravesa Akhter et al. (2021) [30] this article summarizes the latest trend in interfacing the IoT, Wireless sensor networks, data mining cum analytics, and Machine learning in agriculture. Smart agriculture is the trending technology, and this article mainly predicts the apple disease in apple orchards in Kashmir valley using machine learning (simple regression model) and IOT Data analytics. Archana Gupta et al. (2021) [31] this article gives sound knowledge about smart farming using machine learning what crop will give maximum yield depending upon the environmental and sensor network parameters. IoT-based smart farming improvising the entire agriculture sector and increasing the crop productivity, recommend the crop which will give real-time monitoring on the parameters to give maximum productivity and quality. Vivekanandhan et al. (2021) [32] this article influences the feature selection, preprocessing and followed by classification using fuzzy rule-based to validate the input parameters and predict the environmental changes efficiently and attain smart irrigation. Table 1 describes the comparison of existing IoT framework in agriculture, this related works support to implement in the proposed work. IoT based low-cost fertilizer intimation system The concept of fuzzy logic is applied to detect the deficiency of nutrients from the sensed data . . .

Methodology
The terms/materials used for this experiment are described for the sake of improving the readability of the proposed framework with clarity.

IoT Framework for Agriculture
The proposed system consists of interfacing the real-world data from storage media to cloud Database management system from where the request is sent to the Machine learning trained model as shown in Figure 2. The output of the module is one among 22 different crops for implementation as shown in Figure 3.

IoT Framework for Agriculture
The proposed system consists of interfacing the real-world data from storage media to cloud Database management system from where the request is sent to the Machine learning trained model as shown in Figure 2. The output of the module is one among 22 different crops for implementation as shown in Figure 3.

Data Mining and Network Implementation
Data capturing and communication utilities are enabled in the first level of architecture. The sensor network is linked with the gateway and the base station. In the second level, the classification specification and algorithm module are incorporated. The next level is implementing the ML algorithms to acquire the results from the server. The server has a trained module for getting the specific crop for irrigation. The parameters like Nitrogen, Phosphorous, Potassium, pH are measured using analytical sensors and stored in

IoT Framework for Agriculture
The proposed system consists of interfacing the real-world data from storage media to cloud Database management system from where the request is sent to the Machine learning trained model as shown in Figure 2. The output of the module is one among 22 different crops for implementation as shown in Figure 3.

Data Mining and Network Implementation
Data capturing and communication utilities are enabled in the first level of architecture. The sensor network is linked with the gateway and the base station. In the second level, the classification specification and algorithm module are incorporated. The next level is implementing the ML algorithms to acquire the results from the server. The server has a trained module for getting the specific crop for irrigation. The parameters like Nitrogen, Phosphorous, Potassium, pH are measured using analytical sensors and stored in

Data Mining and Network Implementation
Data capturing and communication utilities are enabled in the first level of architecture. The sensor network is linked with the gateway and the base station. In the second level, the classification specification and algorithm module are incorporated. The next level is implementing the ML algorithms to acquire the results from the server. The server has a trained module for getting the specific crop for irrigation. The parameters like Nitrogen, Phosphorous, Potassium, pH are measured using analytical sensors and stored in the module, Parameters like temperature, Humidity, and rainfall are measured using specific sensors and stored in the database. The compiled data is stored in a spreadsheet with the ground truth by having knowledge about the specified 22 different crops as shown in Figure 3. By training the module using a machine learning algorithm the attained model is ready to recommend the crop for the user for irrigation. Figure 4 shows flow procedure of IoT-based smart agriculture is possible by combining field Physical structure Data acquisition, Data processing, Data analytics for monitoring and control. The datasheet was acquired from Kaggle [33]. on a crop, the recommendation is taken for predicting the crop for irrigation and obtaining maximum yield.
Technologies 2022, 10, x FOR PEER REVIEW 6 of 12 the module, Parameters like temperature, Humidity, and rainfall are measured using specific sensors and stored in the database. The compiled data is stored in a spreadsheet with the ground truth by having knowledge about the specified 22 different crops as shown in Figure 3. By training the module using a machine learning algorithm the attained model is ready to recommend the crop for the user for irrigation. Figure 4 shows flow procedure of IoT-based smart agriculture is possible by combining field Physical structure Data acquisition, Data processing, Data analytics for monitoring and control. The datasheet was acquired from Kaggle [33]. on a crop, the recommendation is taken for predicting the crop for irrigation and obtaining maximum yield. Irrigation of crops depends on different environmental factors and soil fertility i.e., available nutrients present in the soil like nitrogen, phosphorous, and Humidity. The 7 attributes can decide a crop for irrigation so that maximum yield can be attained. This article can be used to make a strong decision making in planting different crops. WEKA or Waikato Environment for Knowledge Analysis the University of Waikato Hamilton, New Zealand is an open-supply facts mining software program issued beneath GNU public license software program that gives freedom to its customers in appearing most of these facts mining works [34].
It is a set of many devices gaining knowledge of algorithms for facts mining tasks. It is a percent of a device that includes diverse operations known as file preparation, clustering, regression, facts preprocessing, classification, Association rules, instance-primarily based totally classifying, and picturing. The technique worried in organizing the project is done the use of this software program known as WEKA for modeling the above stated clever positioning the use of photo processing

Selected Classifiers (Supervised Learning Algorithms)
Some of the selected classifiers are for this module are Multilayer perceptron, JRip, Irrigation of crops depends on different environmental factors and soil fertility i.e., available nutrients present in the soil like nitrogen, phosphorous, and Humidity. The 7 attributes can decide a crop for irrigation so that maximum yield can be attained. This article can be used to make a strong decision making in planting different crops. WEKA or Waikato Environment for Knowledge Analysis the University of Waikato Hamilton, New Zealand is an open-supply facts mining software program issued beneath GNU public license software program that gives freedom to its customers in appearing most of these facts mining works [34].
It is a set of many devices gaining knowledge of algorithms for facts mining tasks. It is a percent of a device that includes diverse operations known as file preparation, clustering, regression, facts preprocessing, classification, Association rules, instance-primarily based totally classifying, and picturing. The technique worried in organizing the project is done the use of this software program known as WEKA for modeling the above stated clever positioning the use of photo processing.

Selected Classifiers (Supervised Learning Algorithms)
Some of the selected classifiers are for this module are Multilayer perceptron, JRip, Decision table in tree category are chosen.

Multilayer Perceptron
It is also called a supplement of a Feedforward neural network. MLP is composed of three layers namely the input layer, hidden layer, and output layer. MLP has a unique ability to approximate continuous functions rather than only linear functions. MLP is composed of neurons which are also called perceptions. For example, the input receives n features [4] as input (x = x 1 + x 2 + x 3 + x 4 + x 5 . . . . . . x n ).
These n features are passed on to an input function u that computes the weighted sum for the input layer This result is passed on to the activation function {f} in this article it is supposed to sigmoid node 0 to sigmoid node 35. MLP has one or more hidden layers. But the input layer and the output layer are exposed to the external world.

Decision Table
Rule-based classifier which uses a simple decision table for classification. This classifier consists of the hierarchical table whose entries are broken down by the values of a pair of added features to form another table. This is analogous to dimensional stacking.

JRip
This classifier in the WEKA tool is a class-based prepositional rule learner, Repeated Incremental Pruning to Produce Error Reduction (RIPPER). There are two basic phases that are grown phase and the pruning phase. Ingrow phase is the rule by greedily adding highest information gain: p(log(p/t) − log(P/T)). In the pruning phase, any final sequences are added to the growing phase. Optimization stage and fixation of discretion length and the whole ruleset is fixed.

Data Preparation Cum Generation
The dataset used for our experimental analysis is taken from a public repository known to be the Kaggle database [33]. Table 2 is the lookup format for crop recommended dataset with seven different parameters like Nitrogen, potassium, phosphorous, pH, Rainfall, Temperature, and Humidity. The different combinations of these seven parameters give rise to different crops. In the given lookup table defines the crops recommended with the numerical values of the 7 different parameters.
The Kaggle data set contains 2200 instances for 22 different crops as mentioned in the look-up table. The comma-delimited format is used for training the optimum model used supervised learning methods with the selected functions and rule-based classifiers.

WEKA (Waikato Environment for Knowledge Analysis) is selected for machine learning algorithm implementation for crop recommendation in this experimental analysis.
WEKA is an open-source innovative tool for all research communities working on both supervised and unsupervised learning methodologies. WEKA with java platform implementation is the best-suited tool for machine learning techniques [34].

Experimental Results and Discussion
Data collection is done first and then the dataset format to comma delimited excel format (CSV file) which is compatible for using to train the data set in WEKA tool using supervised learning methods and after completing the preprocessing the classification process is done for the selected classifiers and the performance characteristics are noted and tabulated. By using the preprocessing method of nominal to binary attribute selection will reduce the time taken to build the model.
The results show in Table 3, the classification or the crop recommendation by this optimum model is very well predicted based on the data set and 7 different attributes. The three classifiers namely function-based and rules-based are taken for implementing the machine learning technique had given us an accuracy performance percentage of 98.2273% to 88.5909% for multilayer perceptron and JRip classifier as shown in Figure 5. The receiver operator characteristics of 0.991 to 0.997 for the Lazy category classifier decision table and multilayer perceptron.  The next characteristics in building the model weighted receiver operator characteristics of 1 will give us an optimum model and MLP showing the best ROC than the selected classifiers as show in Figure 6. The time taken to build the model is spanned from 10.56 to 0.23 s for multilayer perceptron and decision table classifiers. The preprocessing of the data set by normalization leads to time reduction in building the model and improving the ROC measure to one almost all classifiers show the same measure approximately. The performance of the model has given an accuracy percentage of 98.2273% for multilayer perceptron and 88.59% for Lazy category decision table classifier.
The second iterated model clearly dictates that the time taken to build the model is reduced by preprocessing the data set using normalization as shown in Table 4. The iterated model after pre-processing indicates that the accuracy performance did not vary even after normalizing the data set. But the time to build the model greatly changed. The data set is normalized to reduce redundancy and to get the required result in less time [4].  The next characteristics in building the model weighted receiver operator characteristics of 1 will give us an optimum model and MLP showing the best ROC than the selected classifiers as show in Figure 6. The time taken to build the model is spanned from 10.56 to 0.23 s for multilayer perceptron and decision table classifiers. The preprocessing of the data set by normalization leads to time reduction in building the model and improving the ROC measure to one almost all classifiers show the same measure approximately. The performance of the model has given an accuracy percentage of 98.2273% for multilayer perceptron and 88.59% for Lazy category decision table classifier.
The second iterated model clearly dictates that the time taken to build the model is reduced by preprocessing the data set using normalization as shown in Table 4. The iterated model after pre-processing indicates that the accuracy performance did not vary even after normalizing the data set. But the time to build the model greatly changed. The data set is normalized to reduce redundancy and to get the required result in less time [4].  The preprocessing of the data set by normalization leads to time reduction in building the model and improving the ROC measure to one almost all classifiers show the same measure approximately. The performance of the model has given an accuracy percentage of 98.2273% for multilayer perceptron and 88.59% for Lazy category decision table classifier. The second iterated model clearly dictates that the time taken to build the model is reduced by preprocessing the data set using normalization as shown in Table 4. The iterated model after pre-processing indicates that the accuracy performance did not vary even after normalizing the data set. But the time to build the model greatly changed. The data set is normalized to reduce redundancy and to get the required result in less time [4].  Figure 7 shows the accuracy percentage is 98.22% for MLP and 96% for JRip after the normalization of data has not deviated from the result. The two iterated model characteristics clearly show that the performance accuracy has not varied. Figure 8 shows the variations in building.   Figure 7 shows the accuracy percentage is 98.22% for MLP and 96% for JRip after the normalization of data has not deviated from the result. The two iterated model characteristics clearly show that the performance accuracy has not varied. Figure 8 shows the variations in building       Figure 7 shows the accuracy percentage is 98.22% for MLP and 96% for JRip after the normalization of data has not deviated from the result. The two iterated model characteristics clearly show that the performance accuracy has not varied. Figure 8 shows the variations in building

Conclusions and Future Scope
Currently, this article is a smart module in recommending the crop for irrigation and obtaining maximum yield based on present environmental factors. This also serves as a guide for any unknown person who is in need of any crop recommendations than facing any trial basis error. The trending machine learning algorithm has helped us to build a model in the agriculture sector also using IoT and helping the farmers in deciding the best yield crop by just measuring the needy parameter like Nitrogen, Phosphorous, Potassium, Rainfall, Temperature, pH, and humidity. In near future, the agriculture sector will be converted into smart agriculture and will never face any decline in production, yield, and quality thereby the agriculture sector progress to AI, IoT-based Precision farming.