AUTHOR=Gunasekaran Kanimozhi , A. Karmel , Sreevardhan Pemmareddy TITLE=Real-time soil fertility analysis, crop prediction, and insights using machine learning and deep learning algorithms JOURNAL=Frontiers in Soil Science VOLUME=Volume 5 - 2025 YEAR=2025 URL=https://www.frontiersin.org/journals/soil-science/articles/10.3389/fsoil.2025.1652058 DOI=10.3389/fsoil.2025.1652058 ISSN=2673-8619 ABSTRACT=Sustainable agricultural management relies heavily on accurate soil fertility prediction. Traditional assessment techniques are often labour-intensive, time-consuming, and may involve hazardous chemicals. Recent advances in machine learning (ML) and artificial intelligence (AI) offer promising alternatives by integrating soil metrics, meteorological data, and other environmental factors for precise and efficient fertility estimation. This study investigates the application of ML and deep learning algorithms for soil fertility prediction. A hardware prototype incorporating sensors and a microcontroller was developed to capture soil parameters, including pH, temperature, humidity, moisture content, NPK (nitrogen, phosphorus, potassium), carbon content, and organic matter, alongside weather and climatic conditions. Real-time sensor data were compared against predictions from ML models. Laboratory soil test results were used as ground truth for validation. Ensemble classifiers (Random Forest, Extra Trees) and deep learning models (Multilayer Perceptron, Long Short-Term Memory networks) were evaluated using accuracy, F1-score, recall, and precision metrics. The Random Forest algorithm achieved the highest prediction accuracy of approximately 92%, with Extra Trees and other ensemble methods also demonstrating strong performance. The deep learning models further enhanced predictive capabilities for crop selection, with MLP and LSTM achieving high accuracy, recall, and F1-scores while maintaining consistent precision. The hardware prototype’s real-time measurements closely aligned with laboratory results, confirming the reliability of the system. The findings highlight the potential of ML and AI-based approaches in advancing soil fertility prediction and crop recommendation systems. By combining real-time sensor data with predictive models, the proposed system enables rapid, reliable, and scalable soil health assessment. This integrated approach empowers farmers to make data-driven decisions, optimize soil fertility, and improve sustainable agricultural practices.