You are on page 1of 51

MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

CHAPTER ONE
INTRODUCTION
1.1 Background of the Project
In a developing country like Ethiopia, the agriculture plays an important role in the economy and
development of the country. At the present time, the farmers have been using irrigation technique
in Ethiopia through the manual control in which the farmers irrigate the land at the regular
intervals. This process sometimes consumes more water or sometimes the water reaches late due
to which the crops get dried .There is a need in the residential/commercial irrigation industry for
an irrigation controller that responds to soil moisture sensors in individual zones as a way of
conserving water.
Due to insufficient rains and lack of proper storage reservoirs there is a need to use the limited
water resources effectively. By using drip irrigation system the water the wastage of water gets
reduced as the water is directly supplied near the roots. But it is very difficult to supply water
only where there is a requirement, so by using an embedded based microcontroller design it is
possible.

Major advantages of drip irrigation are (1) high uniformity of water application under plastic
mulch, (2) Reduced foliage diseases as water does not wet the foliage and (3) ability to apply a
portion of a plant‟s nutrients throughout the growing season.
Drip irrigation also uses 30 to 50 percent less water than other irrigation systems, like overhead
Sprinkler depending on plant row layout.

1
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

1.2 Problem Statement

In the case of traditional irrigation system water saving is not considered, since the water is
irrigated directly in the land, Plants undergo high stress from variations in soil moisture,
therefore plant appearance is reduced, Weed growth is increased because areas between plants
are irrigated, The high application rate and the absence of automatic controlling of the system
results in improper water control, System‟s high flow rate allows irrigation of lower areas and
few plants can be watered at once. So this is the serious problem in agricultural areas such as
horticulture, flour planting areas, in greenhouses, and so more. We want to design an automated
drip irrigation system to solve the above listed problems.

2
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

1.3 Objective Of the project

1.3.1 General Objective


The main core of this project is to design and implement automated drip irrigation system. Here
microcontroller plays an important role in controlling the valve, starting and stopping the motor.
Then the system will control all the necessary devices and irrigate the area in the appropriate
way.

The goal of this project is to design automated drip irrigation system by using microcontroller
PIC16F877A. The controller will maintain the valve opening and closing, and motor starting and
stopping when there is variation in temperature and moisture sensors. By varying temperature
sensor to the desired value, and desired moisture level the valve will controlled and the motor
will also started and stopped easily.

1.3.2 Specific Objective


The specific objectives are listed below:

 To study and understand the PIC16F877A microcontroller architecture and register.


 To study LM35 temperature sensor and EC-5 moisture sensor.
 To develop the flow chart
 Interfacing the motor, LCD, LM35 temperature sensor, and other devices with
PIC16F877A microcontroller.

1.4 Scope of the project


In order to achieve the objective of the project, there are several scopes had been outlined. The
scope of this project includes using the MikroC to program microcontroller PIC16F877A to
control the valve which is used in the opening and closing of the flow of water. Sensors used to
control the watering system are temperature sensor, and soil moisture sensor. Temperature of
specified value is used as the indicator value of turning on and off the valve. Other than that, this
system should also monitor the Temperature of the environment to protect the plant when the
temperature is greater than the maximum limit is used as the indicator value of turning on and off
the valve. We want to build the hardware by making appropriate connection using devices like
motor, microcontroller, LCD, LM35 temperature sensor and MOSFET.

3
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

1.5 Limitation of the Project

1.5.1 Simulation and Design Limitation


 We don‟t have any specified type of soil moisture sensor on the simulating software,
but we represent it using simple switch BUTTON.

 We don‟t have any specified type of control valve, but we represent it by two LEDs.
.
 We wouldn‟t simulated our system with controller realization result because we
represented our modeled system (Valve) by LEDS, so the design used to show how
practically the normal system will operates; incase we designed it up to final and we
simulated our design by another technical way.

CHAPTER TWO

THEORY AND LITERATUR REVIEW


4
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

2.1 Components of Automatic Drip Irrigation

The automated control system consists of moisture sensors, temperature sensors, Signal
conditioning circuit, Digital to analog converter, LCD Module, Relay driver, solenoid control
valves, etc. The important parameters to be measured for automation of irrigation system are soil
moisture and temperature. The entire field is first divided in two small sections such that each
section should contain one moisture sensor and a temperature sensor. LM35 can be used as a
temperature sensor while Tensio-meter can be used as the moisture sensor to detect moisture
contents of soil. These sensors are buried in the ground at required depth. Once the soil has
reached desired moisture level, the sensors send a signal to the microcontroller to turn off the
relays, which control the valves. The signal send by the sensor is boosted up to the required level
by corresponding amplifier stages. Then the amplified signal is fed to A/D converters of desired
resolution to obtain digital form of sensed input for microcontroller use. A 20X4 line LCD
module can be used in the system to monitor current readings of all the sensors and the current
status of respective valves. The solenoid valves are controlled by microcontroller though relays.
Varying speed of pump motor can control pressure of water. A flow meter is attached for
analysis of total water consumed. The required readings can be transferred to the Centralized
Computer for further analytical studies, through the serial port present on microcontroller unit.
While applying the automation on large fields more than one such microcontroller units can be
interfaced to the Centralized Computer. The microcontroller unit has in-built timer in it, which
operates parallel to sensor system. In case of sensor failure the timer turns off the valves after a
threshold level of time, which may prevent the further disaster. The microcontroller unit may
warn the pump failure or insufficient amount of water input with the help of flow meter.

The components of micro controller based drip irrigation system are follows: -
1) Pump
2) Water Filter
3) Flow Meter
3) Control Valve
4) Drip lines with Emitters
5) Moisture and Temperature Sensors.
6) Micro controller Unit (The brain of the system).
For our project we were study in detail the controlling parts and controlling mechanisms of the
irrigation system, in detail we explained the basic components we used in controlling the system
such as Microcontroller, Temperature and soil moisture sensors, and solenoid valve.

2.2 Microcontroller

5
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

A microcontroller is a compact microcomputer designed to govern the operation of embedded


systems. Microprocessors Terms related to microprocessors, including definitions about silicon
chips and words and phrases about computer processors.

A microcontroller is a compact microcomputer designed to govern the operation of embedded


systems in motor vehicles, robots, office machines, medical devices, mobile radios, vending
machines, home appliances, and various other devices. A typical microcontroller includes a
processor, memory, and peripherals.

2.2.1 PIC Microcontroller (PIC16F877A)

Microcontroller PIC16F877A is one of the PIC Micro Family microcontroller which is popular
at this moment, start from beginner until all professionals. Because very easy for using
PIC16F877A and use FLASH memory technology so that can be write-erase until thousand
times. PIC microcontrollers are a family of specialized microcontroller chips produced by
Microchip Technology in Chandler, Arizona. The acronym PIC stands for "peripheral interface
controller," although that term is rarely used nowadays.
PIC16F877A have 40 pin by 33 path of I/O. PIC16F877A perfectly fits many uses, from
automotive industries and controlling home appliances to industrial instruments, remote sensors,
electrical door locks and safety devices. It is also ideal for smart cards as well as for battery
supplied devices because of its low consumption. EEPROM memory makes it easier to apply
microcontrollers to devices where permanent storage of various parameters is needed (codes for
transmitters, motor speed, receiver frequencies, etc.). Low cost, low consumption, easy handling
and flexibility make PIC16F877A applicable even in areas where microcontrollers had not
previously been considered (example: timer functions, interface replacement in larger systems,
coprocessor applications, etc.).In System Programmability of this chip (along with using only
two pins in data transfer) makes possible the flexibility of a product, after assembling and testing
have been completed. This capability can be used to create assembly-line production, to store
calibration data available only after final testing, or it can be used to improve programs on
finished products.

6
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 2.1 Schematic circuit of PIC16F877A

PIC16F877A Microcontroller Features


 High-Performance RISC CPU

 Lead-free; Ro HS-compliant
 Operating speed: 20 MHz, 200 ns instruction cycle
 Operating voltage: 4.0-5.5V
 Industrial temperature range (-40° to +85°C)
 15 Interrupt Sources
 35 single-word instructions
 All single-cycle instructions except for program branches (two-cycle)

 Special Microcontroller Features

 Flash Memory: 14.3 Kbytes (8192 words)


 Data SRAM: 368 bytes
 Data EEPROM: 256 bytes
 Self-reprogrammable under software control
 In-Circuit Serial Programming via two pins (5V)
 Watchdog Timer with on-chip RC oscillator
 Programmable code protection
 Power-saving Sleep mode
 Selectable oscillator options
 In-Circuit Debug via two pins

7
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

 Peripheral Features

 33 I/O pins; 5 I/O ports


 Timer0: 8-bit timer/counter with 8-bit prescaler
 Timer1: 16-bit timer/counter with prescaler
o Can be incremented during Sleep via external crystal/clock
 Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
 Two Capture, Compare, PWM modules
o 16-bit Capture input; max resolution 12.5 ns
o 16-bit Compare; max resolution 200 ns
o 10-bit PWM
 Synchronous Serial Port with two modes:
o SPI Master
o I2C Master and Slave
 USART/SCI with 9-bit address detection
 Parallel Slave Port (PSP)
o 8 bits wide with external RD, WR and CS controls
 Brown-out detection circuitry for Brown-Out Reset

 Analog Features

 10-bit, 8-channel A/D Converter


 Brown-Out Reset
 Analog Comparator module
o 2 analog comparators
o Programmable on-chip voltage reference module
o Programmable input multiplexing from device inputs and internal VREF
o Comparator outputs are externally accessible

Advantages of Microcontroller

Microcontroller's use increased rapidly. The main advantages of microcontrollers:

 Microcontrollers are cheap and very small in size; therefore they can be embedded on any
device.
 Programming of Microcontrollers is simple to learn. It‟s not much complicated.
 We can use simulators on Computers to see the practical results of our program. Thus we
can work on a Embedded project without even buying the required Components and
Chips. Thus we can virtually see the working of our project or program.

8
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

2.3 Sensors

A sensor (also called detector) is a converter that measures a physical quantity and converts it
into a signal which can be read by an observer or by an (today mostly electronic) instrument. For
accuracy, most sensors are calibrated against known standards. A sensor is a device which
receives and responds to a signal when touched. A sensor's sensitivity indicates how much the
sensor's output changes when the measured quantity changes. For our project basically we used
temperature sensor (LM35 type) and soil moisture sensor (EC-5 type).

2.3.1 Temperature Sensor LM35


The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is
linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage
over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a
large constant voltage from its output to obtain convenient Centigrade scaling. Low cost is
assured by trimming and calibration at the wafer level. The LM35's low output impedance, linear
output, and precise inherent calibration make interfacing to readout or control circuitry especially
easy.

Fig: 2.2 Block diagram of LM35 interfacing


9
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

The LM35 is basically a thermometer on a chip, designed by National Semiconductor. Instead of


using mercury or another fluid, it relies on a property of diodes that causes the breakdown
voltage of the diode to increase with temperature. This relationship is linear and predictable,
making the LM35 a very accurate temperature sensor, with a voltage output that is linearly
proportional to temperature.

Range and Accuracy

 The LM35 measures a temperature range of -55 to 150 degrees Celsius. It produces an
analog voltage signal that has a linear relationship to temperature, with a scale of 10.0
mV per degree Celsius. At room temperature, the LM35 has a typical accuracy of plus or
minus 0.25 degrees Celsius, and plus or minus 0.75 degrees Celsius over the full
temperature range. In still air, it takes three minutes for the output to reach its final value;
at one minute, the output is about 70 percent of the final value.

Voltage and Current

 The sensor normally takes a supply voltage of either 5 or 10 volts, but it can accept a
supply voltage ranging from 4 to 30 volts. The LM35 draws only 60 uA of current from a
single or bipolar power supply. If you use a single supply voltage, the chip will measure
temperatures from 0 to 150 degrees Celsius, where 0 degrees outputs 0 V and 150
degrees outputs 1,500 mV.

Reading Negative Temperatures

 There are two ways to read temperatures below freezing. The first way is to give the chip
a negative supply voltage, in addition to the normal positive supply voltage. This is called
a bipolar power supply. In this configuration, the chip will output below-freezing
temperatures as a negative voltage. To do this, connect the output pin of the chip to the
negative supply voltage through a resistor. Choose the value of the resistor by dividing
the absolute value of the negative supply voltage by 0.0005 amps. The second method
uses a single power supply. Connect the ground pin of the chip to ground through a
diode, and connect the output to ground through a resistor. Again, choose the resistor
value by dividing the supply voltage by 0.0005 amps. In this case, your actual reading is
the difference between the voltage at the output pin and the voltage at the ground pin.

Available Packages
As of October 2010, all LM35-series integrated circuit temperature sensors are available
in a TO-46 transistor package. The LM35C, LM35CA and LM35D variations are also
available in plastic TO-92 transistor packages, and the LM35D is available in an 8-lead
small outline package and a plastic TO-220 package. The device only uses three pins of
the small outline package. Pin one is the output, pin four is the ground, and pin eight is

10
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

the supply voltage. The transistor package pin out, from left to right, is supply, ground,
and output. The LM35C has a smaller effective range, from -40 to 110 degrees Celsius,
but higher accuracy.

The LM35 is an integrated circuit sensor that can be used to measure temperature with an
electrical output proportional to the temperature (in oC).

Why Use LM35s to Measure Temperature?

o You can measure temperature more accurately than a using a thermostat.


o The sensor circuitry is sealed and not subject to oxidation, etc.
o The LM35 generates a higher output voltage than thermocouples and may not
require that the output voltage be amplified.

What Does an LM35 Do? How does it work?

o It has an output voltage that is proportional to the Celsius temperature.


o The scale factor is .01V/oC
o The LM35 does not require any external calibration or trimming and maintains an
accuracy of +/-0.4 oC at room temperature and +/- 0.8 oC over a range of 0 oC to
+100 oC.
o Another important characteristic of the LM35DZ is that it draws only 60 micro
amps from its supply and possesses a low self-heating capability. The sensor self-
heating causes less than 0.1 oC temperature rise in still air.

What Can You Expect When You Use An LM35?

 You will need to use a voltmeter to sense Vout.


 The output voltage is converted to temperature by a simple conversion factor.
 The sensor has a sensitivity of 10mV / oC.
 Use a conversion factor that is the reciprocal, which is 100 oC/V.
 The general equation used to convert output voltage to temperature is:
o o
o Temperature ( C) = Vout * (100 C/V)
o
o So if Vout is 1V , then, Temperature = 100 C
o The output voltage varies linearly with temperature.

11
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

2.3.2 Soil Moisture sensor

Soil moisture sensors measure the water content in soil. A soil moisture probe is made up of
multiple soil moisture sensors. The soil moisture sensor is a sensor connected to an irrigation
system controller that measures soil moisture content in the active root zone. Soil moisture
sensor can reduce irrigation application by 50%. Sensors are placed at least 5 ft from the
downspouts for avoiding the high moisture areas. Tensiometer can be used as the moisture
sensor to detect moisture contents of soil.

EC-5 SOIL MOISTURE SENSOR

Fig: 2.3 EC-5 soil moisture sensors

There are five different soil moisture sensors EC-5 Soil Moisture Sensor, 10HS Soil Moisture Sensor,
5TM Soil Moisture Sensor, 5TE soil moisture sensor, GS3 soil Moisture sensor, and MAS-14-20
milliamp water content sensor. From those lists of sensors we selected EC-5 soil moisture sensor for our
project.

Soil moisture levels can be expressed in terms of soil water content. A predefined moisture
threshold is used as a reference to control the water pumping if needed. If the water level is less
than a predefined value then our sensor will detect this and will inform the system to pump the
water. On the other hand if it exceeds the threshold value and the water pump is ON then our
system will switch OFF the water pump. This will allow efficient usage of water.

The EC-5 is our lowest-cost soil moisture sensor, and measures Volumetric Water Content only.
Just 5 cm long with a 0.3 L measurement volume, this handy little sensor is easy to install in the
field and can also be used in nursery pots.
12
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Lowest Cost Individual Sensors for Large Sensor Networks

Looking for a basic, no-frills soil moisture sensor? Look no further than the EC-5, a sensor that
accurately measures water content in any soil or soilless media with minimal salinity and textural
effects.

The EC-5 delivers research-grade accuracy at a price that makes large sensor networks
economically practical. You can adequately characterize your site with sensors at multiple depths
and locations, even if you're on a tight budget.

Engineered for Accuracy

The EC-5 determines volumetric water content (VWC) by measuring the dielectric constant of
the media using capacitance/frequency domain technology. Its 70 MHz frequency minimizes
salinity and textural effects, making this sensor accurate in almost any soil or soilless media.
Factory calibrations are included for mineral soils, potting soils, Rockwool, and prelate.

Easy Installation

Just 5 cm long with a 0.3 L measurement volume, this handy little sensor is easy to install in the
field and can also be used in nursery pots. The EC-5's robust design makes it easy to push
directly into undisturbed soil to ensure good accuracy.

Reasons to pick the EC-5:

 If volumetric water content is the only measurement you need.


 If you are on a tight budget.
 If you want a basic, all-purpose sensor with excellent accuracy.
 If you are interested in a small volume of influence (e.g. field spatial variability, lab
column studies, or greenhouse research).

13
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

2.4 Control Valve


Control valves are valves used to control conditions such as flow, pressure, temperature, and
liquid level by fully or partially opening or closing in response to signals received from
controllers that compare a "set-point" to a "process variable" whose value is provided by sensors
that monitor changes in such conditions.

The opening or closing of control valves is usually done automatically by electrical, hydraulic or
pneumatic actuators. Positioners are used to control the opening or closing of the actuator based
on electric or pneumatic signals. These control signals, traditionally based on 3-15psi (0.2-
1.0bar), more common now are 4-20mA signals for industry. A flow control valve regulates the
flow or pressure of a fluid. Control valves normally respond to signals generated by independent
devices such as flow meters or temperature gauges.

2.4.1 Solenoid Valve


Solenoid valves are electromechanical valves that are controlled by stopping or running an
electrical current through a solenoid, in order to change the state of the valve. A solenoid is a coil
of wire that is magnetized when electricity runs through it. The solenoid valve makes use of this
solenoid in order to activate a valve, thus controlling water flow, airflow and other things with
electricity.
A solenoid valve is an electromechanically operated valve. The valve is controlled by an electric
current through a solenoid: in the case of a two-port valve the flow is switched on or off; in the
case of a three-port valve, the outflow is switched between the two outlet ports.

Fig: 2.4 a) solenoid valve b) its connection to microcontroller

14
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

A solenoid valve is an electromechanical device used for controlling liquid or gas flow. The
solenoid valve is controlled by electrical current, which is run through a coil. When the coil is
energized, a magnetic field is created, causing a plunger inside the coil to move. Depending on
the design of the valve, the plunger will either open or close the valve. When electrical current is
removed from the coil, the valve will return to its de-energized state.

 Energized: -A valve is energized when current is supplied to the coil.


 De-Energized:-The state of a valve where electrical current is not being applied to the
coil.
 Normally-Closed Valve:-The normal state of the valve is closed. The valve opens when
the coil is energized and re-closes once the power is removed from the coil.
 Normally-Open Valve:-The normal state of the valve is open. Once the coil is energized,
the valve closes. Removal of the electrical power causes the valve to open.

Fig: 2.5 process valve

In physics, the term refers specifically to a long, thin loop of wire, often wrapped around a
metallic core, which produces a uniform magnetic field in a volume of space (where some
experiment might be carried out) when an electric current is passed through it. Solenoids are
important because they can create controlled magnetic fields and can be used as electromagnets.
In engineering, the term may also refer to a variety of transducer devices that convert energy into
linear motion.

In direct-acting solenoid valves, the plunger directly opens and closes an orifice inside the valve.
In pilot-operated valves (also called the servo-type), the plunger opens and closes a pilot orifice.
The inlet line pressure, which is led through the pilot orifice, opens and closes the valve seal.

The most common solenoid valve has two ports: an inlet port and an outlet port. Advanced
designs may have three or more ports. Some designs utilize a manifold-type design. Solenoid
valves make automation of fluid and gas control possible.

15
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Parts of a solenoid valve


A control valve consists of three main parts in which each part exist in several types and designs:

 Valve's actuator
 Valve's positioner
 Valve's body

The illustration below depicts the basic components of a solenoid valve. The valve shown in the
picture is a normally-closed, direct-acting valve. This type of solenoid valve has the most simple
and easy to understand principle of operation.

Fig: 2.6 parts of solenoid valve

1. Valve Body 4. Coil / Solenoid 7. Plunger

2. Inlet Port 5. Coil Windings 8. Spring

3. Outlet Port 6. Lead Wires 9. Orifice

 Orifice:-An opening through which media passes when flowing through a valve. The
orifice is opened and closed to control the flow of media through the valve.
 Port, Inlet:-The media (fluid or gas) from the source enter the valve through the inlet port.
 Port, Outlet:-The media (fluid or gas) from exits the valve through the outlet port.
 Plunger (Solenoid Core):-The moving component of a linear solenoid which opens and
closes the valve body orifice or pilot orifice for pilot operated valves.
 Spring Loaded Plunger:-Indicates that the valve has a plunger return spring. Usually a sign
that the valve may be mounted in any position.
 Valve Body:-The portion of the valve that contains the inlet and outlet ports. It can be
made out of plastic, brass, steel, stainless steel etc.
 Valve Coil:-Single or multiple-turn winding of a conductor such as copper wire. The coil
produces the magnetic field which in turn moves the valve plunger.

16
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

 Coil/ Solenoid: The purpose of a solenoid valve coil is to convert electrical energy into
linear motion. The coil consists of copper wire (or aluminum) wound around a hollow
form. When electric current flows through the coil, a magnetic field is created. This is
accomplished by placing a ferromagnetic core inside the coil. In a solenoid valve, the
ferromagnetic core is called the valve plunger. When the current flows through the coil,
the lines of magnetic flux turn the plunger into an electromagnet. The magnetic field
causes the plunger to slide further up into the coil, opening the valve body orifice or pilot
orifice.

How does a solenoid valve work?


The media controlled by the solenoid valve enters the valve through the inlet port (Part 2 in the
illustration above). The media must flow through the orifice (9) before continuing into the outlet
port (3). The orifice is closed and opened by the plunger (7). The valve pictured above is a
normally-closed solenoid valve. Normally closed valves use a spring (8) which presses the
plunger tip against the opening of the orifice. The sealing material at the tip of the plunger keeps
the media from entering the orifice, until the plunger is lifted up by an electromagnetic field
created by the coil.

Solenoid Valve Coils (DC) and Electrical Polarity:-A common question about solenoid valve
coils is whether the electrical current polarity matters in a DC coil. Most coils with lead wires
use the same color wire for both terminals and have no polarity markings. The answer is that
polarity does not matter. You can connect the positive terminal to either of the two wires without
affecting the operation of the valve.
Solenoid Valve Coil Voltages:-Solenoid valve coils are available for both DC and AC
electricity. Although a coil can be made to work with almost any imaginable voltage, the most
common voltages available are:

6-Volt DC 12-Volt DC 24-Volt DC

24-Volt AC 120-Volt AC 220/240-Volt AC

The advantage of the low voltage coils is obviously electrical safety. Hobbyists and do-it-
yourselfers often power the low voltage solenoid valves with wall transformers. Smaller valves
12 VDC valves can be powered by a 12-Volt / 500 mA power supply. However, always make
sure your power supply does meet or exceed the power requirement of the solenoid. The 24 VAC
solenoid valves appeal to hobbyists as well since they can be easily controlled by irrigation
timers. Most industrial applications and heavy machinery use solenoids with 24 VDC coils.

17
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

2.5 Liquid Crystal Display (LCD)


Here we are using a 20x4 LCD for displaying the values on the screen. It has 14 pins. It support
20 characters per rows and total no of rows are 4. It means that it can support up to 80 characters
at a time, which is sufficient for data display purpose. RS, R/W and Enable pins of LCD are
connected with the receiving end microcontroller port pins. Data lines D4-D7 are connected to
one of the output port of microcontroller.
The basic connection of LCD is shown below. Here VDD (contrast voltage) is adjusted by using
a variable resistor connected with it.

Fig: 2.7 LCD Basic Connection Diagram

2.7 Project Applicability

Low volume irrigation systems are designed for placement in both, new, existing landscapes and
vegetable gardens. They are also ideal for installation on difficult terrain such as on slopes, in
oddly shaped areas, and sites with high winds. Drip irrigation can be used on shrubs,
groundcovers, trees, flowers bed, vegetable garden, perennials pot and containers. It can also
install in a greenhouse and nurseries.
How long and how often should we use this irrigation depends on the location, plant material,
soil type and the weather conditions.

18
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

CHAPTER THREE

HARDWARE IMPLEMENTATION

3.1 Methodology and Physical system Block Diagram

In this project, overall steps that are taken to be carried out to successfully achieve the objectives are:
 Choosing a microcontroller. .
 Choosing temperature sensor.
 Choosing moisture sensor.
 Choosing solenoid valve.
 Choosing transistor for water motor switching.
 Testing of switches control over system.
 Testing of L.C.D with microcontroller.
 Software design.

The project principle is based on the following facts. In this project the main objective of this
project is to automatically control the watering system of plant in using soil moisture sensor.
For this purpose we need different mechanisms first to sense the water content in the soil, then
we give this signal to the microcontroller not only the sensor output but also time is given to
the MC, then the output which out to the MC is given to the motor then the motor make the
valve open and closed at the end the LCD display the status of the valve and motor. We need
different kinds of electrical devices for doing so.

19
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 3.1 System Block Diagram

Fig: 3.2 A typical drip irrigation control system

20
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Drip irrigation systems with a pre-filter, pump station with backflow prevention, and chemical
injection site. The chemical injection site can be before or after the main filter station. A pressure
control valve is recommended to adjust the water pressure as desired before it enters the drip
lines. A water meter can be placed after the pressure control or between a solenoid valve and
each zone. An air vent provides vacuum relief. Vacuum relief is necessary between the solenoid
valve and the drip tapes to avoid suction of soil into the emitters when the system is shut off.

3.1.1 Microcontroller
A microcontroller plays a great roll in controlling all the devices interfaced on it. The user enters
the desired input values, that means the threshold values of the sensors then the microcontroller
has the power to control all the operations based on the values given as the input to it.

3.1.2 Motor Drive and power MOSFET interfacing


For this project we require dc motor to create rotational movement. It is driven by an operating
voltage of 6V, 12V or 24V. .In order to switch medium power motors, a power MOSFET is used
instead of a darlington transistor. The device IRF530 is a suitable power MOSFET to use in this
circuit.
The device IRF530 is a suitable power MOSFET to use in this circuit. Note that it is usual to
connect a back emf suppression diode across the output device. This is essential with devices
such as relays, solenoids and motors which create a back emf when power is switched off. The
diode type 1N4001 is the device recommended.

To run the motor – high PIN

To stop the motor – low PIN

Fig: 3.3 Motor and power MOSFET interfacing

21
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

3.1.3 Light Emitting Diode (LEDs)


The PIC Microcontroller can sink (“absorb”) or source (“give out”) a small amount of current,
which means that an LED can be connected directly to the output pin. A series resistor (value
330R) is also required to limit the current.

Fig: 3.4 LED interfacing circuit

3.1.4 LCD
A Liquid Crystal Display is an electronic device that can be used to show numbers or text. There
are two main types of LCD display, numeric displays (used in watches, calculators etc) and
alphanumeric text displays (often used in devices such as photocopiers and mobile telephones).
The display is made up of a number of shaped „crystals‟. In numeric displays these crystals are
shaped into „bars‟, and in alphanumeric displays the crystals are simply arranged into patterns of
„dots‟. Each crystal has an individual electrical connection so that each crystal can be controlled
independently. When the crystal is „off‟ (i.e. when no current is passed through the crystal) the
crystal reflect the same amount of light as the background material, and so the crystals cannot be
seen. However when the crystal has an electric current passed through it, it changes shape and so
absorbs more light. This makes the crystal appear darker to the human eye - and so the shape of
the dot or bar can be seen against the background. It is important to realise the difference
between a LCD display and an LED display. An LED display (often used in clock radios) is
made up of a number of LEDs which actually give off light (and so can be seen in the dark). An
LCD display only reflects light, and so cannot be seen in the dark.

LCD Characters

The table on the next page shows the characters available from a typical LCD display. The
character „code‟ is obtained by adding the number at the top of the column with the number at
the side of the row. Note that characters 32 to 127 are always the same for all LCDs, but
characters 16 to 31 & 128 to 255 can vary with different LCD manufacturers. Therefore some
LCDs will display different characters from those shown in the table. Characters 0 to 15 are

22
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

described as „user-defined‟ characters and so must be defined before use, or they will contain
„randomly shaped‟ characters. For details on how to use these characters see the LCD
manufacturer‟s data sheets.

3.1.5 Solenoid & Solenoid Valves


A solenoid consists of a steel plunger inside an electric coil which is wrapped around a tube.
When the coil is energized a magnetic field is created, and this draws the plunger into the tube.
When the coil is de-energized a spring pushes the plunger back out of the tube.
To control a solenoid the standard MOSFET circuit is used, the standard transistor switching
circuit can be used to drive the solenoid valve.

Fig: 3.5 Solenoid valve interfacing

3.1.6 Push Button


There are a large variety of switches available, but the majority all have two „contacts‟ which are
either „open‟ (off) or „closed‟ (on). The two circuits shown below can be used with almost all
switches. With this circuit the input pin is high when the switch is open and low when the switch
is closed.

Fig: 3.6 Switch interfacing circuit

23
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

3.1.7 Temperature sensor LM35


The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is
linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage
over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a
large constant voltage from its output to obtain convenient Centigrade scaling.

Fig: 3.7 LM35 pin definition

24
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

CHAPTER FOUR
Controller Design, Analysis and Software Implementation
4.1 Controller Design and Analysis
In this chapter we shall look at the design of a digital controller for a control system, namely a
drip irrigation control system. Drip irrigation control systems are commonly used in many
process control applications to control, for example, the opening and closing of the control valve,
and measuring the flow of the water in the pipe by flow meter. Liquid enters the pipe and valve
using a pump. The requirement in this system is to control the rate of liquid delivered by the
pump so that the flow of liquid within the pipe through the valve is at the desired point. In this
chapter the system will be identified from a simple step response analysis. A constant voltage
will be applied to the pump so that a constant rate of liquid can be pumped through the pipe. The
volumetric flow rate of the fluid in the pipe is measured. A simple model of the system can then
be derived from the equation of Hydraulic resistance occurs whenever there is a pressure
difference, such as liquid flowing from a pipe of one diameter to one of a different diameter, and
equation of liquid flow in the control valve. After obtaining a model of the system, a suitable
controller will be designed to control the control valve and liquid flow in the pipe as well as the
external devices such as sensors.

To design a controller that makes a system behave in a desirable manner, we need a way to
predict the behavior of the quantities of interest over time, specifically how they change in
response to different inputs. Mathematical models are most often used to predict future behavior,
and control system design methodologies are based on such models. Understanding control
theory requires engineers to be well versed in basic mathematical concepts and skills, such as
solving differential equations and using Laplace transform. The role of control theory is to help
us gain insight on how and why feedback control systems work and how to systematically deal
with various design and analysis issues. Specifically, the following issues are of both practical
importance and theoretical interest:
1. Stability and stability margins of closed-loop systems.
2. How fast and smooth the error between the output and the set point is driven to
zero.
3. How well the control system handles unexpected external disturbances, sensor
noises, and internal dynamic changes.

25
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

4.1.1 SYSTEM MODEL


The control input signal to the valve is a current signal in mA which is converted into a pressure
signal. This pressure is applied to a valve and changes the valve stem position (in mm). The
valve position dictates the amount of flow passing through the valve into the area.

The Solenoid block represents the electrical characteristics and generated force for the solenoid
in the following figure:

Fig: 4.1 Electrical model of solenoid valve

The equation of motion for the plunger as a function of position, x, is:

Where Fe is the electromagnetic force, Fl is the load force, λ is the viscous damping term
and m is the plunger mass.
But actually the input signal to the valve is the current, and the electromotive force of the
solenoid coil is given by the following figure.

26
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 4.2 Rough sketch of solenoid valve

Where N is the number of turns and I (t) is the current flowing through the coil

For a more complete discussion on modeling the mechanical system, in this article the traditional
basically linear mass-spring-damper and for constant load force Fl from equation (1)

Then taking the Laplace form of equation (3) we can get the following:

And taking the input output equation of the above equation X(s) / I(s) = Gp(s)

27
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Simplified form of equation (5) is:

From this equation N- number of turns, M-armature mass, B- springs damping coefficient
and K- spring stiffness coefficient are the constants.
Now our plant block diagram is given in the following figure:

Fig: 4.3 Block Diagram of the system

In our system model above the output Q is proportional to the armature or plunger
displacement X.

28
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

4.1.2 Controller Design


The design using the root-locus method is directly connected to the considerations, the
specifications of maximum overshoot; rise and settling time for a closed loop having a dominant
pair of poles have been converted into the conditions for the damping ratio  and for the
natural frequency of the related transfer function Gp(s).

The root-locus method is - as generally known - a graphical method, which is used to analyze the
position of the closed-loop poles. This method offers the possibility to combine in
the complex S plane the desired dominant pair of poles with the root locus of the fixed part of the
loop and to deform the root locus by adding poles and zeros such that two of the branches
traverse through the desired dominant pair of poles at a certain gain K.

The root locus for the system is a plot of the root of the system‟s characteristic equation as gain
is varied. Hence, the character of the transient response of the system is evident from the root
locus. The design procedure is to add poles and zeros via a digital controller so as to shift the
roots of the characteristic equation to more appropriate locations in the Z-plane.

The principal strategy during the controller design by the root-locus method will be shown.

Now for the system block diagram of fig: 4.3 let‟s assume the values for the plant transfer
function as we modeled before, and design the controller based on these values.

Assumption: we assumed that if there is 100 numbers of turns with the plunger mass of 0.1Kg,
viscous damping constant of 0.3Kg/sec and stiffness spring constant of 0.2Kg/sec/sec.

Now the transfer function becomes

Also assume that the feedback has the gain of unity, Ks = 1 and there is no need of modeling the
power switch since it is a constant, in case let‟s use ZOH to serve our final controller result not
affected.

Now by using this root locus method let‟s design the digital controller for the system we
modeled. Let assume the desired closed loop characteristic equation dominant poles have a
damping ratio  = 0.5 and settling time ts = 2 second, and also we assumed the sampling
period as T = 0.2 second.

29
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 4.4 Controller block diagram

For the system now let‟s follow the steps below to design the controller

4. Checking our sampling period is appropriate or not

30
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

5. Next let‟s find the magnitude of Z for the constant damping ratio

6. Now let‟s convert our system in to Z domain

For, T = 0.2sec and simplifying the given equation we can get:

31
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

7.Next draw the root locus


The following figure illustrates the testing of point P to determine if it is on the root locus.

Fig: 4.5 Sketch of root locus

If point P is located on the root locus, then (contribution angle) the desired dominant closed
loop pole the sum of angles at point P from pole and zero of the open loop pulse transfer function
must be equal to , but the contribution at point P is given by:

32
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Now assume that the controller pulse transfer function would be:

In this design, the gain K is utilized to meet steady state error requirement. The controller pole is
restricted to real value inside the unit circle.

If we decide to cancel the pole stable at Z = 0.670

33
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 4.6 Sketch of root locus for zeros and poles

Then we have , the open loop pulse transfer function of the given system
is given by:

34
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Then using the magnitude condition we can find the value of controller gain K

 Procedures we followed to design the controller

Fig: 4.7 procedures we followed to design the controller

35
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

4.1.3 Realization and Implementation of the controller


The controller we designed is given by:

For the general case the transfer function expression of the controller is given by

We can realized the controller in the following way

Fig: 4.8 Realization of the controller

36
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

From the block diagram above

The implementation flow diagram will be given below

Fig: 4.9 Flow diagram of microcontroller implementation

37
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

4.2 Software Implementation

4.2.1 Algorithm and programming in MikroC Compiler


Microcontroller is the center of the whole the software design part of our system. That is the
program is based on the microcontroller registers and ports. It will receive desired value from the
sensors through ADC which is embedded on it. The actual input values will be compared to the
desired and the decision will be done by the microcontroller.

The required algorithm has to be developed to make the microcontroller to read the inputs and
respond the output accordingly. Therefore, the algorithm is established and represented by a flow
chart shown below. This flow chart is translated in to C language and compiled using MikroC,
the development tool for PIC mikroC.

Software implementation includes


3.2 Read the sensors values through analog to digital convertor.
3.3 Update the status of switches to ON OFF solenoid valves and water motor, but in
case of solenoid valve we used two LED‟s to represent the opening and closing of the
valve.
3.4 Display the status on LCD display accordingly.

The main program for this system is written by using the embedded C programming language.
The schematic diagram for this system which consists of all the components was designed by
using the proteus ISIS 7.10 professional editions. The main program was developed in the
Mikroc code by using the embedded C programming language. The C program was burned into
the ROM part of the PIC16F877A microcontroller.

A. The flow chart


The flow chart is the base the software design and the translated to the C code. It gives the
general overview of the algorithms used in the main C program and the flow sequence of the
program from the start to the end of the code and return back. There are initialization of ports,
ADC, LCD, and LM35 temperature sensor. The other parts in the flow chart include, get the
reference value of LM35 temperature sensor, and LCD display.

38
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 4.10 program of the flow chart

39
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

B. MikroC Compiler
MikroC compiler is a powerful reach development tool for PIC micros. It is designed to provide
us with the easiest possible solution for developing applications for our systems.

PIC and C fit together well: PIC is the most popular 8-bit chip, used in a wide variety of
applications. mikroC is a full-featured ANSI C compiler that is available for six different
microcontroller architectures (in this case, for PIC 12/16/18). It features an intuitive IDE, a
powerful compiler with advanced SSA optimizations, lots of hardware and software libraries,
and additional tools that will help you in your work. The compiler comes with a comprehensive
Help file (700 pages) and lots of ready-to-use examples designed to get you started in no time.

Each compiler license includes free upgrades and tech support for the lifetime of the product.
The software features a Live Update service so you can get new features and improvements
instantly. The mikroC PRO for PIC compiler supports 504 PIC microcontrollers. Newly released
PIC microcontrollers will be supported by new versions of the compiler software that is updated
regularly. The compiler is designed to be smart and efficient, so you can rely on it to do the hard
work. It features four levels of optimizations that can reduce your code size up to 20 percent.
Standard header files are included that make it easy to port your code from other C compilers.

Features

MikroC allows us to quickly develop and deploy complex applications:

 Write C source code using the built-in code editor (Code and parameter assistants, Syntax
highlighting, Auto correct, Code Templates, and more….)
 Use the included MikroC libraries to dramatically speed up the development: Data
acquisition, memory, displays, conversions, communications…..
 Generate commented, human-readable assembly and standard HEX compatible with all
programmers.
 Monitor program structure, variables and functions in the code explorer.
 Inspect program flow and debug executable logic with the integrated debugger.

MikroC Libraries
MikroC for PIC provides a set of libraries which simplify the initialization and use of PIC
compliant MCUs and their modules:

40
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

ADC Library

ADC (Analog to Digital Converter) module is available with a number of PIC MCU modules.
ADC is an electronic circuit that converts continuous signals to discrete digital numbers. ADC
Library provides you a comfortable work with the module.

Library Routines

 ADC_Init
 ADC_Get_Sample
 ADC_Read

Lcd Library

The mikroC for PIC provides a library for communication with LCDs (with HD44780 compliant
controllers) through the 4-bit interface. An example of LCD connections is given on the
schematic at the bottom of this page. For creating a set of custom LCD characters use LCD
Custom Character Tool.

Library Routines

 Lcd_Init
 Lcd_Out
 Lcd_Out_Cp
 Lcd_Chr
 Lcd_Chr_Cp
 Lcd_Cmd

Temperature recording Operation


The most interesting parts of the software are shown above. The variable val is an unsigned int
so the maximum value it can store is 65535. The reference in use is 2.5V so for the 10bit ADC
each ADC bit is worth
2.5/1023 = 2.44mV

If you work out values generated for a maximum temperature of 100°C using the scale factor
2.44mV (or 244/100)
100 * 10mV = 1.0V
1.0V/2.44mV = 410
410 * 244 = 100,040 which will not fit into an unsigned int. So this scale factor does not work
for all input values

41
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

By using a little math‟s it can be made to fit -you need to reduce the top number to fit. e.g.

410 * 122 = 50,020 which does fit.


Dividing by 50 us gets back to the correct scale factor of 244.

So the scale 122/50 works for all input values. This is an example of avoiding the use of floating
point variables which take up too many resources. You can still make the system work but you
have to be careful when using fixed types and you have to check all input values and outputs to
make sure they fit.

Averaging
Averaging would be better done in the PC as it has more resources - the same goes for
calculating and displaying the temperature in Fahrenheit but this gives a demonstration of what
you can do.

Note: The RAM is used up since a bug in MikroC 5.0.0.3 puts strings int RAM - in future
versions this will be corrected.

Typical output from the temperature recorder


96 RAW 234 C 741 F

The left most value is the RAW ADC value, the next is the temperature sensor output in degrees
centigrade and the next is the temperature sensor output in degrees Fahrenheit.

Note: We have to put in the decimal point so the above readings are:

234 C 23.4°C

741 F 74.1°F

42
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

C. Simulation using Proteus


Our simulation for valve controlling and motor starting and stopping based on microcontroller is
done using SIS7.10 professional. So that as we know in the Proteus there are devices, for our
simulation we have used some devices. They are PIC16F877A microcontroller, motor-DC,
LM35 temperature sensor, LM044L LCD display, IRF530 MOSFET as motor drive, Crystal
4MHz, BUTTON as ON/OFF switch as moisture sensor, AVX0402X7R22N capacitor 15pF,
Resistors like 3WATT10K 10k  and 330  , Yellow and Red LEDs to represent the opening
and closing of the valve respectively, and 1N4001 Diode.

To explain the function and interconnection of the devices:

 The first connection is the ON/OFF switch Button and the PIC16F877A on PIN
RA1/AN1, just to start and stop the motor, lighting the LEDs where they represent as
opening and closing of the valve. It works as follows when the button is at ON state
means the soil will be dray which implies the motor must run and the valve must be
opened in this case YELLOW-LED gives sign, and when the button is at closed state
means the soil will be wet and this implies the motor stops and the valve must be closed,
this is also represented by RED-LED which gives sign in this case.
 The next interconnection is LM35 and PIC16F877A on PIN RA0/AN0, which is just the
input device and used to vary the temperature value. It works when the temperature is
varied above the optimal value the motor will stop, and if the temperature is between the
minimum and maximum value the motor will run properly.
 The other connection is for external oscillator that is the 4MHz and the two 15pF
capacitors are connected to PIN OSC1/CLKIN and OSC2/CLKOUT. The crystal and
capacitors produce the clock pulses that are required to step the microcontroller through
the program and provide the timing pulses, or the oscillator is used to provide the clock to
the PIC16F877A which decides the speed or baud rate of the microcontroller.
 The other interconnection is the two LEDs and PIC16F877A on pin RD1/PSP1 connected
Yellow-LED and RD2/PSP2 connected Red-LED giving the signs where they represent
the valve in the opening and closing condition. When the YELLOW-LED gives sign it
mean that valve is open and when the RED-LED gives sign it mean the valve is closed.
 The other connection is IRF530 MOSFET on PIN RD0/PSP0 of PIC16F877A used to
derive the motor. The diode connected parallel to the motor is used to prevent the spike
happen by the back emf of the motor when the motor will stop.
 The other interconnection is the LCD display and the PIC. We use port B of the PIC to
interface to the LCD in 4-bits mode. And the LCD has constant 5volt supply (VDD)
connection, ground connection (VSS) and contrast control resistance used to control the
back ground light of the LCD (VEE) connection. The LCD will display temperature
value, the soil state, the motor state, and the valve state.

43
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Fig: 4.11 Simulations

44
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

CHAPTER FIVE
RESULT and DISCUSSION
5.1 Results
As we know the results when we vary the temperature sensor (LM35) all its values were
displayed on LCD from -55 to 150, but at the reference maximum value of LM35 temperature
sensor the motor will stop running and simultaneously the Red LED giving light were both they
controlled, this is the state where the temperature sensor controls overall system. On the other
case we see that if the temperature is optimal (between the maximum and minimum) value, but
the moisture sensor is maximum mean the soil is wet the motor will stop running incense Red
LED gives sign, this is the condition where the moisture sensor controls the overall system. But
in the case when temperature is optimal and moisture is minimum means the soil is dry also
moisture sensor controls the overall system the motor starts running and the Yellow LED gives
sign, and if the moisture level is between the minimum and maximum values, and the
temperature is below the maximum value is the normal condition of the system were the motor
will be running and Yellow LED gives sign. The other results displayed on the LCD were the
current state of the motor, the valve and the soil moisture level whether wet or dry. We can see
the results of the simulation in the LCD.

5.2 Discussion

An irrigation controller is a device to operate automatic irrigation system drip irrigation systems.
Most controllers have a means of setting the frequency of irrigation, the start time, and the
duration of watering. Some controllers have additional features such as multiple programs to
allow different watering frequencies for different types of plants, rain delay settings, input
terminals for sensors such as rain and freeze sensors, soil moisture sensors, weather data, remote
operation, etc. There are two basic types of controllers, electric and hydraulic. Two general types
of controllers are used to control irrigation systems: Open control loop systems, and closed
control loop systems. The difference between these is that closed control loops have feedback
from sensors, make decisions and apply decisions to the irrigation system and we used also this
control system for our project. On the other hand, open control loop systems apply a preset
action, as is done with irrigation timers.

Most new systems employ electromechanical or electronic controllers. In this scenario, the
controller is connected to an electrical circuit that operates a solenoid attached to each valve
(solenoid valve). When the solenoid is actuated, the water above the diaphragm is relieved and
the valve opens. There are broadly two categories of irrigation controllers: domestic ones for
gardening applications, and professional controllers for more demanding agricultural
applications. While most domestic (gardening) controllers can only open/close zones based on a
time duration, without any feedback from the irrigation process, professional irrigation
controllers can irrigate based on volume (quantities defined in cubic meters / Gallons), receive
feedback from the process, and react to actual events happening during the process.

45
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

CHAPTER SIX
CONCLUSION and RECOMMENDATION
6.1 Conclusions
The project we dealt so fare is Microcontroller based Drip-Irrigation system. It uses LM35
temperature sensor which senses the external environment of the area, and EC-5 soil moisture
sensor which senses and measures the volumetric water content in the soil.

This project paper contains six chapters including this conclusion and recommendation. In the
first chapter we discussed generally about the introductory part of the project including its
background, the project objective, and its scope as well as problem statement and the solution we
found for the problem. In the second chapter we dealt the theory of each device we used to do
this project, and the third chapter deals general about the methodology and the systems block
diagram including their circuitry system. In the fourth chapter we dealt our systems model,
controller design analysis and the software implementation of the system. Finally in the fifth and
sixth chapters we dealt result, discussion, conclusion and recommendation of the project.

The project accuracy is limited by the lack of the efficiency of the circuit components and other
ambient constraints. We basically used PIC16F877A Microcontroller to apply what we have
learned in introduction to embedded system.

We hope that if the design is applied there will be tremendous of cost reduction for agricultural
sectors such as horticulture, flower centers, and etc. and in the domestic grading and
greenhouses. The other advantage is that other control operations can be included in the future as
the Microcontroller control is flexible.

46
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

6.2 Recommendation
Our recommendations are presented as follows:

First of all we recommended the department to provide financial budget for the students; we
needed it even to buy some devices which wouldn‟t found in the laboratories and helps us to do
the project.

Also we recommend the department to provide basic laboratory equipments for students prior to
the demonstration time specially microcontroller and the PLC were the basic controlling devices
currently the students need to do the project.

Finally we recommended the department to inform our juniors about title selection and proposal
in the first semester of their final year.

47
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Reference
 Drip irrigation coerces module from IWRE students
 K.Prathyush Automation of drip irrigation
 www.wikpidiafree encyclopedia
 Martin P.Bates programming 8-bit PIC microcontroller

48
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

Appendix
Mikroc-code
//Target PIC: PIC16F877A//

#define LOAD PIN_D0

sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D4 at RB0_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D6 at RB2_bit;

sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;

sbit LCD_EN_Direction at TRISB5_bit;

sbit LCD_D4_Direction at TRISB0_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D7_Direction at TRISB3_bit;

Unsigned int ADRead,triptemp, TripTempc=41; // load switching threshold in Celsius

Float temp, cent;

Unsigned int vDisp[3];

Unsigned char Display [7];

Float temp()

Float refin,numin, temp;

Int1 flag;

49
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

setup_adc(ADC_CLOCK_INTERNAL);

setup_adc_ports(ALL_ANALOG);

For (;;)

delay_ms(500);

set_adc_channel(0);

refin=read_adc();

set_adc_channel(1);

numin= read_adc();

Temp= (numin*1)*2;

putc(254);putc(1);delay_ms(10);

printf("Temp:%f",temp);

putc (254);putc(192);putc(1);

delay_ms(10);

If (temp<20)

output_high(PIN_D2);

output_low(PIN_D4);

Flag=1;

If (flag==1)

printf("person in");

If (temp>30)

50
MICROCONTROLLER BASED DRIP IRRIGATION SYSTEM 2013

output_high(PIN_D4);

output_low(PIN_D2);

Flag=0;

If (flag==0)

printf("person in");

If ((temp>20)&&(temp<30))

output_low(PIN_D4);

output_low(PIN_D2);

putc(254);putc(1);delay_ms(10);

printf("temp:%3.2f", temp);

putc(254);putc(192);putc(1);delay_ms(10);

printf("normal temp");

}}}

Void main ()

While (1)

Temp ();

Display (1);

}}

51

You might also like