WEB-BASED IRRIGATION MONITORING AND CONTROL SYSTEM
New Microsoft Office Word Document
1. MICROCONTROLLER BASED DRIP IRRIGATION
SYSTEM
A PROJECT REPORT
Submitted by
DUKE JOHN SOLOMON. M. J
B. JAFFREY DANIEL
in partial fulfillment for the award of the degree
of
BACHELOR OF ENGINEERING
in
ELECTRONICS AND COMMUNICATION ENGINEERING
ST. JOSEPH’S COLLEGE OF ENGINEERING, CHENNAI
ANNA UNIVERSITY: CHENNAI 600 025
MAY 2012
2. ANNA UNIVERSITY: CHENNAI 600 025
BONAFIDE CERTIFICATE
Certified that this project report “MICROCONTROLLER BASED DRIP
IRRIGATION SYSTEM “is the bonafide work of “DUKE JOHN SOLOMON.
M. J (31708106040) AND B. JAFFREY DANIEL (31708106047) “who carried
out the project work under my supervision.
SIGNATURE SIGNATURE
Dr. Siva Subramanian Mr. Udhayakumar
HEAD OF THE DEPARTMENT SUPERVISOR
ASSOCIATE PROFESSOR
ELECTRONICS AND ELECTRONICS AND
COMMUNICATION ENGG COMMUNICATION ENGG
OLD MAHABALIPURAM ROAD, OLD MAHABALIPURAM ROAD,
CHENNAI-600 119. CHENNAI-600 119.
Submitted for Viva Voice held on ……………………………………
INTERNAL EXAMINER EXTERNAL EXAMINER
3. CERTIFICATE OF EVALUATION
College Name : St.Joseph’scollege of engineering
Branch Name : Electronics and Communication Engineering
Semester : VIII
S.NO NAME PROJECT TITLE NAME OF
SUPERVISOR
WITH
DESIGNATION
1.
2.
DUKE JOHN
SOLOMON. M. J
(31708106040)
B. JAFFREY
DANIEL
(31708106032)
MICROCONTROLLER
BASED DRIP
IRRIGATION SYSTEM
Mr.
Udhayakumar,
Associate
Professor
The reports of the project work submitted by the above students in partial
fulfillment for the award of Bachelor of Engineering degree in the Electronics and
Communication Engineering branch of Anna University were evaluated and
confirmed to be reports of the work done by the above students and then evaluated.
(INTERNALEXAMINER) (EXTERNAL EXAMINER)
4. ABSTRACT
In the field of agriculture, use of proper method of irrigation is important and it is
well known that irrigation by drip is very economical and efficient. In the
conventional drip irrigation system, the farmer has to keep watch on irrigation
timetable, which is different for different crops. This project makes the whole
irrigation process automated. With the use of low cost sensors and the simple
circuitry makes this project, a low cost product, which can be bought even by a
poor farmer. This project is best suited for places where water is scarce and has to
be used in limited quantity. Also, third world countries can afford this simple and
low cost solution for irrigation and obtain good yield on crops.
The heart of the project is the ATMEL89S52 microcontroller. A 16×2 LCD is
connected to the microcontroller, which displays the current humidity level. The
moisture content measured by the sensor is used to control the solenoid valve which
in turn allows the water in a drop by drop manner. The humidity levels are
transmitted at regular time interval to the PC through the RS232 serial port for data
logging and analysis. In this project a total of two relays are controlled by the
microcontroller through the high current driver IC, ULN2003.
5. ACKNOWLEDGEMENT
My heartful gratitude and thanks to Almighty God, my parents and other family
members and friends without whose unsustained support, I could not have made
this course successfully.
My sincere thanks and profound sense of gratitude goes to respected Chairman
Dr.Jeppiaar, M.A., B.L., Ph.D., for all efforts and administration in educating me
in his premier institution. I take this opportunity to thank our beloved Director
Dr.B.Babu Manoharan, M.A., M.B.A., Ph.D., for their kind co-operation in
completing this project.
I like to express my gratitude to my Principal Dr.Jolly Abraham, M.E., Ph.D., and
head of the Department Dr. A. Siva Subramanian, M.E, Ph.D., for their guidance
and advice all through my tenure.
I take the privilege to extend my hearty thanks to my energetic internal guide Mr.
Udayakumar, for her valuable guidance and support to make this project a
successful one.
Finally with great enthusiasm I express my thanks to all my department faculty
members and technical staff members for providing necessary information and their
sustained interest in my part of fruitful completion.
6. LIST OF TABLE
TABLE NO. TITLE PAGE NO.
3.1 Port 1 Alternate function
3.2 Port 3 Alternate function
3.3 AT89S52 SFR Map
Reset Values
3.4 T2CON – Timer/Counter
2 Control Register
3.5a AUXR: Auxiliary
Register
3.5b AUXR1: Auxiliary
Register 1
3.6 16*2 LCD PIN
Description
3.7 Display Character
Address Code
3.8 LCD Connector Functions
3.9 Input states needed to
select a channel in 8
channel multiplexer
8. CONTENTS
CHAPTER NO. TITLE PAGE NO.
ABSTRACT
LIST OF TABLE
LIST OF FIGURES
1 INTRODUCTION
2 DESIGN OVERVIEW
2.1 OBJECTIVE
2.2 EXISTING SYSTEM
2.3 PROPOSED SYSTEM
2.4 BLOCK DIAGRAM
3 HARDWARE DETAILS
3.1 MICROCONTROLLER ATMEL89S52
3.1.1 GENERAL DESCRIPTION
3.1.2 FEATURES
3.1.3 BLOCK DIAGRAM
3.1.4 PIN DIAGRAM
3.1.5 PIN DESCRIPTION
3.1.6 MEMORY ORGANIZATION
3.1.6.1 PROGRAM MEMORY
3.1.6.2 DATA MEMORY
3.1.7 SPECIAL FUNCTION REGISTERS
3.1.7.1 TIMER2 REGISTERS
3.1.7.2 INTERRUPT REGISTERS
3.1.8 OSCILLATOR CHARACTERISTICS
3.2 16*2 CHARACTER LCD
9. 3.2.1 GENERAL DESCRIPTION
3.2.2 FEATURES
3.2.3 PIN DESCRIPTION
3.2.4 DISPLAY CHARACTER ADDRESS
CODE
3.2.5 INTERFACING WITH
MICROCONTROLLER
3.3 ANALOG TO DIGITAL CONVERTER
3.3.1 GENERAL DESCRIPTION
3.3.2 FEATURES
3.3.3 BLOCK DIAGRAM
3.3.4 PIN DIAGRAM
3.3.5 FUNCTIONAL DESCRIPTION
3.3.5.1 MULTIPLEXER
3.3.5.2 CONVERTER
3.4 RELAY
3.4.1 DESCRIPTION
3.4.2 RELAY DRIVER
3.4.2.1 FEATURES
3.5 SOLENOIDAL VALVE
3.6 SENSOR
4 SOFTWARE DETAILS
4.1 KEIL COMPILER
4.1.1 KEIL TUTORIAL
5 PROJECT OVERVIEW
6 CONCLUSION
REFERENCE & CONSULTANT
10. CHAPTER 1
INTRODUCTION
Can you imagine a lush green golf field in the middle of a desert? Ever wondered
how this is possible? The answer to the above perplexing question is nothing but
Drip Irrigation. Yes, Irrigation by Drip is the most widely used irrigation technique
in the world.
Drip irrigation, also known as trickle irrigation or microirrigation or localized
irrigation, is an irrigation method which saves water and fertilizer by
allowing water to drip slowly to the roots of plants, either onto the soil surface or
directly onto the root zone, through a network of valves, pipes, tubing, and emitters.
It is done with the help of narrow tubes which deliver water directly to the base of
the plant.
Modern drip irrigation began its development in Afghanistan in 1866 when
researchers began experimenting with irrigation using clay pipe to create
combination irrigation and drainage systems. In 1913, E.B. House at Colorado State
University succeeded in applying water to the root zone of plants without raising
the water table. Perforated pipe was introduced in Germany in the 1920s .
Water is a natural resource and should be used sparingly. As water scarcity is an
ever rising problem especially in third world countries, more and more farmers are
switching to irrigation techniques which consume less water. In Drip Irrigation
water is fed to the plants drop wise close to its roots. The water is supplied to the
plants according to a timetable maintained by the farmer which depends on the
plant, soil, and climate. If the farmer misses out the schedule for the crops
(especially hybrid crops which are highly sensitive), this may lead to heavy
financial loss.
11. In this project we are automating the whole process of Drip Irrigation so that the
farmer is relieved of his tension of controlling the solenoid valve.
The advantages of the project are
Hassle free operation as the farmer is relieved of his tension
No Soil Erosion
Low water consumption and ideally suited for drought prone areas
Low cost of circuitry
Low fertilizer wastage
12. CHAPTER 2
DESIGN OVERVIEW
2.1 OBJECTIVE
The aim of this project is to improve the present drip irrigation process used in
rural India. The proposed system automates the whole process of drip irrigation
system such that the plants are watered without human intervention. This system
uses low cost sensors and other products.
2.2 EXISITING SYSTEM
In the conventional drip irrigation system, the farmer has to keep watch on
irrigation timetable, which is different for different crops . Especially for hybrid
crops this has to be strictly followed otherwise this may lead to crop failure. Also
this is labour intensive.
2.3 PROPOSED SYSTEM
In the proposed system, the moisture content of the field is measured by humidity
sensors placed in different parts of the field. Depending on the moisture content in
the field, the valves are opened and closed which allows the flow of water in a drop
by drop manner. Hence the plant gets the required amount of water without human
intervention. Also this is an all weather system and works in any weather
condition.
13. 2.4 BLOCK DIAGRAM
The design consists of the following blocks
1) ATMEL 89S52 Microcontroller
2) 16*2 LCD
3) Relay switch
4) Solenoid Valve
5) Motor
6) Serial Port
7) Analog to Digital Convertor
8) Sensor
Figure 2.1 Overall Block Diagram
14. CHAPTER 3
HARDWARE DETAILS
3.1 MICROCONTROLLER ATMEL89S52
3.1.1 GENERAL DESCRIPTION
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with
8Kbytes of in-system programmable Flash memory. The device is manufactured
using Atmel’s high-density nonvolatile memory technology and is compatible with
the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows
the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel AT89S52 is a
powerful microcontroller which provides a highly-flexible and cost-effective
solution to many embedded control applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, a six-vector two-level interrupt architecture, a full duplex serial
port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed
with static logic for operation down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while allowing the
RAM, timer/counters, serial port, and interrupt system to continue functioning. The
Power-down mode saves the RAM contents but freezes the oscillator, disabling all
other chip functions until the next interrupt or hardware reset.
15. 3.1.2 FEATURES
Compatible with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory
Endurance: 1000 Write/Erase Cycles
4.0V to 5.5V Operating Range
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
WatchdogTimer
Dual Data Pointer
Power-off Flag with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory
Endurance: 1000 Write/Erase Cycles
Dual Data Pointer
Power-off Flag
4.0V to 5.5V Operating Range
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
16. Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
WatchdogTimer
3.1.3 BLOCK DIAGRAM
Figure 3.1 Microcontroller Block Diagram
17. 3.1.4 PIN DIAGRAM
Figure 3.2 ATMEL 89S52 Pin Diagram
3.1.5 PIN DESCRIPTION
VCC
Supply voltage
GND
Ground
PORT 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port,
each pin can sink eight TTL inputs. When 1s are written to port 0 pins,
the pins can be used as high impedance inputs. Port 0 can also be
configured to be the multiplexed low order address/data bus during
accesses to external program and data memory. In this mode, P0 has
internal pull-ups. Port 0 also receives the code bytes during Flash
programming and outputs the code bytes during program verification.
External pull-ups are required during program verification.
18. PORT 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to
Port 1 pins, they are pulled high by the internal pullups and can be used
as inputs. As inputs, Port 1 pins that are externally being pulled low will
source current (IIL) because of the internal pullups. In addition, P1.0
and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively, as shown in the following table. Port 1 also receives the
low-order address bytes during Flash programming and verification.
Table 3.3 Port 1 alternate functions
PORT 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to
Port 2 pins, they are pulled high by the internal pull-ups and can be used
as inputs. As inputs, Port 2 pins that are externally being pulled low will
source current (IIL) because of the internal pull-ups. Port 2 emits the
high-order address byte during fetches from external program memory
and during accesses to external data memory that use 16-bit addresses
(MOVX @DPTR). In this application, Port 2 uses strong internal pull-
ups when emitting 1s. During accesses to external data memory that use
19. 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2
Special Function Register. Port 2 also receives the high-order address
bits and some control signals during Flash programming and
verification.
PORT 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to
Port 3 pins, they are pulled high by the internal pull-ups and can be used
as inputs. As inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pull-ups. Port 3 also serves the
functions of various special features of the AT89S52, as shown in the
following table. Port 3 also receives some control signals for Flash
programming and verification.
Table 3.4 Port 3 Alternate Funations
RST
Reset input. A high on this pin for two machine cycles while the
oscillator is running resets the device. This pin drives High for 96
oscillator periods after the Watchdog times out. The DISRTO bit in
SFR AUXR (address 8EH) can be used to disable this feature. In the
default state of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG
20. Address Latch Enable (ALE) is an output pulse for latching the low
byte of the address during accesses to external memory. This pin is also
the program pulse input (PROG) during Flash programming. In normal
operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes.
Note, however, that one ALE pulse is skipped during each access to
external data memory. If desired, ALE operation can be disabled by
setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.
PSEN
Program Store Enable (PSEN) is the read strobe to external program
memory. When the AT89S52 is executing code from external program
memory, PSEN is activated twice each machine cycle, except that two
PSEN activations are skipped during each access to external data
memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to
enable the device to fetch code from external program memory
locations starting at 0000H up to FFFFH. Note, however, that if lock bit
1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives
the 12-volt programming enable voltage (VPP) during Flash
programming.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
21. XTAL2
Output from the inverting oscillator amplifier
3.1.6 Memory Organization
MCS-51 devices have a separate address space for Program and Data Memory. Up
to 64K bytes each of external Program and Data Memory can be addressed.
3.1.6.1 Program Memory
If the EA pin is connected to GND, all program fetches are directed to external
memory. On the AT89S52, if EA is connected to VCC, program fetches to
addresses 0000H through 1FFFH are directed to internal memory and fetches to
addresses 2000H through FFFFH are to external memory.
3.1.6.2 Data Memory
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy
a parallel address space to the Special Function Registers. This means that the upper
128 bytes have the same addresses as the SFR space but are physically separate
from SFR space.
When an instruction accesses an internal location above address 7FH, the address
mode used in the instruction specifies whether the CPU accesses the upper 128
bytes of RAM or the SFR space. Instructions which use direct addressing access of
the SFR space.
For example, the following direct addressing instruction accesses the SFR at
location 0A0H (which is P2).
MOV 0A0H, #data
22. Instructions that use indirect addressing access the upper 128 bytes of RAM. For
example, the following indirect addressing instruction, where R0 contains 0A0H,
accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect addressing, so the upper 128
bytes of data RAM are available as stack space.
3.1.7 OSCILLATOR CHARACTERISTICS
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier that can be configured for use as an on-chip oscillator, as shown in
Figure 3.3. Either a quartz crystal or ceramic resonator may be used. To drive
the device from an external clock source, XTAL2 should be left unconnected
while XTAL1 is driven, as shown in Figure 3.4. There are no requirements on
the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide by-two flip-flop, but minimum and
maximum voltage high and low time specifications must be
observed.
Figure 3.3 Oscillator Connections
23. Figure 3.4 External Clock Drive Configuration
3.2 16*2 CHARACTER LCD
3.2.1 GENERAL DESCRIPTION
A liquid crystal display (commonly abbreviated LCD) is a thin, flat display
device made up of any number of color or monochrome pixels arrayed in front of a
light source or reflector. It is often utilized in battery-powered electronic devices
because it uses very small amounts of electric power.
Each pixel of an LCD typically consists of a layer of molecules aligned
between two transparent electrodes, and two polarizing filters, the axes of
transmission of which are (in most of the cases) perpendicular to each other.
With no liquid crystal between the polarizing filters, light passing through the
first filter would be blocked by the second (crossed) polarizer
The surfaces of the electrodes that are in contact with the liquid crystal
material are treated so as to align the liquid crystal molecules in a particular
direction. This treatment typically consists of a thin polymer layer that is
24. unidirectional rubbed using, for example, a cloth. The direction of the liquid crystal
alignment is then defined by the direction of rubbing.
Before applying an electric field, the orientation of the liquid crystal
molecules is determined by the alignment at the surfaces. In a twisted nematic
device (still the most common liquid crystal device), the surface alignment
directions at the two electrodes are perpendicular to each other, and so the
molecules arrange themselves in a helical structure, or twist. Because the liquid
crystal material is birefringent, light passing through one polarizing filter is rotated
by the liquid crystal helix as it passes through the liquid crystal layer, allowing it to
pass through the second polarized filter. Half of the incident light is absorbed by the
first polarizing filter, but otherwise the entire assembly is transparent.
When a voltage is applied across the electrodes, a torque acts to align the
liquid crystal molecules parallel to the electric field, distorting the helical structure
(this is resisted by elastic forces since the molecules are constrained at the surfaces).
This reduces the rotation of the polarization of the incident light, and the device
appears gray. If the applied voltage is large enough, the liquid crystal molecules in
the center of the layer are almost completely untwisted and the polarization of the
incident light is not rotated as it passes through the liquid crystal layer. This light
will then be mainly polarized perpendicular to the second filter, and thus be blocked
and the pixel will appear black. By controlling the voltage applied across the liquid
crystal layer in each pixel, light can be allowed to pass through in varying amounts
thus constituting different levels of gray.
The optical effect of a twisted nematic device in the voltage-on state is far less
dependent on variations in the device thickness than that in the voltage-off state.
Because of this, these devices are usually operated between crossed polarizer’s such
that they appear bright with no voltage (the eye is much more sensitive to variations
25. in the dark state than the bright state). These devices can also be operated between
parallel polarizer’s, in which case the bright and dark states are reversed. The
voltage-off dark state in this configuration appears blotchy, however, because of
small thickness variations across the device.
Both the liquid crystal material and the alignment layer material contain ionic
compounds. If an electric field of one particular polarity is applied for a long period
of time, this ionic material is attracted to the surfaces and degrades the device
performance.
This is avoided either by applying an alternating current or by reversing the
polarity of the electric field as the device is addressed (the response of the liquid
crystal layer is identical, regardless of the polarity of the applied field).
When a large number of pixels is required in a display, it is not feasible to
drive each directly since then each pixel would require independent electrodes.
Instead, the display is multiplexed. In a multiplexed display, electrodes on one side
of the display are grouped and wired together (typically in columns), and each
group gets its own voltage source. On the other side, the electrodes are also grouped
(typically in rows), with each group getting a voltage sink. The groups are designed
so each pixel has a unique, unshared combination of source and sink. The
electronics or the software driving the electronics then turns on sinks in sequence,
and drives sources for the pixels of each sink.
Figure 3.5 16*2 LCD
26. 3.2.2 FEATURES
8 dots with cursor
Built-in controller (KS 0066 or Equivalent)
+ 5V power supply (Also available for + 3V)
1/16 duty cycle
B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A.K (LED)
N.V. optional for + 3V power supply
3.2.3 PIN DESCRIPTION
16*2 LCD consists of a 16 pins. The functions of these pins are described
below.
Table 3.6 16*2 LCD PIN Description
3.2.4 DISPLAY CHARACTER ADDRESS CODE
27. All the pixels in the LCD have and address code. In order to display a value in a
pixel, the value is stored in that address. The address codes for a typical 16*2 LCD
is shown below.
Table 3.7 Display Character Address Code
3.2.5 INTERFACING WITH MICROCONTROLLER
The LCD Module can easily be used with an 8051 microcontroller such as
the ATMEL89S52. The LCD Module comes with a 16 pin connector.
28. Figure 3.6 LCD Interfacing Circuit Diagram
To connect the LCD Module to a standard 40 pin 8051, use the pin names listed
below to find the correct pin number on the 8051 microcontroller.
LCD
Connector
Function
89S52
Pin Number & Name
LCD
Connector
Function
2051
Pin Number & Name
1 Data Line 6 18, P1.6 16 LCD RS 7, P3.3
2 Data Line 1 13, P1.1 15 Data Line 5 17, P1.5
3 Power - 5VDC 14 LCD Read/Write 6, P3.2
4 Not Connected 13 Data Line 0 12, P1.0
5 Display Adjust 12 Data Line 4 16, P1.4
29. 6 Data Line 7 19, P1.7 11 LCD Enable 8, P3.4
7 Data Line 2 14, P1.2 10 Data Line 3 15, P1.3
8 Ground 9 Not Connected
Table 3.8 LCD Connector Functions
Connect LCD Pin 3 to Vcc (5 Volts). Connect LCD Pin 8 to Ground. Connect a
510 ohm resistor between LCD Pin 5 and ground. Connect a 2.2k ohm resistor from
LCD Pin 2 and Vcc. Connect a 2.2k ohm resistor from LCD Pin 13 to Vcc.
3.3 ANALOG TO DIGITAL CONVERTOR
3.3.1 GENERAL DESCRIPTION
The ADC0809 data acquisition component is a monolithic CMOS device with an 8-
bit analog-to-digital converter, 8-channel multiplexer and microprocessor
compatible control logic. The 8-bit A/D converter uses successive approximation as
the conversion technique. The converter features a high impedance chopper
stabilized comparator, a 256R voltage divider with analog switch tree and a
successive approximation register. The 8-channel multiplexer can directly access
any of 8-single-ended analog signals.
The device eliminates the need for external zero and full-scale adjustments. Easy
interfacing to microprocessors is provided by the latched and decoded multiplexer
address inputs and latched TTL TRI-STATE outputs.
3.3.2 FEATURES
30. Easy interface to all microprocessors
Operates ratiometrically or with 5 VDC or analog span adjusted voltage
reference
No zero or full-scale adjust required
8-channel multiplexer with address logic
0V to 5V input range with single 5V power supply
Outputs meet TTL voltage level specifications
Standard hermetic or molded 28-pin DIP package
28-pin molded chip carrier package
ADC0809 equivalent to MM74C949-1
3.3.3 BLOCK DIAGRAM
Figure 3.7 ADC0809 Block Diagram
31. 3.3.4 PIN DIAGRAM
Figure 3.8 ADC0809 PIN Diagram
3.3.5 FUNCTIONAL DESCRIPTIONAL
3.3.5.1 MULTIPLEXER
The device contains an 8-channel single-ended analog signal multiplexer. A
particular input channel is selected by using the address decoder. Table 3.11 shows
the input states for the address lines to select any channel. The address is latched
into the decoder on the low-to-high transition of the address latch enable signal.
32. Table 3.9 Input states needed to select a channel in 8 channel multiplexer
3.3.5.2 CONVERTER
The heart of this single chip data acquisition system is its 8-bit analog-to-digital
converter. The converter is designed to give fast, accurate, and repeatable
conversions over a wide range of temperatures. The converter is partitioned into 3
major sections: the 256R ladder network, the successive approximation register, and
the comparator. The converter’s digital outputs are positive true. The 256R ladder
network approach (Figure 3.9) was chosen over the conventional R/2R ladder
because of its inherent monotonicity, which guarantees no missing digital codes.
Monotonicity is particularly important in closed loop feedback control systems. A
non-monotonic relationship can cause oscillations that will be catastrophic for the
system. Additionally, the 256R network does not cause load variations on the
reference voltage. The bottom resistor and the top resistor of the ladder network in
Figure 3.9 are not the same value as the remainder of the network. The difference in
these resistors causes the output characteristic to be symmetrical with the zero and
full-scale points of the transfer curve. The first output transition occurs when the
33. analog signal has reached +1⁄2 LSB and succeeding output transitions occur every 1
LSB later up to full-scale.
Figure 3.9 Resistor Ladder and Switch Tree
The successive approximation register (SAR) performs 8 iterations to approximate
the input voltage. For any SAR type converter, n-iterations are required for an n-bit
converter. Figure 3.10 shows a typical example of a 3-bit converter. In the
ADC0808, ADC0809, the approximation technique is extended to 8 bits using the
256R network. The A/D converter’s successive approximation register (SAR) is
reset on the positive edge of the start conversion (SC) pulse. The conversion is
begun on the falling edge of the start conversion pulse. A conversion in process will
be interrupted by receipt of a new start conversion pulse. Continuous conversion
34. may be accomplished by tying the end-of-conversion (EOC) output to the SC input.
If used in this mode, an external start conversion pulse should be applied after
power up. End-of-conversion will go low between 0 and 8 clock pulses after the
rising edge of start conversion. The most important section of the A/D converter is
the comparator. It is this section which is responsible for the ultimate accuracy of
the entire converter. It is also the comparator drift which has the greatest influence
on the repeatability of the device. A chopper-stabilized comparator provides the
most effective method of satisfying all the converter requirements.
Figure 3.10 3bit A/D Transfer Curve
Figure 3.11 3bit A/D Absolute Accuracy Curve
35. The chopper-stabilized comparator converts the DC input signal into an AC signal.
This signal is then fed through a high gain AC amplifier and has the DC level
restored. This technique limits the drift component of the amplifier since the drift is
a DC component which is not passed by the AC amplifier. This makes the entire
A/D converter extremely insensitive to temperature, long term drift and input offset
errors. Figure 3.17 shows a typical error curve for the ADC0808 as measured using
the procedures outlined in AN-179.
Figure 3.12 Typical Error Curve
3.3.6 RELAY
3.3.6.1 DESCRIPTION
A simple electromagnetic relay consists of a coil of wire surrounding a soft iron
core, an iron yoke, which provides a low reluctance path for magnetic flux, a
moveable iron armature, and a set, or sets, of contacts. The armature is hinged to
the yoke and mechanically linked to a moving contact or contacts. It is held in place
by a spring so that when the relay is de-energized there is an air gap in the
magnetic circuit. The relays may have some sets of contacts closed or open
depending on their function. The relay also has a wire connecting the armature to
the yoke. This ensures continuity of the circuit between the moving contacts on the
armature, and the circuit track on the Printed Circuit Board (PCB) via the yoke,
which is soldered to the PCB.
36. 3.3.6.2 RELAY DRIVER
The ULN2003A is a high voltage, high current darlington arrays each containing
seven open collector darlington pairs with common emitters. Each channel rated at
500mA and can withstand peak currents of 600mA. Suppression diodes are
included for inductive load driving and the inputs are pinned opposite the outputs to
simplify board layout.
It is useful for driving a wide range of loads including solenoids, relays DC motors,
LED displays filament lamps, thermal printheads and high power buffers. The
ULN2003A is supplied in a 16 pin plastic DIP packages with a copper leadframe to
reduce thermal resistance. They are available also in small outline package (SO-16)
as ULN2001D/2002D/2003D/2004D.
3.3.6.2.1 FEATURES
SEVEN DARLINGTONS PER PACKAGE
OUTPUT CURRENT 500mA PER DRIVER(600mA PEAK).
OUTPUT VOLTAGE 50V
INTEGRATED SUPPRESSION DIODES FOR INDUCTIVE LOADS
OUTPUTS CAN BE PARALLELED FORHIGHER CURRENT.
TTL/CMOS/PMOS/DTL COMPATIBLE INPUTS
INPUTS PINNED OPPOSITE OUTPUTS TO SIMPLIFY LAYOUT
38. 3.3.7 SOLENOIDAL VALVE
A solenoid valve is an electromechanical valve for use with liquid or gas. The valve
is controlled by an electric current through a solenoid.
Solenoid valves are the most frequently used control elements in fluidics. Their
tasks are to shut off, release, dose, distribute or mix fluids. They are found in
many application areas. Solenoids offer fast and safe switching, high reliability,
long service life, good medium compatibility of the materials used, low control
power and compact design.
A solenoid valve has two main parts: the solenoid and the valve. The solenoid
converts electrical energy into mechanical energy which, in turn, opens or closes
the valve mechanically. A direct acting valve has only a small flow circuit, shown
within section E of Figure 3.22. This diaphragm piloted valve multiplies this small
flow by using it to control the flow through a much larger orifice.
Figure 3.15 Solenoid Valve
39. Solenoid valves may use metal seals or rubber seals, and may also have electrical
interfaces to allow for easy control. A spring may be used to hold the valve opened
or closed while the valve is not activated.
The Figure 3.22 shows the design of a basic valve. At the top figure is the valve in
its closed state. The water under pressure enters at A. B is an elastic diaphragm and
above it is a weak spring pushing it down. The function of this spring is irrelevant
for now as the valve would stay closed even without it. The diaphragm has a
pinhole through its center which allows a very small amount of water to flow
through it. This water fills the cavity C on the other side of the diaphragm so that
pressure is equal on both sides of the diaphragm; however the compressed spring
supplies a net downward force. The spring is weak and is only able to close the inlet
because water pressure is equalized on both sides of the diaphragm.
In the previous configuration the small conduit D was blocked by a pin which is the
armature of the solenoid E and which is pushed down by a spring. If the solenoid is
activated by drawing the pin upwards via magnetic force from the solenoid current,
the water in chamber C will flow through this conduit D to the output side of the
valve. The pressure in chamber C will drop and the incoming pressure will lift the
diaphragm thus opening the main valve. Water now flows directly from A to F.
It can be seen that this type of valve relies on a differential of pressure between
input and output as the pressure at the input must always be greater than the
pressure at the output for it to work. Should the pressure at the output, for any
reason, rise above that of the input then the valve would open regardless of the state
of the solenoid and pilot valve.
3.3.8 SENSOR
40. A general purpose agricultural humidity sensor is used in the project. Humidity
sensor converts relative humidity to output voltage.
This sensor is based on resistance. When the moisture content determined is high,
then the output resistance increases and hence the voltage developed is low. On the
other hand, if the moisture is low, the output resistance decreases.
FEATURES
Small and Light.
High response and reliable.
Dew detection high sensitivity and accuracy.
No power supply required.
Rugged design.
SPECIFICATION
Rated Voltage DC 0.8V max.
Operating Temperature 0~60 degreeC.
Rated power < 3.0nA
Operating Humidity 0~100% RH.
Resistance: 75% RH - 20 max. at 25 degreeC.
Storage temperature -30~85 C.
Range: 10feet
41. CHAPTER 4
SOFTWARE DETAILS
4.1 KEIL COMPILER
Keil provides a broad range of development tools like ANSI C compiler, macro
assemblers, debuggers and simulators, linkers, IDE, library managers, real-time
operating systems and evaluation boards for 8051.
4.1.1 KEIL TUTORIAL
1. Open Keil from the Start menu
2. The Figure below shows the basic names of the windows referred in this
document
Figure 3.16 Keil Compiler
42. Starting a new Assembler Project
1. Select New Project from the Project Menu.
2. Name the project ‘Toggle.a51’
3. Click on the Save Button.
4. The device window will be displayed.
5. Select the part you will be using to test with. For now we will use the Dallas
Semiconductor part DS89C420.
6. Double Click on the Dallas Semiconductor.
7. Scroll down and select the DS89C420 Part
8. Click OK
Creating Source File
1. Click File Menu and select New.
2. A new window will open up in the Keil IDE.
3. Create a source program in the window.
4. Click on File menu and select SaveAs…
5. Name the file Toggle.a51
6. Click the Save Button
43. Adding File to the Project
1. Expand Target 1 in the Tree Menu
2. Click on Project and select Targets, Groups, Files…
3. Click on Groups/Add Files tab
4. Under Available Groups select Source Group 1
5. Click Add Files to Group… button
6. Change file type to Asm Source file(*.a*;*.src)
7. Click on toggle.a51
8. Click Add button
9. Click Close Button
10. Click OK button when you return to Target,Groups, Files… dialog box
11. Expand the Source Group 1 in the Tree menu to ensure that the file was added
to the project
Creating HEX for the Part
1. Click on Target 1 in Tree menu
2. Click on Project Menu and select Options for Target 1
3. Select Target Tab
4. Change Xtal (Mhz) from 50.0 to 11.0592
44. 5. Select Output Tab and Click on Create Hex File check box
6. Click OK Button
7. Click on Project Menu and select Rebuild all Target Files
8. In the Build Window it should report ‘0 Errors (s), 0 Warnings’
9. You are now ready to Program your Part
Testing Program in Debugger
1. Comment out line ACALLDELAY by placing a Semicolon at the beginning.
This will allow you to see the port change immediately.
2. Click on the File Menu and select Save
3. Click on Project Menu and select Rebuild all Target Files
4. In the Build Window it should report ‘0 Errors (s), 0 Warnings’
5. Click on Debug Menu and Select Start/Stop Debug Session
Running the Keil Debugger
1. The Keil Debugger should be now be Running.
2. Click on Peripherals. Select I/O Ports, Select Port 1
3. A new window should port will pop up. This represent the Port and Pins
4. Step through the code by pressing F11 on the Keyboard. The Parallel Port 1 Box
should change as you completely step through the code.
5. To exit out, Click on Debug Menu and Select Start/Stop Debug Session
45. CHAPTER 4
PROJECT OVERVIEW
Sensors are placed in different parts of the field. The distance between two sensors
is kept around 20 feet or a sensor covers an area of 10 feet. This is based on the fact
that the moisture content in a field does not change abruptly and remains the same
for some distance. When the moisture content in a part of field goes down, the
microcontroller is informed about the situation. The microcontroller produces the
control signal to open the solenoidal valve through a relay, water flows through the
tube and finally through the dripper. When the moisture content goes up, the
solenoid valve is closed and water flow is stopped. This process continues.
The LCD module connected to the microcontroller gives the current moisture
reading measured by each sensor.
The moisture measured by different sensors are given as the input to the ADC. The
ADC 0809 has the capability to read only one value at a time. Depending on the
current select lines(which alternates every 1.085microsec), the moisture value is
46. digitized into 8bit digital value. The value is passed to the microcontroller for
further processing.
The sensors used are particularly designed for agricultural use and can withstand
harsh usage and climatic conditions. Hence the chance of sensor failure is very low.
However as a precaution, for every sensor connected a back up sensor can be
connected parallel to the main sensor. When the main sensor fails, the backup
sensor can be used. The other option is that the farmer can periodically monitor the
health of sensor and replace the worn out ones.
The important condition to be maintained is that the water tank should be kept at a
higher level and the slope of the land should be maintained such that it is higher
near the tank and gradually decreases while going to the other side so that water
flow to reach even the last plant.
47. CHAPTER 5
CONCLUSION
In recent times there has been an acute shortage of quality manpower and the ever
rising labour cost. Hence the need for automation of process has increased in recent
times. This project is designed to address such concerns. With the commissioning
of this project, the farmer is relieved with the duty of watering the crops and has to
monitor only the health of the sensors.
With rapid urbanization and population growth, the agricultural land is shrinking
very fast. Hence the need arises to obtain maximum yield from a given plot of land.
With this system, the plant is fed with the right amount of water and hence the yield
of crops increases. This also prevents wastage of fertilizers. This project paves a
way forward in the modernization of agriculture.
48. REFERENCES
Clemens, A.J. 1990.Feedback Control for Surface Irrigation Management in:
Visions of the Future. ASAE Publication 04-90. American Society of
Agricultural Engineers, St. Joseph, Michigan, pp. 255-260.
Fang Meier, D.D., Garrote, D.J., Mansion, F. and S.H. Human. 1990.
Automated Irrigation Systems Using Plant and Soil Sensors. In: Visions of
the Future. ASAE Publication 04-90. American Society of Agricultural
Engineers, St. Joseph, Michigan, pp. 533-537.
www.wikipedia.org
www.datasheetcatalog.com
CONSULTANT
Vel Tech Irrigation Systems,
Nerkundram,
Chennai.