0% found this document useful (0 votes)
40 views

2023 Base Paper

Uploaded by

Arshx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

2023 Base Paper

Uploaded by

Arshx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Published by : International Journal of Engineering Research & Technology (IJERT)

http://www.ijert.org ISSN: 2278-0181


Vol. 12 Issue 03, March-2023

Automation in Irrigation using IoT and ML


based Crop Recommendation System
Aditya Gor Kandarp Joshi
Dept. of Computer Science & Engineering Parul Institute of Dept. of Computer Science & Engineering Parul Institute of
Engineering & Technology Vadodara, India
Engineering & Technology Vadodara,India

Dr. Warish Patel


Rushil Togadiya Dept. of Computer Science & Engineering
Dept. of Computer Science & Engineering
Parul Institute of Engineering &Technology Vadodara,
Parul Institute of Engineering & Technology Vadodara, India
India

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

IJERTV12IS030112 www.ijert.org 171


(This work is licensed under a Creative Commons Attribution 4.0 International License.)
Published by : International Journal of Engineering Research & Technology (IJERT)
http://www.ijert.org ISSN: 2278-0181
Vol. 12 Issue 03, March-2023

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

IJERTV12IS030112 www.ijert.org 172


(This work is licensed under a Creative Commons Attribution 4.0 International License.)
Published by : International Journal of Engineering Research & Technology (IJERT)
http://www.ijert.org ISSN: 2278-0181
Vol. 12 Issue 03, March-2023

limits the free tier version of its service to 3 million messages


per year and message update interval time to 15 seconds [12].
The feature of downloading sensor data into a CSV format
requires MS Excel or any other application that can read
file stored in this format. The crop recommendation system
here is built on top of open source technologies and does not
require any additional cost, the modules and libraries can be
installed freely from the internet without any licensing issues.
In summary apart from ThingSpeak service (free version) used
here for real time analytics all of the software used here is open
source and free to use.

A. UML Diagrams
UML Diagrams explaining the flow of the project have been
provided in Fig. 1 & Fig. 2. Fig. 2. Sequence Diagram

• Humidity & Temperature sensor (DHT11 / DHT22).


• Connecting wires and USB to micro USB cable.
2) Software Requirements: The software requirements are
mentioned below:
• Arduino IDE.
• Apache server.
• MySQL database.
• MS Excel, Google sheets or any other application to view
CSV file.
• Python libraries and modules for performing machine
learning,
• Web browser for running the web application.
System has been tested on a Windows 11 PC with intel CORE
i5 8th Gen processor and 8GB RAM.

IV. M ETHODOLOGY
The project methodology has been given below:

A. Node MCU connectivity


Users have to first connect their mobile phone to the Node
MCU. This is required to establish stable connection. Users
should also have their device connected to their computer.

B. Data acquisition from sensors


The values returned by the soil moisture sensor and DHT11
Fig. 1. Flowchart sensor in real time are sent to a locally hosted Apache server
and are stored in MySQL database. The same data is also sent
to third party analytics service ThingSpeak, in which a channel
B. Project Modules has been created to record and display real time change in
The project consists of hardware and software modules sensor values by plotting a value vs timestamp graph.
which facilitate the smooth and error free functioning of
the system. Libraries and dependencies are needed to be C. Login page
configured prior to running the project. A login page has been created that needs user name and
1) Hardware Requirements: The hardware requirements are password for authentication. In order to login to the system to
mentioned below: view the main webpage users need to provide their email ID
• Node MCU (ESP8266). as username and a 6 letter password. Authentication has been
• Soil Moisture sensor (Resistive / Capacitive). achieved by writing a code snippet in JavaScript.

IJERTV12IS030112 www.ijert.org 173


(This work is licensed under a Creative Commons Attribution 4.0 International License.)
Published by : International Journal of Engineering Research & Technology (IJERT)
http://www.ijert.org ISSN: 2278-0181
Vol. 12 Issue 03, March-2023

Fig. 3. Status page


Fig. 5. Data Collection Dashboard

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

Fig. 6. Export as CSV page

If the user wants to download a snapshot of the sensor


readings taken during any particular time, he/she can do so
by going to the export as CSV page here the sensor readings
along with the timestamp (in GMT) have been made available.
Uses can download the CSV file and open it by using an
appropriate application like MS Excel or Google Sheets. This
Fig. 4. Motor Status page is useful if the user wants to run his/her own analytics locally
such as generating descriptive statistics on the sensor data.
If the user notices that the soil moisture level readings taken This feature has been developed using Express.js and makes
in real time are somehow less than what is predetermined use of EJS for generating HTML markup.
than the user can click on motor status link which will
take the user to a new page where he/she will be provided H. Crop Recommendation System
with a button through which an on command can be sent to
the microcontroller. The microcontroller which receives the
command can transmit it to a relay. The relay sends the signal
to motor which is finally turned on. After sometime when
moisture level has been restored the user can press the same
button on the motor status webpage that could send an off
signal to the microcontroller. The microcontroller passes this
signal to the motor through relay and the motor is finally
turned off.
F. Data Collection Dashboard
The data collection dashboard shows a webpage that dis-
plays the frequently updating values from the ThingSpeak Fig. 7. Crop Recommendation System
channel. Users have not been granted direct access to ThingS-
peak channel due to privacy and security concerns related to A crop recommendation system has been developed which
API keys. predicts the most suitable crop based on a variety of envi-

IJERTV12IS030112 www.ijert.org 174


(This work is licensed under a Creative Commons Attribution 4.0 International License.)
Published by : International Journal of Engineering Research & Technology (IJERT)
http://www.ijert.org ISSN: 2278-0181
Vol. 12 Issue 03, March-2023

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.

IJERTV12IS030112 www.ijert.org 175


(This work is licensed under a Creative Commons Attribution 4.0 International License.)
Published by : International Journal of Engineering Research & Technology (IJERT)
http://www.ijert.org ISSN: 2278-0181
Vol. 12 Issue 03, March-2023

[12] ”ThingSpeak™ Licensing FAQ”, available at


https://thingspeak.com/pages/license faq, visited in February 2023.
[13] “k-nearest neighbors algorithm-Wikipedia”, available at
https://en.wikipedia.org/wiki/K-nearest neighbors algorithm, visited in
February 2023.
[14] “Crop Recommendation Dataset”, available at
https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-
dataset, visited in February 2023.

IJERTV12IS030112 www.ijert.org 176


(This work is licensed under a Creative Commons Attribution 4.0 International License.)

You might also like