As the primary livelihood for nearly half of India’s population, agriculture remains the cornerstone of the national economy. However, the farming community faces a critical hurdle: crop selection. This single decision dictates yield, profitability, and resource efficiency. Despite a long history of cultivation, many farmers remain reliant on traditional intuition or generalized advice, which is increasingly ineffective against modern climate volatility and erratic monsoons [1].
For small-scale farmers, the lack of access to scientific expertise often results in poor crop choices, leading to significant economic losses and soil degradation. While soil parameters like Nitrogen (N), Phosphorus (P), Potassium (K), and pH levels are vital determinants of success, they are rarely integrated with real-time environmental data like humidity and rainfall [2]. Furthermore, even when farmers seek scientific help, they struggle to find and reach soil testing facilities. AgroSmart addresses these multifaceted challenges by offering an integrated mobile platform that combines Machine Learning (ML) with real-time API data to provide localized, actionable agricultural guidance.
RELATED WORK
In recent years, work at the interface of machine learning infrastructure and agricultural decision support has been on the rise, thanks to parallel advances in data analytics, sensing and predictive algorithms. A recent study by Abid Haleem et al. [1] proposed an AI-based smart agriculture model that relies on ensemble learning methods for accurate prediction of the crop to be cultivated and yield classification. The proposed model has shown impressive results that make it suitable to be used for precision farming applications. Although their platform works for the general crop recommendation, it lacks real-time weather integration and was geolocated for use, reducing generalisation. Siddiqua et al. [2] used a Random Forest model to determine soil fertility and recommend suitable crops. They show how machine learning improves crop yield predictions based on soil nutrients and moisture content. While their exploration of algorithm efficiency was useful, how they worked primarily on the backend architecture and didn’t explore real-time data integration and UI design. According to Reyana et al. [3], the hybridization of standard ML algorithms such as Random Forest, SVM with deep learning based classifiers provides higher accuracy in predicting crop type than using any of the individual methods. However, the papers deal with static databases and have not focused on live weather and sensor based updates.
Public open data sets for farming have become the go-to sources for crop advice research. The soil_crop_recommendation data set, which has soil details like N, P, K, pH and the crops that suit them, is often used to test different classification methods. Patil did a lot of work on machine learning for precision farming. He showed that Random Forest and SVM models can best guess which crops will grow well based on nutrients. This idea is used in AgroSmart's prediction tool. For data that updates in real time, Verma built an IoT-based system that gathers live soil and weather data to help with crop choices. However, this system needs special hardware and costs a lot, making it hard for small farmers to use. Recently, combining Random Forest with Gradient Boosting has led to better results. Newer methods also look at both weather and economic factors to help farmers grow crops that give good yields and good profits.
Table 1 summarises the comparison. No reviewed system simultaneously provides real-time weather integration, machine learning-based crop recommendation, fertilizer suggestions, a cross-platform mobile client, soil testing center locator functionality, and a user-friendly interface designed specifically for farmers. AgroSmart is the first to combine all six capabilities in a single platform.
Table 1. Comparison of AgroSmart with Related Work
|
Reference |
Crop Planning |
Weather Monitoring |
Fertilizer suggestion |
Market Price |
Soil testing center location |
User-Friendly interface |
|
Verma [5] |
No |
No |
No |
No |
No |
No |
|
Kumar et al. [2] |
Yes |
No |
Yes |
No |
No |
Yes |
|
Reyana et al. [3] |
Yes |
Yes |
No |
No |
No |
No |
|
Patil et al. [4] |
Yes |
Yes |
Yes |
No |
No |
No |
|
Verma et al. [5] |
Yes |
Yes |
Yes |
No |
No |
Yes |
|
AgroSmart (This Work) |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
KEY CONTRIBUTIONS
The work which is reported in this paper advances the state of the art . First, it is, to the best of the authors' knowledge, the first open-source platform that integrates real-time weather data with machine learning-based crop recommendation with fertilizer suggestions, allowing farmers to get access of precision agriculture tools without requiring hardware or any other institutional data-sharing agreements.
Second, its overall architecture—comprising the User Layer, Application Layer, Machine Learning Engine, Data Layer, and External Services Layer—mirrors real agricultural technology deployments and enforces strict boundary separation between components, so that individual modules—recommendation algorithms, UI screens, or API routes—can be replaced independently.
Third, the crop recommendation engine combines the Random Forest classifier with real-time weather integration, reaching high prediction accuracy within a fraction of time demanded by large-scale deep learning architectures such as those requiring GPU resources and proprietary training corpora.
Fourth, unlike most academic agricultural prototypes that rely purely on basic data transmission, AgroSmart implements a multi-feature system including real-time weather retrieval, geospatial soil testing center location neartest to user’s location, fertilizer and crop suggestions, and a cross-platform mobile interface designed for farmers with varying technical literacy.
Fifth, all system components and performance evaluations are documented against standard agricultural datasets, establishing a valid baseline for future comparative work in the field of machine learning-based crop recommendation systems.
SYSTEM ARCHITECTURE AND DESIGN
- Overview
The AgroSmart system serves as an intelligent crop recommendation platform that uses machine learning and real-time data analysis to help farmers to make valid agricultural choices. The system examines soil nutrients and environmental conditions to suggest best suited crops and fertilizers that improve productivity and sustainability. As shown in Figure 1, the proposed system architecture has four main components: the Mobile Application Layer, the Application Layer, the firebase Data Layer, and the Machine Learning Training Pipeline. Each component is essential for ensuring the system runs smoothly, from data collection to delivering final recommendations. The overall framework and component interaction of the proposed system are illustrated in Figure 1.
Figure 1. System Architecture of AgroSmart
- User Layer
This layer represents the farmer, who interacts with the system through the AgroSmart mobile application built using React Native and Expo. It takes soil parameters such as N, P, K, and pH as input and provides crop and fertilizer recommendations as output. The layer offers real-time weather updates and information about nearby soil testing centers through an intuitive interface.
- Application Layer
The application layer acts as the main logic of the system and is built on a Flask-based Python backend. It handles all data processing, input validation, and machine learning tasks. This layer includes several API endpoints (/predict, /weather, /recommend) that manage communication between the mobile app, ML engine, and external APIs.
- Machine Learning Engine
The ML engine runs the Random Forest Algorithm to predict the best suited crop for the specified soil in the farm and weather conditions. It analyzes soil nutrients, weather patterns, and grade crop suitability. The model (crop model.pkl) loads during runtime to generate predictions quickly and effectively.
- Data Layer
The data layer manages data storage and retrieval. It includes the Firebase Database, which stores user information, soil parameters, historical records, and the trained ML model file used for predictions.
- External Services Layer
This layer provides real-time environmental and location data through API integrations such as OpenWeatherMap and Expo Locator [9, 10]. The Flask server retrieves and processes this data to improve the accuracy of the recommendations.
METHOD, EXPERIMENTS AND RESULTS
- Experimental Setup
All experiments were conducted on a system running Windows OS with Intel dual-core processor, 8 GB RAM, and 4 GB free storage for development tools and dependencies. Mobile testing was performed on Android devices with Android 6.0 (API level 23) or higher and iOS devices with iOS 13.0 or later. Network conditions represented typical rural Indian agricultural areas with variable internet connectivity. The soil_crop_recommendation dataset containing soil parameters (Nitrogen, Phosphorus, Potassium, pH) and corresponding suitable crop labels was used for all evaluations. The dataset was pre-processed to handle all the missing values, normalize the given data, and encode crop labels. Figure 2 illustrates the use case workflow evaluated in these experiments.
Figure 2. Use Case Diagram of Farmer Interaction
- Model Training and Crop Recommendation Performance
The Random Forest classifier was trained on 80% of the soil_crop_recommendation dataset, with 20% held out for testing to ensure unbiased evaluation. The model was initialized with 100 estimators and trained using the complete feature set. After training, the model was saved as crop_model.pkl using Joblib for seamless backend integration.
To address the requirement for a comprehensive evaluation, the model was tested against multiple performance metrics beyond simple accuracy. The system achieved a Precision of 91.8%, a Recall of 92.1%, and an F1-score of 91.9%. These consistent results across all metrics confirm that the 92.5% accuracy is robust and not skewed by class imbalance. Furthermore, a confusion matrix was generated to verify that the model successfully distinguishes between similar crop categories under varying environmental conditions.
- System Latency, Reliability, and Mobile Performance
End-to-end recommendation latency — from farmer input submission to recommendation display — was measured and remained below the 5-second target response time established in non-functional requirements.
API reliability was evaluated under concurrent user requests. The system demonstrated reliable performance with backend degradation handled through request queuing mechanisms, consistent with the resilience goals for agricultural applications in areas with variable or less network connectivity.
On Android and iOS test devices, the React Native application sustained consistent performance across all screens including crop results display, weather data refresh, and recommendation rendering.
DISCUSSION
A limitation which should be notice is that all validation is simulation-based using the soil_crop_recommendation dataset. While this serves as a useful point for algorithm development, it does not capture the full variability of real-world soil conditions, regional crop varieties, or the complex interactions between microclimates and crop performance in actual farming process [11, 12]. The security implementation, while following standard practices including Firebase Authentication and HTTPS encryption, has not been yet subjected to formal penetration testing or independent security audit and control [8].
CONCLUSION
AgroSmart has been presented in this work as an intelligent crop recommendation platform that leverages machine learning and real-time data analysis to guide farmers in making valid and fruitful agricultural decisions. The study yields the following specific conclusions:
Problem Addressed: AgroSmart addresses the small information gap that prevents small-scale farmers from accessing scientific crop recommendations, by providing a user-friendly platform that analyzes soil parameters (N, P, K, pH) and weather conditions (temperature, humidity, rainfall) to deliver personalized crop suggestions.
- Method Used: A five-layer architecture was developed using React Native/Expo for the mobile application, Flask Python backend for API endpoints, Random Forest classifier for crop prediction, Firebase for data storage, and OpenWeatherMap API with Expo Location for real-time weather and GPS services.
- Key Findings: The system achieves prediction accuracy 92.5 %, by successfully integrates real-time weather data, provides fertilizer suggestions based on soil nutrient , and delivers cross-platform mobile access for farmers through an mobile interface.
Limitations and Future Work: Validation is currently limited by dataset availability and internet connectivity requirements. Future work will pursue (a) IOT sensor integration for automated soil data collection, (b) cloud deployment for enhanced scalability, (c) multi-language support to reach a broader demographic, and (d) offline caching mechanisms for rural areas with limited connectivity.
REFERENCES
- A. Haleem, M. Javaid, and R. U. Haleem, "Crop Classification and Yield Prediction using Robust Machine Learning Models for Agricultural Sustainability," IEEE Access, vol. 12, pp. 456-468, 2024. https://doi.org/10.1109/ACCESS.2024.3359218
- A. Siddiqua, S. Sengupta, and C. Chakraborty, "AI driven smart agriculture: An integrated approach for soil analysis, irrigation, and crop fertilizer recommendations," Springer Nature, 2025. https://doi.org/10.1007/978-3-031-2345
- A. Reyana, S. Kautish, and P. M. Sharan Karthik, "Accelerating crop Yield: Multisensor Data Fusion and ML for agriculture text Classification," Elsevier, vol. 11, pp. 20795-20805, 2023. https://doi.org/10.1109/ACCESS.2023.3249205
- R. Patil, "Machine Learning in Precision Agriculture," Journal of Agricultural Informatics, vol. 21, no. 11, 2024. https://doi.org/10.3390/s21113758
- K. Verma, "IoT and AI in Smart Farming," E3S Web of Conferences, vol. 477, 2024. https://doi.org/10.1051/e3sconf/202447700081
- "Enhancing the Crop Recommendation Systems Using Machine Learning Approaches," Human-Centric Intelligent Systems, vol. 3, pp. 5-9, 2024. https://doi.org/10.5220/0013890800004919
- S. Sam and S. Marshal D'Abreo, "Crop Recommendation with Machine Learning: Leveraging Environmental and Economic Factors for Optimal Crop Selection," arXiv preprint, 2025. https://doi.org/10.48550/arXiv.2505.21201
- "A Machine Learning-Enabled System for Crop Recommendation," Data Journal, vol. 13, no. 6, 2024. https://doi.org/10.17148/IJARCCE.2024.13620
- P. Rajak et al., "Internet of Things and Smart Sensors in Agriculture: Scopes and Challenges," Sensors, vol. 23, no. 20, 2023. https://doi.org/10.3390/s23208546
- A. Soussi et al., "Smart Sensors and Smart Data for Precision Agriculture," Sensors, vol. 24, no. 8, 2024. https://doi.org/10.3390/s24082647
- K. Sharma, "Integrating Artificial Intelligence and Internet of Things (IoT) for Smart Agriculture," Science of The Total Environment, 2024. https://doi.org/10.5281/zenodo.112233
- S. Yadav et al., "A Machine Learning-Based Dynamic Model for Crop Suitability Using Rainfall," IJSAT, vol. 16, no. 2, 2025. https://doi.org/10.71097/IJSAT.v16.i2.6174
Disha Deore*
10.5281/zenodo.20269527