🏆
Global Research Press
Serving Researchers Since 2012

IoT-Based Soil Fertility Monitoring and NPK Analysis for Precision Agriculture Using Optical Sensing Technique

DOI : https://doi.org/10.5281/zenodo.19978590
Download Full-Text PDF Cite this Publication

Text Only Version

IoT-Based Soil Fertility Monitoring and NPK Analysis for Precision Agriculture Using Optical Sensing Technique

Dr . S. Sakthivel

Associate Professor Department of Computer Science and Engineering Knowledge Institute of Technology, Salem, India

Devaraj T

Department of Computer Science and Engineering Knowledge Institute of Technology, Salem, India

Arunprasanth S D

Department of Computer Science and Engineering Knowledge Institute of Technology, Salem, India

Harish B

Department of Computer Science and Engineering Knowledge Institute of Technology, Salem, India

Jainithish V

Department of Computer Science and Engineering Knowledge Institute of Technology, Salem, India

Abstract – Soil health directly decides how well crops grow, and with food demand rising every year, keeping soil fertile has become more critical than ever. The three primary nutrients that control plant development are Nitrogen (N) Phosphorus (P) and Potassium (K), but farmers face difficulties because they need to spend extra time and money to evaluate each nutrient’s availability through soil testing. Soil amendment and enough time for exploration make soils specially receptive to fertilizers in ways to convey continued protection unto them. Timing is crucial to farming; it may take several weeks for farmers to receive back soil sample results and besides that they must pay fees, which are not low, to laboratories. To solve this problem we developed an Internet of Things system which monitors soil fertility by measuring NPK levels through an optical transducer that detects specific light wavelengths. The system uses IoT sensors to monitor pH levels and moisture content and temperature conditions and transmits all results to a cloud dashboard which was developed using PHP and MySQL. The machine learning system uses nutrient measurements to create recommendations for crop and fertilizer applications after it assigns Low, Medium, Normal, and High ratings to each nutrient measurement. The system required validation through testing of ten soil samples which included five samples from organic farming fields that used compost and bio-fertilizers and five samples from inorganic farming fields that had a history of chemical fertilizer application. Organic Horizon Soils are characterized by higher levels of NPK and the richness in health nutrient content. Agriculture, especially in virgin lands, hasten the loss of nutrients, which have been cumulative from antigorical times. The research results demonstrate that extended chemical fertilizer application leads to soil health deterioration, but organic farming methods maintain natural soil fertility. The research findings show that chemical fertilizers harm soil health when used for extended periods, whereas organic farming methods preserve soil fertility. Our system showed fast and accurate and dependable performance which proved that budget-friendly Internet of Things devices combined with machine learning technology help farmers make improved environmentally sustainable agricultural choices.

Keywords Soil Fertility, NPK Sensing, Organic Farming, Inorganic Farming, IoT, Optical Transducer, Precision Agriculture, Machine Learning, Real-Time Monitoring, Soil Degradation, Fertilizer Impact, Crop Recommendation.

INTRODUCTION

Soil fertility exists as the capacity of soil to support plant growth. The elite initially viewed luxury fodder as a special dietary item but it has now become essential for human survival. The three soil parameters which most directly affect plant development and agricultural production and soil quality are Nitrogen (N) and Phosphorus (P) and Potassium (K). The three macronutrients which create an agricultural system’s essential balance must be maintained at their proper levels; when these three nutrients become unbalanced, productivity decreases while agricultural practices become harder to maintain.

An important but overlooked factor shaping soil nutrient levels is the farming practice itself. Organic farming using natural compost, green manure, and bio-fertilizers gradually replenishes soil nutrients and supports healthy long-term soil structure [9]. Inorganic farming that depends heavily on synthetic chemical fertilizers may deliver short-term yield benefits but progressively degrades the soil’s natural fertility when applied over extended cultivation periods [10].

Traditional soil testing relies on laboratory chemical analysis, which provides accurate results but takes several days to weeks and costs more than most smallholder farmers can afford on a regular basis [1]. As a result, many farmers apply fertilizers based on habit or guesswork rather than actual data, leading to overuse, soil degradation, water pollution, and wasted resources.

Recent advancements in Internet of Things technology have opened practical new possibilities for agricultural monitoring [2]. By combining sensors, microcontrollers, and cloud platforms, IoT systems make it possible to monitor soil conditions continuously and remotely without physical presence in the field. Optical sensing has emerged as a particularly efficient approach for NPK detection measuring how much light specific wavelengths absorb when passed through a soil sample to determine nutrient concentrations [3][4].

Despite the growing body of IoT-based soil monitoring research, very few studies have directly compared NPK profiles of organic and inorganic farming soils using real-time sensing systems. This paper addresses that gap by presenting an IoT-Based Soil Fertility Monitoring System using an optical transducer for real-time NPK analysis, supported by a machine learning classification model and automated crop recommendation engine. The system was validated by testing ten soil samples five from organic farming fields and five from inorganic farming fields to provide measurable evidence of how long-term farming practices impact soil nutrient health. Results show that organic soils consistently exhibited higher NPK concentrations, while inorganic soils showed progressive nutrient decline with increasing duration of chemical fertilizer use

LITERATURE SURVEY

A lot of research has gone into using technology to understand soil better, and reading through the existing work made it clear just how much progress has been made and also where the real gaps still are.

Srivastava and his team in 2021 reviewed how deep learning and computer vision are being used to classify different soil types [1]. The accuracy results were impressive, and the idea of automating soil health assessment through image analysis is genuinely promising. The catch is that the hardware required is expensive and not something most field farmers can realistically afford or operate on a daily basis.

Seaton et al. in 2020 looked at soil health monitoring from a national data perspective, using cluster analysis across large soil indicator datasets [2]. What stood out most for us was their finding that long-term agricultural activity leaves a measurable mark on soil health which directly connects to what we were investigating through our organic and inorganic soil sample comparison.

Benedet and colleagues in 2020 tested whether portable spectroscopic devices could predict soil subgroups accurately enough to be practically useful [3]. Their results showed that handheld devices offered promising accuracy and a far more accessible alternative to laboratory testing. This gave us confidence that field-deployable optical sensing is a scientifically valid approach for soil nutrient measurement.

Vibhute and his team in 2015 used hyperspectral remote sensing data to mapand classify soil types across large agricultural areas [4]. The classification performance was strong, but the equipment is expensive and

complex to deploy, which reinforced our decision to use a simpler and more affordable optical transducer instead.

Yu et al. in 2019 combined compressive spectral imaging with a three-dimensional convolutional neural network and achieved some of the highest soil classification accuracy reported in recent literature [5]. Their work confirmed that optical wavelength-based sensing is a powerful foundation for soil analysis which is exactly the principle our NPK transducer is built on.

Paulino and colleagues in 2019 reviewed laser-induced breakdown spectroscopy as a method for soil characterization and elemental analysis [6]. Their key finding was that rapid, reagent-free, field-level nutrient measurement is not just theoretically possible but has already been demonstrated through different optical techniques something that directly supported our sensor design approach.

Patel and Mehta in 2020 showed that machine learning models trained on IoT sensor data can predict crop yield with meaningful accuracy [7]. Their work confirmed that combining real-time IoT data collection with machine learning produces results that are genuinely useful for agricultural decision-making, giving us a solid basis for including a classification module in our system.

Nguyen and his team in 2019 built a low-cost IoT smart farming system for mango production in Vietnam and demonstrated that affordable IoT monitoring can be deployed successfully in developing agricultural economies [8]. This was directly relevant to our goal of building a system accessible to smallholder farmers rather than only large commercial operations.

Reganold and Wachter in 2016 published one of the most comprehensive comparisons of organic and conventional farming systems across multiple countries [9]. Their findings consistently showed that organic farming produced healthier soil with higher nutrient cycling and more biological activity. When we designed our experiment with organic and inorganic soil samples, we expected to see differences based on their work and our sensor readings confirmed those differences clearly.

Mondelaers and colleagues in 2009 conducted a meta-analysis comparing soil quality between organic and conventional farming and found that organic soils showed significantly higher nitrogen, phosphorus, and potassium content [10]. The research team observed that the nutrient gap became larger with extended usage of different farming techniques because the sensor data showed identical results across all ten soil samples.

The message is clear upon reviewing it all.Soil sensing together with IoT monitoring experience substantial progress since their inception yet current systems treat these technologies as distinct challenges which lack a system to conduct real-time optical NPK testing for field comparison between organic and inorganic agricultural soils. Our research addresses this particular research gap because we developed an affordable operational system that combines optical sensing with IoT transmission to enable machine learning classification and field testing of organic versus inorganic materials.

EXISTING SYSTEM

Soil health has traditionally been determined through chemical testing within a lab setting. Farmers use this method to collect soil samples from their fields which they send to agricultural testing laboratories that use chemical reagents and titration methods to measure Nitrogen Phosphorus Potassium and other vital nutrients in the samples. The laboratory analysis produces precise results but it has become the main method that farmers and agricultural institutions have relied on for their testing needs throughout the past 100 years.

Portable soil testing kits are being utilized in various projects of local organizations and NGOs, providing a better alternative at the field level. These kits, in turn, enable farmers to conduct basic chemical tests on-the-spot, instead of having samples sent to a laboratory. A usual way to assess colorimetric reactions for pH and sometimes for basic nutrient indicators and chemical reagents.Hence, perceived as a more accessible option compared to lab testing, these synthetics still operate based on manual chemical manipulation, giving out results only for a single point of time.

Current agricultural monitoring systems which use Internet of Things technology have been created and implemented in different farming environments. The majority of these systems monitor environmental conditions which include soil moisture levels and ambient temperature and humidity. The line of sight is intended never to be interrupted, says Rod Johnson, a Raytheon executive, regarding the S-band frequency planned for the radar.The systems have demonstrated their value for both irrigation management and greenhouse monitoring. However, these systems lack the ability to directly measure soil nutrient levels.

The present decision support method uses human interpretation as its only basis for decision-making. The present decision support method uses human interpretation as its only basis for decision-making. Farmers and agricultural consultants receive soil-test results, and from there, they proceed to consult fertiliser evaluation techniques or crop requirement charts in order to determine what to bring in as inputs. Farmers need a system capable of providing crop or fertilizer recommendations in real-time through the translation of soil data.

The figure below illustrates the workflow of the existing soil fertility assessment system:

Fig. 1. Workflow of the existing soil fertility assessment system

PROBLEMS OF THE CURRENT SYSTEM

After going through how the existing system works, it becomes obvious that the problems run deeper than just a few inconveniences. These are fundamental gaps that affect millions of farmers every single day, and they directly motivated every design decision we made when building our system.

  1. LACK OF REAL-TIME MONITORING

    Laboratory testing delivers results only after several days or weeks. The results arrive after the most suitable time for fertilization has passed which leads to decreased crop yield and quality.

  2. HIGH COST AND LIMITED ACCESSIBILITY

    Laboratory testing requires substantial expenses which include costs for sample collection and transportation and laboratory analysis and final test result reporting. The testing costs are too high for rural smallholder farmers in India because they need to handle testing expenses which most farmers cannot afford thus they tend to use fertilizers without any scientific proof.

  3. HUMAN ERROR AND MANUAL INTERVENTION

    Conventional testing requires human workers to perform testing tasks which begin with sample collection and end with result interpretation. Each step introduces the possibility of human error that can compromise the accuracy of final nutrient readings.

  4. ABSENCE OF CONTINUOUS MONITORING

    A single lab test captures soil conditions at only one point in time. The nutrient levels on a farm experience continuous changes which make it impossible to use a single measurement for effective nutrient control during the entire growing period.

  5. NO AUTOMATED ALERTS

    Existing approaches provide no alert system to warn farmers when nutrient levels drop below essential thresholds. The agricultural industry usually waits until farmers observe visible crop symptoms before

    applying necessary corrective measures which results in considerable yield decline.

  6. LACK OF INTEGRATED DECISION SUPPORT

    Farmers who lack agricultural training face difficulties in making fertilizer choices because they do not understand how to interpret available soil data. The current systems do no offer automatic crop and fertilizer recommendations for specific soil conditions.

  7. NO CLOUD CONNECTIVITY OR REMOTE ACCESS

    Traditional systems store data locally in paper records or spreadsheets which prevents remote access and prohibits long-term trend analysis. The absence of centralized storage prevents organizations from making unified evidence-based agricultural decisions.

  8. ENVIRONMENTAL IMPACT OF UNINFORMED FERTILIZER

USE

Farmers apply excessive fertilizers to their fields because they lack precise nutrient information and their only option is to estimate their needs. The agricultural sector faces risks to its long-term viability because farmers apply nitrogen and phosphorus in excessive amounts which results in soil acidification and groundwater contamination and greenhouse gas emissions.

The combined problems demonstrate the requirement for an automated system that provides real-time soil fertility monitoring at an affordable cost while delivering intelligent monitoring capabilities. The system needs to deliver information for making decisions which will help farmers practice sustainable farming methods.

PROPOSED SYSTEM

After spending time understanding what was broken about the existing approach, we had a clear picture of what a better system needed to look like. It had to be affordable enough for smallholder farmers to actually use. It had to give real-time information rather than results that arrive days later. It had to measure NPK directly rather than just tracking temperature and humidity. And it had to do something useful with that information not just collect numbers and leave farmers to figure out the rest on their own. What we built is a system that tries to deliver all of that in one connected and practical package.

At the heart of our system is an optical transducer that measures Nitrogen, Phosphorus, and Potassium levels directly in the soil. The way it works is straightforward each nutrient absorbs light at a specific wavelength, so by shining light at those wavelengths and measuring how much comes back, the sensor can calculate how much of each nutrient is present. This approach does not need chemical reagents, does not require laboratory equipment, and gives results almost instantly. Alongside the NPK transducer, we included additional IoT sensors to track soil pH, moisture content, and ambient temperature, because these parameters interact with nutrient availability and give a much more complete picture of soil health than NPK alone.

All of this sensor data is collected and processed by a NodeMCU ESP8266 microcontroller, which serves as the central processing unit of the hardware setup. Once the readings are collected and formatted, the microcontroller transmits everything wirelessly over Wi-Fi to our cloud server. We chose Wi-Fi for data transmission because it is reliable, widely available, and keeps the hardware cost low compared to alternatives like GSM or LoRa modules. The entire hardware assembly was put together on a PCB to make it compact, stable, and suitable for actual field conditions rather than just lab demonstrations.

On the software side, we built a web-based dashboard using PHP, HTML, CSS, JavaScript, and Bootstrap that displays everything a farmer needs to see in one place. Live sensor readings, historical data charts, soil fertility classifications, and recommendations all appear on the same screen, and the dashboard is fully responsive so it works on a smartphone just as well as on a desktop computer. We designed it with simplicity in mind because the people using it should not need technical training to understand what they are looking at.

The machine learning component is where the system moves from just collecting data to actually making sense of it. We trained a classification model on a dataset of soil NPK readings compiled from agricultural research sources and field measurements across different soil types and crop-growing regions. The model takes incoming sensor readings and classifies the

Nitrogen, Phosphorus, and Potassium levels independently into one of four categories Low, Medium, Normal, or High. So instead of seeing a raw number like 18 mg/kg and not knowing what to do with it, a farmer sees a clear label that immediately tells them whether that nutrient needs attention.

Once the classification is done, the recommendation engine takes over. It queries our MySQL database to pull up the crops and fertilizers that are best matched to the specific combination of NPK levels detected in that soil. If nitrogen is Low and the other nutrients are Normal, the system recommends nitrogen-rich fertilizers like urea or ammonium nitrate and lists crops that perform well under those conditions. The top three crop recommendations and the relevant fertilizer suggestions appear directly on the dashboard, and can also be sent via SMS for farmers in areas with limited internet access.

The system also includes an automated alert mechanism that sends notifications whenever nutrient levels cross outside the acceptable range for the crops currently being grown. This is the kind of early warning capability that the existing system completely lacks instead of finding out there is a problem when the crops start showing symptoms, farmers get notified while there is still time to do something about it.

One of the things we were most conscious of throughout the design process was keeping the system accessible. We used low-cost sensors, open-source software frameworks, and cloud platforms that do not require expensive subscriptions. The hardware runs on battery power with provisions for solar charging, which means it can operate in remote fields without access to mains electricity. And because everything transmits wirelessly, there is no complex wiring infrastructure to install or maintain.

Beyond just monitoring individual fields, the system is designed to scale. Multiple sensor nodes can be deployed across different locations and managed through the same central dashboard. Each node transmits location-tagged data, so it becomes possible to build up a spatially distributed picture of soil health across an entire farming region over time.

We also applied our system to something beyond just monitoring we used it to conduct a direct comparison between organic and inorganic farming soils, testing five samples from each type of farming environment. This gave our research a concrete scientific contribution beyond just building and validating a system. The results of that comparison are discussed in detail in the Results and Discussion section.

Fig. 2. Architecture of the proposed IoT-based soil fertility monitoring system

METHODOLOGY

    1. SYSTEM ARCHITECTURE

      We designed the system as a three-tier architecture that moves data from physical sensors in the soil all the way to the farmer’s dashboard through the cloud.

      The first tier is the sensing layer which includes NPK optical transducer and pH sensor and soil moisture sensor and DHT22 temperature and humidity sensor which all operate at the field location. All worker shifts came with a different way to calculate weights. All worker shifts came with a different way to calculate weights. The micro-controller transmits the Wi-Fidictated readings of a sensor to the cloud server at regular intervals of time in order to maintain the latest field conditions as far as updating the database is concerned.

      The third tier is the intelligence layer. The MySQL database and web application and machine learning classification engine all operate on the cloud server. The system records incoming data with timestamp information and location identifiers, which the ML model uses for classification, and the system links to crop and fertilizer recommendations. The system is accessible by the farmers, the GeoAdmins, and the SyAdmins by their webdashboard logins.

    2. SENSOR CALIBRATION AND HARDWARE SETUP

      Before field deployment, we calibrated every sensor carefully to ensure accurate readings.The optical NPK transducer was calibrated using soil samples of known nutrient concentrations prepared in the lab. The researchers established a direct connection between sensor output voltages and actual NPK values through linear regression, which they tested under different lighting and moisture conditions to assess its reliability. The pH sensor calibration process used buffer solutions at three pH values of 4.0, 7.0, and 10.0 through the standard three-point procedure which required the probe to be rinsed with distilled water after each testing phase. The researchers calibrated the capacitive soil moisture sensor by measuring its output in completely dry soil and completely saturated soil while using gravimetric measurements to confirm the results at intermediate points.The DHT22 was calibrated in the factory with the extreme precision of ±0.5°C for temperature and ±2% for humidity.

      The NodeMCU ESP8266 received all sensor connections through signal conditioning circuits which engineers designed and built on their printed circuit board. The measuring instrument proved to be compatible with all sensors which confirmed the accuracy of the probe measurements.

    3. DATASET PREPARATION AND EXPLORATION

      We compiled the training dataset from agricultural research publications, government soil health databases, and field measurements across diverse soil types. The dataset included NPK concentrations along with pH, moisture, and temperature values, each annotated with fertility classifications and crop suitability labels. We performed statistical analysis to check nutrient value distributions, class imbalances, and outliers. Histograms, box plots, and correlation matrices guided our preprocessing decisions.

    4. PRE-PROCESSING

      Raw data was processed through a preprocessing pipeline before model training. Missing values were handled through mean imputation. Outliers were capped using the interquartile range method. Min-max normalization scaled all features to a common 0 to 1 range. Fertility labels were encoded numerically using label encoding. The dataset was split 80:20 into training and testing subsets for unbiased performance evaluation.

    5. SOIL DETECTION

      When a farmer or geologist initiates a reading at a field location, the system activates the optical transducer and supporting sensors to measure NPK concentrations, pH, moisture, and temperature simultaneously. All readings are timestamped, tagged with GPS location identifiers, and transmitted to the cloud server where they are logged into the MySQL database. Location tagging was particularly important for our organic versus inorganic comparison study to keep track of which reading came from which field.

    6. FEATURE EXTRACTION

      Primary features extracted from sensor readings include NPK concentrations in mg/kg, soil pH, volumetric moisture content as a percentage, and ambient temperature in degrees Celsius. Two derived features were also computed the NPK ratio capturing macronutrient balance, and a composite soil fertility index. Feature importance analysis confirmed that NPK concentrations and soil pH were the most influential predictors, while moisture and temperature served as important contextual features.

    7. SOIL TYPE CLASSIFICATION

      A supervised machine learning model categorizes incoming NPK readings into four fertility levels for each macronutrient independently Low, Medium, Normal, and High producing outputs such as N: Low, P: Normal, K: High. Classification thresholds were derived from standard agronomic guidelines and stored in the MySQL database, allowing updates without changing the underlying code. Our model achieved an overall classification accuracy of 94.3% on the validation dataset.

    8. TESTING PHASE

      We validated sensor accuracy by comparing readings against laboratory colorimetric analysis, calibrated pH meters, and gravimetric moisture measurements. Data transmission reliability was assessed by monitoring packet consistency over extended operation periods. Classification performance was evaluated using accuracy, precision, recall, and F1-score on the held-out test dataset. Alert response time was measured from threshold exceedance to notification delivery. All components performed within acceptable parameters.

    9. CROP YIELD RECOMMENDATION

Once classification results are generated, the recommendation engine queries the MySQL database to retrieve the top three most suitable crops and specific fertilizers matched to the detected NPK profile. For example, if soil is classified as N: Low, P: Normal, K: Normal, the system recommends nitrogen-rich fertilizers like urea or ammonium nitrate alongside crops suited to low-nitrogen conditions. Recommendations appear on the web dashboard and are also delivered via SMS for farmers in low-connectivity areas.

EXPERIMENTAL SETUP AND SOIL SAMPLE COLLECTION

    1. OVERVIEW OF EXPERIMENTAL DESIGN

      Beyond building and validating the system, we wanted to use it to answer a real agricultural question does the type of farming practice a farmer uses actually show up in soil NPK data in a measurable way? To investigate this, we collected ten soil samples in total five from fields managed through organic methods and five from fields using synthetic chemical fertilizers over different durations. Samples were selected to represent a genuine range of conditions within each farming type rather than cherry-picking the best or worst examples.

    2. ORGANIC FARMING SOIL SAMPLES

      The five organic samples were collected from fields in our local agricultural region managed exclusively using natural inputs compost, green manure, farmyard manure, and bio-fertilizers for a minimum of three years with no synthetic fertilizers applied. We confirmed this directly with each farmer before sampling.

      Each sample was collected from 10 to 15 cm depth the root zone most relevant to nutrient availability from three spots per field and composited into one representative sample. Samples were stored in sealed labeled containers and brought back for testing within 24 hours of collection.

    3. INORGANIC FARMING SOIL SAMPLES

      The five inorganic samples were collected from fields using synthetic chemical fertilizers as their primary soil amendment. We deliberately selected fields with different durations of chemical fertilizer use ranging from three to four years up to over ten years to investigate whether duration of use correlates with nutrient decline. The same collection protocol as organic samples was followed for consistency.

    4. SOIL SAMPLE DETAILS

      The table below summarizes the ten soil samples tested, including crop type, farming method, and duration of practice:

      Sample

      Crop

      Farming Type

      Duration

      O1

      Rice

      Organic

      3 years

      O2

      Groundnut

      Organic

      4 years

      O3

      Greens

      Organic

      4 years

      O4

      Turmeric

      Organic

      5 years

      O5

      Banana

      Organic

      5+ years

      I1

      Rice

      Inorganic

      3 to 4 years

      I2

      Groundnut

      Inorganic

      5 to 6 years

      I3

      Greens

      Inorganic

      7 to 8 years

      I4

      Sugarcane

      Inorganic

      9 to 10 years

      I5

      Maize

      Inorganic

      10+ years

    5. TESTING CONDITIONS AND MEASUREMENT PROCEDURE

All ten samples were tested using a consistent procedure to ensure comparable results. Each sample was brought to a uniform moisture level before testing to avoid optical sensor interference. Three separate readings were taken at different points within each sample and averaged to produce the final NPK, pH, moisture, and temperature values. All readings were automatically logged to the cloud dashboard with sample identifiers, farming type, and duration tags. Tests were conducted indoors under controlled lighting across two consecutive days to eliminate ambient sunlight interference on the optical sensor. Full results and comparative analysis are presented in the Results and Discussion section.

RESULTS AND DISCUSSION

We ran all ten soil samples through our IoT-based soil fertility monitoring system and recorded NPK, pH, moisture, and humidity readings for each sample. The results clearly demonstrated measurable differences between organic and inorganic farming soils across all parameters.

    1. SENSOR ACCURACY VALIDATION

      Before analyzing results, we validated sensor performance by comparing readings against standard laboratory analysis. The optical NPK transducer showed a mean absolute error of ±2 mg/kg for nitrogen, with comparable accuracy for phosphorus and potassium. The pH sensor maintained ±0.1 pH unit accuracy. The DHT22 delivered temperature accuracy of ±0.5°C and humidity accuracy of ±2%. Data transmission latency averaged under 2 seconds with no data loss recorded throughout the testing period.

    2. SOIL SAMPLE READINGS ORGANIC FARMING

      The table below shows the sensor readings for all five organic soil samples:

      Sam ple

      Crop

      N

      (mg/k g)

      P

      (mg/k g)

      K

      (mg/k g)

      p H

      Moistu re (%)

      Humidi ty (%)

      N

      Class

      P

      Class

      K

      Class

      O1

      Rice

      52

      34

      96

      7.

      1

      38

      72

      Norm al

      Norm al

      High

      O2

      Groundnu t

      48

      30

      88

      6.

      8

      35

      68

      Norm al

      Norm al

      High

      O3

      Greens

      44

      27

      82

      6.

      5

      40

      74

      Norm al

      Norm al

      Norm al

      O4

      Turmeric

      42

      24

      78

      6.

      4

      36

      70

      Norm al

      Mediu m

      Norm al

      O5

      Banana

      38

      22

      80

      6.

      2

      34

      66

      Mediu m

      Mediu m

      Norm al

      Aver age

      44.8

      27.4

      84.8

      6.

      6

      36.6

      70

      Organic soils consistently showed Normal to High NPK classifications with balanced nutrient profiles and optimal pH levels between 6.2 and 7.1.

    3. SOIL SAMPLE READINGS INORGANIC FARMING

      The table below shows the sensor readings for all five inorganic soil samples:

      Samp le

      Crop

      N

      (mg/ kg)

      P

      (mg/ kg)

      K

      (mg/ kg)

      p H

      Moist ure (%)

      Humi dity (%)

      N

      Clas s

      P

      Class

      K

      Class

      Years of Chemi cal Use

      I1

      Rice

      31

      22

      61

      6.2

      28

      58

      Low

      Medi um

      Medi um

      34 yrs

      I2

      Groun dnut

      24

      16

      52

      5.9

      25

      54

      Low

      Low

      Medi um

      56 yrs

      I3

      Greens

      18

      12

      42

      5.7

      22

      50

      Low

      Low

      Low

      78 yrs

      I4

      Sugarc ane

      15

      10

      35

      5.5

      20

      46

      Low

      Low

      Low

      910

      yrs

      I5

      Maize

      12

      8

      28

      5.4

      18

      42

      Low

      Low

      Low

      10+

      yrs

      Aver age

      20

      13.6

      43.6

      5.7

      4

      22.6

      50

      Inorganic soils showed a clear and consistent downward trend in all three nutrients as the duration of chemical fertilizer use increased. The oldest fields showed critically Low NPK across all three nutrients.

    4. COMPARATIVE ANALYSIS ORGANIC VS INORGANIC

      Parameter

      Organic Average

      Organic Class

      Inorganic Average

      Inorganic Class

      Nitrogen

      44.8 mg/kg

      Normal

      20 mg/kg

      Low

      Phosphorus

      27.4 mg/kg

      Normal

      13.6 mg/kg

      Low

      Potassium

      84.8 mg/kg

      High

      43.6 mg/kg

      Medium

      Soil pH

      6.6

      Optimal

      5.74

      Acidic

      Moisture

      36.6%

      Adequate

      22.6%

      Low

      Humidity

      70%

      Normal

      50%

      Low

      Organic farming soils had more than double the nitrogen, double the phosphorus, and nearly double the potassium compared to inorganic farming soils. The pH of inorganic soils was consistently more acidic, confirming that long-term synthetic fertilizer use degrades natural soil buffering capacity. Moisture and humidity levels were also notably lower in inorganic fields, reflecting reduced organic matter content.

    5. EFFECT OF LONG-TERM CHEMICAL FERTILIZER USE

      Arranging the five inorganic samples by duration of chemical fertilizer use revealed a consistent downward nutrient trend across all three macronutrients:

      Duration

      Crop

      N (mg/kg)

      P (mg/kg)

      K (mg/kg)

      Overall Fertility

      34 years

      Rice

      31

      22

      61

      LowMedium

      56 years

      Groundnut

      24

      16

      52

      Low

      78 years

      Greens

      18

      12

      42

      Low

      910 years

      Sugarcane

      15

      10

      35

      Low

      10+ years

      Maize

      12

      8

      28

      Critically Low

      The data confirms that prolonged chemical fertilizer use progressively degrades soil natural nutrient-holding capacity. Fields under inorganic farming for over ten years showed critically low NPK levels approaching near-infertile conditions.

    6. CLASSIFICATION AND RECOMMENDATION PERFORMANCE

      The machine learning model achieved an overall classification accuracy of 94.3% with precision and recall exceeding 93% across all nutrient classes. The recommendation engine produced agronomically appropriate crop and fertilizer suggestions for all ten samples, with 88% of recommendations aligning with national agricultural research institution guidelines. Response time from sensor reading to recommendation delivery was consistently under 5 seconds.

    7. SYSTEM RELIABILITY

      The system operated continuously across two days of testing without any crashes, transmission failures, or sensor malfunctions. Dashboard load times stayed below 3 seconds throughout, and all alert notifications triggered correctly when nutrient levels crossed defined thresholds. Battery performance supported extended field deployment on a single charge.

    8. COMPARISON WITH EXISTING APPROACHES

Feature

Traditional Lab Testing

Existing IoT Systems

Our Proposed System

NPK detection

Yes

No

Yes

Real-time monitoring

No

Partial

Yes

Result delivery time

Days to weeks

Instant

Instant

Crop recommendation

No

No

Yes

Organic vs inorganic comparison

No

No

Yes

Cost

High

Medium

Low

Our system uniquely combines real-time optical NPK sensing, machine learning classification, automated recommendations, and organic versus inorganic comparative analysis capabilities not available in any existing low-cost IoT agricultural monitoring system reviewed in this study.

CONCLUSION AND FUTURE ENHANCEMENT

The paper introduced an IoT-Based Soil Fertility Monitoring System which displays real-time NPK measurements through its optical transducer and IoT sensors that monitor pH and moisture and temperature and its wireless data transmission system which uses NodeMCU ESP8266 microcontroller and its cloud-based web application which performs machine learning classification and automated crop and fertilizer recommendations.The system achieved a classification accuracy of 94.3% and produced agronomically validated recommendations for 88% of tested soil profiles, which demonstrated that farmers can achieve affordable real-time precision agriculture through their standard equipment.

The research on grasses which included identification and monitoring and analysis of sixteen solid samples from various growth stages and different environmental conditions found that developmental stages affected phytostabilization results while the study did not find any statistical proof which reached significance at the 0.05 level. More than double the levels were recorded in the NPK, in other words, numbers privileged the organic-farming soils that accepted the inorganic counterparts.The inorganic group showed declining nutrient levels because chemical fertilizer usage increased throughout time. The fields which received synthetic fertilizer for more than ten years exhibited extremely low NPK values which approached conditions of near-infertility.The field evidence shows that occupational farming practices, which require workers to stay on the land for their entire working time, will protect soil from degradation and preserve its ability to retain nutrients even after farmers use chemical fertilizers for extended periods, but the ongoing expense to sustain proper soil structure will create significant financial burden.

If we discuss the given research in detail, then it suggests the need and urge for awareness about the key specialized features, a limitation that requires solving through future investigations. The system faces its main operational challenge because remote agricultural areas lack Wi-Fi access but system deployability will increase through the addition of GSM and LoRa and NB-IoT backup modules.The current sensor suite covers only primary macronutrients NPK expanding detection to include secondary nutrients like Calcium, Magnesium, and Sulfur would provide a more complete soil health picture. The ten-sample comparative study, while revealing clear patterns, should be expanded across larger datasets, more crop varieties, and diverse geographic regions for statistically definitive conclusions.

The project will develop a mobile application that provides users with offline data access and notification features while it builds edge computing infrastructure for local data processing and AI-powered predictive analytics which will predict nutrient loss based on soil data and seasonal trends. The system will expand its capabilities to create regional soil health maps through the combination of drone-based remote sensing and satellite imagery.

The research shows that IoT technology and optical sensing and machine learning form a combination which creates affordable soil monitoring systems that help precision farming and deliver essential soil health information to farmers and advisors and policymakers.

REFERENCES

  1. Srivastava, P., Shukla, A., and Bansal, A., “A Comprehensive Review on Soil Classification Using Deep Learning and Computer Vision Techniques,” Multimedia Tools and Applications, pp. 128, 2021.

  2. Seaton, F. M., et al., “Soil Health Cluster Analysis Based on National Monitoring of Soil Indicators,” European Journal of Soil Science, 2020.

  3. Benedet, L., et al., “Soil Subgroup Prediction via Portable X-ray Fluorescence and Visible Near-Infrared Spectroscopy,” Geoderma, vol. 365, 114212, 2020.

  4. Vibhute, A. D., et al., “Soil Type Classification and Mapping Using Hyperspectral Remote Sensing Data,” International Conference on Man and Machine Interfacing (MAMI), 2015.

  5. Yu, Y., et al., “Compressive Spectral Imaging System for Soil Classification with Three-Dimensional Convolutional Neural Network,” Optics Express, vol. 27, no. 16, pp. 2302923048, 2019.

  6. Paulino, R. V. B., et al., “Applications of Laser-Induced Breakdown Spectroscopy for Soil Characterization, Part II: Review of Elemental Analysis and Soil Classification,” European Journal of Soil Science, vol. 71, issue 5, pp. 805818, 2019.

  7. Patel, S., and Mehta, R., “Machine Learning Approaches for Predicting Crop Yield Using IoT Data,” International Conference on Machine Learning and Data Science (ICMLDS), 2020.

  8. Nguyen, T., Tran, P., and Vu, D., “Smart Farming with IoT Case Study Mango Production in Vietnam,” International Journal of Agricultural Technology, vol. 15, no. 4, pp. 4558, 2019.

  9. Mondelaers, K., Aertsens, J., and Van Huylenbroeck, G., “A Meta-Analysis of the Differences in Environmental Impacts Between Organic and Conventional Farming,” British Food Journal, vol. 111, no. 10, pp. 10981119, 2009.