You are on page 1of 5

Soil Analysis for Fertilizer and Crop Prediction

Using Optical Sensors and Machine Learning


[1],
Swathi T S Vinayak R Bhat [2], Y Sai Meghana [3], Yashas PM [4], Prof Raghu B R [5]
[1][2][3][4] - Department of ECE, Dayananda Sagar Academy of Technology and Management, Bengaluru, Karnataka,
India.
[1] [2] [3]
swathikuntagod@gmail.com , vinayakbhat94@gmail.com , meghasai555@gmail.com ,
[4]
pmyashas98@gmail.com
[5] – Assistant Professor, Department of ECE, Dayananda Sagar Academy of Technology and Management, Bengaluru,
Karnataka, India.
[5]
raghubrgowda@gmail.com

Abstract - Consequently, farmers are unable to choose available nutrients for the plants in the soil, plants absorb
the right crops based on the soil environmental factors these major nutrients of the soil for their growth. The
like Nitrogen, Phosphorus, Potassium, and other contents process of manually testing the soil takes several weeks
in the soil. The process of manually testing the soil takes to arrive back from lab and even after the soil sampling,
several weeks to arrive back from the lab and even after the right crop is not predicted. Farmers are unable to
the soil sampling, the right crop is not predicted only the choose the right crops based on the soil nutrients like
nutrients present in them are reported which is a time- Nitrogen, Phosphorus, Potassium, Sulphur, Calcium,
consuming process. To overcome this problem, we Manganese, Copper, Iron, Zinc, Boron, Chloride, Nickel,
propose this system of crop prediction using machine Molybdenum contents in the soil. Our aim is to create a
learning which contains sensors that can predict the prediction engine for most suitable crops for a particular
Nitrogen(N), Phosphorus(P), Potassium(K), pH, soil and also suggest the fertilizer which consists the
temperature, moisture, Sulphur(S), Calcium(Ca), minerals required for a specific crop.
Manganese(Mn), Copper(Cu), Iron(Fe), Zinc(Zn),
Boron(B), Chloride(Cl), Nickel(Ni), Molybdenum(Mo) Ⅱ. LITERATURE SURVEY
contents in the soil and transmit time-stamped live data
to the spreadsheet using which machine learning In [1]: This paper describes the development of crop
algorithms analyse the data and predict the fertilizer and prediction system to predict crop based on humidity
crop suitable for the area to increase the quality and yield sensor, temperature sensor and NPK sensor to get details
of the crop. about the moisture content in the soil, temperature of the
surrounding and Nitrogen, phosphorous, potassium
Keywords- Decision Tree, Machine Learning, Crop contents in the soil and then these readings are sent to
Prediction, Fertilizer Prediction, Optical Sensor, Soil Ph Arduino UNO board. Using a wi-fi module the data
Sensor. gathered like Temperature, Humidity and NPK values by
different sensors is sent to the cloud using Arduino board.
Ⅰ. INTRODUCTION The data from the sensors are stored in Influx DB cloud
which is an open-source cloud storage. Data is updated to
Agriculture plays an important role in food industry Influx DB cloud regularly. Grafana dashboard is an
which accounts 18% of India’s GDP and it is the inbuilt feature within Influx DB which shows the
backbone of our country. Production of food grains in graphical representation of the gathered data i.e., stored
India is estimated to be 292 million tons, as per Indian in cloud. To predict the future values of the data, they are
Council for Agricultural Research (ICAR) estimations processed by machine learning technique. The Long
the demand would increase to 346 million tons by the end Short-Term Memory Network (LSTM), a tier of RNNs,
of this decade. Increase in population should not lead to is chosen for its formal application in managing nonlinear
food crisis. India having wide range of weather dynamic systems.
conditions and different types of soil which is used for
growing various types of crops the average productivity In view of the anticipated Temperature, Humidity and
of many crops are low. Low yield in agriculture sector is NPK esteems, the system can distinguish the reasonable
one of the biggest problems in India. Poor infrastructure, harvest and what kind of water system can be liked for
wrong use of farm techniques decreases the fertility of the yield will be recommended to the users i.e., farmers.
the soil due to the use of pesticides and fertilizers. Soil This is finished with the assistance of application. The
analysis is an important process to determine the
application is made utilizing android studio analysis is utilized for predicting the appropriate
programming. This application will show the Fertilizer from the Fertilizer data set and afterward, the
temperature, humidity and nutrients of the soil. suggestions are shipped off the farmer's device utilizing
Additionally gives a caution about the low moisture the GSM module.
region to give the water to that region. It utilizes
anticipated temperature and supplements to predict the In [3]: The system aims to assist farmers with smart
best crop to be cultivated. The proposed framework is choice while predicting the crops. To extend the
displayed in the underneath outline. accuracy alongside live data, historic data for
temperature and humidity from government
website is additionally collected and stored.
Additionally, historic rainfall data is collected and
stored. To be clear and precise in crop prediction, the
project examines the temperature and humidity of the
field, live information gathered utilizing DHT-22 sensor,
notable information gathered from government site or
potentially google climate API, kind of the soil utilized
Fig. Proposed system flow diagram by the fa rmer and the historic rainfall data. It tends to be
accomplished utilizing unsupervised or supervised
In [2]: In this paper, the IoT is incorporated with machine machine learning algorithm. By learning organizations,
learning to build the framework with the help of an LDR dataset is prepared. The precision obtained by various
sensor and Logistic Regression Algorithm to work with machine learning techniques compared to get the most
the farmers about the awareness of soil nutrients dependable outcome which will be conveyed to the end
inadequacy and appropriate fertilizer to be added to the user. Alongside the most reasonable yield, the system
fields at the legitimate time. The information detected by additionally suggests the fertilizer for that crop.
the designed NPK sensor from the chosen farming fields Responsive, Multilingual site is utilized by farmer to
is sent to the cloud utilizing the Thingspeak tool. communicate with the system.
Thingspeak is software that coordinates between Cloud
computing and the Internet of things (IoT). The soil
samples are examined with the LDR module and their
mineral composition data is stored in the Thingspeak
cloud. Thingspeak creates a channel between Arduino
UNO and the cloud.

In [4]: This paper proposes a system that needs installing


required sensors in agricultural land. The IoT sensors are
established in farms to monitor the farm environment. The
sensor equipment can help detect the temperature,
humidity, pH value of the soil. The data of the IoT sensors
are transmitted to the server. Data from all sensors are often
exported from the database to undergo data analysis. The
system does analyse the environmental factors of the farm
and selects suitable crops. Before analysing any data, the
The board is associated with this channel utilizing Wi-Fi
Module. Application programming interface (API) keys system performs feature extraction like suitable months,
soil types to ensure that both the analysed data and the
are utilized to associate with the cloud. There are two API
analysis result of predetermined targets are accurate.
keys for the channel READAPIKEY and
WRITEAPIKEY. A data set is made by recording LDR
Data sets are collected that consist of different varieties of
information and NPK mineral qualities. On this database,
a supervised algorithm called logistic regression crops and their suitable climate conditions such as
temperature, soil type and pH. The proposed approach
algorithm is applied. Accordingly, the machine learning
consists of Arduino UNO and sensors like DHT11 and soil pH
model is trained with predefined datasets. The anticipated
information from the Machine learning model is sensors. DHT11 sensor is a temperature and humidity sensor,
which is put in the land to take the temperature and humidity
currently saved for future reference. The results of the
value. The predefined data sets are loaded in CSV format display screen. In this paper, machine learning
to the supervised machine learning algorithm like KNN algorithms such as Random Forest Classifier, Support
Classification Algorithm. Then sensor outputs are given Vector Machine and Logistic Regression are used on
to the machine learning algorithm. In the backend, the agriculture data. After the information is gathered
machine learning model will investigate the qualities and utilizing Arduino it is being shown in the serial monitor.
return the best 5 yields that are appropriate to plant Now the data are being exported to the Excel sheet in
within the user’s land. After the plantation, the user can CSV format. This is done using a data streamer present
screen the crop utilizing the web application. Farmers can in Excel. This .CSV file contains five different fields like
notice the sensor outputs and take necessary actions soil moisture data, temperature data and NPK data.
when a ny rapid change happens to the crop.
Speech synthesis applications can be very useful for
In [5]: The proposed approach in this paper is a web- normal humans as well as persons having some disability
based application that suggests and advises the suitable like dyslexia where the person has some reading
crop for the land. The factors like temperature, humidity, disability. Research has found out that various speech
soil moisture, soil pH is taken in real-time using the assistance tools and software are very helpful for such
sensors. For the proficient computation of NPK values, people. Serverless applications are the new era of
the soil is clinically tested. The four factors and NPK computing, but according to some research for heavy
values are now considered and predict which crop will be data applications like databases, big data applications and
suitable for that soil using this system. The sensors are video streaming, the serverless approach is not suitable.
interfaced with Raspberry Pi, and it collects the sensor's But in this paper which is based on micro-services
output data. A predefined dataset is prepared with 5 architecture, a serverless application is suitable. With
attributes like temperature, humidity, pH, moisture and almost no monetary investment, the text data can be
NPK values. The data from the sensors, NPK values and converted to speech-enabled output. AWS has provided
predefined data set is given to the machine learning the best documentation for developers and technology-
algorithm (SVM). The model is prepared for more than enabled persons. The documentation for AWS Lambda,
30000 combinations in this manner increasing the DynamoDB, API Gateway, SNS, S3, etc. helped a lot to
precision. configure the components of this application.

The data needs to be pre-processed prior to training. The


information is pre-processed through methods like Data
Cleaning, Label Encoding and CSV File generation. The
two libraries used for Data Cleaning are Numpy and
Pandas. A monitor is utilized to see the output from the
controller. It is connected to Raspberry pi utilizing a
VGA to HDMI cable. The users can access the webpage
through this screen. The system can also advise whether
the particular crop can be cultivated in the land and give
appropriate fertilizer suggestions. As the system lists out
all possible crops, it helps the farmer to make an accurate
decision of which crop to be cultivated. In [7]: Data mining technique is used to predict the yield of
the crop and maximize its productivity. Here the proposed
In [6]: In this paper, the proposed framework analyses the data is clustered using decision tree and SVM algorithms and
essential constituents of soil, like temperature and the yield of the crop is predicted based on generated rules.
moisture which significantly influence the nature of the Using the historic data collected the district/area and the crop
soil. This system includes LM293 Comparator used with is given as an input to the module and the crop is
a soil moisture sensor, DS18B201 Temperature sensor, recommended by the decision tree and SVM algorithms. The
TS230 Colour RGB sensor for measuring soil nutrients, accuracy of the algorithms is also calculated compared and a
Arduino board along with the breadboard. Sensors sense sample graph is generated.
the moisture, temperature, NPK values of a particular soil
sample and give the value to the Arduino board in real- In [8]: In this proposed system, using a remotely checked
time. The power supply of 9V is applied to the Arduino ripeness method, the conventional cultivating strategy of
Board with the help of an adapter for collecting various testing and soil ripeness is supplanted. With the help of this
information of soil and the sensors which are connected framework, the farmer can get information about soil richness.
to the hardware require 3.3V-5V power. With the help of The nature of the soil is resolved by utilizing electrochemical
Arduino, Nitrogen, Phosphorus and potassium values are sensors. They have used a PH sensor to know the soil
received for determining soil quality. Arduino shows the ripeness. The Kind of soil is predicted by using the decision
NPK values, temperature, and moisture values on the tree algorithm and they will anticipate the harvests reasonable
for the specific kind of soil. And they also recommend pathway for the robot, the image processing using NI
the prerequisites of the supplements if a farmer needs to myRIO was carried out utilizing the NI LabVIEW
yield a specific harvest in a similar soil. software.This also enhanced the value
proposition concerning accuracy in real-time
implementation. They made sure that the app interface
is linked automatically to the local bodies and
agricultural units for empowering the bad pattern of
farming by identifying them based on the copy of results
obtained. The PTC ThingWorx composer is used to
provide fast streaming of sensor data to the end-user with
the help of widgets and locate the agro robot movement
with the help of GPS coordinates. With the trained set of
data based on historic weather conditions and the nature
of the soil, the crop quality factor is evaluated using
In [9]: In this paper, the model for Crop selection and its machine learning algorithms. On supplementing the
yield prediction is implemented using Machine Learning proposed system with a real-time interface, the PTC
algorithms like Decision tree for classification and Linear Vuforia platform can be dealt with for the Augmented
regression for yield prediction to maximize the crop Reality development where the agricultural parameters
yield. This also gives an approximate percentage of yield can be visualized in actual scenarios and driven for the
based on the data available in the dataset. This system operation of the robot.
gets the input such as state name, district name, a season
for classifying the crop, and inputs such as year and ⅡI. METHODOLOGY
available yield area for predicting the crop production.
This system analyses the crop yield production based on Soil analysis is an important process to predict a crop or
available data in the dataset. To classify the crops based fertilizer best suitable for cultivation. To analyse the soil
on location and season they used the decision tree quality and nutrients in the soil this proposed system uses
algorithm and for crop yield production they used the pH, Moisture and optical sensors to predict moisture,
Linear regression method. The suitable crop to be temperature, Ph, Nitrogen, Phosphorous, Potassium and
cultivated is obtained from decision tree classifiers such other nutrient values present in the soil using an Arduino.
as state name, district name, season, and fed as an input The time-stamped live data sensed by the sensor is sent to
to the linear regression algorithm to find the yield of that the Arduino using an RS485 Modbus which helps in the
selected crop. This proposed system reduces the need for serial transmission of the data it is further sent to
costlier hardware and the time to acquire knowledge spreadsheet and Python IDLE used for predicting the crop.
about suitable crops. Also selecting crops for cultivation The decision tree algorithm is used to predict the crop and
becomes an easier task for farmers because the selection fertilizer best suitable for cultivation from the analysed soil
of the correct crop for their location is precisely sample. The decision tree is a supervised machine learning
implemented using this project. algorithm that consists of predefined data set having a firm
ability to learn and can compromise the non-linear
relationship between input and output. The predicted crop
and the fertilizer which is best suitable for the soil are
displayed using the Tkinter library.

The decision tree is a machine learning classifier, used for


classification and regression analysis. The process of
building a Decision Tree starts from the root node and this
root node contains all the crops and fertilizers specified in
the dataset. When the first nutrient in the soil is analysed,
the decision tree classifier algorithm groups all the crops
and fertilizers into one node which are corresponding to the
In [10]: In this paper, the proposed approach is to build a nutrients present in the soil, and groups the rest of the crops
semi-autonomous agro robot with a completely secured and fertilizers into the other node.
and reliable system for simplifying the endeavours Further, when the next nutrient in the soil is analysed, it
undertaken by farmers. The agro robot for testing was again repeats the same process of grouping the crop and
created with FRDM KL25Z utilizing ARM Cortex M0+ fertilizer into two different nodes. This classification
processor. Further, the precise need for power was process continues until the last step where the classification
overcome with solar energy for extended periods and ends and the crop which is present at the end of the
piezo power supply for shorter periods. On leading the classification is the predicted crop and fertilizer.
[4] Crop Selection using IoT and Machine Learning
Sujaya S Nair, Christy Lueis, Vysakh Balachandran,
Krishnaveni V, College of engineering Kidangoor, 2020.

[5] Smart Agro: Precision Crop Suggestion using Machine


Learning Technique Gopika G Nair, Gopika V, Athira
Murali T E, I B Amritha, Department of Computer Science
Engineering, Nehru College of Engineering and Research
Centre, Thrissur, Kerala, India, 2020.

[6] Soil Analysis and its Type Prediction with Speech


Enabled Output using IoT and AWS, Suman Mohapatra,
Alivarani Mohapatra, Aniket Patil, School of Computer
IV. CONCLUSION Science Engineering KIIT Deemed to Be University
Bhubaneswar, India, 2020.
In this project, we have proposed an innovative approach
for smart agriculture using optical sensors and machine [7] IoT based Classification Techniques for Soil Content
learning. The proposed system helped in collecting the Analysis and Crop Yield Prediction, R. Reshma, V.
parameters present in the soil using different sensors and Sathiyavathi, T. Sindhu, K. Selvakumar, L. SaiRamesh,
Arduino. The collected information is then used for Dept. of IST CEG Campus, Anna University Chennai,
analysis of the soil and predicting the crop and fertilizer. India, 2020.
The NPK, Temperature, Moisture, Ph sensors are
inserted into the soil to be tested. The outputs of these [8] Soil Monitoring and Testing Using Iot for Fertility
sensors are stored in the spreadsheet. Using the amount Level and Crop Prediction, Swapnil Sunil Raut, Prof.
of Nitrogen(N), Phosphorus(P), Potassium(K), pH, Vidya Chitre, Department of Information Technology,
temperature, moisture, Sulphur(S), Calcium (Ca), Vidyalankar Institute of Technology, Mumbai, India,
Manganese (Mn), Copper (Cu), Iron (Fe), Zinc (Zn), 2019.
Boron(B), Chloride (Cl), Nickel (Ni), Molybdenum (Mo)
contents present in the soil and historical data in the [9] Crop Selection and it’s Yield Prediction, Aksheya
database, fertilizer and crop is predicted using machine Suresh, K Monisha, R Pavithra, B Marish Hariswamy,
learning algorithms. This system will be used to reduce 2020.
the difficulties faced by the farmers and will increase the
quantity and quality of work done by them. [10] IoT based agro Automation System using Machine
Learning Algorithms Akash Raj N, Balaji Srinivasan,
V. REFERENCES Deepit Abhishek D, Sarath Jeyavanth J, Vinith Kannan A,
Department of ECE, RMK Engineering College, Tamil
Nadu, India, 2019.
[1] A Soil Quality Analysis and An Efficient Irrigation
System using Agro-Sensors Fenila Naomi J,
Theepavishal RA, Madhuaravindh K S, Tharuneshwar V,
Department of Computer Science and Engineering, Sri
Krishna College of Engineering and Technology,
Coimbatore, India, 2019.

[2] Soil Analysis for Fertilizer Prediction using IoT and


Machine Learning, N V S Sai Teja, P Sri Gowtham, T
Lakshmi Surekha, P Gopala Krishna, Department of
Information Technology, Velagapudi Ramakrishna
Siddhartha Engineering College, JNTUK, Andhra
Pradesh, India, 2020.

[3] Smart Crop Prediction using IoT and Machine


Learning, Archana Gupta, Dharmil Nagda, Pratiksha
Nikhare, Atharva Sandbhor, Computer Engineering K.J.
Somaiya of Engineering Mumbai, India, 2020.

You might also like