
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
![]()

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
Mourya S Dasharath,Kritika Vishal , Likith S, Nagendra Prasad P N
Guide: Prof.ChetanGhatage,Asst.Professor,Dept.ofCSE,RNSIT
Abstract Agriculture remains a critical domain in global food security, yet farmers often rely on intuition rather than datadriven decision-making. This research presents an integrated IoT- ML system that leverages real-time soil and environmental data to recommend the top three most suitable crops for a given farmland. Unlike conventional prediction models that depend solely on static datasets, the proposed system fuses real-time sensor values retrieved via Think Speak and atmospheric data obtained from the Google Weather API to deliver dynamic crop recommendations. Soil nutrient parameters (N, P, K), pH, organic matter content, crop cycle duration, and soil texture are entered manually by the user, while temperature, humidity, moisture, and rainfall are automatically fetched from sensor feeds. The Ran- dom Forest Classifier identified through comparative evaluation against Gradient Boosting and KNN achieved 100% top-1 and top-3 accuracy on the training dataset and demonstrated superior generalization capability.
The model was deployed using Flask, enabling seamless integration with a web interface where farmers can input soil parameters manually or rely on automated sensor ingestion. The system returns top-3 crop recommendations with probability scores, ensuring explainability and confidence estimation. Real- time soil monitoring, automated weather integration and a user- friendly web interface position this work as an impactful tool toward precision agriculture. Results validate the system’s effect- tiveness in real-world scenarios, achieving accurate predictions for crops such as grapes and roses, demonstrating practical yield estimation capabilities. This work contributes a scalable, low-cost, and sensor-integrated solution capable of empowering farmers with actionable insights to improve agricultural productivity and sustainability.
Agriculture is undergoing rapid digital transformation with the rise of IoT, artificial intelligence, and precision farming methodologies. Despite technological advancements, many farmers still depend on traditional, experience-based decision making, resulting in suboptimal crop selection, inefficient resource usage, and yield inconsistencies. Predicting the most suitable crop for a given farmland requires understanding a combination of soil nutrients, environmental conditions, and historical crop performance factors that cannot be reliably assessed without computational support. To address these challenges, this work introduces an AI-powered crop rec-commendationsystemenrichedwithIoT-driven real-time data ingestion.
The motivation behind this project is to reduce guesswork and provide farmers with actionable, data-backed insights. By leveraging machine learning and real-time sensing, the system bridges the gap between raw agricultural data and interpretable recommendations. The system integrates soil nutrient data Nitrogen (N), Phosphorus (P), Potassium (K), pH,cropcycleduration,soiltexture,andorganicmatter withatmospheric parameters like temperature, humidity, moisture content, and rainfall. ThinkSpeak IoT feeds were utilized toretrievereal-timesoilandclimatedata,whileexternalrainfall datawasacquireddynamicallyfromtheGoogleWeatherAPI.
Furthermore, thedesign prioritizes easeofuse by employing a simple yet efficient Flask-based web interface. The platform automaticallyfetchessensordatawhileallowing manual over- rides to preserve flexibility in low-sensor-availability regions. The machine learning model, built using Random Forest, processes these inputs to recommend the top three most suitable crops enabling farmers to make informed choices that maximize productivity. Overall, this project embodies a holistic approachtomodernagriculturebycombiningIoTautomation,machinelearning,andanintuitiveuserexperience.
Existing literature highlights the transformative potentialofmachinelearningandIoTinagriculture.StudiessuchasKiran et al. (2024) have emphasized the importance of inte- grating weather, soil nutrients, and environmental factors for crop prediction,demonstratinghighaccuracyusingmachinelearningmodelssuchasRandomForestandGRNN.Similarly,Islamet al. (2023) introduced an IoT-enabled soil nutrient monitoring device integrating sensors such as NPK, DHT11, and moisture

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
probes,showingtheeffectivenessofreal-timemonitoringcombinedwithML-basedrecommendations.Theirworkprovidesa foundationforcombiningsensornetworkswithpredictiveMLmodelstoenhanceagriculturaldecisionmaking.
AnotherstudybyPrityetal.(2024)compared ninemachinelearning models for crop prediction, concluding that Ran- dom ForestoutperformedalgorithmslikeLogisticRegression,SVM,andExtraTreesinaccuracyandrobustness.Afzalet al.(2025) proposed an ensemble RFXG model integrating Random Forest and XGBoost to recommend crops using soil nutrients and climatic conditions, achieving 98% accuracy. These works consistently highlight the dominance of Random Forest in agriculturalpredictionapplicationsduetoitsabilitytohandlenoisydata,non-linearrelationships,andmixed-typefeatures. IoT-basedworks,includingSmartIoT-drivenPrecisionAgriculture(2025)andvarioussoil-qualitymonitoringsys-tems,have showcased the effectiveness of integrating sensors, cloud platforms, and ML-driven analytics. These studies high- light the importanceofreal-timedataingestiontoachievedy-namicdecisionsupport.Furthermore,multiplepapersaddressthegapin combiningautomatedsensordatawithuser-enteredparameters agapthisprojectdirectlyaddresses. WhileexistingresearchdemonstratesthevalueofIoT,ML,andcloudintegrationindividually,fewsystemsprovideacomplete architecture blending real-time data ingestion; ML- based multi-crop recommendation, and web deployment. This paper extendspriorworkbyintegratingThinkSpeakIoTfeeds,GoogleWeatherAPIdata,andaproduction-readyMLmodeldeployed usingFlask,formingaholisticprecisionagricultureplatform.

The methodology of our system follows a multi-stage pipeline that integrates dataset preparation, machine learningmodel development,IoT-basedreal-timedataingestion,pre-dictiongeneration,andbackenddeployment.Eachstageisde-signedto ensureaccuracy,reliability,andseamlessinteractionbetweensensinghardwareandthemachinelearningengine.
Theinitialphaseinvolvestheingestionofbothstaticdataset values and real-time sensor data. The training dataset includes soil chemical properties (N, P, K, pH), organic matter content, crop cycle duration, and soil texture. Soil texture, being categorical, is label-encoded, while all other features remain numerical. A Python preprocessing pipeline standardizes all numeric attributes using a Standard Scalar, ensuring uniform feature distribution during model training. Missing values, duplicates,andinconsistent entrieswerehandledthroughau- tomatedvalidationscripts.Thefinal processeddatasetserved asthebasisformodeldevelopment.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
Three machine learning algorithms Random Forest, Gradi- ent Boosting, and K-Nearest Neighbors were evaluated under identical configurations. The dataset was divided using an 80:20 stratified train-test split to maintain proportional represonationacrossall22supportedcrops.Evaluationmetricsincludedtop-1accuracy,top-3accuracy,andmacroF1-score.The Random Forest classifier achieved perfect scores (1.0 across all metrics), outperforming the other candidates. Based on the rankingcriteriaprioritizingtop-3accuracy,RandomForestwasselectedasthefinalmodel.Themodel,alongwithitsfeature orderingandlabelencoders,wasexportedusing joblib fordeployment.
Real-time environmental data is ingested through Think -Speak channels. Sensors continuously measure temperature, humidity, and soil moisture, transmitting these readings to the cloud at fixed intervals. Rainfall data isobtained dynamically from the Google Weather API. The backend fetches these val- ues at each prediction request, ensuring that model inference reflectscurrent fieldconditions.Manual inputssuchasN,P,K, pH, soil texture, and organic matter can be overriddenor combinedwithsensor-fedvalues,allowingflexibilityfordifferentuserscenarios.
When the user initiates a prediction, the Flask backend merges manual soil parameters with automatically fetched IoT and weatherdata.Thecombinedfeaturevectorispassedthrough the preprocessing pipeline before being fed intotheRandom Forestmodel.Thesystemcomputesprobabilityscoresforall22cropsandextractsthetopthreewiththehighestlikelihoods. Theseresultsarethendisplayedonthefrontend,alongwithprobabilityvaluesfortransparencyandinterpretability.
To support monitoring and debugging, the system logs each prediction request, including timestamped sensor readings and user-providedinputs.Thisreal-timelogcanbeusedforfurthermodelretraining,analytics,andtrackingenvironmentaltrends. Italsoenablesfutureexpansiontowardyieldestimationanddynamicfertilizerrecommendationmodules
IV. SYSTEM ARCHITECTURE


International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
Thesystemarchitectureisdesignedasamulti-layeredframeworkcombiningIoTsensors,clouddataingestion,back-endML processing,andaweb-baseduserinterface.Atthehardwarelayer,thesystemleveragesNPKsensors,soil mois-turesensors, andDHT11modules.Thesesensorsconnecttomicrocontrollersthatperiodicallytransmitreal-timedatatoThinkSpeakcloud channels. Each sensor operates indent- dental, pushing temperature, humidity, and moisture readings for real-time processing.
At the cloud layer, Think Speak acts as the IoT data broker, storing sensor values and providing REST endpoints that Flask periodically polls. Concurrently, rainfall and atmospheric information are fetched through the Google Weather API to maintainanupdatedenvironmentalcontext.Thebackendlayer,builtusingFlask,mergesreal-timesensordatawithmanually entered soil values including N, P, K, pH, organic matter, crop cycle duration, and soil texture creating a unified feature vectorthatreflectsthecurrentfarmlandstate.
The ML layer loads the trained Random Forest model and the label encoder. Feature ordering is maintained using a JSONbased schema to avoid inference discrepancies. Model inference generates probability distributions over 22 possiblecrops Thetopthreecropsareextractedandreturnedtothe UI,alongwiththeirprobabilityscores.
The frontend, built with HTML, CSS, and Jinja2 templates, offers a clean user interface for entering manual values while automatically fetching IoT readings. The layered design en- sures modularity, scalability, and adaptability, enabling integrationwithmobileappsorexpandedsensornetworksinthefuture.



International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
TABLE I-MODEL PERFORMANCE COMPARISON ON TEST DATASET
ModelevaluationrevealedthattheRandomForestClassifierconsistentlyoutperformedallothertestedalgorithmsacrossevery performance metric. Using a stratified holdout test set, the model achieved 100Comparative experiments showed that while Gradient Boosting produced reasonably strong predic- tions, it exhibited slower training and inference times and required more computational resources, making it less suitablefor an IoT-integrated system performing real-time predictions. KNN performednoticeablyworse,particularlyonunseensamples,duetoitssensitivitytonoiseandlackofscalabilitywhendealing withmulti-attributeagriculturaldatasets.
Tovalidatepracticalapplicability,wetestedthemodelusingreal-worldsoilreadingsfromgrape-growingregions.Thesys-tem successfullyidentifiedgrapeswithinthetop-3predictedcrops,confirmingthatthemodelgeneralizeswellbeyondthetraining dataset.Basedonapproximateyieldestimationformu-lasintegratedintothesystem,themodelprojectedaproductionrangeof 15–25 tons per 1.5 acres, which aligns with standard grape yield records. Similar validation was performed using rose cultivation data, where roses were correctly returned as a primary recommendation, with an estimated yield of 300 kg per acre,againmatchingrealagriculturalbenchmarks.
The IoT pipeline was tested through continuous real-time data ingestion using ThinkSpeak. Moisture and temperature variationsweresuccessfullyreflectedinthepredictionlogicwithoutrequiringuserintervention.Additionally,rainfallval-ues fetcheddynamicallythroughtheGoogleWeatherAPIenhancedmodeladaptabilitybyrespondingtosuddenclimaticchanges. These tests collectively demonstrate that integrating manual soil inputs with automated environmental data signif- icantly enhances the accuracy, responsiveness, and contextual reliability of crop predictions, making the system suitable for realworlddeploymentinprecisionagriculture.
Theimplementedsystemresolvesseveral limitationsob- servedin priorresearch. Traditional croprecommendationmodels relyonstaticdatasetsorrequiremanualentryofallparameters,reducingpracticalityforfarmers.ByintegratingIoTsensors andexternalAPIdata,thesystemallowsautomaticingestionofkeyenvironmentalfactors,reducingusereffortandincreasing accuracy.Real-timedataimprovesresponsive-nesstosuddenweatherchanges,acapabilitymissinginmostexistingsystems.
Random Forest emerged as the ideal algorithm due to its ability to handle high-dimensional, non-linear agricultural datasets. The model’s perfect accuracy demonstrates that the dataset features are well-separated and suitable for decisiontree-based learning. The top-3 prediction mechanism also adds robustness by offering farmers multiple viable crop choices ratherthanasinglerigidrecommendation.
Despiteitsstrengths,thesystemhaslimitations.Real-timedata availabilitydependsonstableinternetconnectivity.Sen- sor calibration and Think Speak channel reliability influence prediction accuracy. Additionally, while rainfall is fetched automatically, implementing real-time NPK sensor data would significantly enhance automation but was not feasible due to hardwareavailabilityconstraints.
Nonetheless, the architecture is scalable. Future enhance- ments may include mobile app integration, satellite-based soil imaging, fertilizer recommendation algorithms, and yield forecasting using LSTM networks. Integrating drone imaging or NDVI-basedplanthealthmonitoringwouldexpandsystemcapabilitiesfurther.
ThisresearchpresentsafullyintegratedIoT-MLsystemthatbridgesthegapbetweensoilanalysis,environmentalmoni-toring, and data-driven crop recommendations. By combining manually entered soil parameters with real-time sensor data from Think Speak and rainfall data from the Google Weather API, the system delivers dynamic and highly accurate top-3 crop

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 13 Issue: 01 | Jan 2026 www.irjet.net p-ISSN: 2395-0072
suggestions. The Random Forest model achieved except- tonal performance, validating its suitability for agricultural predictiontasks.
The system’s architecture demonstrates practicality, scala- bility, and ease of use through a Flask-based web interface. Farmerscannowreceiveinstantandintelligentrecommenda-tionswithoutrequiringtechnicalexpertise.Real-worldtesting withgrapeandrosecultivationconfirmsthesystem’sapplica-bility.
Inconclusion,integratingIoTtechnologywithmachinelearning significantlyenhancescropdecision-making,reducesfarmer dependency on intuition, and promotes sustainable agriculture. This work contributes a practical framework for precision farmingandopenspathwaysforadvancedAI-drivenagriculturalsystemsinthefuture.
References
[1] S. Shenbagavadivu, S. S. Kumar, C. Rajan et al., “AI-Driven Soil Monitoring and Crop Recommendation Using Machine LearningAlgorithm,” 2024.
[2] F. S. Prity, M. M. Hasan, S. H. Saif et al., “Enhancing Agricultural Productivity: A Machine Learning Approach to Crop Recommendations,” Human-Centric Intelligent Systems,vol.4,pp.497–510, 2024
[3]H.Afzal,M.Amjad,A.Raza et al.,“IncorporatingSoilInformationwithMachineLearningforCropRecommendationto ImproveAgriculturalOutput,” Scientific Reports,vol.15,no.8560, 2025.
[4]M.R.Islam,K.Oliullah,M.M.Kabir et al.,“MachineLearningEnabledIoTSystemforSoilNutrientsMonitoringandCrop Recommendation,” Journal of Agriculture and Food Research,vol.14,Art.no.100880, 2023
[5] G. Saha, F. Shahrin, F. H. Khan et al., “Smart IoT-Driven Precision Agriculture: Land Mapping, Crop Prediction, and IrrigationSystem,” PLOS ONE, March 2025.
[6] S. D. Koparde, P. P. Joshi, V. S. Nimbalkar et al., “Soil Crop Predictor: ML-Driven Soil Analysis and Crop Recommendation,” International Research Journal of Modernization in Engineering, Technology and Science, vol. 6, no. 10, 2024.
[7]L.Gottemukkala,S.T.R.Jajala,A.Thalari et al.,“SustainableCropRecommendationSystemUsingSoilNPKSensor,” E3S Web of Conferences,vol.430, 2023