JHJHJHJH Merged
JHJHJHJH Merged
A
Minor Project Report
Submitted
In partial fulfilment
for the award of degree of
This Team
(Anshika Goyal, Darpan Jajoo, Garvit Maheshwari, Nitika Singh, Ranjak Bhoola)
This project, involving the benefits of using the IOT devices for the benefits of
environment via agriculture field. The project focuses on that how the smart agriculture
can be done in the era of internet where the farmer can water the field according to
the soil, moisture, humidity conditions in the environment. One can control the above
functionalities with the help of their smartphone from anywhere in the world.
Date of Completion:
Signature
Guest Faculty
i
ACKNOWLEDGEMENT
First of all I am grateful to the UDRTU, Kota for arranging the seminar student program which
leads me to learn how to do professional research and summarize all the great information that
I gathered during my research.
I would also like to thank my great supervisor Dr. Sapna Gupta Ma’am. I am really fortunate
that, I had the kind and humble guidance of sir. I am absolutely sure that the experience I got
during this program will help me somewhere in future.
Lastly, I would like to express my appreciation to the institution for providing the necessary
resources and support for the project.
This project would not have been possible without the collective efforts of all those mentioned
above, and I am truly thankful for their invaluable contributions.
ii
ABSTRACT
This college project presents an innovative IoT-based Smart Irrigation System designed for
efficient crop watering. Leveraging advanced technologies such as IoT and microcontrollers,
the system integrates soil moisture sensors to monitor and automate irrigation based on real-
time soil conditions. The prototype, illustrated in report includes temperature and humidity
monitoring, providing a comprehensive approach to precision agriculture.
The project addresses the critical need for sustainable water management in agriculture by
offering a solution that optimizes water usage through intelligent automation. The use of IoT
facilitates remote monitoring and control, enhancing the system's adaptability to diverse
agricultural landscapes. The implementation of this system aligns with the broader goals of
achieving Sustainable Development Goals (SDGs) in agriculture.
Key features include the integration of Microcontroller NodeMCU ESP8266 for seamless
communication and control. The successful development and deployment of this IoT-based
Smart Irrigation System contribute to ongoing research in the field, emphasizing the role of
technology in promoting resource-efficient and environmentally conscious agricultural
practices.
iii
Content
Certificate……………………………………………………………………………………...i
Acknowledgement……………………………………………………………………………ii
Abstract………………………………………………………………………………………iii
Content……………………………………………………………………………………….iv
List of Figure…………………………………………………………………………………vi
List of Table…………………………………………………………………………………vii
Chapter 1 INTRODUCTION………………………………………………………………1
1.1 Farming Dynamics……………………………..…………………………………………1
Chapter 2 SOFTWARECOMPONENTS………………………...……………………….2
Chapter 3 HARDWARECOMPONENTS…………..……………………………………..7
iv
3.9 Single Relay Module………………………………...………………………………….21
3.10 Buzzer………………………………………………………………………………….23
4.1 Approach……………………………………………..………………………………….27
4.6 Code……………………………………………………………………………………..35
Chapter 6 CONCLUSIONS………………………………...……………………………..40
REFERENCES………………………………………………...…………………..……….41
v
LIST OF FIGURE
vi
LIST OF TABLES
vii
CHAPTER 1
INTRODUCTION
The worldwide population is anticipated to contact 9.6 billion by 2050 – this represents a
major issue for the farming business. Regardless of fighting difficulties like extraordinary
climate conditions, rising environmental change, and cultivating's ecological effect, the
interest for more food must be met. To meet these expanding needs, farming needs to go to
new innovation. New savvy cultivating applications dependent on IoT advances will
empower the horticulture business to decrease waste and upgrade profitability from
enhancing manure use to expanding the productivity of ranch vehicles' courses.
For continuously increasing demand and decrease in supply of food necessities, it’s important
to rapid improvement in production of food technology. Agriculture is only the source to
provide this. This is the important factor in human societies to growing and dynamic demand
in food production. Agriculture plays the important role in the economy and development,
like India. Due to lack of water and scarcity of land water result the decreasing volume of
water on earth, the farmer use irrigation. Irrigation may be defined as the science of artificial
application of water to the land or soil that means depending on the soil type, plant are to be
provided with water.
Smart farming is a capital-intensive and hi-tech system of growing food cleanly and
sustainable for the masses. It is the application of modern ICT (Information and
Communication Technologies) into agriculture. In IoT-based shrewd cultivating, a
framework is worked for checking the yield field with the assistance of sensors (light,
stickiness, temperature, soil dampness, and so on.) and robotizing the water system
framework. The ranchers can screen the field conditions from anyplace. IoT-based brilliant
cultivating is profoundly productive when contrasted and the traditional methodology [1].
The uses of IoT-based savvy cultivating objective ordinary, huge cultivating tasks, yet could
likewise be new switches to elevate other developing or regular patterns in rural like natural
1
cultivating, family cultivating (perplexing or little spaces, specific cows and additionally
societies, protection of specific or great assortments, nd so forth.), and upgrade profoundly
straightforward cultivating.[2]
As far as natural issues, IoT-based keen cultivating can give incredible advantages including
increasingly effective water utilization, or advancement of information sources and
medicines.
2
CHAPTER 2
SOFTWARE COMPONENTS
The ATMega328p microcontroller IC with Arduino bootloader makes a lot of work easier in
this project as Arduino code is written in C++ with an addition of special methods and
functions, which we’ll mention later on. C++ is a human-readable programming language.
When you create a ‘sketch’ (the name given to Arduino code files), it is processed and
compiled to machine language.
The Arduino Integrated Development Environment (IDE) is the main text editing program
used for Arduino programming. It is where you’ll be typing up your code before uploading it
to the board you want to program. Arduino code is referred to as sketches.[3]
3
2.2 Blynk IoT: Android/Web App
A scope of Arduino modules accessible including Arduino Uno, Arduino Mega, Arduino
Leonardo, Arduino Micro and some more with no earlier specialized information can
consider going all in with the learning procedure.
It is easily available for operating systems like MAC, Windows, Linux and runs on the Java
Platform that comes with inbuilt functions and each of them contains a microcontroller on the
board that is really modified and acknowledges the data as code.[11]
Blynk is an IoT (Internet of Things) stage utilizing which you can without much of a stretch
and distantly control equipment. Furthermore, you can likewise see sensor information, store
the information, picture the information and so on everywhere. Talking about equipment, the
Blynk stage bolsters a wide scope of sheets and MCUs like: here throughout the web.
4
2.3 Arduino Libraries
2.3.1 ESP8266WiFi
The Wi-Fi library for ESP8266 has been developed based on ESP8266 SDK, using the
naming conventions and overall functionality philosophy of the Arduino Wi-Fi library. Over
time, the wealth of Wi-Fi features ported from ESP8266 SDK to esp8266 / Arduino outgrew
Arduino Wi-Fi library and it became apparent that we would need to provide separate
documentation on what is new and extra.
In the first line of the sketch, #include <ESP8266WiFi.h> we are including the ESP8266WiFi
library. This library provides ESP8266 specific Wi-Fi routines that we are calling to connect
to the network.
2.3.2 Blynk
Blynk Library is an extension that runs on top of your hardware application. It handles all the
connection routines and data exchange between your hardware, Blynk Cloud, and your app
project. [8]
Blynk is the most popular Internet of Things platform for connecting any hardware to the
cloud, designing apps to control them, and managing your deployed products at scale.
• With Blynk Library you can connect over 400 hardware models (including ESP8266,
ESP32, NodeMCU, all Arduinos, Raspberry Pi, Particle, Texas Instruments, etc.)to
the Blynk Cloud. Full list of supported hardware can be found here.
• With Blynk apps for iOS and Android apps you can easily drag-n-drop graphic
interfaces for any DIY or commercial project. It's a pure WYSIWG experience: no
coding on iOS or Android required.
• Hardware can connect to Blynk Cloud (open-source server) over the Internet using
hardware connectivity available on your board (like ESP32), or with the use of
various shields (Ethernet, WiFi, GSM, LTE, etc). Blynk Cloud is available for every
user of Blynk for free. Direct connection over Bluetooth is also possible.
5
2.3.3 DHTesp
The DHT11 and DHT22 sensors are used to measure temperature and relative humidity.
These are very popular among makers and electronics hobbyists. These sensors contain a chip
that does analog to digital conversion and spit out a digital signal with the temperature and
humidity. This makes them very easy to use with any microcontroller. [12]
Arduino ESP library for DHT11, DHT22, etc Temp & Humidity Sensors Optimized library
to match ESP32 requirements.
These sensors contain a chip that does analog to digital conversion and spit out a digital
signal with the temperature and humidity. This makes them very easy to use with any
microcontroller.
In the first line of the sketch, #include <DHTesp.h> we are including the DHT library. This
library provides DHT sensor to interface with the microcontroller by using the dedicated
functions we can read the sensor readings in user readable format.
2.3.4 NTPClient
The Network Time Protocol (NTP) is a client/server application. Each workstation, router, or
server must be equipped with NTP client software to synchronize its clock to the network
time server. In most cases the client software is already resident in the operating system of
each device.
Two steps are all that is required to establish your synchronized network time source:
It is not necessary to purchase expensive client software. In most cases, the client software is
already resident in the operating system of the workstation, server, or router. In other cases, it
is available as freeware, shareware, or inexpensive applications.
6
CHAPTER 3
HARDWARE COMPONENTS
The NodeMCU ESP8266 development board comes with the ESP-12E module containing
ESP8266 chip having Tensilica Xtensa 32-bit LX106 RISC microprocessor. This
microprocessor supports RTOS and operates at 80MHz to 160 MHz adjustable clock
frequency. NodeMCU has 128 KB RAM and 4MB of Flash memory to store data and
programs. Its high processing power with in-built Wi-Fi / Bluetooth and Deep Sleep
Operating features make it ideal for IoT projects.[4]
NodeMCU can be powered using Micro USB jack and VIN pin (External Supply Pin). It
supports UART, SPI, and I2C interface.
7
The NodeMCU Development Board can be easily programmed with Arduino IDE since it is
easy to use.
Programming NodeMCU with the Arduino IDE will hardly take 5-10 minutes. All you need
is the Arduino IDE, a USB cable and the NodeMCU board itself. You can check this Getting
Started Tutorial for NodeMCU to prepare your Arduino IDE for NodeMCU. [5]
8
Table 3.1: NodeMCU Pin Description
Control EN, RST The pin and the button reset the microcontroller
Pins
SPI Pins SD1, CMD, NodeMCU has four pins available for SPI
SD0, CLK communication.
UART Pins TXD0, NodeMCU has two UART interfaces, UART0 (RXD0 &
RXD0, TXD0) and UART1 (RXD1 & TXD1). UART1 is used to
TXD2, RXD2 upload the firmware/program.
I2C Pins NodeMCU has I2C functionality support but due to the
internal functionality of these pins, you have to find
which pin is I2C.
9
3.2 Soil Sensor
The Soil Moisture Sensor Module determines the amount of soil moisture by measuring the
resistance between two metallic probes that is inserted into the soil to be monitored. This can
be used in an automatic plant watering system or to signal an alert of some type when a plant
needs watering.
These sensors work by measuring the resistance between the two probes of the fork that is
inserted into the soil. That resistance will depend mostly on the moisture content of the soil.
The resistance affects a voltage divider and so an analog voltage output is available which
can be read by an analog input on a uC that roughly corresponds to the moisture content of
the soil. [6]
The more moisture in the soil, the lower the resistance. A low resistance gives a low analog
voltage reading. As the soil dries out, the resistance increases. The higher the resistance
(drier the soil), the higher the voltage will be.
Besides the analog output, there is also a LM393 comparator IC that provides a HIGH output
when that analog voltage goes above a certain level. A potentiometer on the module allows
the set-point of this digital output to be adjusted. This output could be used to drive a relay to
activate a small water pump to water the plant without necessarily having a uC in the loop.
An LED lights when this output goes HIGH.
Besides moisture, there are other factors that can affect the resistance including minerals that
are dissolved in the water which can come from fertilizers and other sources. The full length
of the forks should be inserted into the soil, but the upper part with the electrical connections
should remain dry to minimize corrosion. The depth that the forks are inserted will affect the
readings and therefore should be kept reasonably constant. [6]
It is not possible to directly define an actual percentage of moisture in the soil from the
measurements taken, but it is fairly straightforward to define basic ranges for what would be
considered ‘too dry’, ‘too wet’ and ‘just right’.
10
To do that, measure the soil under 3 basic conditions:
• When watered so it has the desired amount of moisture that would be ideal for the
plant
• When watered so the soil is too wet and not ideal for the plant.
From those 3 measurements, ranges for each of the 3 conditions can be initially determined
and then honed in on once the setup goes into operation.
On most microcontrollers like Arduino, the ADC is 10-bit, so the measurement has a range of
0-1023. When the sensor is dry in open air, the ADC will read close to the upper limit of
1023. From a test, that reading was 985-1000. When the sensor was inserted into a cup of
clean water, the reading dropped to about 445. Adding a little salt to increase conductivity as
you might have from minerals dissolved in the water in the soil lowered the reading to about
300. This is with a 5V microcontroller.
11
3.3 Rain Sensor
A rain sensor or rain switch is a switching device activated by rainfall. There are two main
applications for rain sensors. The first is a water conservation device connected to an
automatic irrigation system that causes the system to shut down in the event of rainfall. The
second is a device used to protect the interior of an automobile from rain and to support the
automatic mode of windscreen wipers. An additional application in professional satellite
communications antennas is to trigger a rain blower on the aperture of the antenna feed, to
remove water droplets from the mylar cover that keeps pressurized and dry air inside the
wave-guides. [6]
The sensing pad with series of exposed copper traces, together acts as a variable resistor (just
like a potentiometer) whose resistance varies according to the amount of water on its surface.
• The more water on the surface means better conductivity and will result in a lower
resistance.
• The less water on the surface means poor conductivity and will result in a higher
resistance.
The sensor produces an output voltage according to the resistance, which by measuring we
can determine whether it’s raining or not.
The sensor contains a sensing pad with series of exposed copper traces that is placed out in
the open, possibly over the roof or where it can be affected by rainfall. These traces are not
connected but are bridged by water.
12
3.4 Moisture Sensor Module (LM393)
The module produces an output voltage according to the resistance of the probe and is made
available at an Analog Output (AO) pin. The same signal is fed to a LM393 High Precision
Comparator to digitize it and is made available at a Digital Output (DO) pin.
The module has a built-in potentiometer for sensitivity adjustment of the digital output (DO).
You can set a threshold by using a potentiometer; So that when the moisture level exceeds the
threshold value, the module will output LOW otherwise HIGH.
This setup is very useful when you want to trigger an action when certain threshold is
reached. For example, when the moisture level in the soil crosses a threshold, you can
activate a relay to start pumping water. You got the idea!
Apart from this, the module has two LEDs. The Power LED will light up when the module is
powered. The Status LED will light up when the digital output goes LOW.
13
Pin Layout for the module:
• AO (Analog Output) pin gives us an analog signal between the supply value to 0V
and will be connected to one of the analog inputs on your Arduino.
• DO (Digital Output) pin gives Digital output of internal comparator circuit. You can
connect it to any digital pin on an Arduino or directly to a 5V relay or similar device.
• VCC pin supplies power for the sensor. It is recommended to power the sensor with
between 3.3V – 5V. Please note that the analog output will vary depending on what
voltage is provided for the sensor.
LM393 Comparator IC is used as a voltage comparator in this Moisture sensor module. Pin 2
of LM393 is connected to Preset (10KΩ Pot) while pin 3 is connected to Moisture sensor pin.
The comparator IC will compare the threshold voltage set using the preset (pin2) and the
sensor pin (pin3).
14
3.5 Temperature and Humidity Sensor (DHT11):
The DHT11 is a basic, ultra-low-cost digital temperature and humidity sensor. It uses a
capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a
digital signal on the data pin (no analog input pins needed). It’s fairly simple to use but
requires careful timing to grab data. The only real downside of this sensor is you can only get
new data from it once every 2 seconds, so when using our library, sensor readings can be up
to 2 seconds old. [6]
DHT11 humidity and temperature sensor is available as a sensor and as a module. The
difference between this sensor and module is the pull-up resistor and a power-on LED.
DHT11 is a relative humidity sensor. To measure the surrounding air this sensor uses a
thermistor and a capacitive humidity sensor.
DHT11 sensor consists of a capacitive humidity sensing element and a thermistor for sensing
temperature. The humidity sensing capacitor has two electrodes with a moisture holding
substrate as a dielectric between them. Change in the capacitance value occurs with the
change in humidity levels. The IC measure, process this changed resistance values and
change them into digital form.
15
For measuring temperature this sensor uses a Negative Temperature coefficient thermistor,
which causes a decrease in its resistance value with increase in temperature. To get larger
resistance value even for the smallest change in temperature, this sensor is usually made up of
semiconductor ceramics or polymers.
Fig. 3.8: DHT11 Temperature and Humidity Sensor Module with Pinout
This sensor is used in various applications such as measuring humidity and temperature
values in heating, ventilation and air conditioning systems. Weather stations also use these
sensors to predict weather conditions. The humidity sensor is used as a preventive measure
in homes where people are affected by humidity. Offices, cars, museums, greenhouses and
industries use this sensor for measuring humidity values and as a safety measure.
Some of its applications include camera light meters, streetlights. On the top and bottom are
metal films which are connected to the terminal leads. It is designed in such a way as to
16
provide maximum possible contact area with the two metal films. The structure is housed in a
clear plastic or resin case, to provide free access to external light. As explained above, the
main component for the construction of LDR is cadmium sulphide (CdS), which is used as
the photoconductor and contains no or very few electrons when not illuminated.
In the absence of light, it is designed to have a high resistance in the range of mega ohms. As
soon as light falls on the sensor, the electrons are liberated and the conductivity of the
material increases. When the light intensity exceeds a certain frequency, the photons
absorbed by the semiconductor give band electrons the energy required to jump into the
conduction band. This causes the free electrons or holes to conduct electricity and thus
dropping the resistance dramatically (< 1 Kilo ohm).
The resistance range and sensitivity of a photoresistor can substantially differ among
dissimilar devices. Moreover, unique photoresistors may react substantially differently to
photons within certain wavelength bands. [7]
The solar tracker system will obtain its data from two CDS (Cadmium Sulphide) photocells,
which are type of LDR. The material used in CDS photocell is of high resistance
semiconductor. Therefore, once light falls on its surface, photons absorbed by the
semiconductor will give bound electrons enough energy to jump into the conduction band. As
a result, free electrons conduct electricity and thus lower the resistance. In case of high
17
intensity, the photocell will produce the lowest resistance, the opposite will occur in case of
complete darkness.
Grow lights either attempt to provide a light spectrum similar to that of the sun, or to provide
a spectrum that is more tailored to the needs of the plants being cultivated. Outdoor
conditions are mimicked with varying color, temperatures and spectral outputs from the grow
light, as well as varying the intensity of the lamps. Depending on the type of plant being
cultivated, the stage of cultivation (e.g. the germination/vegetative phase or the
flowering/fruiting phase), and the photoperiod required by the plants, specific ranges of
spectrum, luminous efficacy and color temperature are desirable for use with specific plants
and time periods.
These can be controlled as simple LED’s with the Arduino, but these lights help in crops
growth. LED grow lights are composed of multiple individual light-emitting diodes, usually
in a casing with a heat sink and built-in fans.
Individual LEDs usually provide only a single narrow range of colors, and so different color
LEDs are mixed in grow lights in proportions depending on the intended use. It is known
18
from the study of photomorphogenesis that green, red, far-red and blue light spectra have an
effect on root formation, plant growth, and flowering, but there are not enough scientific
studies or field-tested trials using LED grow lights to recommend specific color ratios for
optimal plant growth under LED grow lights. It has been shown that many plants can grow
normally if given both red and blue light. However, many studies indicate that red and blue
light only provides the most cost-efficient method of growth, plant growth is still better under
light supplemented with green.
White LED grow lights provide a full spectrum of light designed to mimic natural light,
providing plants a balanced spectrum of red, blue and green. The spectrum used varies,
however, white LED grow lights are designed to emit similar amounts of red and blue light
with the added green light to appear white.
A large number of plant species have been assessed in greenhouse trials to make sure plants
have higher quality in biomass and biochemical ingredients even higher or comparable with
field conditions. Plant performance of mint, basil, lentil, lettuce, cabbage, parsley, carrot was
measured by assessing health and vigor of plants and success in promoting growth.
In tests conducted by Philips Lighting on LED grow lights to find an optimal light recipe for
growing various vegetables in greenhouses, they found that the following aspects of light
affects both plant growth (photosynthesis) and plant development (morphology): light
intensity, total light over time, light at which moment of the day, light/dark period per day,
light quality (spectrum), light direction and light distribution over the plants. However, it's
noted that in tests between tomatoes, mini cucumbers and bell peppers, the optimal light
recipe was not the same for all plants, and varied depending on both the crop and the region,
so currently they must optimize LED lighting in greenhouses based on trial and error.
They've shown that LED light affects disease resistance, taste and nutritional levels, but as of
2014 they haven't found a practical way to use that information.
The diodes used in initial LED grow light designs were usually 1/3 watt to 1 watt in power.
However, higher wattage diodes such as 3-Watt and 5-watt diodes are now commonly used in
LED grow lights. For highly compacted areas, COB chips between 10 watts and 100 watts
can be used. Because of heat dissipation, these chips are often less efficient. To prevent leaf
burn, LED grow lights should be kept between 12 inches (30 cm) away from plants for lower
wattage lamps (under 300 watts) up to 36 inches (91 cm) away from plants for higher wattage
lamps (1000 watts or more).
19
Historically, LED lighting was very expensive, but costs have greatly reduced over time, and
their longevity has made them more popular. LED grow lights are often priced higher, watt-
for-watt, than other LED lighting, due to design features that help them to be more energy
efficient and last longer. In particular, because LED grow lights are relatively high power,
LED grow lights are often equipped with cooling systems, as low temperature improves both
the brightness and longevity.
Water pump is a machine that delivers or pressurizes a liquid. It transfers the mechanical
energy of the prime mover or other external energy to the liquid, increasing the energy of the
liquid. While mini water motor pump is mini type to transfer water from lower place to
higher place or too far place.
DC powered pumps use direct current from motor, battery, or solar power to move fluid in a
variety of ways. Motorized pumps typically operate on 6, 12, 24, or 32 volts of DC power.
Solar-powered DC pumps use photovoltaic (PV) panels with solar cells that produce direct
current when exposed to sunlight.
The main advantage of DC (direct current) pumps over AC (alternating current) pumps is that
they can operate directly from a battery, making them more convenient and portable. They
are easier to operate and control, since AC systems typically require a controller to manage
speed. DC pumps also tend to be more efficient.
20
3.9 Single Relay Module:
A relay is an electrically operated device. It has a control system and (also called input circuit
or input contactor) and controlled system (also called output circuit or output cont. actor). It
is frequently used in automatic control circuit. To put it simply, it is an automatic switch to
controlling a high-current circuit with a low-current signal. [7]
Relays are used to protect the electrical system and to minimize the damage to the equipment
connected in the system due to over currents/voltages. The relay is used for the purpose of
protection of the equipment connected with it. These are also used to control the high voltage
circuit with low voltage signal in applications audio amplifiers and some types of modems.
These are used to control a high current circuit by a low current signal in the applications like
starter solenoid in automobile. These can detect and isolate the faults that occurred in power
transmission and distribution system. Typical application areas of the relays include:
• Telecommunication
• Traffic control
• Computer interfaces
• Automotive
• Home appliances
21
Fig 3.11: 5V Single Relay Module
INPUT:
SIG – Controls this relay, active Low! Relay will turn on when this input goes below about
2.0V
OUTPUT:
NC- Normally Closed, in which case NC is connected with COM when INT1 is set low and
disconnected when INT1 is high
NO- Normally Open, in which case NO is disconnected with COM1 when INT1 is set low
and connected when INT1 is high
The maximum DC load is 10A, the maximum DC load voltage is 30V the maximum AC load
is 10A, the maximum AC load voltage is 250V.
22
3.10 Buzzer
23
Buzzer Features and Specifications:
• Rated Voltage: 6V DC
A buzzer is a small yet efficient component to add sound features to our project/system. It is
very small and compact 2-pin structure hence can be easily used on breadboard, Perf Board
and even on PCBs which makes this a widely used component in most electronic
applications.
There are two types are buzzers that are commonly available. The one shown here is a simple
buzzer which when powered will make a Continuous Beeeeeeppp. sound, the other type is
called a readymade buzzer which will look bulkier than this and will produce a Beep. Beep.
Beep. Sound due to the internal oscillating circuit present inside it. But the one shown here is
most widely used because it can be customised with help of other circuits to fit easily in our
application.
This buzzer can be used by simply powering it using a DC power supply ranging from 4V to
9V. A simple 9V battery can also be used, but it is recommended to use a regulated +5V or
+6V DC supply. The buzzer is normally associated with a switching circuit to turn ON or
turn OFF the buzzer at required time and require interval.
24
3.11 Power Supply
A power supply is a device that supplies power to another device, at a specific voltage level,
voltage type and current level. For example, when we talk about a 9VDC @ 500mA power
supply can provide as much as 500mA of current and the voltage will be at least 9V DC up to
that maximum current level.
A power supply is an electronic device that supplies electric energy to an electrical load. The
primary function of a power supply is to convert one form of electrical energy to another. As
a result, power supplies are sometimes referred to as electric power converters.
25
CHAPTER 4
4.1 Approach
The system uses four different sensors to monitor the complete status of the agriculture field.
The soil moisture sensor and rain sensor are connected with a moisture sensor module which
has LM393 comparator IC. LM393 Comparator IC is used as a voltage comparator in this
Moisture sensor module. This module sends data of moisture levels of soil and rain to the
Arduino micro-controller. The Light dependent resistor (LDR) which is used here as a light
sensor is connected to the Arduino with a 10 K-ohm pull-up resistor. DHT11 temperature and
humidity sensor module is used for temperature and humidity readings of the atmospheric
conditions.
The rain sensor integrated with a moisture senor module with LM393 Comparator IC will
help us to detect the amount of rainfall like rain warning for light rain, moderate rainfall and
heavy rainfall. This is a very useful integration used in the project for more precise
monitoring. A rain sensor works on the principle of conductive property of water. Rain sensor
is just a small open circuit which gets closed when water falls on it and complete the circuit.
Since using a Moisture sensor module with a microcontroller is very easy. Connect the
Analog/Digital Output pin of the module to the Analog/Digital pin of Microcontroller.
Connect VCC and GND pins to 5V and GND pins of Microcontroller. When there is more
water presented due to heavy rainfall, it will conduct more electricity that means resistance
will be low and the rainfall level will be high.
The same moisture is sensor is usually used with a soil sensor. The moisture sensor consists
of two probes that are used to detect the moisture of the soil. These two probes are used to
pass the current through the soil and then the sensor reads the resistance to get the moisture
values and to detect and compare these values using the LM393 comparator IC in the
moisture sensor module, the data is sent to the Arduino. After that insert the probe inside the
soil. When there is more water presented in the soil, it will conduct more electricity that
means resistance will be low and the moisture level will be high.
The light sensor which is an LDR (Light Dependent Resistor) here, the soil moisture sensor,
and the rain sensor are connected to the Analog pins of the Arduino to determine a range of
rain, moisture, and sunlight levels instead of just binary values like yes and no for better and
26
more precise monitoring. This will in deciding the amount of rainfall, moisture and sunlight
present in real time. Whenever LDR detects low sunlight, A grow light attached to the system
turns on which is a substitute of sunlight.
Since water pump needs more power than the Arduino micro-controller and other sensors, a
5V relay is used. A relay is a device which lets a low current device like Arduino to control a
device with a high current requirement like a water pump. The relay behaves like a switch.
We make a complete circuit to run the water pump (using a 12V DC power jack) and then use
the relay as a way to make or break the circuit.
By integrating all the above-mentioned systems together with the Arduino and also connect a
networking device like ESP8266 a complete automation can be done to make an automated
Smart Agriculture Monitoring System.
27
4.2 Design And Implementation
Step 1: First we prepare all the input devices which are all the sensors used in the project.
28
The other sensors used are LDR and Temperature and Humidity Sensor which will connect
directly to the Arduino Uno micro-controller.
Step 2: Now we will prepare the output devices used in the project.
The water pump used for irrigation cannot be powered by the Arduino so a 5V relay module
is used with it. And grow LED is also used as output device for this project.
29
4.2.2 Block Diagram
After the compilation, program is in the online simulation mode. Online simulation is used to
check that how program is running step by step.
• When power supply is ON, the input module of four sensors starts to activate.
• If Moisture level in soil is low, the water pump motor is operated, and it water the
plant.
30
4.2.3 Working
• The microcontroller which has a built-in Wi-Fi module and is the heart of the project
which takes in input from the soil sensor and gives output to the relay to switch on the
irrigation pump. This also controls the time for which the irrigation needs to be done.
This also sends data to the cloud which can be used for improving the crop production.
• The sensor is connected to the GPIO pin which continuously gives input to the controller
about the moisture content.[8]
• Once this value nears or becomes less than the threshold value given the code instructs
the GPIO pin which is connected to the relay board to activate.
• The program will loop for given period of time and then sends a signal to deactivate the
relay thereby switching of the supply.
• The NodeMCU which is connected to the internet will update the moisture value and
also receive command through cloud from the user sitting in any part of the world.
• The cloud services will ease the work of farmers and can be upgraded to control other
components as well.
• The whole of project will work on an isolate power supply as these small modules will
be place at different places on the agricultural ground.
• The design is made in such a way that it can be used for drip irrigation and indoor
precision agriculture.
• Rain sensor to send rain warnings on mobile so that necessary action can be taken to
protect crops.
• Soil sensor to monitor the moisture in soil and also it is integrated with water pump
which will automatically turn on whenever soil sensor detects dry soil.
• LDR here used as light sensor, whenever it detects low sunlight, microcontroller turns on
the grow LED lights for crops.[8]
• Data from all the sensors is send through Wi-Fi to the mobile device using local network
to monitor real time conditions.
31
4.3 Application Design
The product parts are structured concerning triggers from the information and enacting pin
for the yields and speaking with cloud servers through web.[9] A fascinating part with
regards to the product is making a deferral for the water system siphon to be ON for a
specific measure of time.
32
4.4 Flow Chart
33
4.6 Code
#include<NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include<DHTesp.h>
#define DHTTYPE DHT11
#define S_Sensor A0
#define R_Sensor D0
#define LDR D1
#define RELAY D2
#define LED D5
#define dht_pin D4
#define SOIL_THRESHOLD 30
#define BUZZER D6
DHTesp dht;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int auto_mode;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP,"pool.ntp.org",utcoffsetInSeconds);
void buzzer() {
digitalWrite(BUZZER,HIGH);
delay(200);
digitalWrite(BUZZER,LOW);
delay(200);
34
digitalWrite(BUZZER,HIGH);
delay(200);
digitalWrite(BUZZER,LOW);
delay(200);
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
delay(100);
pinMode(R_Sensor,INPUT);
pinMode(LDR,INPUT);
pinMode(RELAY,OUTPUT);
pinMode(LED,OUTPUT);
pinMode(BUZZER,OUTPUT);
dht.setup(dht_pin,DHTesp::DHT11);
timeClient.begin();
}
void loop()
{
Blynk.run();
int soil_read = map(analogRead(S_Sensor),0,1023,100,0);
float h = dht.getHumidity();
delay(100);
float t = dht.getTemperature();
delay(100);
Serial.print("Current humidity = ");
Serial.print(h);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(t);
Serial.println("C ");
if(soil_read<SOIL_THRESHOLD and auto_mode==1) {
digitalWrite(RELAY,HIGH);
Blynk.virtualWrite(V3,1);
auto_mode = true;
Blynk.notify("Automode On");
}
else if(soil_read>50 and auto_mode==1) {
digitalWrite(RELAY,LOW);
Blynk.virtualWrite(V3,0);
}
if(digitalRead(LDR)==HIGH and auto_mode==1) {
digitalWrite(LED,HIGH);
Blynk.virtualWrite(V6,1);
}
else if(digitalRead(LDR)==LOW and auto_mode==1){
digitalWrite(LED,LOW);
Blynk.virtualWrite(V6,0);
35
}
if(digitalRead(LDR)==HIGH) {
Blynk.virtualWrite(V8,0);
}
else if(digitalRead(LDR)==LOW){
Blynk.virtualWrite(V8,255);
}
if(digitalRead(R_Sensor)==LOW) {
Blynk.virtualWrite(V7,255);
buzzer();
}
else {
Blynk.virtualWrite(V7,0);
}
if(h>=0 and h<=101) {
timeClient.update();
String currentTime = String(timeClient.getHours()) + ":" + timeClient.getMinutes()
+ ":" + timeClient.getSeconds();
Serial.println(currentTime);
Blynk.virtualWrite(V0,soil_read);
Blynk.virtualWrite(V1,t);
Blynk.virtualWrite(V2,h);
Blynk.virtualWrite(V4,currentTime);
}
Blynk.syncVirtual(V3);
Blynk.syncVirtual(V5);
Blynk.syncVirtual(V6);
}
BLYNK_WRITE(V3) {
int state = param.asInt();
if(state==1)
digitalWrite(RELAY,HIGH);
else if(state==0)
digitalWrite(RELAY,LOW);
}
BLYNK_WRITE(V5) {
auto_mode = param.asInt();
}
BLYNK_WRITE(V6) {
int state = param.asInt();
if(state==1)
digitalWrite(LED,HIGH);
else if(state==0)
digitalWrite(LED,LOW);
}
36
CHAPTER 5
PERFORMANCE ANALYSIS
The framework going for delicate products is the looking at achieved on an outright, included
machine to assess the machine's congruity with its exact necessities. gadget testing would
also fall inside the range of the dark compartment looking at, and in this way, it must need no
data around the interior structuring of the presence of mind or the code. It's miles a totally
comparable deliberate check case lettering. inside the check case lettering we ought to be
equipped for compose the check case circumstances and moreover the utilization cases.
The Black-box looking at is an approach to “test programming that uncovers out the ability
and running of a product without the peering into the inward structures or into the operations,
explicit data of the products inside shape, code and programming understanding is commonly
not required”. Furthermore, the analyser is enjoyably careful about unequivocally what our
item is thought to do anyway it isn't responsive of ways it would do it. as a case, our analyser
is responsive that one careful enter may restore a definite, never-ending yield yet it isn't sure
generally how the item would convey the yield inside the essential spot.
37
5.3 Unit Testing
Throughout pc programming and coding, we have this unit testing assisting which of the
product tests approaches with the methods for which specific units of the supply code, or a
fixed of 1 and now and then additional PC programming component together with related
control records, managing procedures, and working methodologies, are experienced, and
analysed to see whether they are strong for use. Instinctively, we likewise can locate a unit to
be the littlest checkable component of an apparatuses. For this situation of the procedural
programming, our unit could have been a whole module, but it's miles more usually a man or
woman manner or characteristic. [10]
The objective of unit checking out is in order to separate every detail of this system and to
illustrate that the person factors are accurate.
38
CHAPTER 6
CONCLUSIONS
Thus the “Automated Agriculture monitoring system” has been designed and tested
successfully. It has been developed by integrated features of all the hardware components
used. Presence of every module has been reasoned out and placed carefully, thus contributing
to the best working of the unit. Thus, the Arduino Based Automatic Plant Watering System
has been designed and tested successfully.
The smart agriculture using Wi-Fi network has been experimentally proven to work
satisfactorily by monitoring the values of humidity and temperature successfully. Through the
local Wi-Fi control the motor in the field. It also stores the sensor parameters in the timely
manner. This will help the user to analyze the conditions of various parameters in the field
anytime anywhere. Then control or maintain the parameters of field properly. Finally, we
conclude that automatic irrigation system is more efficient than scheduled irrigation process.
39
REFERENCES
[4]. Truong Hong Kha Temperature and humidity monitor with ESP8266 Thesis 2019
[7]. https://www.techtarget.com/iotagenda/tip/An-overview-of-IoT-sensor-types-and-
challenges
[12]. Pro Green Irrigation, “Pro Green Irrigation: Your Lawn Sprinkler Professionals,”
2017. [Online]. Available: https://progreenirrigation.com/.
40