You are on page 1of 72

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/371071895

IOT Based Smart Agriculture Monitoring System.

Thesis · May 2023


DOI: 10.13140/RG.2.2.14040.47367

CITATIONS READS

0 47

4 authors, including:

Aboubakar Bin Mushtaq


International Islamic University, Islamabad
1 PUBLICATION   0 CITATIONS   

SEE PROFILE

All content following this page was uploaded by Aboubakar Bin Mushtaq on 26 May 2023.

The user has requested enhancement of the downloaded file.


IOT Based Smart Agriculture
Monitoring System

A BSC Final Year Project by

Abou Bakar Bin Mushtaq


67-FET/BSCEET/F20

Muhammad Ammar
63-FET/BSCEET/F20

Hassan Ali
66-FET/BSCEET/F20

Supervised by
Engr. Rizwan Latif

Department of Electrical & Computer Engineering


Faculty of Engineering & Technology
International Islamic University, Islamabad
May, 2023
Certificate of Approval
It is certified that we have checked the project presented and demonstrated by AbouBakar Bin
Mushtaq 67-FET/BSCEET/F20, Muhammad Ammar 63-FET/BSCEET/F20, Hassan Ali
66-FET/BSCEET /F20 and approved it.

External Examiner Internal Examiner


Dr. Wasim Khan Engr. Haris Anis
Associate Professor Associate Professor

Supervisor
Engr. Rizwan Latif
Lab Engineer

Department of Electrical & Computer Engineering


Faculty of Engineering & Technology, IIUI

ii
A BSC Final Year Project submitted to the
Department of Electrical & Computer Engineering
International Islamic University, Islamabad
In partial fulfillment of the requirements
For the award of the degree of
Bachelor of Science
in Electrical Engineering Technology

iii
Declaration
We hereby declare that this work, neither as a whole nor as a part there of has been copied out
from any source. No portion of the work presented in this report has been submitted in support
of any application for any other degree or qualification of this or any other university or institute
of learning. We further declare that the referred text is properly cited in the references.

Abou Bakar Bin Mushtaq


67-FET/BSCEET/F20

Muhammad Ammar
63-FET/BSCEET/F20

Hassan Ali
66-FET/BSCEET/F20

iv
Acknowledgments
This BSC project report in Electrical Engineering Technology has been conducted at
Department of Electrical and Computer Engineering, Faculty of Engineering and Technology,
International Islamic University, as part of the degree program. We would like to thank Engr.
Rizwan Latif for providing us an opportunity to work on this project, under his supervision and
guidance throughout the project. We would also like to thank Engr. Asad Ali for his help,
efforts and dedicated support throughout the project. We would also like to thank Engr. Ubaid
Umar the In-charge of our degree program provide this opportunity.

Further we are particularly thankful to almighty Allah and grateful to our parents, brothers and
sisters who always supported and encouraged us during our project and studies at IIUI.

Abou Bakar Bin Mushtaq

Muhammad Ammar

Hassan Ali

v
Project Title: IOT Based Smart Agriculture Monitoring System

Undertaken By: Abou Bakar Bin Mushtaq (67-FET/BSCEET/F20)

Muhammad Ammar (63-FET/BSCEET/F20)

Hassan Ali (66-FET/BSCEET/F20)

Supervised By: Engr. Rizwan Latif


Lab Engineer
Supervised

Date Started: Sept 2022

Date Completed: May 2023

vi
Abstract
Pakistan is an agricultural country where the agriculture sector is the backbone of the economy,
contributing to more than 20% of the country's GDP. However, the agriculture sector is facing
numerous challenges such as water scarcity, climate change, and low productivity due to
outdated farming practices. Therefore, there is a dire need to introduce modern technology in
the agriculture sector to enhance its productivity and efficiency. This project presents an IOT
Based Smart Agriculture Monitoring System aimed at increasing agricultural productivity by
automating and optimizing crop management. The system uses various sensors to monitor
environmental conditions in real-time. The data collected is processed by a microcontroller and
transmitted wirelessly to a web application that provides farmers with visualized information
about their crops. The system is designed to be affordable and easy to use, allowing farmers to
monitor their crops remotely and take necessary actions to optimize their growth. By providing
farmers with real-time data on their crops, the system can help them make informed decisions
regarding water and fertilizer usage, pest control, and harvesting times. This, in turn, can lead
to increased crop yields, reduced costs, and improved profitability. The project also has future
implications, including the integration of machine learning and artificial intelligence
technologies to further optimize crop management. With the increasing demand for food
production and the need to address the challenges of climate change and food security, this
project serves as a promising solution for sustainable agriculture.

vii
Table of Contents
List of Figures ...................................................................................................... x

List of Tables ................................................................................................... xiii

List of Abbreviations .......................................................................................xiv

Chapter 1.............................................................................................................. 1

Introduction and Problem Statement ............................................................... 1


1.1 Introduction ................................................................................................................. 1

1.2 Problem Statement ...................................................................................................... 1

1.3 Objectives .................................................................................................................... 2

1.4 Scope of Project .......................................................................................................... 2

1.5 Application Areas ........................................................................................................ 2

1.6 Project Development Methodology ............................................................................ 3

Chapter 2.............................................................................................................. 4

Literature Review and Background .................................................................. 4


2.1 Background ................................................................................................................. 4

2.2 Literature Review ........................................................................................................ 5

2.3 Project Contribution .................................................................................................... 8

Chapter 03 ........................................................................................................... 9

System Design and Implementation Detail ....................................................... 9


3.1 System Design ............................................................................................................. 9

3.2 Block diagram/System Architecture ........................................................................... 9

3.3 Requirements/Requirements Analysis ........................................................................ 9

3.4 Methodological/Implementation Detail .................................................................... 10

3.5 Hardware/Development Setup .................................................................................. 10

3.6 Hardware Component Detail ..................................................................................... 12

3.7 Software Detail:......................................................................................................... 26

3.8 Simulation Details: .................................................................................................... 33

viii
Chapter 4............................................................................................................ 43

Testing and Validation ..................................................................................... 43


3.9 Testing: ...................................................................................................................... 43

4.1.1 Prototype: ........................................................................................................... 43

3.10 Result:........................................................................................................................ 51

Chapter 5............................................................................................................ 54

Conclusion and Future Recommendations..................................................... 54


3.11 Conclusion................................................................................................................. 54

3.12 Future Recommendation: .......................................................................................... 54

References .......................................................................................................... 55

ix
List of Figures
Figure 1: Designing Methodology ............................................................................................. 3

Figure 2: Old Agriculture System .............................................................................................. 4

Figure 3: Smart Agriculture Monitoring System ....................................................................... 5

Figure 4:System Block Diagram ................................................................................................ 9

Figure 5:Soil Moisture Data Collection Process ...................................................................... 10

Figure 6: Process to Measure Amount of Light through LDR Sensor ................................... 11

Figure 7:Process to Detect Different Toxic gases through MQ-135 ...................................... 11

Figure 8:Process to Measure Temperature and Humidity Level with DHT-11....................... 12

Figure 9: Final Look of Project with NODE MCU ESP8266 ................................................. 12

Figure 10: Arduino Uno Atmega328 ....................................................................................... 13

Figure 11: LDR Sensor (Light Dependent Resistor) ............................................................... 14

Figure 12: LDR sensor sense Some amount of Light .............................................................. 14

Figure 13: LDR sensor sense no Light ................................................................................... 14

Figure 14: Gas Sensor MQ-135 ............................................................................................... 15

Figure 15:Temperature and Humidity Sensor DHT-11 ........................................................... 16

Figure 16: Soil Moisture Sensor .............................................................................................. 17

Figure 17: Liquid Crystal Display (16x2) ................................................................................ 18

Figure 18: I2c Module ............................................................................................................. 19

Figure 19: Double Channel Relay............................................................................................ 20

Figure 20: Relay Operation ...................................................................................................... 21

Figure 21:Two Channel Relay Hardware Overview ............................................................... 21

Figure 22:Output Terminal Blocks .......................................................................................... 21

Figure 23: Relay Module Control ............................................................................................ 22

Figure 24: Relay Behave as a Normally Close (NC) ............................................................... 22

Figure 25: Behave as a Normally Open (NO) ......................................................................... 22

Figure 26: Hydroponic Water Pump ........................................................................................ 23

Figure 27: Arduino USB Cable................................................................................................ 23

Figure 28: NODE MCU ESP8266 ........................................................................................... 24


x
Figure 29: Male and Female Wires .......................................................................................... 25

Figure 30: Breadboard Power Supply ...................................................................................... 25

Figure 31: Buzzer ..................................................................................................................... 26

Figure 32: Arduino IDE Code.................................................................................................. 26

Figure 33: Add Library Menu .................................................................................................. 27

Figure 34: Library Manger Menu ............................................................................................ 27

Figure 35: Zip Library Menu ................................................................................................... 28

Figure 36:Thingspeak Website ................................................................................................ 29

Figure 37: Unfilled Field on My Channel................................................................................ 29

Figure 38: Filled Field on Thingspeak Channel ...................................................................... 29

Figure 39:API Key ................................................................................................................... 30

Figure 40:API Key of Channel ................................................................................................ 30

Figure 41: API Requested link................................................................................................. 30

Figure 42: Field 1 is reserved for Soil Moisture Sensor .......................................................... 31

Figure 43: Field 2 Reserved for Light Sensor .......................................................................... 31

Figure 44: Field 3 Reserved for Gas Sensor ............................................................................ 32

Figure 45: Field 4 Reserved for Temperature .......................................................................... 32

Figure 46: Field 5 Reserved for Humidity ............................................................................... 32

Figure 47: Proteus Simulation of Sensors ................................................................................ 33

Figure 48: Proteus Simulation of LCD, NODEMCU ESP8266 Module with Arduino .......... 33

Figure 49: Proteus Simulation of all Components ................................................................... 34

Figure 50: Email Interface ....................................................................................................... 42

Figure 51:Password Interface .................................................................................................. 42

Figure 52: Channel GUI Accessible over worldwide .............................................................. 42

Figure 53: Soil Moisture Sensor Integrated with Arduino UNO ............................................. 43

Figure 54: Serial Monitor Showing the values of Soil Moisture ............................................. 44

Figure 55: Gas Sensor Integrated with Arduino Uno .............................................................. 45

Figure 56: Build Potentiometer Available for Adjusting Sensor Sensitivity........................... 45

Figure 57: Gas Sensor Reading on Serial Monitor .................................................................. 46


xi
Figure 58: Light Dependent Resistor (LDR) Connected with Arduino ................................... 47

Figure 59: Light Dependent Resistor Reading on Serial Monitor ........................................... 48

Figure 60: DH11 Sensor Integrated with Arduino ................................................................... 48

Figure 61: DHT11 Reading on Serial Monitor ........................................................................ 49

Figure 62: Serial Communication Between Arduino and NODE MCU.................................. 50

Figure 63: Output of NODEMCU on Serial Monitor .............................................................. 50

Figure 64: Arduino Sending Sensors Data in a String to NODEMCU ESP8266 .................... 51

Figure 65: Soil Moisture and Light Sensor Real Time Reading on Thingspeak ..................... 51

Figure 66: Gas Sensor and Temperature Sensor Real Time Readings on Thingspeak ........... 51

Figure 67: All Sensors Readings Graphical Representation on Thingspeak ........................... 52

Figure 68: Access Readings of Sensors from Cell Phone........................................................ 53

xii
List of Tables
Table 1: Gas Sensor Pin Configuration and Connections ........................................................ 15

Table 2: Pin Configuration of DHT11 ..................................................................................... 16

Table 3:Pin Configuration Table of Soil moisture Sensor ....................................................... 18

Table 4: Pin Configuration detail of I2c Module ..................................................................... 19

Table 5: Pin Configuration of Relay ........................................................................................ 20

Table 6: Field Distribution ....................................................................................................... 31

xiii
List of Abbreviations
IoT Internet of Thing

DHT11 Digital Humidity and Temperature

WIFI Wireless Fidelity

LCD Liquid Crystal Display

UART UART (Universal Asynchronous Receiver-Transmitter)

xiv
Chapter 1
Introduction and Problem Statement
1.1 Introduction
The economy of Pakistan heavily relies on its major crops, and agriculture and farming are
considered the backbone of the country's economy. According to current condition of Pakistan
we can see that population is increasing day by day and overall Pakistan depend upon on
Agriculture. As population is increasing demand of agriculture related food is increasing
because without agriculture Pakistan is nothing and Pakistan will can’t survive with this
increasing speed of population. Also large amount of people related to agriculture. Government
of Pakistan invest large amount of money on agriculture. Pakistan is an agricultural country
where the agriculture sector is the backbone of the economy, contributing to more than 20% of
the country's GDP and employs almost 44.3% of the labors force. But Now when agriculture
crisis increased day by day also agriculture monitoring is more difficult. So smart agriculture
monitoring system is best way for monitor agriculture through different parameters. This
monitoring help us to enhance crop production and improve the quality of production.

With the help of smart agriculture monitoring we can collect important data about the behavior
of Crops in the field. With the help of this smart monitoring we can find out and observed the
behavior of plants. After Collecting data, data could be send on IoT platform. This platform is
called Thingspeak. Thingspeak is a real-time platform that allows for data analysis and
verification. The data gathered or logged in Thingspeak is presented in a vibrant and graphical
style. A botanist or a Knowledgeable farmer may be read the reading on this platform and make
the sensible changing in the field for gaining more and obtain high yield.

1.2 Problem Statement


To monitor agricultural variables through NODE MCU ESP8266 module based real time IoT
for improving yield through use of multiple sensors. There are many main Problems related to
Agriculture. Pakistan is under developed country that’s why Pakistan face many problems and
these problems is increasing day by day. There are many problems we faced in field agriculture
when we talk about crops. There are many types of toxic gases flow in the air. These effect on
the health of crop due to these toxic gases crop growth is slowly and also grow sick due to these
gases we cannot take good quality of food from crops. Also more light effect on the health of
crops because crops need moderate level of light for growth. This light helps in the process of
photosynthesis. Those areas where water available in huge amount farmer irrigate the crops
more than sufficient amount of water to sure that’s crop received the required amount of water
due to more water this water bad effect on the health of crops. Some area is hot and some areas
cold. Pakistan is the country where having the four season. When season change temperature
will also change. Temperature is important and deciding factor for crops. When crops will
ready to grow and produce food. We will make the system. In this system we will be measure
different variables according to above defined different Parameters.

1
1.3 Objectives
The objectives of an IoT based smart agriculture monitoring system is to use advanced
technology to monitor and manage various environmental conditions affecting crops, such as
soil moisture, temperature, light intensity, and air quality, among others. This system aims to
provide farmers with real-time data and analytics to help them optimize crop yield, reduce
water usage, lower costs, and enhance sustainability.

The specific objectives of an IoT based smart agriculture monitoring system may include:

 To decrease the amount of manual labor.


 To Developing an integrated system of sensors and actuators that can collect and
transmit real-time data about soil moisture, temperature, light intensity, air quality, and
other relevant factors.
 To take the update about the crop behavior from anywhere when climate suddenly vary.
 To take action against toxic gases though fertilizers and antioxidant.
 To Providing farmers with access to this data through a user-friendly interface, allowing
them to monitor crop conditions, analyze data trends, and make informed decisions
about crop management.
 To Lowering costs by reducing waste and improving efficiency in crop management.
 To monitor the Temperature and Humidity level of the crops in the field.

1.4 Scope of Project


The scope of an IoT based smart agriculture monitoring system project can include several
aspects such as hardware and software development, system design, testing, and validation,
among others. The specific scope of the project may depend on the objectives, requirements,
and resources available.

Some potential areas of scope for an IoT Based Smart Agriculture Monitoring System project
could include:

 With the help of sensors, the labor need will decrease.


 The sensor allows precisely measure the moisture level of soil.
 The gas sensor will detect different toxic gases. With the help of gas sensor farmers
and labors will take action on accurate time to save crops from bad growth.
 The temperature sensor detects the temperature level precisely and accurate than
the manual process.
 This may involve using statistical methods and other analytical tools to process the
data collected by the system and generate useful insights
 This may involve creating a user-friendly interface that allows farmers to easily
access and interpret the data collected by the system.

1.5 Application Areas


 Those places where temperature suddenly vary with the help of this we can monitor
temperature easily.
 Crops where we can’t monitor the different required parameters of crops.
 All those areas where industrial toxic gases effect on crops health.

2
 Areas where labor can’t go and unable to access, we can easily monitor crop
variable on real-time.

1.6 Project Development Methodology

Problem Literature Project


Start
Identification Review Planning

Hardware Software
Module Module
Design Design

Electrical
Simulation
Work

Combine Electrical and


Software

Project
Testing

Project
Final Report

End

Figure 1: Designing Methodology

3
Chapter 2
Literature Review and Background
2.1 Background
IoT technology is used by smart agriculture monitoring systems to track and manage different
elements of farming, such as crop health, soil conditions, weather patterns, and more. These
systems gather and analyze real-time data from agricultural fields using a network of sensors,
actuators, and communication technologies. The processed and used data is then used to
optimize farming operations and make educated decisions. The basis of an IoT-based Smart
Agriculture Monitoring system is the rising need for productive and environmentally friendly
agricultural methods. Traditional agricultural techniques encounter difficulties such erratic
weather patterns, a lack of resources, and labor-intensive procedures. IoT and other
contemporary technologies have been used to create smart agricultural solutions as a response
to these problems. Many author proposed many idea and research about Smart Agriculture
Monitoring System. Because in Sub-continent agriculture system is very old specially in
Pakistan. We yet work on old agriculture system. Specially, if we talk about the different
monitoring parameters of agriculture. We yet adopted the 19’s agriculture method.

Figure 2: Old Agriculture System

We need to improve this method and change this system into new system. We want to invent
new system for agriculture where we improve the yield of crops and also improve the
production of crops and also improve the quality of production. Whole world shifted toward
smart agriculture for gaining more profit from the agriculture. European Countries is now
shifted toward smart agriculture system.

Where they can monitor agricultures variables without need of any huge labor. Also smart
agriculture system is less expensive system than manual labor. Because in manual we need
huge amount of manual labor for measuring the different values according to different
parameters. But in smart agriculture sensor perform these tasks more easily and efficiently than
human and manual labor.

4
Figure 3: Smart Agriculture Monitoring System

For increasing more yields of crops we need to adopt this system. With this system more will
grow, when crops amount is increase in parallel our export will increase and it is directly effect
on our economy. With this our economic condition will improve.

2.2 Literature Review


Zahid Khan, Muhammad Zahid Khan, Sikandar Ali, Irshad Ahmed Abbasi, Discusses
the impact of the Internet of Things (IoT) technology on the agriculture and farming industry.
The IoT is a concept where everyday objects and devices are connected to the internet and can
communicate with each other to provide intelligent solutions. Smart farming is an emerging
trend in agriculture that is heavily dependent on IoT technology. The paragraph explains how
IoT-based solutions can be used in smart farming. For example, IoT devices can be used to
track farm vehicles, monitor livestock, storage conditions, and keep an eye on the health of
crops and plants. By using IoT technology, farmers can have access to real-time data and
insights that can help them make better decisions regarding their farming practices. Also
highlights the fact that the adoption rate of IoT technology is increasing across all industries,
including agriculture and farming. The data indicates that approximately 43% of enterprises
worldwide have employed IoT applications in one way or another. This means that IoT
technology is no longer just a buzzword, and it has become an essential tool for many
businesses, including farmers. Suggests that IoT-based solutions for farming have a promising
future, and farmers are likely to benefit from these intelligent solutions. With the rapid adoption
of IoT technology, it is expected that more and more farmers will incorporate IoT-based
solutions in their farming practices in the future. [1]

Harika Pendyala1, Ganesh Kumar Rodda, Anooja Mamidi, Discusses the advantages of
IoT-based smart farming compared to traditional farming methods. The author highlights the
proposed A connected irrigation system that makes use of a DHT11 sensor and ESP8266
NodeMCU module. Based on the amount of moisture in the soil, this irrigation system is
intended to automatically water the field. The system also transmits information to the
Thingspeak server, which aids in monitoring the state of the land. Explains that the recent
advances in sensor technology for agriculture and the evolution of wireless sensor networks
(WSN) and IoT technologies have allowed for the development of automatic irrigation systems.
The use of these technologies has made farming more efficient, as farmers no longer have to
manually monitor the moisture levels of the soil and irrigate the land. The author concludes by
stating that agricultural production depends on seasonal situations, and there is often a lack of

5
water sources. With IoT-based smart farming, farmers can be more efficient in their water
usage and reduce waste. The automation of the irrigation system can also help to reduce labor
costs and improve the overall yield of crops. Suggests that IoT-based smart farming has a lot
of potential benefits for farmers. It allows for more efficient water usage, reduces labor costs,
and helps farmers to make better decisions based on real-time data. The use of IoT-based smart
farming technologies can contribute to more sustainable agriculture practices and increase crop
yields. [2]

D Betteena Sheryl Fernando provides an overview of the agriculture sector and its
significance in developing countries. The Latin words "Ager" (land or field) and "Culture"
(cultivation) are the origin of the word agriculture. According to the text, the agriculture
industry is a substantial employer and a considerable contributor to the economy in many
developing nations. In reality, agriculture provides food and a means of subsistence for 64% of
the entire population in these nations. By enhancing the soil and providing water, agriculture
aims to create plants and crops that are more resilient and productive. The paragraph highlights
the value of agriculture in nations like India, where the majority of the population relies on
farming and agriculture provides the majority of the country's revenue. The author goes on to
explain the changes in agriculture that have occurred over the years. The Green Revolution,
which began in the 1970s, brought about a remarkable change in the field of agriculture.
However, variable rainfall, a lack of basic infrastructural amenities, and an unequal distribution
of resources prevent the growth of agriculture from being efficiently channeled. The author
contends that in order to overcome these challenges, methodical planning is necessary. Finally,
the author draws attention to the fact that many farmers still use conventional techniques
including manual seed distribution, a pattern of two harvests each year, and illogical cultivation
practises. The author contends that in order to raise agricultural output and boost the sector's
general effectiveness, agriculture must be modernised and embrace more scientific practises.
An outline of the role agriculture plays in emerging nations and the difficulties the industry
faces. It emphasizes the need to modernize agriculture and adopt more scientific methods to
improve crop yield and efficiency. [3]

Ahmad Faisol Suhaimi, Naimah Yaakob2, Sawsan Ali Saad, the author draws attention to
some of the drawbacks of manual irrigation techniques, which are still popular among farmers
in the agricultural sector. It implies that conventional drip irrigation and can watering
techniques are inaccurate and inefficient. The author also mentions that human error might
result from manual agricultural field monitoring. If farmers are not physically on the property,
they might not be aware of incursions. The Author describes a fresh endeavor meant to deal
with these problems. The goal of the project is to create an intelligent monitoring and automated
watering system. With the use of sensors and automation, this system will monitor and irrigate
crops more effectively and precisely. By using sensors, the system will be able to monitor the
soil moisture level and determine when irrigation is necessary. The automation of irrigation
will save time and improve accuracy. In addition, the smart monitoring system will alert
farmers to any intrusions or unusual activity, even if they are not physically present on the
farm. Overall, the author suggests that the current manual irrigation methods have limitations
that can result in inefficiencies and inaccuracies in crop monitoring and irrigation. The
proposed smart monitoring and automated irrigation system is expected to address these issues
by using modern technology to improve the efficiency and accuracy of irrigation, thereby
helping farmers to produce better yields. [4]

6
Soukaina Bouarourou, Abderrahim Zannou, The author discusses the concept of precision
agriculture and its importance in achieving optimum and sustainable profits in the agricultural
sector. In order to increase crop yields and decrease waste, precision agriculture refers to the
application of technology and field data in agricultural processing systems. According to the
author, the increase in global population has led to food shortages and a rise in water demand.
By using specific resources more effectively and sustainably, such as water, seeds, fertilizer,
and other necessities, precision agriculture seeks to solve this issue. This promotes a balance
between environmental concerns and production. In order to offer precise information on soil
conditions, crop development, and environmental variables, precision agriculture makes use of
contemporary technology like GPS, drones, sensors, and other data collecting tools. This
information is then used to make more informed decisions about crop management, such as
determining the optimal time for planting, the amount of water and fertilizer needed, and the
best method for pest control. The use of precision agriculture helps farmers to minimize waste,
increase efficiency, and maximize their profits while also reducing the impact of farming on
the environment. By using resources in a more sustainable manner, farmers can achieve the
best possible results while also contributing to a more sustainable future for agriculture. [5]

Swaraj C M Describes the use of remote sensors and the Internet of Things (IoT) technology
to track household conditions and gather information about various environmental factors that
affect agriculture. Remote sensors are used to track conditions such as climate, humidity,
temperature, and soil fertility. Using IoT technology, which enables the effective collecting
and processing of data from several sources, this information is gathered and examined. Wild
plants, water levels, precise location, field interruption, field development, horticulture, and
other significant aspects that influence crop growth and development may all be found using
an IoT-based analysis. By gathering this data, farmers may better manage their crops and
increase production by making more educated decisions. IoT technology also enables farmers
to connect to their home from anywhere, making it simpler to remotely manage and monitor
their crops. This provides farmers with greater flexibility and enables them to respond more
quickly to changing environmental conditions or other factors that affect their crops. Overall,
the use of remote sensors and IoT technology in agriculture has the potential to significantly
improve crop yields and make farming more efficient and sustainable. By gathering and
analyzing data in real-time, farmers can make more informed decisions and take proactive steps
to address issues before they become larger problems. [6]

Raj Aryan he paragraph describes the use of smart farming and crop monitoring technology
that utilizes the Internet of Things (IoT) in agriculture. The main objective is to implement
automation in agriculture in order to overcome the problems associated with traditional farming
methods. One of the issues with traditional farming techniques is that they require manual
intervention for tasks such as land irrigation. To address this issue, the project proposes the use
of sensors to collect data from the field. The sensors include temperature, humidity, soil
moisture, and rain detectors. The collected data is then processed using IoT technology. The
IoT system allows for the efficient gathering, processing, and analysis of data from multiple
sources. This enables farmers to make more informed decisions about how to manage their
crops and improve their yield. By utilizing this technology, farmers can remotely monitor their
crops and make adjustments to the irrigation system based on real-time data. This can help to
optimize water usage, reduce waste, and increase crop yields. Overall, the use of smart farming

7
and crop monitoring technology can improve the efficiency and sustainability of agriculture.
By reducing the need for manual intervention and providing real-time data, farmers can make
more informed decisions and optimize their crop yield. This can help to address the challenges
associated with traditional farming methods and promote sustainable agriculture practices. [7]

Rau, A. J., Sankar, J., Mohan, A. R. The authors highlights the importance of agriculture as
the main source of food and raw materials for human beings. Agriculture is also an important
contributor to the economy and provides significant employment opportunities to people.
Despite the importance of agriculture, the paragraph notes that many farmers still rely on
traditional methods of farming. These methods may be less efficient and result in lower yields
of crops and fruits. This can have a negative impact on the livelihoods of farmers and the
availability of food and raw materials for the population. The use of modern farming techniques
and technology, such as precision agriculture and IoT-based crop monitoring, can help to
improve the efficiency and yield of crops. By adopting these new techniques, farmers can
increase their productivity, reduce waste, and promote sustainable agriculture practices.
Overall, the author emphasizes the importance of agriculture to human life, the economy, and
employment opportunities. It also highlights the need for farmers to adopt modern techniques
and technology to improve their productivity and the quality of their crops, ultimately
benefiting both farmers and consumers. [8]

M. Manoj Venkata Sai, K. Subba Rao, N. Vamsi Krishna, Discusses the application of IoT
and wireless sensor networks to agriculture. The majority of research publications, according
to the paragraph, emphasize the usage of wireless sensor networks to gather data from multiple
sensors and then wirelessly send it to the main server. The goal of the study is to use automation
and IoT technology to make agriculture smart. The author goes on to say that agriculture plays
a key part in the use of freshwater by using 85% of the freshwater resources that are accessible
globally. Therefore, in order to boost production and decrease water use in agriculture,
contemporary science and technology must be implemented. By implementing these modern
technologies, the agriculture sector can become more efficient and productive while
minimizing the resource consumption. [9]

2.3 Project Contribution


We are working to design a Smart Agriculture Monitoring System. This mainly includes the
different sensor where we can measure different parameters. This Project will help us in high
crops production in large areas. These all sensor integrated with micro-controller. This micro-
controller managed all the input data. In parallel NODE MCU ESP8266 module is connected,
this module Wirelessly send data of all sensor on IoT platform (Thing Speak) where we can
monitor different parameters of crops on real time. LCD 1 is connected with micro-controller
where we can easily see different values of different sensors. Hydroponic Water pump is used
for maintaining moisture level. Buzzer is used for alarm against high concentration of Toxic
gases. In this way, every component of project contributes in this project through different
ways.

8
Chapter 03
System Design and Implementation Detail

3.1 System Design


Smart Agriculture Monitoring System include different sensor the to solve different problems
about agriculture and use of these sensor effectively according to their need and utilize the
ability of sensors and use it effectively for our purposes. [10]

Smart agriculture for more yields of crops convert the agriculture towards new technologies by
using new trends. There are different sensors are connected with micro controller and every
single sensor perform their own task effectively. The use of a soil moisture sensor in smart
agriculture can solve the issue of water scarcity and optimize the use of environmental
conditions. It uses smart Soil moisture sensors to actually detect the physical condition of earth
that whether it has a need of water or not. Smart Agriculture include gas sensor it will detect
different toxic gases those are dangerous and harmful for crops health and growth. Many other
sensors are used and will discuss in detail in Portion of Hardware. [11]

3.2 Block diagram/System Architecture

Soil Moisture
NODE MCU IOT Thing
Sensor
ESP8266 Speak

Temperature
and
Humidity LCD 16 x 2
Sensor

Light
Water Pump
Dependent
With Relay
Resistor

Gas
Buzzer
Sensor

Figure 4:System Block Diagram

3.3 Requirements/Requirements Analysis


The major requirements of this system are

 Determining actual soil moisture level with aid of soil moisture sensor.
 Converting this analogue data collected in digital form through Micro-controller with
aid of coding.

9
 Make this data to be transferred between sensors unit and to main controller.
 Making main controller (Arduino Uno) capable to receive actual sensor data.
 Setting the Threshold voltage of Different sensors.
 Fetch the data of different sensor in IoT platform (Thingspeak) through API in the
system to make system to generate reading. Monitored these all values on Thingspeak
in form on Graph.

3.4 Methodological/Implementation Detail


Project implementation method includes following points.

 Design of System such that there are total one mesh containing two nodes present and
each node consist of sensors unit that receives data from sensors unit and after it is
linked with micro-controller to convert this analogue data in to the digital and send it
to NODE MCU ESP8266 module from where it will be communicated to main
controller.
 All sensors and NODE MCU ESP8266 module are connected with microcontroller and
the collected data of these sensors are send to Thingspeak through NOD MCU
ESP8266. These sensors collect data according to their specialty.
 Micro-controller is connected with NODE MCU ESP8266 and in this case micro-
controller received all the data of sensors and send toward NODE MCU ESP8266 and
then NODE MCU ESP8266 will communicate IoT Platform.

3.5 Hardware/Development Setup


The main hardware of Smart Agriculture consists on following system. We discuss in detail

 Physical earth Condition:

Soil moisture sensor that collects data (moisture content) from earth/field and sends it to Micro-
controller ATMEGA 328 UNO where this analogue data is converted to digital form. Because
digital form is easily understandable by micro-controller and micro-controller have able to read
the data in digital form. Also controller send all data toward NODE MCU ESP8266 and then
NODE MCU ESP8266 is connected with internet with the help of internet NODE MCU
ESP8266 send data to Thingspeak channel.

Collection of data
NODE MCU
through Controller
ESP8266
Soil Moisture

Channel of
Thingspeak
(IoT Platform)

Figure 5:Soil Moisture Data Collection Process

10
 Measure Amount of Light:

LDR sensor measure the amount of light and send this collected data to micro-controller
Arduino UNO (ATMEGA 328) where will converted analogue data into digital. This digital
data send to NODE MCU ESP8266 and then NODE MCU ESP8266 with the help of internet
send data on Thingspeak channel (IoT platform).

Collection of data
through
Soil Moisture

Channel of
NODE MCU
Controller Thingspeak
ESP8266
(IoT Platform)

Figure 6: Process to Measure Amount of Light through LDR Sensor

 Detect gases:

MQ-135 sensor able to detect different toxic gases when sensor detect different gases then
sensor send this collected data to micro-controller Arduino UNO (ATMEGA 328) where will
converted analogue data into digital. This digital data send to NODE MCU ESP8266 and then
NODE MCU ESP8266 with the help of internet send data on Thingspeak channel (IoT
platform). In this channel, we can easily monitor different variable conditions of different
sensors on this channel.

Detect Gases with


MQ-135

Channel of
NODE MCU
Controller Thingspeak
ESP8266
(IoT Platform)

Figure 7:Process to Detect Different Toxic gases through MQ-135

 Temperature and Humidity Level:

DHT11 sensor collect Temperature and Humidity level and then send to controller. Then
convert this analogue data into digital. Then controller send this data to NODE MCU ESP8266
and with the help of Internet NODE MCU ESP8266 able to send data on channel of
Thingspeak.

11
Monitor
Temperature and
Humidity level Controller
with DHT11
Sensor

Channel of
NODE MCU
Thingspeak
ESP8266
(IoT Platform)

Figure 8:Process to Measure Temperature and Humidity Level with DHT-11

3.6 Hardware Component Detail

Figure 9: Final Look of Project with NODE MCU ESP8266

12
 Hardware Component to be Used
 Arduino UNO Atmega328  Water Pump

 Light sensor  Arduino Cable

 Gas Sensor  NODE MCU ESP8266 Module

 Temperature and Humidity Sensor  Male and Female Cable

 Soil Moisture Sensor  Breadboard Power Supply

 LCD  Buzzer

 I2C Module

 Relay

 Arduino UNO ATmega328


The ATmega328P is the core of the Arduino UNO microcontroller board. Among its 14 digital
input/output ports are a 16 MHz ceramic resonator, six analogue inputs, and six PWM outputs.
To get started, power it using an AC-to-DC converter, a battery, or a USB cable to connect it
to a computer. Microcontroller is what Arduino is. It functions and acts like a brain. The
ATMEGA 328P is a kind of embedded micro-controller utilized in the Arduino UNO board to
transform data from atmospheric pressure sensors, soil moisture sensors, temperature sensors,
gas sensors, and LDR sensors into digital form for easy understanding.

Figure 10: Arduino Uno Atmega328

 Light Sensor:
In this project we use, LDR (Light dependent Resistor) as a Light Sensor. This device is use to
take data about light. It takes data from sunlight to tell about the Quantity of light (by using
both concept of density and intensity). Take data in Analog from and send to micro-controller
in order to convert into Digital form.
 Why we using LDR or Photo-resistor?

13
LDR or photo-resistor can be used to measure the quantity of light that reaches a piece of land.
Understanding the significance of light for plants is Important because they use it in a process
known as photosynthesis to create their own food. To grow and generate food, plants require
the right quantity of light-not too much or too little.
Important Note: When Percentage is zero it means there is no light, when Percentage is 100%
it means lot of light.

Figure 11: LDR Sensor (Light Dependent Resistor)

The quantity of light that a sensor known as an LDR (Light Dependent Resistor) senses causes
it to alter its electrical resistance. After that, the amount of light is transformed into a 10-bit
digital number and finally into a percentage out of 100.

 Two Cases in LDR-Sensor:


 Case I: When LDR Sensor Sense/Detect Some Amount of Light.
 Case II: When LDR Sensor Sense/Detect no Light.

Case I: When LDR Sensor detect some amount of light:

Figure 12: LDR sensor sense Some amount of Light

In first case, when LDR sensor sense Some quantity of Light the Output will be High and Show
Some Output. The value of output is greater than 1 and the value Between 1 and 100.

Case II: When LDR Sensor detect no light

Figure 13: LDR sensor sense no Light

In Second case, when LDR sensor sense no Light the Output will be LOW and Show Some
Output. The value of output is Zero.

14
 Air Quality Sensor / Gas Sensor:
This device is use to detect different Toxic gases which is harmful for food and Crop. The
Sensor sensing data is in Analog form. This sensor take data from its surrounding. If any toxic
gas within the range of sensor, then sensor captured some Analog signal from it and send to
micro-controller. Micro-controller converts these analog form signals into Digital Form
Because digital is easily understandable.
 Why we are using Gas Sensor?
Plants and trees, which depend on clean air for proper growth and development, can be
adversely affected by pollution. The fruits and vegetables that are produced as a result of
polluted air may be of inferior quality. Additionally, crops' resistance to diseases and pests
might be weakened by dirty air. Therefore, air quality is an essential factor to consider for
assessing crop growth. To measure air quality, the MQ 135 air quality sensor is being used.

Figure 14: Gas Sensor MQ-135

 Pin Configuration:
The MQ-135 sensor has 4 terminals, but only 3 of them are needed: VCC, GND, and Aout which
is the analog output. In some cases, Dout is not here. But in above mention sensor Dout displayed
but it will never be use. Because gas sensor detects toxic gases and these gases analog in nature.
All natural signals are Analog.
Table 1: Gas Sensor Pin Configuration and Connections

Sr. No Pins Connection

+3.3 V – 5.5 V
1 Vcc (Input High)

Ground
2 GND (LOW)

3 Aout (Analog Output) Connected with Arduino

4 Dout Not use

The percentage value obtained from the MQ-135 air quality sensor ranges from 0% to 100%,
with a higher value indicating more air contamination and a lower value indicating better air
quality. When sensor detect any toxic gas the output will be High and otherwise output will be
Low. The primary drawback of the MQ-135 sensor is that it is unable to identify the pollutant
gas that is being detected.
NOTE: The MQ-135 sensor can provide accurate output only when it reaches its optimal
temperature, which takes approximately 5 minutes. The sensor remains heated during
operation.
 Temperature and Humidity Sensor

15
This device is use to take data about Temperature and Humidity. Temperature is Important
factor when crops are beginning to ready. When temperature exceed the maximum level it will
be dangerous for crops growth, health and Quality.
Accordingly, we use DHT-11 sensor to measure the temperature and Humidity. This sensor
take data from its surrounding. All data in its surrounding in analog form and this analog data
send to micro-controller and change into digital form in sequence. Digital form is easily
understandable and transferable.
 Why we are using Temperature and Humidity Sensor?

Just like humans and other living things, plants have evolved to be sensitive to changes in
temperature and humidity. In order to keep comfortable, we get ready for the impending winter,
summer, or rainy seasons. Similar to how people prepare for the next seasons, plants do the
same, either to adjust for the worse or to blossom with fruits and blooms.

The DHT11 digital sensor is used to measure temperature and humidity in order to determine
the start of crop growth or fruit production, as these variables play a significant role in the
process.

Figure 15:Temperature and Humidity Sensor DHT-11

 Pin Configuration:

The pin arrangement of the DHT-11 sensor, which is available from several manufacturers, can
change from the one seen in the circuit diagram. Determining the appropriate Vcc, GND, and
output/Data Pins for your particular DHT-11 sensor is so crucial.

Table 2: Pin Configuration of DHT11

Sr. No Pins Connection

+3.3 V – 5.5 V
1 Vcc (Input High)

Ground
2 GND (LOW)

3 Data Pin Connected with Arduino

 Soil Moisture Sensor:


A tool that gauges the quantity of water in the soil is called a soil moisture sensor. A soil
moisture sensor may be used in an IoT-based smart agriculture monitoring system to give

16
farmers and growers vital information on the water requirements of their crops. Here are some
reasons why soil moisture sensor is useful in this context:
1. Automation of Irrigation System: By measuring the soil moisture levels, the sensor can
be used to control the irrigation system to automatically provide water to the crops only
when it is needed, improving the efficiency of water usage and reducing waste.
2. Real-time monitoring: The sensor can be connected to the internet through a
microcontroller or gateway and the data can be monitored in real-time using a mobile
application or web portal, enabling farmers to make informed decisions about irrigation.
3. Early warning: By monitoring the soil moisture levels, the sensor can provide early
warning of potential issues, such as dry soil or waterlogging, allowing farmers to take
action before the problem becomes severe.
4. Adaptability: Soil moisture sensors can be used in a variety of crops and soil types,
making them a versatile tool for farmers and growers.
5. Cost-effective: Soil moisture sensors are relatively inexpensive, making them a cost-
effective solution for automating irrigation systems.
6. Water saving: By providing accurate data about the soil moisture, the sensor can help
farmers to save water and reduce the water consumption.

Overall, Soil moisture sensor is a key component in the IoT-based smart agriculture monitoring
system as it plays an important role in providing accurate information about the water needs of
the crops, allowing farmers to make informed decisions about irrigation.

Analog
Digital
GND
VCC (3V-5V)

Figure 16: Soil Moisture Sensor

 Pin Configuration:

The pin configuration of a soil moisture sensor can vary depending on the specific sensor
being used. Some soil moisture sensors have additional pin like digital output pin and power
supply pin like 3.3V or 5V. Please note that the pin configuration may vary depending on the
specific soil moisture sensor used, it's always a good idea to check the datasheet before using
it. And also make sure that the power supply voltage is matched with the sensor voltage
rating. However, here is an example of a common pin configuration for a soil moisture sensor
in following below table.

17
Table 3:Pin Configuration Table of Soil moisture Sensor

Sr. No Pins Connection

+3.3 V – 5.5 V
1 Vcc (Input High)

Ground
2 GND (LOW)

Connected with
3 Analog Pin (A0) Arduino

4 Digital Pin (NA) Not Used

 Liquid Crystal Display (LCD) 16x2:

An LCD 16x2 display can be used in an IoT-based smart agriculture monitoring system to
display information such as temperature, humidity, and soil moisture levels. This allows
farmers to easily monitor the conditions in their fields without having to constantly check their
devices. The 16x2 format of the LCD display allows for the display of two rows of 16
characters, providing ample space for displaying multiple pieces of information at once.
Additionally, LCD displays consume less power than other types of displays, making them
well-suited for use in remote, battery-powered monitoring systems.

Figure 17: Liquid Crystal Display (16x2)

 I2C Module:
The I2C (Inter-Integrated Circuit) shield can be used in an IoT-based smart agriculture
monitoring system in conjunction with an LCD 16x2 display to allow for communication
between the microcontroller and the display.
The I2C shield allows for communication between the microcontroller and the LCD display
using the I2C protocol. This protocol is a popular choice for communication between devices
because it uses a simple two-wire interface (SDA and SCL) and allows for multiple devices to
be connected to the same bus, reducing the number of required pins on the microcontroller.
Additionally, the I2C protocol allows for multiple devices to share the same address, making
it easy to add additional devices to the system without modifying the software.
Additionally, using an I2C shield, it can also add more functionality to the project like
providing power to the device, adding more sensors, etc. Also, it can save the pin number of
the microcontroller since the I2C shield only uses 2 pins for communication.

18
Figure 18: I2c Module

 Pin Configuration:
Here is a table showing the pin configuration of a typical I2C module:

Table 4: Pin Configuration detail of I2c Module

SDA: Serial Data Line

SCL: Serial Clock Line

VCC: Power Supply (3.3V or 5V)

GND: Ground

Please note that the pin configuration may vary depending on the specific I2C module used,
it's always a good idea to check the datasheet before using it.
 Relay:
Relays are electrically powered switches that may be used to control circuits with high
voltage or current using signals with lower voltage or current. In an IoT-based smart
agriculture monitoring system, relays can be used to control various devices such as irrigation
systems, lighting systems, and ventilation systems based on the information collected by the
sensors.
1. Isolation: Relays provide electrical isolation between the control circuit and the load
circuit, which can protect the microcontroller and other low-voltage components from
damage caused by high-voltage or high-current circuits.
2. Control High Voltage/Current: Relays can control high voltage and high current loads
with a low voltage control signal, which is compatible with microcontrollers and other
low-voltage electronic devices.
3. Remote Control: Relays can be controlled remotely, for example, when the
microcontroller receives a signal from the cloud, it can use the relay to turn on or off the
light or irrigation system
4. Automation: Relays can be used to automate various systems and processes, such as
irrigation, lighting, and ventilation, based on the information collected by the sensors.
5. Safety: Relays can be used to control potentially dangerous equipment or systems, such
as electrical heating elements, in a safe manner.
Relays are widely used in IoT projects to control devices, automate processes, and ensure
safety.

19
Figure 19: Double Channel Relay

 Pin Configuration:

Here is a table showing the pin configuration of a typical relay:

Table 5: Pin Configuration of Relay

Pin Description

Pin Configuration where Load is Connected

The pin where the current flows to activate the relay, often connected to
Coil
a microcontroller or other control circuit

The common terminal, connected to either the normally open (NO) or


Common
normally closed (NC) contact

Normally Open The terminal that is open (not connected) when the relay is not
(NO) energized.

Normally Closed
The terminal that is closed (connected) when the relay is not energized.
(NC)

Pins Connected with Controller

VCC Power Supply ( DC +5V)

GND Ground

INT (Signal) The signal pin is mainly used for controlling the relay.

 Relay Operation:

A relay has five pins, three of which are high voltage terminals (NC, COM, and NO) that
connect to the device being controlled through these terminals.

20
Figure 20: Relay Operation

The relay is the device it is connected with NO pin when there is no signal on INT Pin. When
there will any signal INT Pin relay automatically connect with NO Pin.
 Two Channel Relay Hardware Overview:

Figure 21:Two Channel Relay Hardware Overview

 Output Terminal Blocks:


Output Terminals are those terminals where load is connected. We want to perform some
action.

Figure 22:Output Terminal Blocks

 Module Control:
On the other side of relay, there are three terminals Vcc, GND, INT1 and INT2. Vcc for positive
voltage we can provide 5V from any controller Like Arduino. INT1 and INT2 is use to provide
signal to relay for controlling relay.

21
Figure 23: Relay Module Control

i. If Logic is LOW on INT1 and INT2, it means relay connected between NC and
COM. In this case, relay is not energized.

Figure 24: Relay Behave as a Normally Close (NC)

ii. If Logic is HIGH on INT1 and INT2, it means relay connected between NO and
COM. In this case, relay is energized and load Perform some action.

Figure 25: Behave as a Normally Open (NO)

 Water Pump:
In an IoT-based smart agriculture monitoring system, a water pump can be used to
automatically provide water to crops based on the information collected by the sensors. Some
reasons for using a water pump in this context are:
1. Irrigation Automation: By using a water pump in conjunction with sensors that measure
soil moisture, temperature, and humidity, the irrigation system can be automated to
provide water to the crops only when it is needed, improving the efficiency of water usage
and reducing waste.
2. Remote Control: A water pump can be controlled remotely through the use of a
microcontroller or other control circuit, allowing farmers to start or stop the pump
remotely.
3. Cost-effective: Water pumps are relatively inexpensive and efficient, making them an
affordable and practical solution for automating irrigation systems.
4. Efficiency: It can pump water from a water source to the field in a faster and more
efficient way than manual watering, allowing the farmer to focus on other tasks.

22
5. Adaptability: Water pumps can be used with different types of irrigation systems, such
as drip irrigation, sprinkler systems, and flood irrigation.
6. Watering in Dry area:

Water pumps can be used in areas where water is scarce or difficult to access, making it possible
to bring water to the crops even in dry conditions. Overall, Water pump is an important
component in the smart agriculture monitoring system as it plays a vital role in providing water
to the crops at the right time, in the right quantity and in the right place. Special program fed
into controller. Controller automatically turn on the water pump when moisture percentage is
less than 50% and turn off automatically when moisture level is greater than 70% percentage.
We can vary these level of turn on and turn off by do changing in programming of controller.

Figure 26: Hydroponic Water Pump

 Arduino USB Cable:


Arduino USB cables are used to connect the Arduino microcontroller board to a computer or
other USB-enabled device. The USB cable provides a communication interface between the
microcontroller and the computer, allowing the computer to send data to the microcontroller,
receive data from the microcontroller, or program the microcontroller's flash memory with new
firmware. Additionally, the USB cable provides a power source for the microcontroller,
allowing it to operate without the need for a separate power supply. By using a USB cable, the
Arduino can be easily integrated into a variety of projects and systems, making it a versatile
and accessible platform for makers and hobbyists.
Arduino USB cable is use to communicate between arduino and computer. It helps us to upload
the c program (code) into arduino. We can easily upload the code in arduino through this USB
cable. This USB cable make communication very easy between arduino and computer.

Figure 27: Arduino USB Cable

 NOD MCU ESP8266

An open-source development board called the NodeMCU ESP8266 combines a


microcontroller unit (MCU) with the ESP8266 Wi-Fi module. Its goal is to offer an intuitive
environment for quick prototyping of IoT (Internet of Things) solutions. A low-cost, Wi-Fi-

23
enabled microcontroller with a built-in TCP/IP protocol stack, the ESP8266 module is perfect
for Internet of Things applications. It utilizes the 2.4GHz Wi-Fi band and is compatible with
TCP/IP, UDP, HTTP, and MQTT, among other common Wi-Fi protocols. The ESP8266
module is integrated with extra functionality by the NodeMCU board to make it more usable
and accessible. It has a chip that converts USB to serial, making it simple to programmed and
communicate with the board via a USB connection.

Additionally, the board has GPIO (General Purpose Input/Output) pins that may be used to
connect to and operate extraneous hardware like sensors. The NodeMCU ESP8266's
interoperability with the Arduino IDE (Integrated Development Environment) is one of its
main benefits. This implies that you may utilize the NodeMCU rich Arduino libraries and
community support while programming it using the well-known Arduino programming
language. The NodeMCU ESP8266 has a number of properties, including as its tiny form size,
low power consumption, and onboard Wi-Fi connection, that make it appropriate for IoT
applications. It may be used for a variety of IoT projects, including data logging, sensor
monitoring, home automation, and remote control systems.

Generally speaking, the NodeMCU ESP8266 offers a user-friendly and adaptable platform for
creating IoT applications. It is a popular option for developers and amateurs alike because to
its mix of Wi-Fi capabilities, Arduino compatibility, and ease of usage.

Figure 28: NODE MCU ESP8266

 Male and Female Wires:

Male and Female wires are used to communicating micro controller and sensors. We also know
as jumper wires. Male and female wires are used to connect different electrical components and
devices together. The terms "male" and "female" refer to the physical connectors on the wires,
which can be plugged together to create a connection. Male connectors have projecting pins or
prongs that can be inserted into the corresponding female connectors, which have holes or
sockets to receive the pins. This type of connection is commonly used in various electronics
applications, such as in cables, sensors, actuators, and other devices. By using male and female
wires, different devices can be easily connected and disconnected as needed, providing a flexible
and modular approach to system design. This makes it easier to build and modify systems, as
well as to troubleshoot and repair them. The choice of male and female connectors depends on
the specific requirements of the devices being connected, including the current and voltage
requirements, the type of signals being transmitted, and other factors such as environmental
conditions and mechanical stability.

24
Figure 29: Male and Female Wires

 Breadboard Power Supply:

Breadboard power supplies are used in electronics projects to provide a regulated and isolated
power source for the components and devices being used on a breadboard. A breadboard is a
type of prototyping board that allows the user to quickly and easily test and prototype electronics
circuits. Breadboard power supplies are designed to be used with breadboards, and they typically
provide both positive and negative voltage rails that can be connected to the breadboard's power
and ground buses. This allows the components and devices on the breadboard to be powered
and connected to the power source in a simple and straightforward manner.

We give DC input 5V-12V to Breadboard and it provide us different junctions of 5V and 3V.
On this breadboard GND is also available with positive voltages.

Figure 30: Breadboard Power Supply

 Buzzer:

The Buzzer connected to an Arduino is an output device that produces audible sounds or tones.
It can be used to provide audio feedback to the user or to alert the user of a specific event.

In the context of a gas sensor, the buzzer can be used to alert the user when a certain level of
gas concentration is detected. For example, if the gas sensor is detecting a dangerous level of
gas, the Arduino can activate the buzzer to produce a loud sound to alert the user to take
appropriate action, such as turning off the gas supply or evacuating the area.

25
In general, the buzzer connected to an Arduino can be programmed to produce different sounds
and tones depending on the application, and can be a useful tool for providing audible feedback
and alerts to the user.

Figure 31: Buzzer

3.7 Software Detail:


 Arduino IDE:

Software for Arduino boards is programmed and developed using the software environment
known as the Arduino IDE (Integrated Development Environment). It’s simple and user-
friendly interface for programming Arduino boards includes a code editor with syntax
highlighting and auto-completion, a serial monitor for communicating with the board, and a
built-in library of functions and examples. The Arduino IDE is used to create the code for the
IoT-based smart agricultural monitoring system that reads data from the sensors, analyses the
data, and regulates the actuators depending on the data. Using a USB cable, the code is sent to
the Arduino board, which then executes it to manage the sensors and actuators that are attached
to it. The serial monitor in the Arduino IDE can be used to debug and test the code, and to
monitor the data being read from the sensors and sent to the NODE MCU ESP8266 module for
transmission to Thingspeak. The Arduino IDE is an essential tool for developing and
programming the code that controls the system.

Figure 32: Arduino IDE Code

26
How to add all required Libraries in Arduino IDE? Step to add libraries in Arduino is
following below:

1. Open Arduino IDE.


2. In the Left Top Corner Click on Sketch >> Include Library. Then menu will display.

Figure 33: Add Library Menu

There are two main menus will be display.

1. First download direct library from arduino IDE from Manage libraries menu. These
libraries provided by the platform of arduino and GitHub. The menu will display when we
click on Library Manager. Add Libraries according to requirement

Figure 34: Library Manger Menu

2. Second add library if you have any library in Zip file. Following menu will display, then
we click on Add. Zip Library
a. LiquidCrystal_I2C.h
b. DHT11 sensor

27
Figure 35: Zip Library Menu

Note:

When whole programming is done need to add correct APN Number and Channel link at
required place of arduino code. Otherwise data cannot be send.

 Other details:
 Thingspeak
 Proteus
 Thingspeak:
An open-source IoT platform called ThingSpeak may be used to gather, examine, and display
data from IoT devices. ThingSpeak may be used to gather and store data from the many sensors
and actuators utilized in the IoT-based smart agricultural monitoring system. The data collected
by ThingSpeak can be analyzed to gain insights into the environmental conditions and plant
growth, and this can be used to make informed decisions about the use of resources such as
water and fertilizers. Additionally, the platform can be used to set up alerts and notifications
when certain conditions are met, such as when the soil moisture levels are too low, which can
help farmers take immediate action to address the issue.
The data collected by ThingSpeak can also be visualized using charts and graphs, which can
provide farmers with a better understanding of the trends and patterns in the data, and help
them to make more informed decisions about their farming practices.
Overall, ThingSpeak is a useful tool for collecting, analyzing, and visualizing data in the IoT-
based smart agriculture monitoring system, and can help farmers to make more informed
decisions about their farming practices, leading to more efficient and sustainable agriculture.

 Create Channel in Thingspeak:

To create a channel on ThingSpeak, follow these steps:

28
1. Go to the ThingSpeak website (thingspeak.com) and sign in or create a new account.

Figure 36:Thingspeak Website

2. Click on the "Channels" tab in the top menu and then click "My Channels".

Figure 37: Unfilled Field on My Channel

3. Click the "New Channel" button.


4. Fill out the form with the required information such as the name of the channel, field
names, and other details.

Figure 38: Filled Field on Thingspeak Channel

5. Click the "Save Channel" button to create the channel.

29
6. Once the channel is created, you can find the channel ID and API key in the "API Keys"
tab of the channel dashboard.

Figure 39:API Key

Figure 40:API Key of Channel

Every channel has unique API Key and Every unique API Key have unique Channel link. With
the help of this link we can easily access the channel. This link is added in arduino
programming then data automatically send on this channel.

Figure 41: API Requested link

GET https://api.thingspeak.com/update?api_key=72L8NK6XIL0UK6XT&field1=0

 What is API?
An API is a collection of protocols, procedures, and development resources for software
applications. It outlines how components should work together and enables communication
between various applications. APIs are a set of protocols, routines, and tools for building
software applications. They are used to simplify and standardize the way software components
interact, making it easier to build and integrate software applications. APIs are often used to
allow a mobile app to communicate with a backend server, or to enable different software
applications to exchange data. An API defines the methods that are available for accessing a
particular software component, and specifies the input and output parameters for each method.

30
By following the rules and protocols specified in the API, software developers can build
applications that can communicate with the software component and use its functionality.

After creating the channel, you can begin sending data to ThingSpeak from your IoT device or
application. The platform provides various options for data visualization, analysis, and alerts
that you can use to monitor and manage your data.

 Field distribution for each sensor:

There is separate field distribution for each senor in IoT Channel. Reading value of each sensor
represented in graphical form.

Table 6: Field Distribution

1. Field 1 = Soil Moisture

2. Field 2 = Light Sensor

3. Field 3 = Air Quality

4. Field 4 = Temperature

5. Field 5 = Humidity

 Field Chart of Different Sensors:

Figure 42: Field 1 is reserved for Soil Moisture Sensor

Figure 43: Field 2 Reserved for Light Sensor

31
Figure 44: Field 3 Reserved for Gas Sensor

Figure 45: Field 4 Reserved for Temperature

Figure 46: Field 5 Reserved for Humidity

32
3.8 Simulation Details:
 Simulation of Physical Data:
Proteus software is a popular simulation software that can be used to simulate and test the IoT-
based smart agriculture monitoring system before deploying it in the field. This software allows
you to simulate the behavior of the system, test the code, and verify the overall functionality of
the system. It can simulate the behavior of the Arduino board, sensors, and actuators, and test
the code that controls the actuators.

Proteus software can also verify the accuracy of the data obtained from the sensors and ensure
that the actuators are being controlled as intended based on the sensor data. It can also be used
to test the system under different environmental conditions, such as varying light intensity and
soil moisture levels, to save time and resources.

Figure 47: Proteus Simulation of Sensors

Figure 48: Proteus Simulation of LCD, NODEMCU ESP8266 Module with Arduino

33
Figure 49: Proteus Simulation of all Components

 Code for Simulation with GSM:


#include <SoftwareSerial.h>
#include <Wire.h>
#include <dht.h>
#include <LiquidCrystal_I2C.h>

dht DHT;
LiquidCrystal_I2C lcd(0x27, 16, 2);
//SoftwareSerial ESP8266(10, 11); // RX, TX (connect Arduino TX to D10,
Arduino RX to D11)

#define DHT11_PIN A3
int chk;
int humi = 0;
int temp = 0;
int soil = 0;
int light = 0;
int gas = 0;
boolean HT;

#define relay 5
#define buzzer 3

void setup()
{
Serial.begin(9600);
// ESP8266.begin(9600);
pinMode(A0, INPUT); //Soil Moisture
pinMode(A1, INPUT); //LDR

34
pinMode(A2, INPUT); //Gas Sensor
pinMode(DHT11_PIN, INPUT); //DHT11,A3
pinMode(relay, OUTPUT); //water pump
pinMode(buzzer, OUTPUT); //Alarm or Buzzer

lcd.init();
lcd.backlight();
lcd.setCursor(0, 0); //First column, first row
lcd.print("Please wait for");
lcd.setCursor(0, 1); //first column, second row
lcd.print("10 seconds.");
delay(5000);
delay(5000);
lcd.clear();
}

void loop()
{
chk = DHT.read11(DHT11_PIN); //Pin A3
temp = DHT.temperature;
humi = DHT.humidity;
soil = analogRead(A0);
light = analogRead(A1);
gas = analogRead(A2);

lcd.clear();
lcd.setCursor(0, 0); //first column, first row
lcd.print("Soil:");
soil = map(soil, 1023, 0, 0, 100); // convert data into 10-bit digital
data and make percentage between 0-100

if (soil > 60) {


digitalWrite(relay, HIGH); // turn on the pump
}
else {
digitalWrite(relay, LOW); // turn off the pump
}
lcd.print(soil);
lcd.print("%");
lcd.setCursor(0, 1); //first column, Second row
lcd.print("Light:");
light = map(light, 1023, 0, 0, 100); // convert data into 10-bit digital
data and make percentage between 0-100
lcd.print(light);
lcd.print("%");
delay(1500);
lcd.clear();
lcd.setCursor(0, 0); //first column, Second row

35
switch (chk) {
case DHTLIB_OK:
HT = true;
break;
default:
HT = false;
break;
}

if (HT) {
lcd.print("Temp:");
lcd.print(temp);
lcd.print("*C");
lcd.setCursor(0, 1); //first column, Second row
lcd.print("Humidity:");
lcd.print(humi);
lcd.print("%");
}
else {
temp = 0;
humi = 0;
lcd.print("Temp:");
lcd.print("Wait...");
lcd.setCursor(0, 1); //first column, Second row
lcd.print("Humidity:");
lcd.print("Wait...");
delay(1500);
}

lcd.clear();
lcd.setCursor(0, 0); //first column, first row
lcd.print("Air Qlt: ");
gas = map(gas, 0, 1023, 0, 100); // convert data into 10-bit digital
data and make percentage between 0-100

if (gas > 30) {


digitalWrite(buzzer, HIGH); //turn ON the alarm
}
else {
digitalWrite(buzzer, LOW); //turn OFF the Alarm
}

lcd.print(gas);
lcd.print("%");
lcd.setCursor(0, 1); //first column, Second row
delay(1000);

if (soil < 60) {


lcd.clear();

36
lcd.setCursor(0, 0); //first column, first row
lcd.print("Water Pump ON");
delay(1000);
}
else {
lcd.clear();
lcd.setCursor(0, 0); //first column, first row
lcd.print("Water Pump OFF");
delay(1000);
}

if (gas > 30) {


delay(500);
lcd.setCursor(0, 1); //first column, second row
lcd.print("Alarm is ON");
delay(500);
}
else {
lcd.clear();
delay(1000);
lcd.setCursor(0, 1); //first column, second row
lcd.print("Alarm is OFF");
delay(1000);

lcd.clear();
lcd.setCursor(0, 0); //first column, second row
lcd.print("Sending Data");
lcd.setCursor(0, 1); //first column, second row
lcd.print("to Thingspeak");

Serial.print(soil);
Serial.print(",");
Serial.print(light);
Serial.print(",");
Serial.print(gas);
Serial.print(",");
Serial.print(temp);
Serial.print(",");
Serial.print(humi);
Serial.println();
}
}
Send_data();
}
void modem_init()
{
Serial.println("Please wait.....");
gsm.println("AT");
delay(1000);

37
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CNMI=2,2,0,0,0");
delay(1000);
}
void data_init()
{
Serial.println("Please wait.....");
gsm.println("AT");
delay(1000);
delay(1000);
Serial.println("AT+CPIN?");
gsm.println("AT+CPIN?");
delay(1000);
delay(1000);
gsm.print("AT+SAPBR=3,1");
gsm.write(',');
gsm.write('"');
gsm.print("contype");
gsm.write('"');
gsm.write(',');
gsm.write('"');
gsm.print("GPRS");
gsm.write('"');
gsm.write(0x0d);
gsm.write(0x0a);
delay(1000); ;
gsm.print("AT+SAPBR=3,1");
gsm.write(',');
gsm.write('"');
gsm.print("APN");
gsm.write('"');
gsm.write(',');
gsm.write('"');
//------------APN------------//
gsm.print("internet"); //APN Here
//--------------------------//
gsm.write('"');
gsm.write(0x0d);
gsm.write(0x0a);
delay(1000);
gsm.print("AT+SAPBR=3,1");
gsm.write(',');
gsm.write('"');
gsm.print("USER");
gsm.write('"');
gsm.write(',');
gsm.write('"');
gsm.print(" ");

38
gsm.write('"');
gsm.write(0x0d);
gsm.write(0x0a);
delay(1000);
gsm.print("AT+SAPBR=3,1");
gsm.write(',');
gsm.write('"');
gsm.print("PWD");
gsm.write('"');
gsm.write(',');
gsm.write('"');
gsm.print(" ");
gsm.write('"');
gsm.write(0x0d);
gsm.write(0x0a);
delay(2000);
gsm.print("AT+SAPBR=1,1");
gsm.write(0x0d);
gsm.write(0x0a);
delay(3000);
}
void internet_init()
{
Serial.println("Please wait.....");
delay(1000);
gsm.println("AT+HTTPINIT");
delay(1000);
delay(1000);
gsm.print("AT+HTTPPARA=");
gsm.print('"');
gsm.print("CID");
gsm.print('"');
gsm.print(',');
gsm.println('1');
delay(1000);
}
void Send_data()
{
lcd.clear();
lcd.print("Sending the data");
lcd.setCursor(0, 1);
lcd.print("to Thingspeak...");
delay(1500);
gsm.print("AT+HTTPPARA=");
gsm.print('"');
gsm.print("URL");
gsm.print('"');
gsm.print(',');
gsm.print('"');

39
gsm.print("http:");
gsm.print('/');
gsm.print('/');
//-----------------------Your API Key Here-----------------------//
//Replace xxxxxxxxxxx with your write API key.
gsm.print("api.thingspeak.com/update?api_key=E0RDJKWFWW5ODDGV&field1=");
// https://api.thingspeak.com/update?api_key=E0RDJKWFWW5ODDGV&field1=0
//---------------------------------------------------------------//
gsm.print(soil);// >>>>>> variable 1
gsm.print("&field2=");
gsm.print(light); // >>>>>> variable 2
gsm.print("&field3=");
gsm.print(gas); // >>>>>> variable 3
gsm.print("&field4=");
gsm.print(temp); // >>>>>> variable 4
gsm.print("&field5=");
gsm.print(humi); // >>>>>> variable 5
gsm.write(0x0d);
gsm.write(0x0a);
delay(1000);
gsm.println("AT+HTTPACTION=0");
delay(1000);
}

 Code for NodeMCU ESP8266

#include <ESP8266WiFi.h>
#include <ThingSpeak.h>

const char* ssid = "test";


const char* password = "12345678";

unsigned long channelID = 2065335;


const char* apiKey = "72L8NK6XIL0UK6XT";

WiFiClient client;

void setup() {
Serial.begin(9600);
delay(1000);

WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}

ThingSpeak.begin(client); // Initialize ThingSpeak client


}

40
void loop() {
if (Serial.available() > 0) {
String data = Serial.readStringUntil('\n');

// Parse the received data


int commaIndex1 = data.indexOf(',');
int commaIndex2 = data.indexOf(',', commaIndex1 + 1);
int commaIndex3 = data.indexOf(',', commaIndex2 + 1);
int commaIndex4 = data.indexOf(',', commaIndex3 + 1);

String soilStr = data.substring(0, commaIndex1);


String lightStr = data.substring(commaIndex1 + 1, commaIndex2);
String gasStr = data.substring(commaIndex2 + 1, commaIndex3);
String tempStr = data.substring(commaIndex3 + 1, commaIndex4);
String humiStr = data.substring(commaIndex4 + 1);

// Convert string data to integers


int soil = soilStr.toInt();
int light = lightStr.toInt();
int gas = gasStr.toInt();
int temp = tempStr.toInt();
int humi = humiStr.toInt();

// Send data to ThingSpeak


ThingSpeak.writeField(channelID, 1, soil, apiKey);
ThingSpeak.writeField(channelID, 2, light, apiKey);
ThingSpeak.writeField(channelID, 3, gas, apiKey);
ThingSpeak.writeField(channelID, 4, temp, apiKey);
ThingSpeak.writeField(channelID, 5, humi, apiKey);

Serial.println("Data sent to ThingSpeak.");


delay(1000);
}
}

 Remotely Access IoT Channel from Desktop over the Internet from the worldwide:
We can easily access main controller from our desktop. We need to just install any web
browser. Like, Chrome, Mozilla Firefox and Microsoft Edge or etc. After Installing anyone of
browser. Just go on thingspeak official link. Link is following below:
https://thingspeak.com/
Just visit this website and login your account by adding required Email and Password. Then
we can easily Access and no need an extra knowledge to access IoT Channel.

41
Figure 50: Email Interface

Figure 51:Password Interface

 IoT Channel Main GUI accessible from Worldwide:

Figure 52: Channel GUI Accessible over worldwide

42
Chapter 4
Testing and Validation

3.9 Testing:
4.1.1 Prototype:
 Physical Data Gathering through Soil Moisture Sensor and Wireless Sensor
Network:

Firstly, the sensor will get power. In order we need to connect other connections of sensor with
arduino. Like ground GND and Analog Pin A0. Without these Pins Sensor cannot work
properly. If any mistake during connection, we need check whole wiring connection before
turn it on. Vcc Pin connect with any Digital Pin. For this we need to declared Digital Pin as an
output. Otherwise we can provide them some other external power supply. We need to Provide
full voltage to sensor until sensor’s Power LED ON.

Figure 53: Soil Moisture Sensor Integrated with Arduino UNO

 Calibration:

A build in potentiometer is available with sensor. From this potentiometer we can easily set the
threshold voltage of sensor. If we set maximum threshold voltage it means that sensitivity is
LOW but if threshold voltage is minimum it means that sensitivity is HIGH. If sensitivity is
HIGH, it means that sensor easily caught any small change in moisture level otherwise it will
take more time to sense the moisture level.

During, working we can adjust the threshold voltage according to our needs and requirements.
After completing setup our sensor is ready for measure the moisture level.

 Code for it:

// Define the pin that the soil moisture sensor is connected to

const int soilMoisturePin = A0;

void setup ()

43
{

// Start the serial communication at 9600 baud

Serial.begin(9600);

void loop ()

// Read the value from the soil moisture sensor

int soilMoistureValue = analogRead(soilMoisturePin);

// Convert the analog value to a percentage (assuming a range of 0-1023)

int soilMoisturePercentage = map (soilMoistureValue, 0, 1023, 0, 100);

// Print the soil moisture percentage to the serial monitor

Serial.print("Reading From the Sensor…");

Serial.print("Moisture: ");

Serial.print(soilMoisturevalue);

Serial.println("%");

// Wait for 1 second before reading again

delay (1000);

 Serial Monitor:

Figure 54: Serial Monitor Showing the values of Soil Moisture

44
 Tested

We have tested two type of soil:

 Dry Soil
 Wet Soil
 Detecting Toxic Gases Through Gas Sensor MQ-135:

Firstly, Sensor is Powered. In ordered like above sensor connected sensor Pins with arduino.
Like: GND, A0 and D0. With the combination of +5V and GND sensor is now and start
working. But with A0 Pins sensor give some inputs as a Voltage of gathered data. In this way
sensor working. This Sensor able to detect smoke, methane gas, Alcohol, Carbon- monoxide
or etc. According to datasheet this family of MQ-Sensors able to detect all kind of gases.

Figure 55: Gas Sensor Integrated with Arduino Uno

 Calibration:

The Build in Potentiometer is available in Module. With this potentiometer we can adjust the
sensitivity level of sensor. If sensitivity level is HIGH, it means sensor detect easily very small
change in gas. If sensitivity level is LOW, it means sensor take some delay to detect any small
change in gas. We can easily adjust this potentiometer according to our need and requirement.

Figure 56: Build Potentiometer Available for Adjusting Sensor Sensitivity

45
 Code for it:

/* Change the threshold value with your own reading */

#define Threshold 400

#define MQ2pin 0

float sensorValue; //variable to store sensor value

void setup() {
Serial.begin(9600); // sets the serial port to 9600
Serial.println("MQ2 warming up!");
delay(20000); // allow the MQ2 to warm up
}

void loop() {
sensorValue = analogRead(MQ2pin); // read analog input pin 0

Serial.print("Sensor Value: ");


Serial.print(sensorValue);

if(sensorValue > Threshold)


{
Serial.print(" | Smoke detected!");
}

Serial.println("");
delay(2000); // wait 2s for next reading
}
 Serial Monitor:

Figure 57: Gas Sensor Reading on Serial Monitor

 Measure Intensity of Light through Light Dependent Resistor (LDR):

46
Firstly, Sensor is energized through Arduino. In ordered like above sensors connected sensor
pins with arduino. Like: A0, D0 and Ground. With the combination of +5V and Ground sensor
is now powered on and start working. But with A0 Pins sensor give some inputs to arduino as
a voltage of gathered data. In this way sensor working. This Sensor able to measure the intensity
of Light.

Figure 58: Light Dependent Resistor (LDR) Connected with Arduino

 Code for it:

void setup()

Serial.begin(9600);

void loop()

unsigned int Light;

Light = analogRead(A0); // read A0 Pin of arduino

Serial.println(Light);

47
 Serial Monitor:

Figure 59: Light Dependent Resistor Reading on Serial Monitor

 Measure Temperature and Humidity Level through Sensor DHT11:

Firstly, Sensor is energized through Arduino or an external power source. In ordered like above
sensors connected sensor pins with arduino. Like: Vcc, Data and Ground. With the combination
of +5V and Ground sensor is now powered on and start working. But with Data Pin of sensor
give some inputs to arduino as a voltage of gathered data or values. In this way sensor working.
After this, now sensor is able to measure the Temperature and Humidity level.

Figure 60: DH11 Sensor Integrated with Arduino

 Code for it:

#include <dht.h>
#define outPin 8
dht DHT;
void setup() {
Serial.begin(9600);

48
}

void loop() {
int readData = DHT.read11(outPin);

float t = DHT.temperature;
float h = DHT.humidity;

Serial.print("Temperature = ");
Serial.print(t);
Serial.print("°C | ");
Serial.print((t*9.0)/5.0+32.0);
Serial.println("°F ");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println("% ");
Serial.println("");

delay(2000); // wait two seconds


}
 Serial Monitor:

Figure 61: DHT11 Reading on Serial Monitor

 Serial Communication Between Arduino and NODE MCU ESP8266:

An effective substitute to switch to utilizing a NODE MCU (NodeMCU ESP8266) for


delivering data to Thingspeak via serial connection between Arduino and NodeMCU. A
flexible microcontroller with in-built Wi-Fi capabilities, the NodeMCU ESP8266 is a good
choice for Internet of Things applications. Without an additional NODE MCU ESP8266
module, you may connect directly to the internet and interact with Thingspeak by utilizing the
NodeMCU ESP8266. The UART (Universal Asynchronous Receiver-Transmitter) interface
enables serial communication between Arduino and NodeMCU. The NodeMCU may manage
the data delivery to Thingspeak using its Wi-Fi capabilities after receiving data from the
Arduino through serial connection.

49
Make sure the relevant serial pins are connected on both the Arduino and NodeMCU in order
to initiate communication between them. By writing to the serial interface, the Arduino may
transmit data to the NodeMCU, and the NodeMCU can receive this data using serial
communication. When the NodeMCU gets the data from the Arduino, it may format and
process it in accordance with the demands of the Thingspeak API. The prepared data may then
be sent to the Thingspeak server using the HTTP or MQTT protocols when the NodeMCU
establishes an internet connection via Wi-Fi.

There are various benefits of sending data to Thingspeak via the NodeMCU ESP8266. A
separate NODE MCU ESP8266 module is no longer required thanks to the integrated Wi-Fi
capabilities, which lowers costs and streamlines the hardware configuration. The NodeMCU is
also a strong microcontroller with the ability to handle complicated jobs, allowing for effective
data processing and formatting before transmission to Thingspeak. Overall, switching from the
Arduino to the NodeMCU ESP8266 for serial connection offers up new opportunities for
dependable and effective IoT-based data transfer. It gives more flexibility in data processing
and transmission and seamlessly integrates Wi-Fi capabilities. It also makes hardware
configuration easier.

Figure 62: Serial Communication Between Arduino and NODE MCU

 Serial Monitor:

Figure 63: Output of NODEMCU on Serial Monitor

50
Figure 64: Arduino Sending Sensors Data in a String to NODEMCU ESP8266

3.10 Result:
The Output of Different Sensors is Shown Below. These reading shown on Laptop. But We
Can Monitor easily these parameters on Cell Phone. All internet GPRS supported cell phones
can show these graphical readings on thingspeak.

Figure 65: Soil Moisture and Light Sensor Real Time Reading on Thingspeak

Figure 66: Gas Sensor and Temperature Sensor Real Time Readings on Thingspeak

51
Figure 67: All Sensors Readings Graphical Representation on Thingspeak

52
Figure 68: Access Readings of Sensors from Cell Phone

53
Chapter 5
Conclusion and Future Recommendations

3.11 Conclusion
In conclusion, the IoT-based smart agriculture monitoring system offers a practical and
effective solution for farmers to monitor and optimize the growth of their crops. By collecting
and analyzing data on various environmental factors such as temperature, humidity, soil
moisture, and light intensity, the system provides farmers with valuable insights into the health
and growth of their crops. Through the use of sensors, the system can detect potential problems
such as pests, diseases, and nutrient deficiencies, allowing farmers to take prompt action to
prevent or mitigate these issues. The system also enables farmers to automate various tasks
such as irrigation and fertilization, saving time and resources while improving crop yields.

Looking to the future, there is great potential for further advancements in smart agriculture
technology. For example, integrating artificial intelligence and machine learning algorithms
could improve the accuracy of data analysis and prediction of crop growth and yield.
Additionally, incorporating drone technology for aerial monitoring of crops could provide even
more detailed insights into crop health and growth.

3.12 Future Recommendation:


In terms of recommendations, it is important for further research and development to focus on
making smart agriculture technology more accessible and affordable for small-scale farmers
who may not have the resources to invest in expensive equipment. Additionally, efforts should
be made to address any potential privacy and security concerns related to the collection and
storage of sensitive agricultural data.

Overall, the IoT-based smart agriculture monitoring system has the potential to revolutionize
the way we approach farming and food production, offering a more sustainable, efficient, and
profitable approach to agriculture.

54
References
[1] Rawal, S. (2017). IOT based smart irrigation system. International Journal of Computer
Applications, 159(8), 7-11.

[2] García, L., Parra, L., Jimenez, J. M., Lloret, J., & Lorenz, P. (2020). IoT-based smart
irrigation systems: An overview on the recent trends on sensors and IoT systems for irrigation
in precision agriculture. Sensors, 20(4), 1042.

[3] Nawandar, N. K., & Satpute, V. R. (2019). IoT based low cost and intelligent module for
smart irrigation system. Computers and electronics in agriculture, 162, 979-990.

[4] Saraf, S. B., & Gawali, D. H. (2017, May). IoT based smart irrigation monitoring and
controlling system. In 2017 2nd IEEE International Conference on Recent Trends in
Electronics, Information & Communication Technology (RTEICT) (pp. 815-819). IEEE

[5] Shekhar ,Y. Dagur, E. Mishra, S. & Sankaranarayanan, S. (2017). Intelligent IoT based
automated irrigation system. International Journal of Applied Engineering Research, 12(18),
7306-7320

[6] Pernapati, K. (2018, April). IoT based low cost smart irrigation system. In 2018 Second
International Conference on Inventive Communication and Computational Technologies
(ICICCT) (pp. 1312-1315). IEEE.

[7] Kansara, K., Zaveri, V., Shah, S., Delwadkar, S., & Jani, K. (2015). Sensor based
automated irrigation system with IOT: A technical review. International Journal of Computer
Science and Information Technologies, 6(6), 5331-5333.

[8] Rajkumar, M. N., Abinaya, S., & Kumar, (2017, March). Intelligent irrigation system An
IOT based approach. In 2017 International Conference on Innovations in Green Energy and
Healthcare Technologies (IGEHT) (pp. 1-5). IEEE.

[9] Obaideen, K., Yousef, B. A., AlMallahi, M. N., Tan, Y. C., Mahmoud, M., Jaber, H., &
Ramadan, M. (2022). An overview of smart irrigation systems using IoT. Energy Nexus,
100124.

[10] Rau, A. J., Sankar, J., Mohan, A. R., Krishna, D. D., & Mathew, J. (2017, July). IoT
based smart irrigation system and nutrient detection with disease analysis. In 2017 IEEE
Region 10 Symposium (TENSYMP) (pp. 1-4). IEEE. 66

[11] Goap, A., Sharma, D., Shukla, A. K., & Krishna, C. R. (2018). An IoT based smart
irrigation management system using Machine learning and open source technologies.
Computers and electronics in agriculture, 155, 41-49.

[12] Krishnan, R. S., Julie, E. G., Robinson, Y. H., Raja, S., Kumar, R., & Thong, P. H.
(2020). Fuzzy logic based smart irrigation system using internet of things. Journal of Cleaner
Production, 252, 119902.

[13] Mishra, D., Khan, A., Tiwari, R., & Upadhay, S. (2018, February). Automated irrigation
system-IoT based approach. In 2018 3rd International conference on internet of things: Smart
Innovation and Usages (IoT-SIU) (pp. 1-4). IEEE.

55
[14] Benyezza, H., Bouhedda, M., Djellout, K., & Saidi, A. (2018, November). Smart
irrigation system based ThingSpeak and Arduino. In 2018 International conference on applied
smart systems (ICASS) (pp. 1-4). IEEE.

[15] VinothKumar, V., Ramasamy, R., Janarthanan, S., & Vasim Babu, M. (2017).
Implementation of IOT in smart irrigation system using arduino processor. International
Journal of Civil Engineering and Technology (IJCIET).

[16] Nandhini, R., Poovizhi, S., Jose, P., Ranjitha, R., & Anila, S. (2017, March). Arduino
based smart irrigation system using IoT. In 3rd National Conference on Intelligent
Information and Computing Technologies (IICT ‘17) (pp. 1-5).

[17] Ragab, M. A. (2022). IoT based smart irrigation system. International Journal of Industry
and Sustainable Development, 3(1), 76-86.

56
57
View publication stats

You might also like