You are on page 1of 7

Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology

ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

IoT Based Soil pH Detection and Crop


Recommendation System
Prabavathi R 1 Subha P 2
Department of Information Technology Department of Information Technology
Sri Sai Ram Institute of Technology Sri Sai Ram Institute of Technology
Chennai Tamil Nadu, India Chennai Tamil Nadu, India

Bhuvaneswari M 3 Prithisha V 4
Department of Information Technology Department of Information Technology
Sri Sai Ram Institute of Technology Sri Sai Ram Institute of Technology
Chennai Tamil Nadu, India Chennai Tamil Nadu, India

Roshini K 5
Department of Information Technology
Sri Sai Ram Institute of Technology
Chennai Tamil Nadu, India

Abstract:- Agricultural productivity hinges on soil crops accordingly. The problem of crop selection is
fertility, influenced by key factors like nitrogen, particularly pronounced in rural areas, where the adoption of
phosphorus, potassium, pH level, and soil moisture. Yet, IoT technologies can offer viable solutions. Utilizing an IoT-
achieving optimal crop growth is challenging due to based approach, an array of sensors including those for
limited farmer knowledge and difficulties in determining Nitrogen (N), Phosphorus (P), Potassium (K), pH,
precise fertilizer quantities. Conventional soil analysis temperature, moisture, and humidity are deployed to ascertain
methods involve manual sampling and costly lab tests, soil nutrient levels. These sensors continuously collect data
which are subjective. To address this, a proposed solution from the agricultural field and transmit it to a cloud-based
integrates IoT-enabled soil nutrient monitoring with platform via wireless communication protocols. A significant
machine learning algorithms for croprecommendations. advantage of utilizing a cloud-based database is its
Sensors collect data on crucial parameters like nitrogen, accessibility from anywhere and at any time, enabling
phosphorus, and soil temperature, transmitting it to a seamless integration with various smart devices. Data stored
cloud-based database. Machine learning analyzes this in the cloud encompasses crucial factors such as soil
data to suggest ideal crops, minimizing fertilizer use, moisture, temperature, rainfall, pH levels, and nutrient
reducing labor, and enhancing overall productivity. This concentrations (N, P, K), facilitating informed decision-
innovative approach streamlines crop selection, making. To recommend suitable crops, machine learning
minimizing unnecessary inputs while maximizing yields. algorithms such as Linear Regression (LR), K Nearest
By harnessing IoT and machine learning, farmers gain Neighbor (K-NN), Decision Tree (DT), Random Forest
valuable insights into soil health, enabling precise Regression (RFR), Neural Network (NN), Support Vector
fertilization and crop selection. This not only boosts Machine (SVM), and XGBoost are leveraged. The
agricultural productivity but also contributes to economic overarching objective of this system is to alleviate farmers'
growth by fostering sustainable practices and increased workload, enhance profitability, and facilitate data-driven
yields. decision- making. Real-time data pertaining to nitrogen,
phosphorus, potassium, pH, temperature, moisture, and
Keywords:- Agriculture Yields, Crop Recommendation, humidity sourced from the cloud database serves as inputs for
Machine Learning, Soil Behavior Analysis. the machine learning algorithms, enabling dynamic and
context-aware crop recommendations.
I. INTRODUCTION
II. LITERATURE SURVEY
In agricultural settings, farmers often grapple with
economic challenges stemming from suboptimal crop The classification algorithm used to predict the crop
selection, resulting in financial losses and crop disorders. Soil suitablefor the soil based on the nutrients level present on that
fertility plays a pivotal role in addressing this issue, aslow- is described in most of the existing literature for precision and
nutrient soils can lead to various plant disorders and smart agriculture. This section includes several articles that
diminished yields. To enhance profitability, farmers must are predicted to illustrate the benefits of adopting precision
accurately assess the nutritional status of their soil and select and smart agriculture as well as the areas that require

IJISRT24APR532 www.ijisrt.com 450


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

improvement. It focuses on the management challenges in III. PROPOSED SYSTEMMETHODOLOGY


IoT-based agricultural systems and how it might best benefit
users. According to [1], agriculture is dependent on the The IoT-based soil monitoring and machine learning-
geographic locations and climatic conditions in the driven crop recommendation system employs a hierarchical
designated places. This article covered potential weather architecture comprising various sensor nodes strategically
changes and forecasted which weather would be best for the positioned across agricultural fields. These sensors,
given place during the particular season. According to encompassing parameters such as nitrogen, phosphorus,
Chlingaryana et al. 2017 [2], the level of nitrogen in the soil potassium, pH, soil temperature, and moisture, continuously
is a key component in predicting crop yield. These days, gather data on soil conditions. Through a Wireless Sensor
decision-making is where most remote sensing devices are Network (WSN), this data is transmitted wirelessly to a
used. Farmers can increase crop production by using these centralized cloud database for storage and analysis. Within
remote sensing data. A choice is made using a vast amount of the cloud infrastructure, machine learning algorithms are
remote sensing data. Nitrogen is used to enhance agricultural deployed to conduct comprehensive analysis of both steady-
yield and cultivate the soil. The choice is madeusing methods state and transient soil behavior. Additionally, environmental
for machine learning. The three main variables we will take parameters including temperature,humidity, and precipitation
into account are nitrogen, soil type, and yield. Analyzing prior are integrated into the analysis. Thisholistic approach enables
data on these variables will helpus make informed decisions, the system to generate precise recommendations for crop
predict yields, and assist farmers. In [3] and [4], the clustering cultivation tailored to the specific land parcel, accounting for
and classification process to grouping, the common users are its nutrient composition and prevailing environmental
discussed. These approaches facilitate the identification of conditions. By leveraging this analytical framework, the
common crops that supports the farmers to use some kind of system assists farmers in optimizing fertilizer application,
cultivation method. The procedure of "smart terrace mitigating manual intervention, and ultimately enhancing
gardening" is described in [5], which demonstrates the agricultural output. Through the provision of accurate crop
effective water-conservation methods used. This system's use recommendations, the system not only fosters operational
of intelligent rules encourages less consumption while efficiency but also contributes to the overall economic
simultaneously supporting improved plant development. The advancement of the agricultural sector.
geographically based customized crop suggestion system is
presented in [6]. It collects user input and offers customized
recommendations that are pertinent to their location and
previous farming. A cloud-based IoT system for precision
gardening is proposed in [7]. Through the use of cloud
computing technology, this system delivered the sensor data
that had been assessed to the user's mobile device or system.
The research cited in [8] analyses the present weather and soil
moisture content and offers recommendations for needed
water level and weather conditions. It's an Internet of Things-
based project that helps intelligent and precise agriculture.
The Naive Bayes classification methods and their use in the
categorization of the crop suitable for the soil chosen for
cultivation are described in another study [9]. Please don't
change any of the labels that are currently in place. Another
study mentioned in [10] The majority of the study
publications that were examined took into account several Fig 1 Architecture for Soil PH Detection and
climate factors, including temperature, humidity, and rainfall. Crop Recommendation
Several agronomic factors, including soil, herbicides, and
nutrient levels like N, P, and K. These variables' values have  pH Sensor:
been used as input. A sizable dataset is needed for data mining
to be applied successfully. The information obtained from  Input: Soil Sample Preparation:
numerous sources is occasionally in raw form. It might The pH sensor receives a soil sample extracted from the
include some conflicting, redundant, or incomplete data. field. Preparation of the soil sample is crucial for ensuring
Thus, such redundant data needs to be filtered in this step. accurate pH measurement. This preparation typically
You should normalize your data. Largedata sets are analyzed involves creating a soil-water slurry by mixing the soil with
using data mining to discover helpful classifications and distilled water in a standardized ratio.
trends. The main objective of the data mining process is to
take the information from a data set and organize it so that it  Output: pH Measurement:
can be used in other ways. Using the data at hand, this The pH sensor provides an outputin the form of the pH
research assesses crop yield output.
value of the soil sample. This value quantifies the acidity or
alkalinity of the soil and is expressed on a numerical scale
ranging from 0 to 14. A pH of 7 indicates neutrality, values
below 7 signify acidity, while values above 7 indicate
alkalinity.

IJISRT24APR532 www.ijisrt.com 451


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

 Working of pH Sensor: data, considering factors such as soil pH levels, crop


requirements, and environmental conditions.Provide real-
 Sensor Calibration and Setup: time feedback and updates to farmers through the user
Calibrate the pH sensor according to the manufacturer's interface or other communication channels.
instructions to ensure accurate readings.Connect the pH
sensor to the Arduino Uno using the RS485interface. Use  User Interface and Interaction:
appropriate wiring and ensure proper electricalconnections. Develop a user interface (e.g., web application, mobile
Set up the Arduino Uno with necessary libraries and app) tovisualize soil pH data and crop recommendations for
configurations to communicate with the pH sensor via farmers.Enable farmers to access the user interface using their
RS485. devices (e.g., smartphones, tablets, computers) and
authenticate securely.Display real-time soil pH
 Initialization and Configuration: measurements, historical trends, and personalized crop
Initialize the Arduino Uno and configure the serial recommendations based on the farmer's location and
communication parameters for RS485 communication. Set preferences. Implement interactive features for farmers to
up the pH sensor for data acquisition, includingconfiguring customize settings, provide feedback, and receive
measurement intervals and calibration settings if necessary. notifications/alertsrelated to soil pH and crop management.
Implement error handling mechanisms to detect andhandle
communication errors with the pH sensor.  Maintenance and Monitoring:
Implement monitoring mechanisms to track the health
 Data Acquisition: and performance of the entire system, including Arduino Uno
Periodically request pH measurements from the sensor devices, IoT modules, and cloud platform components.Set up
using the RS485 communication protocol. Receive pH data automated alerts and notifications to inform administrators of
packets from the sensor via RS485 anddecode them to extract any system anomalies, errors, or failures that require
pH values. Implement error-checking mechanisms to ensure attention.Conduct regular maintenance tasks such as updating
the integrity of received data and handle any transmission firmware/software, calibrating sensors, and replacing faulty
errors. components to ensure the smooth operation of the system.

 Data Processing and Storage:


Process the received pH data to convert it into a usable
format, such as floating-point values representing pH
levels.Store the processed pH data locally on the Arduino
Uno'smemory or an external storage device, depending on the
storage requirements and available resources. Implement
buffering mechanisms to manage data storageefficiently and
prevent data loss in case of temporary storage unavailability.

 Communication with Iot Module:


Establish communication between the Arduino Uno and
the IoT module (e.g., using UART, SPI, or I2C interface).
Transfer the processed pH data from the Arduino Uno tothe
Fig 2 pH Sensor Connection
IoT module for further transmission to the cloud platform.
Ensure compatibility and interoperability between the
A. Decision Trees:
Arduino Uno and the IoT module by configuring
communication protocols and data formats accordingly.
 Input:
The Decision Trees algorithm takes soil parameters such
 Cloud Platform Integration:
as nitrogen, potassium, phosphorus, and pH levels as input
Configure the IoT module to connect to the internet and
features.
establish communication with the cloud platform. Implement
protocols and security mechanisms (e.g., MQTT, TLS) to
 Output:
ensure secure and reliable datatransmission to the cloud. Send
It provides a recommended crop based on the input soil
pH data packets from the IoT module to the cloud platform at parameters.
regular intervals, adhering to predefined communication
protocols and data formats.  Steps:
 Data Collection and Preprocessing: Soil data, including
 Data Analytics and Crop Recommendation:
pH, nitrogen, potassium, and phosphorus levels, is
On the cloud platform, receive and process the incoming collected and preprocessed to ensure consistency and
pH data packets from multiple Arduino Uno devices. Analyze
suitability for analysis.
the pH data using statistical methods andmachine learning
 Dataset Splitting: The dataset is divided into training and
algorithms to identify trends, patterns,and anomalies.
testing subsets to facilitate model training andevaluation,
Generate crop recommendations based on the analyzed pH
respectively.

IJISRT24APR532 www.ijisrt.com 452


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

 Model Training: A decision tree classifier is trained using C. k-Nearest Neighbors (k-NN):
the training dataset. The classifier employs soil
parameters as features and crop types as labels to learn the  Input:
underlying relationships between soil characteristics and The k-Nearest Neighbors (k-NN) algorithm utilizes soil
suitable crops. parameters such as nitrogen, potassium, phosphorus, and pH
 Model Evaluation: The trained decision tree model's levels as input features.
performance is assessed using the testing dataset through
metrics such as accuracy, precision, recall, and F1-score,  Output:
among others. It offers a recommended crop based on the input soil
 Prediction: Upon successful training and evaluation, the parameters.
trained decision tree model is employed to predict the
recommended crop based on the input soil parameters  Steps:
provided by the user. The model utilizes its learned  Data Preprocessing and Splitting: The soil data undergoes
decision-makingprocess to classify the input data into the preprocessing to address missing values and outliers.
most appropriate crop category. Subsequently, it is partitioned into training and testing
sets to facilitate model training and evaluation.
B. Support Vector Machines (SVM):  Feature Standardization or Normalization: To ensure
uniformity in feature scales, the features are standardized
 Input: or normalized. This step is crucial for accurate distance
The Support Vector Machines (SVM) algorithm accepts computation in the k-NN algorithm.
soil parameters such as nitrogen, potassium, phosphorus, and  Model Training: Using the training dataset, the k-NN
pH levels as input features. classifier is trained. The parameter 'k' denotes the number
of nearest neighbors considered during classification.
 Output:  Parameter Selection: The optimal value of 'k' is selected
It offers a recommended crop based on the input soil utilizing techniques such as cross-validation to enhance
parameters. the model's performance.
 Model Evaluation: The trained k-NN model is evaluated
 Steps: using the testing dataset to assess its performance metrics.
 Data Preprocessing and Splitting: Initially, the soil data These metrics include accuracy, precision, recall, and F1-
undergoes preprocessing to address missing values and score, providing insights intothe classifier's effectiveness.
outliers. Subsequently, the dataset is partitioned into  Prediction: Upon successful training and evaluation, the
training and testing subsets. This division facilitates trained k-NN model is employed to predict the
model training and subsequent evaluation. recommended crop based on the input soil parameters
 Feature Scaling: To ensure uniformity and comparability provided by the user. The model identifies the 'k'nearest
among features, they undergo scaling to bring them within neighbors in the feature space and determines the majority
a similar range. This step enhances the convergence speed class among them as the predicted crop category, thereby
and effectiveness of the SVM classifier. facilitating informed agricultural decisions.
 Model Training: Using the training dataset, an SVM
classifier is trained. This classifier leverages soil
parameters as features and crop types as labelsto discern
the optimal decision boundary that segregates various
crop categories effectively.
 Parameter Tuning: Fine-tuning of SVM parameters,
including the kernel type and regularization parameter
(C), is executed. Techniques such as grid search or
randomized search, coupled with cross-validation, are
employed to optimize the model's performance.
 Model Evaluation: The trained SVM model undergoes
evaluation using the testing dataset to gauge its
performance metrics. These metrics encompass accuracy,
precision, recall, F1-score, among others, providing
insights into the classifier's efficacy.
 Prediction: Upon successful training and evaluation, the
trained SVM model is deployed to predict the
recommended crop based on the input soil parameters Fig 3 Algorithm analysis
furnished by the user. By applyingthe acquired decision
boundary, the model classifies the input data into the most
suitable crop category, facilitating informed agricultural
decisions.

IJISRT24APR532 www.ijisrt.com 453


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

IV. EXPERIMENTAL SETUP AND RESULT


ANALYSIS A. Soil Behavior Observations and Analysis:
In the IoT-based soil pH detection and crop
The IoT-based soil pH detection and crop recommendation project, soil pH analysis involves
recommendation project integrates sensor technology, data employing pH sensors to measure soil acidity or alkalinity.
analysis, and agricultural expertise to offer farmers actionable These sensors detect hydrogen ion concentrations in the soil
insights for optimized crop growth. Through a web interface, solution, providing a pH value indicative of the soil's
farmers input soil parameters including nitrogen, potassium, chemical balance. NPK analysis entails evaluating nitrogen
phosphorus, and pH levels, allowing the system to analyze (N), phosphorus (P), and potassium (K) levels in the soil,
this data and recommend suitable crops tailored to the given critical nutrients for plant growth. Soil samples are typically
conditions. Additionally, the system identifies soil collected and analyzed using laboratory methods or portable
deficiencies and suggests appropriate fertilizers to enhance soil testing kits to ascertain nutrient content accurately. By
crop productivity. Leveraging IoT sensors for real-time data integrating IoT sensors and data analysis techniques, the
collection, advanced algorithms for crop recommendation, project facilitates real-time monitoring of soil pH and nutrient
and user-friendly web-based interfaces, this project levels. This enables informed decisions regarding crop
empowers farmers with personalized recommendations for selection and fertilizer application, optimizing crop growth
sustainable agricultural practices. and yield.

Table 1 Soil behavior analysis

B. The Impact of Soil pH on Plant Nutrient Availability:


Soil pH significantly modulates the availability of plant
nutrients by influencing their chemical speciation and
solubility. In acidic soils (pH below 7), key nutrients such as
phosphorus (P), potassium (K), calcium (Ca), and magnesium
(Mg) undergo increased solubility, rendering them more
readily accessible to plants. Conversely, micronutrients like
iron (Fe), manganese (Mn), and zinc (Zn) may experience
heightened concentrations, potentially leading to toxicity
issues. On the contrary, in alkaline soils (pH above 7),
nutrients such as phosphorus (P), iron (Fe), and zinc (Zn) may
exhibit reduced availability due to precipitation or formation
of insoluble compounds. To address soil pH disparities and
optimize nutrient accessibility, farmers can employ strategic
fertilization practices. In acidic soils, the application of lime-
containing fertilizers facilitates pH elevation, thereby
ameliorating nutrient availability. Conversely, in
alkalinesoils, sulfur-containing fertilizers aid in lowering pH
levels. Additionally, targeted fertilization strategies involving
the application of nutrient-specific formulations help
supplement deficiencies induced by pH-related nutrient
imbalances. By rectifying soil pH and optimizing nutrient
availability, these practices ensure conducive conditions for
robust plant growth and development.

Fig 4 Performance Analysis

IJISRT24APR532 www.ijisrt.com 454


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

V. CONCLUSION

In summary, the IoT-based soil pH detection and crop


recommendation project heralds a transformative solution for
contemporary agriculture by harnessing technological
advancements to elevate farming methodologies. Through
the provision of real-time soil pH, nitrogen, potassium, and
phosphorus data, coupled with tailored crop
recommendations and fertilizer guidance, the initiative
aspires to enhance crop yields, optimize resource allocation,
and attenuate environmental impact. By integrating IoT
sensors, web-based interfaces, and dataanalytics algorithms,
the project empowers farmers to make data-driven choices
regarding crop selection and nutrient management. Through
targeted remediation of soil deficiencies and customized
fertilizer prescriptions aligned with crop requirements, the
initiative endeavors to streamline input expenditures while
maximizing agricultural output. Moreover, the project's
scalability and adaptability render it suitable for deployment
across diverse agricultural landscapes, spanning from small-
scale farms to expansive commercial enterprises. Through
collaborative engagement with agricultural stakeholders and
continual integration of emerging sensor technologies,
machine learning methodologies, and precision agriculture
techniques, the initiative stands poised to evolve and
contribute substantially to sustainable agricultural practices
and global food security endeavors. Ultimately, the IoT-
based soil pH detection and crop recommendation project
epitomizes a pivotal instrument within the contemporary
agricultural arsenal, empowering farmers with actionable
insights to cultivate resilient crops, fortify soil vitality, and
forge a more robust and productive food ecosystem for future
generations.

REFERENCES

[1]. F. Hao, S. Li, G. Min, H.-C. Kim, S. S.Yau, and L. T.


Yang, “An efficient approach to generating location-
sensitive recommendations in ad-hoc social network
environments,”IEEE Transactions on Services
Computing, vol. 8, no. 3, pp. 520–533, 2015.
[2]. Anna Chlingaryana, Salah Sukkarieha, Brett Whelanb
― Machine learning approaches for crop yield
prediction and nitrogen status estimation inprecision
agriculture: A review , Computers and Electronics in
Agriculture 151 (2018) 61– 69,Elisver,2018.
[3]. Selvakumar, K., L. Sai Ramesh, and A. Kannan.
"Enhanced K-means clustering algorithm for evolving
user groups." Indian Journal of Science and
Technology, vol. 8, no. 24, pp. 1-7, 2015.
[4]. Sabena, S., S. Kalaiselvi, B. Anusha, and L. Sai
Ramesh. "An MultiLabel Classification with Label
Correlation." Asian Journal of Research in Social
Sciences and Humanities, vol. 6, no. 9, pp. 373-386,
2016.
[5]. Pandiyaraju, V., P. Shunmuga Perumal, A. Kannan,
Fig 5 Outcomes and L. Sai Ramesh. "Smart terrace gardening with
intelligent roof control algorithm for water
conservation." Pak. J. Agri. Science, vol. 54, no. 2, pp.
451-455, 2017

IJISRT24APR532 www.ijisrt.com 455


Volume 9, Issue 4, April – 2024 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/IJISRT24APR532

[6]. J.D. Zhang, C.Y. Chow, and Y. Li, “igeorec: A


personalized and efficient geographical location
recommendation framework,” IEEE Transactions on
Services Computing, vol. 8, no. 5, pp. 701–714, 2015.
[7]. Khattab, Ahmed, Ahmed Abdelgawad, and Kumar
Yelmarthi. "Design and implementation of a cloud-
based IoT scheme for precision agriculture." In 2016
28th International Conference on Microelectronics
(ICM), pp. 201-204. IEEE, 2016.
[8]. Keswani, Bright, Ambarish G. Mohapatra, Amarjeet
Mohanty, Ashish Khanna, Joel JPC Rodrigues,
Deepak Gupta, and Victor Hugo C. de Albuquerque.
"Adapting weather conditions based IoT enabled
smart irrigation technique in precision agriculture
mechanisms." Neural Computing and Applications,
vol. 31, no. 1, pp. 277-292, 2019.
[9]. P. Bhargavi and S. Jyothi, “Applying naiveBayes data
mining technique for classification of agricultural land
soils,” International journal of computer science and
network security, vol. 9, no. 8, pp. 117–122, 2009.
[10]. Liu, H. Xiong, S. Papadimitriou, Y. Fu, and Z.Yao, “A
general geographical probabilistic factor model for
point of interest recommendation,” IEEE Transactions
on Knowledge and Data Engineering, vol. 27, no. 5,
pp. 1167–1179,2015.

IJISRT24APR532 www.ijisrt.com 456

You might also like