Automatic Irrigation System Using Microcontroller Main Document
Automatic Irrigation System Using Microcontroller Main Document
INTRODUCTION
1.1 INTRODUCTION
This chapter includes the problem statement, system block diagram and explanation
about the each block. It also includes the relevance of our project i.e. what are the applications
of this projects.
In the fast paced world human beings require everything to be automated. Our life
style demands everything to be remote controlled. Apart from few things man has made his life
automated. And why not? In the world of advance electronics, life of human beings should be
simpler hence to make life simpler and convenient; we have made AUTOMATIC
IRRIGATION SYSTEM. A model of controlling irrigation facilities to help millions of
people. This model uses sensor technology with microcontroller to make a smart switching
device.
The model shows the basic switching mechanism of Water motor/pump using
sensors from any part of field by sensing the moisture present in the soil. Our basic model can
be extended to any level of switching & controlling by using DTMF.
PROBLEM STATEMENT:
To build an Automatic Irrigation System using ATMEGA16 Microcontroller.
.OBJECTIVE:
Now days, water shortage is becoming one of the biggest problem in the world.
Many different methods are developed for conservation of water. We need water in each and
every field. In our day to day life water plays a vital part and is considered as a Basic Human
Need. Water is needed for everyone human beings, animals, plants, etc.
Agriculture is one of the fields where water is required in tremendous quantity.
Wastage of water major problem in agriculture. Every time excess of water is given to the
fields. There are many techniques to save or to control wastage of water from agriculture.
Different types of irrigation are used for management of water in agricultural land.
IRRIGATION:
Irrigation is an artificial application of water to the soil. It is usually used to assist
the growing of crops in dry areas and during periods of inadequate rainfall.
2
is
very
labor-intensive method of
cut
into
steps
and
supported by retaining walls. The flat areas are used for planting and the idea is that the water
flows down each step, while watering each plot. This allows steep land to be used for planting
crops.
Drip Irrigation:
This is known as the most water efficient method of irrigation. Water drops right
near the root zone of a plant in a dripping motion. If the system is installed properly you can
steadily reduce the loss of water through evaporation and runoff.
Rotary Systems:
This method of irrigation is best suited for larger areas, for the sprinklers can reach
distances of up to 100 feet. The word Rotary is indicative of the mechanical driven sprinklers
moving in a circular motion, hence reaching greater distances. This system waters a larger area
with small amounts of water over a longer period of time.
Avionics, such as inertial guidance systems, flight control hardware/software and other
integrated systems in aircraft and missiles.
Handheld calculators.
Handheld computers.
Medical equipment.
Videogame consoles.
CHAPTER 2
LITERATURE REVIEW
The chapter covers an overview about the previous and future projects related to the
system.
2.1 PREVIOUS RELATED WORK:
In India, normal irrigation technique, which are manually operated are used widely
due to its low cost and high profits. Automatic irrigation techniques are not so prevalent here.
But various methods like the automatic sprinklers, which are used widely for domestic
gardening purpose; these are designed to supply water for a particular period of the day only.
They are time controlled. The volume of water to be supplied and the rate of flow of water are
essential to calculate the time interval.
More over Volume control system are more advantageous than time control system.
The amounts of water they supply are fixed irrespective of continuous electricity availability
but still time controlled systems are more popular due to its cheap value. Here volume meters
are connected, which emits a pulse after delivering a specific amount of water and the
controller measures these pulses to keep a check on the supply.
The most recent type is the rainfall detector for detecting a set amount of rainfall.
This functions to interrupt the normal operation of an automatic sprinkler or irrigation system
upon detection of the set amount of rainfall, it includes a rainwater-collection tray having an
opening and mounted so that the portion of the opening exposed to rainwater during a
rainstorm is adjustable. The rainwater-collection tray may be able to slide and is mounted
below a detector housing which houses a switching circuit with two sensors extending into the
tray, and it also prevents from the debris to fall in the tray. When water in the tray is filled up to
the mark of reference the sensor completes the circuitry and isolates the irrigation system from
the supply and thus prevent from excessive water supply to the plants. This method is patent to
Richard E. Morrison, (Salt Lake City, UT) and Kent C. Erickson (Centerville, UT).
In addition to the above there are two more methods they are closed loop and open
loop irrigation system. The closed loop type of system requires feedback from one or more
sensors. The operator develops a general control strategy. Once the general strategy is defined,
the control system takes over and makes detailed decisions of when to apply water and how
much water to apply. Irrigation decisions are made and actions are carried out based on data
from sensors. In this type of system, the feedback and control of the system are done
continuously. But in an open loop system, the operator makes the decision on the amount of
water that will be applied and when the irrigation event will occur. This information is
8
programmed into the controller and the water is applied according to the desired schedule.
Open loop control systems use either the irrigation duration or a specified applied
volume for control purposes. The drawback of open loop systems is their inability to respond
automatically to changing conditions in the environment. In addition, they may require frequent
resetting to achieve high levels of irrigation efficiency.
2.2 STATE OF ART:
The scientists are developing an underground irrigation system. The major
drawback of water evaporation taking place at the surface level irrigation is overcome by this
method. In this method various sensors are placed below the ground level to determine the
moisture percentage in the soil. The water supply in this case is directly to the root system and
as the moisture level at the root level is essential to be known the sensor are placed near the
roots. This will optimize the water consumption further and will make maximum use of all
agricultural resource.
CHAPTER 3
10
The main content of the chapter is about the total block diagram and detailed
designing of the System.
3.1 BLOCK DIAGRAM
EXPLANATION OF BLOCKS
3.2 POWER SUPPLY:
The power supplies are designed to convert high voltage AC mains electricity to a
suitable low voltage supply for electronic circuits and other devices. A RPS (Regulated Power
Supply) is the Power Supply with Rectification, Filtering and Regulation being done on the AC
mains to get a Regulated power supply for Microcontroller and for the other devices being
interfaced to it.
A power supply can be broken down into a series of blocks, each of which performs
a particular function. A D.C power supply which maintains the output voltage constant
irrespective of A.C mains fluctuations or load variations is known as Regulated D.C Power
Supply
11
include
and
Fig. LM 7805
9VDC to 24VDC) to the Input pin, connect the negative lead to the
Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.
Here in this project we use a LM7805 IC as ATMEGA 16 works on 5v DC .
78XX
The Bi Linear LM78XX is integrated linear positive regulator with three terminals. The
LM78XX offer several fixed output voltages making them useful in wide range of applications.
When used as a zener diode/resistor combination replacement, the LM78XX usually results in
12
Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V.
13
ATMEGA 16 Microcontroller:
GND:
It is pin 31 on the microcontroller. Ground should be providing for the perfect functioning
of the circuit inside the microcontroller.
Port A (PA7-PA0):
Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bidirectional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up
resistors (selected for each bit). The Port A output buffers have symmetrical drive
characteristics with both high sink and source capability. When pins PA0 to PA7 are used as
inputs and are externally pulled low, they will source current if the internal pull-up resistors are
activated. The Port A pins are tri-stated when a reset condition becomes active, even if the
clock is not running.
14
Port B (PB7-PB0):
Port B is an 8-bit bi-directional I/O with internal pull-up resistors (selected for each bit). The
Port B output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port B pins that are externally pulled low will source the pull-up resistors
are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the
clock is not running. Port B also serves the functions of various special features of the
ATmega16.
Port C (PC7-PC0):
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port C output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port C pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes
active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on
pins PC5 (TDI), PC3 (TMS) and PC2 (TCK) will be activated even if a reset occurs. Port C
also serves the functions of the JTAG interface and other special features of the ATmega16.
Port D (PD7..PD0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port D output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port D pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes
active, even if the clock is not running.
RESET:
Reset Input. A low level on this pin for longer than the minimum pulse length will generate
reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.
15
XTAL1:
Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
Output from the inverting Oscillator amplifier.
AVCC:
AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to
VCC through a low-pass filter.
AREF:
AREF is the analog reference pin. It is provided for the Analog to Digital conversion. For A to
D conversion we need reference voltage which will be provided by this pin.
FEATURES OF ATmega16:
a) High-performance, Low-power Atmel AVR 8-bit Microcontroller
2) Advanced RISC Architecture
a) 131 Powerful Instructions Most Single-clock Cycle Execution
b) 32 x 8 General Purpose Working Registers
c) Fully Static Operation
d) Up to 16 MIPS Throughput at 16 MHz
e) On-chip 2-cycle Multiplier
3) High Endurance Non-volatile Memory segments
a) 16 Kbytes of In-System Self-programmable Flash program memory
b) 512 Bytes EEPROM
c) 1 Kbyte Internal SRAM
16
.
Fig. Light Emitting Diodes
This section is basically meant to show up the status of the project. This project
makes use of Light Emitting Devices to display / prompt for necessary information.
18
Benefits of LEDs:
Low power requirement:
Most types can be operated with battery power supplies.
High efficiency:
Most of the power supplied to an LED or IRED is converted into radiation in the desired
form, with minimal heat production.
Long life:
When properly installed, an LED or IRED can function for decades.
3.6 Operational Amplifiers:
An operational amplifier ("op-amp") is a DC-coupled high-gain electronic voltage
amplifier with a differential input and, usually, a single-ended output. An op-amp produces an
output voltage that is typically hundreds of thousands times larger than the voltage difference
between its input terminals.
Operational amplifiers are important building blocks for a wide range of electronic
circuits. They had their origins in analog computers where they were used in many linear, nonlinear and frequency-dependent circuits. Their popularity in circuit design largely stems from
the fact that characteristics of the final op-amp circuits with negative feedback (such as their
gain) are set by external components with little dependence on temperature changes and
manufacturing variations in the op-amp itself.
Op-amps are among the most widely used electronic devices today, being used in a
vast array of consumer, industrial, and scientific devices. Many standard IC op-amps cost only
a few cents in moderate production volume; however some integrated or hybrid operational
amplifiers with special performance specifications may cost over $100 US in small quantities.
Op-amps may be packaged as components, or used as elements of more complex integrated
circuits.
The op-amp is one type of differential amplifier. Other types of differential
amplifier include the fully differential amplifier (similar to the op-amp, but with two outputs),
the instrumentation amplifier (usually built from three op-amps), the isolation amplifier
(similar to the instrumentation amplifier, but with tolerance to common-mode voltages that
19
would destroy an ordinary op-amp), and negative feedback amplifier (usually built from one or
more op-amps and a resistive feedback network).
LM 358 OPERATIONAL AMPLIFIER
The LM158 series consists of two independent, high gain, internally frequency compensated
operational amplifiers which were designed specifically to operate from a single power supply
over a wide range of voltages. Operation from split power supplies is also possible and the low
power supply current drain is independent of the magnitude of the power supply voltage.
20
21
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC
mains circuit. There is no electrical connection inside the relay between the two circuits; the
link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay,
but it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs
(chips) cannot provide this current and a transistor is usually used to amplify the small IC
current to the larger value required for the relay coil. The maximum output current for the
popular 555 timer IC is 200mA so these devices can supply relay coils directly without
amplification.
Relays are usually SPDT or DPDT but they can have many more sets of switch
contacts, for example relays with 4 sets of changeover contacts are readily available. For
further information about switch contacts and the terms used to describe them please see the
page on switches.
Most relays are designed for PCB mounting but you can solder wires directly to the
pins providing you take care to avoid melting the plastic case of the relay. Relay coils produce
brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in
the circuit. To prevent damage you must connect a protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can see a
lever on the left being attracted by magnetism when the coil is switched on. This lever moves
the switch contacts. There is one set of contacts (SPDT) in the foreground and another behind
them, making the relay DPDT.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.
Choosing a relay:
You need to consider several features when choosing a relay:
a) Physical size and pin arrangement If you are choosing a relay for an existing PCB you will
need to ensure that its dimensions and pin arrangement are suitable. You should find this
information in the supplier's catalogue.
b) Coil voltage the relay's coil voltage rating and resistance must suit the circuit powering the
relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also
readily available. Some relays operate perfectly well with a supply voltage which is a little
lower than their rated value.
c) Coil resistance the circuit must be able to supply the current required by the relay coil. You
can use Ohm's law to calculate the current:
supply voltage
coil resistance
Switch ratings (voltage and current) the relay's switch contacts must be suitable for
the circuit they are to control. You will need to check the voltage and current ratings. Note that
the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC".
Switch contact arrangement (SPDT, DPDT etc). Most relays are SPDT or DPDT
which are often described as "single pole changeover" (SPCO) or "double pole changeover"
(DPCO). For further information please see the page on switches
Protection diodes for relays:
Transistors and ICs (chips) must be protected from the brief high voltage 'spike'
produced when the relay coil is switched off. The diagram shows how a signal diode (e.g.
1N4148) is connected across the relay coil to provide this protection. Note that the diode is
connected 'backwards' so that it will normally not conduct. Conduction only occurs when the
relay coil is switched off, at this moment current tries to continue flowing through the coil and
23
it is harmlessly diverted through the diode. Without the diode no current could flow and the coil
would produce a damaging high voltage 'spike' in its attempt to keep the current flowing.
Relays and transistors compared.
Like relays, transistors can be used as an electrically operated switch. For switching
small DC currents (< 1A) at low voltage they are usually a better choice than a relay. However
transistors cannot switch AC or high voltages (such as mains electricity) and they are not
usually a good choice for switching large currents (> 5A). In these cases a relay will be needed,
but note that a low power transistor may still be needed to switch the current for the relay's
coil! The main advantages and disadvantages of relays are listed below:
Advantages of relays:
Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Relays can switch many contacts at once.
Disadvantages of relays:
24
CHAPTER 4
IMPLEMENTATION
25
The power supply unit provides the required power to all the components and
devices in the circuit
The input is obtained from the moisture sensors whether the soil contains moisture
or not. If the water is adequate, It is indicated by the GREEN LED in the circuit.
When ever any two or more sensors founds that the water level in the farms are
below the sensors fixed level, then RED LED glows indicating us that the water level is low
and simultaneously the voltage at the OP AMP is Open circuited, There by gives the
information to the PORT A of ATMEGA 16 Microcontroller
According to the program code written in the micro controller using AVR Studio
4.0, When two or more sensors senses the decrease in the water level or insufficiency in the
moisture level of the soil, then the YELLOW LED is indicated to be ON and Pin PB0 is set in
high position such that the obtained voltage is amplified by the transistor 2N3904 which is an
NPN transistor which helps in the amplification of the signal and fed to the RELAY
As soon as the coil in the relay is energized, the motor is going to be in the ON Condition.
Motor in the ON condition pumps the water in to the fields. As soon as the water is
adequate in the field, and touches the sensors, the motor keeps still running till all the sensors
get enough amount of water as such the sensors are short circuited and there is no difference in
the voltage among the positive and negative terminals of the sensors. Thus by reaching this
stage the motor switches to OFF condition as the sensors sends the signals that all the sensing
elements are covered with the water and there is no need for the extra water to flow to the
fields. Thus automation can be obtained without the human intervention.
TOOLS USED:
Soldering iron
A soldering iron is a hand tool most commonly used in soldering. It supplies heat to
melt the solder so that it can flow into the joint between two workpieces.
A soldering iron is composed of a heated metal tip
and
COMPONENT MOUNTING
Now mount all the components on the PCBs using the above mentioned tools.
28
platform.
It
includes
the
GNU
GCC
compiler
for
and
C++.
choose the ATmega16 AVR processor. Select in the drop down list.
h) Click on the Finish button. You should then see the IDE
29
2. Typing in a program:
a) Type in the program. Note the color-coded text. This is done automatically by the IDE and
helps you to make corrections as you go.
b) When you have completed the program save the program.
4. Simulating a program:
Simulate the program. To start the simulator you may choose Start Debugging from The
Debug Menu or you may click on the arrow button
4.5 CODING:
Program code can be written in C language or in an Assembly Language.
DDRB=0xff;
while(1)
{
if((PINA & 0b00000110)==0b00000110)
PORTB=0b00010001;
if((PINA & 0b00001100)==0b00001100)
PORTB=0b00010001;
if((PINA & 0b00011000)==0b00011000)
PORTB=0b00010001;
if((PINA & 0b00010010)==0b00010010)
PORTB=0b00010001;
if((PINA & 0b00001010)==0b00001010)
PORTB=0b00010001;
if((PINA & 0b00010100)==0b00010100)
PORTB=0b00010001;
if((PINA & 0b00001110)==0b00001110)
PORTB=0b00010001;
if((PINA & 0b00011100)==0b00011100)
PORTB=0b00010001;
if((PINA & 0b00011010)==0b00011010)
PORTB=0b00010001;
if((PINA & 0b00010110)==0b00010110)
PORTB=0b00010001;
if((PINA & 0b00011110)==0b00011110)
31
PORTB=0b00100001;
if((PINA & 0b00011110)==0b00000000)
PORTB=0b01000000;
}
}
32
CHAPTER 5
33
5.1 RESULT
The system provides with several benefits and can operate with less manpower. The
system supplies water only when the humidity in the soil goes below the reference. Due to the
direct transfer of water to the roots water conservation takes place and also helps to maintain
the moisture to soil ratio at the root zone constant to some extend. Thus, the system is efficient
and compatible to the changing environment.
In present days especially farmers are facing major problems in watering their
agriculture fields, its because they have no proper idea about when the power is available so
that they can pump water. Even after then they need to wait until the field is properly watered,
which makes them to stop doing other activities. Here is an idea which helps not only farmers
but also for watering the gardens , which senses the soil moisture and switches the pump
automatically when the power is ON.
Electronic Gardner is a prototype for an automatic irrigation system that can be used
in wide landscapes. Properly installed, maintain and managed system can be implemented in
large fields like public gardens, lawns, golf fields etc.
34
5.2 ADVANTAGES
1. Reduced run-off of water and nutrients:
Automation can help keep fertilizer on farm by effectively reducing run-off from the
property. Retaining fertilizer on farm has both economic and environmental benefits.
2. Improves growth:
Smaller amounts of water applied over a longer amount of time provide ideal
growing conditions. Drip irrigation extends watering times for plants, and prevents soil erosion
and nutrient runoff. Also, because the flow is continuous, water penetrates deeply into the soil
to get well down into the root zone.
3. Reduced Labour:
As the irrigator is not required to constantly monitor the progress of irrigation, the
irrigator is available to perform other tasks un-interrupted.
4. Saves time:
Setting and moving sprinklers are not required. A timer delay as per environment
can be added to the system for automatic watering.
5. Improved Life Style
The irrigator is not required to constantly check the progress of water down the base
being irrigated. The irrigator is able to be away from the property, relax with the family and
sleep through the night.
6. Adaptable:
A drip irrigation system can be modified easily to adjust to the changing needs of a
garden or lawn.
7. Simplest Method:
Start by drawing a map of your garden and yard, showing the location of plantings.
Measure the distances required for lengths of hose or plastic tubing to reach the desired areas.
35
5.3 DIS-ADVANTAGES:
1. Reliability:
Sometimes failures will occur often these failures are because of human error in
setting and maintaining the systems. A reuse system is good insurance to collect any excess run
off when failures occur
2. Increased Channel Maintenance:
There is a need to increase maintenance of channels and equipments to ensure the
system works correctly. Channels should be fenced to protect the automatic units from stock
damage.
3. Slopes in the fields:
These systems require careful study of all the relevant factors like land topography,
Soil, Water, Crop and agro-climatic conditions and suitability of irrigation system and its
components
Due to rust of sensors we cannot predict the water level after a period of time.
36
5.4 APPLICATIONS
1. Irrigation in fields.
2. Irrigation in gardens, parks and golf fields
3. Very efficient for paddy (Rice) fields.
4. Picsiculture.
37
38
5.6 REFERENCES
1.
2.
3.
Electronic Components
-D. V. Prasad.
4.
www.atmel.com
5.
www.wikipedia.com
6.
www.avrfreaks.net
7.
www.google.com
39