Development of an AI-Enabled Vision-Based On-Site Rapid Detection of Nitrates and Nitrites from Drainage Samples

Abstract Plant growth is significantly impacted by the concentration of nutrients in the soil. Accurate and real-time measurement of nitrates and nitrites levels remains a significant challenge. Existing laboratory-based methods are expensive, time-consuming, and labor-intensive, highlighting the need for a rapid, on-site solution. This study proposes a rapid method for measuring nitrates and nitrite levels in water samples collected from tile drainage. We utilized Hach Nitrate and Nitrite test strips for image dataset collection as these test strips change color based on the concentration of nitrate and nitrite in the water samples. A purpose-built black box, equipped with an internal lighting arrangement for imaging test strips, was designed to collect images of the test strips. Unlike many existing smartphone-based colorimetric approaches, which are sensitive to ambient lighting variations and often rely on external calibration or offline analysis, the proposed system integrates a controlled illumination environment with real-time edge computation for robust on-site detection of nitrate and nitrite. An Nvidia Orin Nano module, connected with an IMX219 camera sensor, was used to capture images of the test strips. Image preprocessing was performed, followed by the implementation of a VGG16-based network for feature extraction. A dataset of approximately 3128 images spanning multiple nitrate and nitrite concentration levels was collected under controlled imaging conditions. Multiple machine learning models including logistic regression (LR), support vector machines (SVM), k-nearest neighbors (KNN), naïve Bayes (NB), and random forest (RF) were evaluated for classification. The nitrate detection using KNN achieved an accuracy of 99.96% training, 99.92% testing, and 99.79% cross-validation. For nitrite detection, the SVM model achieved accuracy of 99.02%, 98.04%, and 98.07% for training, testing, and cross-validation, respectively, demonstrating both systems' high reliability and practical applicability for real-time monitoring. The total system cost is approximately USD 300, highlighting the affordability and practicality of the proposed solution for on-site water quality monitoring. This technology can enable farmers, water quality researchers, and agronomists to efficiently monitor the levels of nitrates and nitrites in tile drainage samples, enabling data-driven decisions to maximize crop yields.

Authors

Institutions

Publication Details

Journal
Water Air & Soil Pollution
Published
2026-01-28
DOI
https://doi.org/10.1007/s11270-026-09143-7
Primary Topic
Smart Agriculture and AI
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Development of an AI-Enabled Vision-Based On-Site Rapid Detection of Nitrates and Nitrites from Drainage Samples

Ali Mirzakhani Nafchi, Mazhar Sher, Muhammad Roman, Azlan Zahid
Water Air & Soil Pollution
Smart Agriculture and AI
article

Development of an AI-Enabled Vision-Based On-Site Rapid Detection of Nitrates and Nitrites from Drainage Samples

Ali Mirzakhani Nafchi, Mazhar Sher, Muhammad Roman, Azlan Zahid
article en

Abstract

Abstract Plant growth is significantly impacted by the concentration of nutrients in the soil. Accurate and real-time measurement of nitrates and nitrites levels remains a significant challenge. Existing laboratory-based methods are expensive, time-consuming, and labor-intensive, highlighting the need for a rapid, on-site solution. This study proposes a rapid method for measuring nitrates and nitrite levels in water samples collected from tile drainage. We utilized Hach Nitrate and Nitrite test strips for image dataset collection as these test strips change color based on the concentration of nitrate and nitrite in the water samples. A purpose-built black box, equipped with an internal lighting arrangement for imaging test strips, was designed to collect images of the test strips. Unlike many existing smartphone-based colorimetric approaches, which are sensitive to ambient lighting variations and often rely on external calibration or offline analysis, the proposed system integrates a controlled illumination environment with real-time edge computation for robust on-site detection of nitrate and nitrite. An Nvidia Orin Nano module, connected with an IMX219 camera sensor, was used to capture images of the test strips. Image preprocessing was performed, followed by the implementation of a VGG16-based network for feature extraction. A dataset of approximately 3128 images spanning multiple nitrate and nitrite concentration levels was collected under controlled imaging conditions. Multiple machine learning models including logistic regression (LR), support vector machines (SVM), k-nearest neighbors (KNN), naïve Bayes (NB), and random forest (RF) were evaluated for classification. The nitrate detection using KNN achieved an accuracy of 99.96% training, 99.92% testing, and 99.79% cross-validation. For nitrite detection, the SVM model achieved accuracy of 99.02%, 98.04%, and 98.07% for training, testing, and cross-validation, respectively, demonstrating both systems' high reliability and practical applicability for real-time monitoring. The total system cost is approximately USD 300, highlighting the affordability and practicality of the proposed solution for on-site water quality monitoring. This technology can enable farmers, water quality researchers, and agronomists to efficiently monitor the levels of nitrates and nitrites in tile drainage samples, enabling data-driven decisions to maximize crop yields.

Water Air & Soil PollutionVol. 237(8)
Texas A&M University System (US), South Dakota State University (US)
National Science Foundation, U.S. Department of Agriculture, South Dakota State University, South Dakota Soybean Research and Promotion Council, National Institute of Food and Agriculture
Openalex Percentile: Top 74%
Smart Agriculture and AI
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.