2023 Base Paper
2023 Base Paper
Abstract—Agriculture is a capital and labor intensive business in a website that is locally hosted. Users can log in and view soil
India. Today the people employed in this sector have to go through moisture readings taken frequently and opt to send a signal to
tremendous hardship, just to perform mundane tasks. One of these the microcontroller to turn the motor on/off depending on the
tasks is to supply water to the field for irrigation. Until very
recently farmers had to manually turn on or turn off the motor moisture values. The current motor status is displayed to the
which supplies water to field. This is an outdated practice and can users. In addition to that, temperature and humidity sensors
be improved upon through the introduction of technology which
enables the farmer to remotely operate the motor through his
have also been connected with the microcontroller and their
own device. Due to the advancement in sensing technology, we can output displayed to the user on the website. The data acquired
design and implement a system that makes it easier to operate the from the sensors through the microcontroller is also sent to
motor remotely. The domain of data exchange and communication
between electronic devices facilitated by the internet which is third party analytics service so that real time graph plotting
commonly known as Internet of Things (IoT), greatly help us bring can be done via a webpage which shows live sensor value
to life the solution to the problem the farmers face by automating vs timestamp which is displayed to the user. Users can also
some manual tasks. In addition to that we can harness the real time
data gathered from IoT systems for performing wide range of download the live data captured in CSV (Comma Separated
analytic tasks to get more insights. The crucial data acquired from Values) format. The system also features a Machine Learning
the sensing devices can be used in Machine Learning models to give based crop recommendation system that is integrated into the
results that may impact future objectives. An example of this would
be the data gathered live from the field can be used to recommend main website. Upon giving the required environmental and
the most suitable crop to grow. soil parameters, the program recommends most suitable crop
that could be grown by running a highly accurate Machine
Keywords Agriculture, Automation, Internet of Things,
Analytics, Machine Learning.
Learning Model. This helps the farmer to choose crops that
may give maximum yield. As India is a huge country impacted
I. I NTRODUCTION by the vagaries of climate, appropriate crop selection becomes
a question of utmost importance.
Agriculture employs about 60 % of the Indian population
[1], however it is appalling to observe that it is one of the II. L ITERATURE R EVIEW
few sectors that is least impacted by the innovations brought Ashwini proposes a Bluetooth based microcontroller system
forward by technological advancement. One of the major prob- through which we can remotely operate a servo motor that
lems faced by people working in agriculture is the problem is used in irrigation [2]. The system consists of an Arduino
of switching on/off the motor used for supplying water to Microcontroller along with low cost temperature and humidity
the field. Manually switching on/off the motor is both time and soil moisture sensors which can keep track of change in
consuming and needs constant supervision. It is possible to temperature and humidity and soil moisture levels in real time,
automate this process by using sensor and microcontroller. In it also consists of an android application through which a user
our system we have gotten soil moisture data in real time from can view the status in real time. The user can set a threshold
capacitive soil moisture sensor. This data is transmitted using value for temperature, humidity and soil moisture below which
WiFi enabled microcontroller that is Node MCU (ESP8266). a signal is sent from the user’s phone to the microcontroller
This live data is stored in a MySQL database and displayed on which in turn signals the servo motor to rotate in order to
provide water for irrigation. The decision to switch the motor
on/off is automatic and does not involve the user however this
can easily be converted to be manual. The values collected by and appropriate crop recommendations are made. This system
the sensors can be stored and displayed to the user on his/her makes 20 different type of crop recommendation. It also shows
phone. The decision to switch the motor on/off is dependent the geographical area that is most suitable for growing the
on Na¨ıve Bayes Algorithm which makes decision based on recommended crop.
frequently occurring attribute not being zero. Vaishnavi, Shobana, Sabitha & Karthik propose a crop
Anitha, Sampath & Jerlin propose a WiFi enabled system recommendation system that recommends a crop for particular
through which Temperature, Humidity and Soil Moisture val- season or year based on historical data about crop production
ues are collected through Arduino [3]. Node MCU (ESP8266) [8]. In this system the authors analyzed the records of district
is connected to Arduino for networking purpose. The values wise production of crops and employed machine learning
gathered by the sensors are sent to a third analytics service model to predict the best suitable crop for a particular year
ThingSpeak which plots graphs in real time and is useful as which may lead to maximum profit. For example it was found
data storage platform. This system also makes use for water that in Coimbatore district of Tamil Nadu if the farmer decides
level sensor which can be used to detect dampness in the soil . to grow banana the chances of him incurring a loss is minimal.
If soil moisture is low and water level sensor detects dampness Jadhav, Riswadkar, Jadhav & Gogawale have proposed
then the Arduino module sends a signal through Node MCU crop recommendation system based on machine learning that
to on the motor. takes in environmental and soil parameters in the dataset as
Naik, Katti, Kumbi & Telkar propose an IoT system that input and recommends the most suitable for that particular
collects temperature, humidity and soil moisture values with climate and soil [9]. The system makes use of Random Forest
the help of DHT11 and Soil Moisture sensor and sends these algorithm as it was found to be the most accurate with respect
values to an android application on the user’s phone using to other machine learning algorithms. The authors have also
Arduino microcontroller [4]. When the Moisture level is less developed a web interface for using this system.
than some predetermined threshold value then the Arduino Gosai, Raval, Nayak, Jayswal & Patel have proposed a crop
microcontroller sends a signal to the relay attached to it to recommendation system based on machine learning algorithms
switch the motor on. The user can view the motor status as that recommends the best suitable crop depending on a variety
well as temperature, humidity and soil moisture values in real of soil an environmental parameters [10]. The system takes soil
time using an android application. and environmental factors as input and recommends crop by
Mishra, Khan, Tiwari & Upadhyay propose a system con- applying a particular machine learning model. In this system
sisting of a soil moisture sensor and Arduino microcontroller the authors have utilized Decision Tree, Na¨ıve Bayes, SVM,
[5]. The soil moisture sensor measures humidity present in the Logistic Regression, RF and XGBoost. By training and testing
soil and if it is found to be less than some predetermined value the dataset on these algorithms it was found that XGBoost
then pump is turned on. The soil moisture value considered algorithm gave the most accurate result.
as threshold can be changed depending on the crop required Parikh, Jain, Gupta & Dabhade propose a machine learning
to be produced. system that recommends the best suitable crop to grow on the
Rawal has proposed an IoT system consisting of soil mois- basis of a variety of soil and environmental parameters [11].
ture sensor, Arduino microcontroller and GSM GPRS module The model is trained and tested on a dataset consisting of the
for internet connectivity [6]. In this system the soil moisture aforementioned parameters. Algorithm such as Support Vector
sensor collects soil moisture values in real time and posts this Machines (SVM), Random Forest and Logistic Regression
data on a webpage. If the soil moisture value recorded is less have been trained and tested on the dataset and their accuracies
than some predetermined threshold value then the Arduino compared. Experimentally it was found that Random Forest
microcontroller sends a signal to the relay module to switch algorithm gives the highest accuracy. Hence it was used in the
the motor on. If the moisture level has been the restored application of the system.
Arduino microcontroller sends a signal to turn the motor off.
Soil moisture and motor status can be viewed on a webpage. III. A PPROACH
Real time data is also transmitted to ThingSpeak server a third The project consists of hardware circuit which has an
party analytics service for plotting of real time graphs. ESP8266 microcontroller connected with DHT11 and Ca-
Doshi, Agarwal, Nadkarni & Shah propose a crop suitability pacitive Soil Moisture sensors. Both of these sensors are
system based on machine learning that intends to solve the relatively inexpensive and provide fairly accurate values. The
problem of accurate crop selection given by environmental ESP8266 microcontroller also known as Node MCU is useful
parameters [7]. This system also includes a rainfall prediction for enabling WiFi connectivity. Users can easily connect to the
system that is based on linear regression which predicts the Node MCU via their mobile phone. Similarly they can connect
amount of rainfall falling in the farmer’s district in every their computer to the phone WiFi and hence data exchange and
month of the year. The system makes use of Neural Networks communication will be facilitated. The Node MCU transmits
as it was experimentally found to be the most accurate machine the command to switch on/off the motor through relay. As
learning model for the crop suitability. The system takes the data recorded from the sensors is stored in locally hosted
input parameters soil type, aquifer, soil pH, soil characteristics database there is no additional cost to the user. The third party
and season. Based on these parameters the model is trained analytics service that is used in this project i.e. ThingSpeak
A. UML Diagrams
UML Diagrams explaining the flow of the project have been
provided in Fig. 1 & Fig. 2. Fig. 2. Sequence Diagram
IV. M ETHODOLOGY
The project methodology has been given below:
D. Sensor Data
The real time values stored in the database are being G. Export as CSV
constantly updated and are displayed on an automatically
updating web page. The web page shows data such as date
and time, location and sensor values. This interface has been
developed with HTML and CSS and PHP has been used in
the backend to fetch data from the database. The web interface
links to all the features provided by the system.
E. Motor Status
ronmental and soil parameters. 22 different types of crops based on the soil moisture readings captured live, tempera-
are recommended by this system. The parameters used in ture and humidity data has also been recorded and stored
this system are Nitrogen, Phosphorus and Potassium content in real time. The system also includes real time graphs
and pH value of the soil, Temperature, Humidity and average to detect sudden or gradual change in sensor values. The
Rainfall in mm. Some of the data is collected i.e. Temperature option of downloading the sensor readings from the database
and Humidity has been collected from the sensors earlier. has also been provided so that personalized analytics such
NPK content and pH of the soil can be obtained from district as descriptive statistics can be done offline. Finally a crop
wise government soil testing laboratory and average rainfall of recommendation system has been developed so that suitable
every district can be obtained from Indian Meteorological De- crops can be recommended to the farmer based on pertinent
partment (IMD) website. After satisfying the input constraints environmental and soil parameters.
of the application, the program outputs the recommended crop
after running a Machine Learning model. The model used B. Future Work
in this application is K Nearest Neighbours, which gives a Future work may be undertaken to fully automate the whole
highly accurate result. This feature has been developed mainly motor switching part of the system based on some threshold
using Python library Scikit-learn for machine learning tasks value of the soil moisture provided. If the threshold value is
and PySimpleGUIWeb for user interface. less than some predetermined value then signal may be sent
KNN: It is a non-parametric method used for making predic- automatically to switch on the motor. Once moisture levels
tions. In this, the predicted value is a class membership. The have been restored a signal to turn off the motor can also
first step of the K-NN algorithm is to identify the k nearest be sent. If NPK sensor and pH sensor is also added to the
neighbors for each incoming new instance. The instance is existing system then crop recommendation in real time can be
classified by a majority vote of these neighbors. In the second achieved. A fertilizer recommendation system can developed
step, depending on the label sets of the k neighbors, a label by acquiring the required soil data. Yield prediction and crop
is predicted for the new instance [13]. profitability are also some noteworthy features that may be
1) Acquisition of dataset: The dataset acquired integrated with the existing system.
from https://www.kaggle.com/datasets/atharvaingle/crop-
R EFERENCES
recommendation- dataset [14].
2) Data Preprocessing: Removal of null values has been [1] ”Agriculture in India - statistics & facts”, available at
https://www.statista.com/topics/4868/agricultural-sector-in-india/,
done in data preprocessing. visited in February 2023.
3) Training & Testing: Training and testing by various [2] Ashwini, B.V., ”Study on Smart Irrigation System Using IoT for
machine learning models takes place. Here 75 % of the dataset Surveillance of Crop- Field”, International Journal of Engineering &
Technology (IJET), vol. 7, no. 4.5, 2018.
is used for training the model while remaining 25 % is used [3] Anitha, A; Sampath, Nithya & Jerlin, Asha, ”Smart Irrigation system
for testing. using Internet of Things”, 2020 International Conference on Emerging
Trends in Information Technology and Engineering (ic-ETITE), Vellore,
4) Comparison of accuracies of various Machine Learning India.
models: The accuracies of 5 different machine learning models [4] Naik, Pavankumar; Katti, Kirthishree; Kumbi, Arun & Telkar, Nagraj,
has been compared, the result of which is shown in Fig. 9. ”Automation Of Irrigation System Using IoT”, International Journal of
Engineering and Manufacturing Science (IJEMS), vol. 8, no. 1, 2018.
[5] Mishra, Dweepayan; Khan, Arzeena; Tiwari, Rajeev & Upadhyay,
Shuchi, ”Automated Irrigation System-IoT Based Approach”, 3rd In-
ternational Conference On Internet of Things: Smart Innovation and
Usages (IoT-SIU), Bhimtal, India, 2018.
[6] Rawal, Srishti, ”IOT based Smart Irrigation System”, International
Journal of Computer Applications (IJCA), vol. 159, no. 8, 2017.
[7] Doshi, Zeel; Agarwal, Rashi; Nadkarni, Subhash & Shah, Neepa, ”Agro-
Consultant: Intelligent Crop Recommendation System Using Machine
Learning Algorithms”, Fourth International Conference on Computing
Communication Control and Automation (ICCUBEA), Pune, India,
2018.
[8] Vaishnavi, S; Shobana, M; Sabitha, R. & Karthik, S., ”Agricultural
Crop Recommendations based on Productivity and Season”, 7th Interna-
tional Conference on Advanced Computing & Communication Systems
(ICACCS), Coimbatore, India, 2021.
[9] Jadhav, Atharva; Riswadkar, Nihar; Jadhav, Pranay & Gogawale, Yash,
”Crop Recommendation System Using Machine Learning Algorithms”,
Fig. 8. Accuracy comparison
International Research Journal of Engineering and Technology (IRJET),
vol. 9, no. 4, 2022.
[10] Gosai, Dhruvi; Raval, Chintan; Nayak, Rikin; Jayswal, Hardik & Patel,
V. C ONCLUSION & F UTURE W ORK Axat, ”Crop Recommendation System using Machine Learning”, Inter-
national Journal of Scientific Research in Computer Science Engineering
A. Conclusion and Information Technology (IJSRCSEIT), vol. 7, no. 3, 2021.
In this paper we have proposed and implemented a WiFi [11] Parikh, Dhruv; Jain, Jugal; Gupta, Tanishq & Dabhade, Rishit, ”Machine
Learning Based Crop Recommendation System”, International Journal
enabled system consisting of a web interface through which of Advanced Research in Science, Communication and Technology
farmers can remotely give command to turn on/off the motor (IJARSCT), vol. 6, no. 1, 2021.