SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SUBMITTED BY
JOSE THOMAS.P
DON P DANIEL
AJAYAN JOY
MARCH 2011
PAGE NO: 1
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
ACKNOWLEDGEMENT
Project is a product of experience and it goes a long way in shaping up a person in his
respective profession and it is not only him who gains that experience but a group of kind
hearts behind his success. If words are considered as a symbol of approval and token of
knowledge, then these words play a heralding role in expressing our deep sense of gratitude.
First and foremost of all, we express our heartfelt gratitude to God Almighty for
showering his blessings upon us in enabling to complete the project on time
We would like to express our heartfelt thanks to Dr.Varghese Paul, Dean, Computer
Science and Engineering and Information Technology, for his invaluable inspiration and
guidance.
We would also like to express our sincere gratitude to Mrs.Sreela Sreedhar, Head of
Department, Computer Science and Engineering, for her kind support and guidance that
proved to be the real support for the completion.
We also express our sincere and heartfelt thanks to our Project Co-ordinators Mr. Alfred
Thomas and Mr. Prince Renjan, project guide Mrs.Smitha Mohan, and all the faculty
members of Department of Computer Science for the pain they took to enquire about the
project unfailingly and for motivating us.
I would also like to express appreciation and thanks to all our friends and family who
knowingly assisted me with their valuable suggestions and supports. I would also like to thank
those who were directly or indirectly guiding us.
PAGE NO: 2
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Thank You……..
TABLE OF CONTENTS
1. INTRODUCTION…………………………………………………………………………………….1
2.1 Definition…………………………………………………………………………………………4
2.2 About the Project………………………………………………………………………………..4
2.3 Scope of the Project…………………………………………………………………………….4
2. SYSTEM ANALYSIS………………………………………………………………………........5
3.1 Hardware requirements…………………………………………….………....……………....7
3.2 Software requirements…………………………………………………………………….7
3. SYTEM STUDY…………………………………………….……………………....9
4.1 Study of existing system…………………………………………...….......................................... 10
4.2 Analysis of proposed system………………………………………………………….................... .10
4. TOOLS AND UTILITIES…………………………………………………………………………………….
4.1 JAVA……………………………………………………………………………………………………
4.2 NETBEANS…………………………………………………………………………………………
4.3 MY SQL……………………………………………………………………………………………..
4.4 MICROCONTROLLER 16F877A…………………………………………………………………
5. DESIGN……………………………………………………………….…………………………………19
5.1 Module requirements…………………………………………………………………………….….20
5.2 Data Flow Diagram…………………………………………….................................................21
5.3 Database tables………………………………………………………………………………………
6. SAMPLE CODE…………………………………………………………………………………………..
7. SYSTEM TESTING…………………………………….…........................................................48
8. SCREEN SHOTS………………………………………………………………………………………..53
9. CONCLUSION…………………………………………………………………….…………….……….55
10. BIBLIOGRAPHY……………………………………………………………….………………………..57
PAGE NO: 3
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 4
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Now days, water shortage is becoming one of the biggest problem in the world. Many
different methods are developed for conservation of water. Also water is essential in our day to
day life. Agriculture is one of the fields where water is required in tremendous quantity.
Wastage of water is the major problem in agriculture. Irrigation is an artificial application of
water to the soil. It is usually used to assist the growing of crops in dry areas and during
periods of inadequate rainfall.
The continuous increasing demand of the food requires the rapid improvement in food
production technology. In a country like India, where the economy is mainly based on
agriculture and the climatic conditions are isotropic, still we are not able to make full use of
agricultural resources. The main reason is the lack of rains & scarcity of land reservoir water.
Automatic irrigation systems are convenient, and highly efficient. Traditional methods of
irrigation using a hose or an oscillator wastes water. Neither method targets plant roots with
any significant degree of precision. Automatic irrigation systems can be programmed to
discharge more precise amounts of water in a targeted area, which promotes water
conservation.
PAGE NO: 5
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
INTRODUCTION
PAGE NO: 6
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
2.1 Definition
Our project Automated Irrigation control System as the name implies
aims at automating the irrigation process. It aims at making the irrigation process
simple & Efficient by enabling a user to control and monitor the conditions in the
agricultural field based on data collected using temperature and humidity sensors.
This project is designed for satisfying the needs of different users. It is mainly suited
for those farmers who have large acres of land where manual monitoring is very
difficult.
PAGE NO: 7
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
reducing the water level due to which lot of land is coming slowly in the zones of un-
irrigated land. Another very important reason of this is due to unplanned use of
water due to which a significant amount of water goes waste. Water is considered to
be the basic need of human.
The heart of the project is the PIC16F877A microcontroller. A 16×2 LCD is connected to
the microcontroller, which displays the humidity level. The humidity sensors used in this project
is SMTHS07. Irrigation system uses valves to turn irrigation ON and OFF. These valves may
be easily automated by using controllers. Automating farm or nursery irrigation allows farmers
to apply the right amount of water at the right time, regardless of the availability of labor to turn
valves on and off. In addition, farmers using automation equipment are able to reduce runoff
from over watering saturated soils, avoid irrigating at the wrong time of day, which will improve
crop performance by ensuring adequate water and nutrients when needed. It also helps in time
saving, removal of human error in adjusting available soil moisture levels and to maximize their
net profits
PAGE NO: 8
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
temperature and compares it with preset wet and dry humidity limits and scales back each of
the watering cycles in proportion to the humidity content of the ground to thereby conserve
irrigation water that is applied to a ground area. The device includes a humidity sensor, a
temperature sensor, a voltage sensor, a central processing unit. When the device of the
invention is initialized, the temperature and humidity sensors will take the readings and sent it
to the database so that each time the timed irrigation system cycles. Graphs are then plotted
using the values available in the database.
Irrigation system uses valves to turn irrigation ON and OFF. These valves may be
easily automated by using controllers and solenoids. Automating farm or nursery irrigation
allows farmers to apply the right amount of water at the right time, regardless of the availability
of labor to turn valves on and off. In addition, farmers using automation equipment are able to
reduce runoff from over watering saturated soils, avoid irrigating at the wrong time of day,
which will improve crop performance by ensuring adequate water and nutrients when needed.
Automatic Drip Irrigation is a valuable tool for accurate soil moisture control in highly
specialized greenhouse vegetable production and it is a simple, precise method for irrigation. It
also helps in time saving, removal of human error in adjusting available soil moisture levels
and to maximize their net profits.
This software can be accessed by only few authorized clients which include
owner of agricultural land, field manager. This software is managed by a single
administrator that is by the owner. He can administer the whole irrigation process by
login this software. Owner can allocate staff, check status of field by analyzing
temperature and humidity data collected by sensors. Each time an employee access
this software the detailed graphs of temperature and humidity plotted against time
will be displayed. The time at which an employee access the site is recorded and
displayed. He can schedule irrigation at appropriate times by evaluating the data.
PAGE NO: 9
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SYSTEM ANALYSIS
PAGE NO: 10
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
2. SYSTEM ANALYSIS
PAGE NO: 11
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
The importance of system hardware configuration comes into scene when the project
development is in its peak utilization of the system’s physical resources. It can be
observed that for developing a software project, one needs a better and higher
configuration of the hardware that which is needed for its actual run. The extravaganza
is the overhead caused by the developing environment.
Technologies used:
JFC
IO Streams
Sockets
Threads
PAGE NO: 12
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SYSTEM STUDY
PAGE NO: 13
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
3. SYSTEM ANALYSIS
System analysis is the process of gathering and interpreting facts, diagnosing problems, and
using the information to recommend improvements to the system. This is the job of the system analyst.
System analysts do more than solve current problems. They are frequently called upon to help handle
the planned expansion of a business. Analysts assess as carefully as possible what the future needs of
the business will be and what changes should be considered to meet these needs.
Understanding application.
Planning.
Scheduling.
PAGE NO: 14
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 15
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
This project is mainly intended for those who own large acres of land as they need not go to
farm land everyday. they can collect data through sensors installed in the field and can analyse
it. All information about the farm land is stored in a central server ,which can be accessed by the
administrator.
PAGE NO: 16
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PROJECT IMPLEMENTATION
PAGE NO: 17
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
5.1.1 JAVA
Java was developed at Sun Microsystems. Work on Java initially began with the
goal of creating a platform-independent language and OS for consumer electronics. The
original intent was to use C++, but as work progressed in this direction, developers identified
that creating their own language would serve them better. The effort towards consumer
electronics led the Java team, then known as First Person Inc., towards developing h/w and
s/w for the delivery of video-on-demand with Time Warner.
Unfortunately (or fortunately for us) Time Warner selected Silicon Graphics as
the vendor for video-on-demand project. This set back left the First Person team with an
interesting piece of software (Java) and no market to place it. Eventually, the natural synergies
of the Java language and the www were noticed, and Java found a market.
PAGE NO: 18
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
into machine level instructions, the Java compiler translates java source code into instructions
that are interpreted by the runtime Java Virtual Machine. So unlike languages like C and C++,
on which Java is based, Java is an interpreted language.
Java is the first programming language designed from ground up with network
programming in mind. The core API for Java includes classes and interfaces that provide
uniform access to a diverse set of network protocols. As the Internet and network
programming have evolved, Java has maintained its cadence. New APIs and toolkits have
expanded the available options for the Java network programmer.
Advantages Of JAVA
In one of their early papers about the language, Sun described Java
as follows: Java: A simple, object-oriented, distributed, interpreted, robust, secure, architecture
neutral, portable, high-performance, multithreaded, and dynamic language.
Sun acknowledges that this is quite a string of buzzwords, but the
fact is that, for the most part, they aptly describe the language. In order to understand why
Java is so interesting, let's take a look at the language features behind the buzzwords.
(a) Object-Oriented
PAGE NO: 19
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
programs when you use Java. In an object-oriented system, a class is a collection of data and
methods that operate on that data. Taken together, the data and methods describe the state
and behavior of an object. Classes are arranged in a hierarchy, so that a subclass can inherit
behavior from its super class. Java comes with an extensive set of classes, arranged in
packages, which you can use in your programs. Strings are represented by objects in Java, as
are other important language constructs like threads. A class is the basic unit of compilation
and of execution in Java; all Java programs are classes. For a complete description of the
object-oriented features of Java, The object oriented language used to create executable
contents such as applications and applets.
(b) Interpreted
PAGE NO: 20
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Virtual Machine. This is a particularly important for applications distributed over the Internet or
other heterogeneous networks. But the architecture neutral approach is useful beyond the
scope of network-based applications. If you write your application in Java, however, it can run
on all platforms. The fact that Java is interpreted and defines a standard, architecture neutral,
byte-code format is one big part of being portable. Programmers need only to make simple
efforts to avoid non-portable pitfalls in order to live up to Sun's trademarked motto "Write
Once, Run Anywhere."
(e) Simple
PAGE NO: 21
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
that Java uses many of the same language constructs as C and C++. In order to keep the
language both small and familiar, the Java designers removed a number of features available
in C and C++. For example, Java provides labeled break and continue statements and
exception handling. Java does not use header files and it eliminates the C preprocessor.
Because Java is object-oriented, Java also eliminates the operator overloading and multiple
inheritance features of C++. Perhaps the most important simplification, however, is that Java
does not use pointers.
(f) Robust
Java has been designed for writing highly reliable or robust software. Java
certainly does not eliminate the need for software quality assurance; it is still quite possible to
write buggy software in Java. One of the things that make Java simple is its lack of pointers
and pointer arithmetic. This feature also increases the robustness of Java programs by
abolishing an entire class of pointer-related bugs. Similarly, all accesses to arrays and strings
are checked at run-time to ensure that they are in bounds, eliminating the possibility of
overwriting memory and corrupting data. Casts of objects from one type to another are also
checked at run-time to ensure that they are legal. Finally, and very importantly, Java's
automatic garbage collection prevents memory leaks and other pernicious bugs related to
memory allocation and deallocation. Exception handling is another feature in Java that makes
for more robust programs.
(g)Secure
PAGE NO: 22
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
(h)High-Performance
PAGE NO: 23
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 24
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Java applets are pieces of java code that are embedded in HTML
document using the applet tag. When the browser encounters such code it automatically
download it and execute it.
5.1.2. NETBEANS
PAGE NO: 25
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
creating graphical user interface (GUI) components or accessing databases easy, and
highlighted code and debugging features alert you to errors in your code.
The NetBeans IDE is open source and is written in the Java programming
language. It provides the services common to creating desktop applications such as window
and menu management, settings storage and is also the first IDE to fully support JDK 5.0
features. The NetBeans platform and IDE are free for commercial and noncommercial use,
and they are supported by Sun Microsystems.
5.1.3 MY SQL
Standard: The MySQL-Standard binaries are recommended for most users, and
include the InnoDB storage engine. Max: (not MaxDB, which is cooperation with SAP AG) is
mysqld-max Extended MySQL Server. The MySQL-Max binaries include additional features
that may not have been as extensively tested or are not required for general usage.
PAGE NO: 26
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
The MySQL-Debug binaries have been compiled with extra debug information,
and are not intended for production use, because the included debugging code may cause
reduced performance.
Beginning with MySQL 5.5, MySQL AB has stopped providing these different
package variants. There will only be one MySQL server package, which includes a
MySQL binary with all functionality and storage engines enabled. Instead of providing a
separate debug package, a server binary with extended debugging information is also included
in the standard package.
PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide
availability, large user base, extensive collection of application notes, availability of low cost or
free development tools, and serial programming (and re-programming with flash memory)
capability.
PIC16F877A is a small piece of semiconductor integrated circuits. The package type of this
integrated circuits is DIP package. DIP stand for Dual Inline Package for semiconductor IC.
This package is very easy to be soldered onto the stripboard. However using a DIP socket is
much easier so that this chip can be plugged and removed from the development board.
The PIC16F877A is very cheap. The 16F877A is one of the most popular PIC microcontrollers
and it's easy to see why - it comes in a 40 pin DIP pinout and it has many internal peripherals.
PAGE NO: 27
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
The 40 pins make it easier to use the peripherals as the functions are spread out over the pins.
This makes it easier to decide what external devices to attach without worrying too much if
there are enough pins to do the job. Apart from that it is also very easy to be assembled.
Additional components need to make this IC work is just a 5V power supply adapter, a 20MHz
crystal oscillator and 2 units of 22pF capacitors.
Advantages of PIC16F877A
One of the main advantages is that each pin is only shared between two or three
functions so its easier to decide what the pin function (other devices have up to 5
functions for a pin).
This IC can be reprogrammed and erased up to 10,000 times. Therefore it is very good
for new product development phase.
PIC16F877A pinout
PAGE NO: 28
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PIC16F877A
PAGE NO: 29
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 30
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
LCDs are the materials, which combine both the properties of both liquids and crystals.
Rather than having melting points, they have a temp range within which the molecules are
almost as mobile as they would be in liquid, but are grouped together in an ordered form
similar to a crystal .LCD would not generate light but scatter light. It consumes less power.
Recent LCDs are field effect LCDs. They are based on optical action of polarized light
on properly oriented liquid crystal. LCD consists of 2 glass panels within the liquid crystal
material sand witched between them. The inner surface of glass plates are coated with
transparent electrodes which defines the character, symbols or patterns to be displayed. The
polymeric layers are present in between the electrodes and the liquid crystal which makes the
liquid crystal molecules to maintain a defined orientation angle. The polarizer would rotate the
light rays passing through them to a defined angle, in a particular direction.
When the LCD is in OFF state, the 2 polarizer’s and the liquid crystals rotates the light
rays, such that the light rays come out the LCD without any orientation and hence the LCD
appear to be transparent. When sufficient light is applied to the electrodes, the liquid crystal
molecules would be aligned in specific direction. The light rays passing through the LCD would
be rotated by the polarizer which would result in activating/highlighting the desired character
.The LCDs are light weight with a few millimeter thickness. They are compatible with low
power electronic circuits. The LCD display used here is HD44780U dot matrix display.
The LCD It is 5*7 matrix display. It is a 16*2 display. The data we are sending are put
into Data Display RAM. At power on the Data Display RAM is empty. After that the data is
displayed. The maximum size of DDRAM is 80 bytes. There are two rows each of 40 bytes.
But at a particular time 16 at top and 16 at bottom can be displayed. There is a pointer
(address counter) .The address counter is initially zero. The data to be displayed are put into
location pointed by the address counter. It is automatically incremented. There is a register
select, which decides whether it is a data or command.
PAGE NO: 31
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
If RS=1, then it is a data. If RS=0, then it is a command. Then the controller processes it.
After each command or data send to LCD it takes some time for execution. During this time
the LCD won’t take any data. There is a busy signal given by the LCD. Busy signal is MSB of
the data bus. So the user has to call the data bus to see that busy is low before sending next
data. For reliable Performance LCD has to be initialized. At power on microcontroller sends
some commands to LCD for proper initialization.
PAGE NO: 32
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
5.6 MAX232
The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply
via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-
232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range,
as power supply design does not need to be made more complicated just for driving the RS-
232 in this case.
The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard
5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of
0.5 V.
The newer MAX3232 is also backwards compatible, but operates at a broader voltage range,
from 3 to 5.5 V.
PAGE NO: 33
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PROJECT DESIGN
PAGE NO: 34
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
1. Login Module
2. DataBase Handler
3. Graph Generator
4. Data Analyzer
1. Sensor Module
PAGE NO: 35
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
2. Communication Module
Login Module
The software is designed in such a way that, it can be used only by authenticated
users. The admin can add/remove users and have full access control. Other users can
customize, view graphs, reports, and customize settings such as time interval,
modifying area ID no, password changing etc.
DataBase Handler
The sensor readings are recorded very frequently at specific time intervals (few
seconds) and stored in the database. The average readings for each minute, hour, day and
month is stored separately for each area.
Graph Generator
The current temp & humidity are plotted against time. Different graphs are
generated for current hour, day and month.
Data Analyzer
All data stored at the database are analyzed and processed which involves
scientific mathematical calculations. Specific settings such as time interval, watering
mode (auto/manual),etc are considered.
PAGE NO: 36
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
The different conditions for a hot, wet or chance of rain are being studied at
varied temperature and humidity conditions.
Sensor Module
This module deals with measuring climatic conditions such as temperature and humidity.
The sensor driving circuit is now being designed using sensor’s datasheet.
Communication Module
Handles communication via serial port, Responds to requests from the computer with the
sensor data.
We are now testing serial port interfacing techniques for accurate and timely transmission of
data at varied time intervals.
PAGE NO: 37
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 38
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
LOGIN
Field Data type Constraint Description
name
username varchar Primary key username
PAGE NO: 39
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
no
DAILY
HOURLY
MINUTELY
PAGE NO: 40
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SECONDLY
PAGE NO: 41
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide
availability, large user base, extensive collection of application notes, availability of low cost or
free development tools, and serial programming (and re-programming with flash memory)
capability.
PAGE NO: 42
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PIC16F877A is a small piece of semiconductor integrated circuits. The package type of this
integrated circuits is DIP package. DIP stand for Dual Inline Package for semiconductor IC.
This package is very easy to be soldered onto the stripboard. However using a DIP socket is
much easier so that this chip can be plugged and removed from the development board.
The PIC16F877A is very cheap. The 16F877A is one of the most popular PIC microcontrollers
and it's easy to see why - it comes in a 40 pin DIP pinout and it has many internal peripherals.
The 40 pins make it easier to use the peripherals as the functions are spread out over the pins.
This makes it easier to decide what external devices to attach without worrying too much if
there are enough pins to do the job. Apart from that it is also very easy to be assembled.
Additional components need to make this IC work is just a 5V power supply adapter, a 20MHz
crystal oscillator and 2 units of 22pF capacitors.
Advantages of PIC16F877A
One of the main advantages is that each pin is only shared between two or three
functions so its easier to decide what the pin function (other devices have up to 5
functions for a pin).
This IC can be reprogrammed and erased up to 10,000 times. Therefore it is very good
for new product development phase.
PIC16F877A pinout
PAGE NO: 43
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PIC16F877A
PAGE NO: 44
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 45
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
LCDs are the materials, which combine both the properties of both liquids and crystals.
Rather than having melting points, they have a temp range within which the molecules are
almost as mobile as they would be in liquid, but are grouped together in an ordered form
similar to a crystal .LCD would not generate light but scatter light. It consumes less power.
Recent LCDs are field effect LCDs. They are based on optical action of polarized light
on properly oriented liquid crystal. LCD consists of 2 glass panels within the liquid crystal
material sand witched between them. The inner surface of glass plates are coated with
transparent electrodes which defines the character, symbols or patterns to be displayed. The
polymeric layers are present in between the electrodes and the liquid crystal which makes the
liquid crystal molecules to maintain a defined orientation angle. The polarizer would rotate the
light rays passing through them to a defined angle, in a particular direction.
When the LCD is in OFF state, the 2 polarizer’s and the liquid crystals rotates the light
rays, such that the light rays come out the LCD without any orientation and hence the LCD
appear to be transparent. When sufficient light is applied to the electrodes, the liquid crystal
molecules would be aligned in specific direction. The light rays passing through the LCD would
be rotated by the polarizer which would result in activating/highlighting the desired character
.The LCDs are light weight with a few millimeter thickness. They are compatible with low
power electronic circuits. The LCD display used here is HD44780U dot matrix display.
The LCD It is 5*7 matrix display. It is a 16*2 display. The data we are sending are put
into Data Display RAM. At power on the Data Display RAM is empty. After that the data is
displayed. The maximum size of DDRAM is 80 bytes. There are two rows each of 40 bytes.
But at a particular time 16 at top and 16 at bottom can be displayed. There is a pointer
(address counter) .The address counter is initially zero. The data to be displayed are put into
location pointed by the address counter. It is automatically incremented. There is a register
select, which decides whether it is a data or command.
PAGE NO: 46
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
If RS=1, then it is a data. If RS=0, then it is a command. Then the controller processes it.
After each command or data send to LCD it takes some time for execution. During this time
the LCD won’t take any data. There is a busy signal given by the LCD. Busy signal is MSB of
the data bus. So the user has to call the data bus to see that busy is low before sending next
data. For reliable Performance LCD has to be initialized. At power on microcontroller sends
some commands to LCD for proper initialization.
PAGE NO: 47
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
5.6 MAX232
The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply
via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-
232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range,
as power supply design does not need to be made more complicated just for driving the RS-
232 in this case.
The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard
5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of
0.5 V.
The later MAX232A is backwards compatible with the original MAX232 but may operate at
higher baud rates and can use smaller external capacitors – 0.1 μF in place of the 1.0 μF
capacitors used with the original device.
The newer MAX3232 is also backwards compatible, but operates at a broader voltage range,
from 3 to 5.5 V
PAGE NO: 48
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SOURCE CODE
PAGE NO: 49
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
ASM CODE:
movlw '$'
xorwf rectemp,w
btfss STATUS,Z
goto bkk2
bsf rcflag,2
movlw 0xa0
movwf FSR
goto back11
bkk2
movlw 'T'
xorwf rectemp,w
btfss STATUS,Z
goto itest
bsf rcflag,0
PAGE NO: 50
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
goto back11
itest
movlw 'H'
xorwf rectemp,w
btfss STATUS,Z
goto btest
bsf rcflag,1
goto back11
btest
movlw 'B'
xorwf rectemp,w
btfss STATUS,Z
goto ntest
bsf rcflag,5
goto back11
ntest
movlw 'N'
xorwf rectemp,w
btfss STATUS,Z
goto onetest
bsf rcflag,6
goto back11
onetest
movlw '1'
xorwf rectemp,w
btfss STATUS,Z
goto twotest
bsf rcflag,3
goto back11
twotest
movlw '0'
xorwf rectemp,w
btfss STATUS,Z
goto back11
bsf rcflag,4
goto back11
coon
; movwf INDTEMP
;movwf INDF
xorlw '$'
btfss STATUS,Z
goto coon1
bcf rcflag,2
goto initfsr
PAGE NO: 51
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
coon1
movf rectemp,w
;movf INDTEMP,w
movwf INDF
incf FSR,f
movlw 0x1f
xorwf FSR ,w
btfss STATUS,Z
goto back11
initfsr
bsf rcflag,7
movlw 0xa0
movwf FSR
Control Desk:
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.util.Date;
import java.util.regex.*;
import java.sql.*;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
PAGE NO: 52
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
import javax.swing.JCheckBox;
/**
*
* @author Don P Daniel
*/
public class ControlDesk extends javax.swing.JFrame {
public ControlDesk(String sUser)
{
initComponents();
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date();
dd=dateFormat.format(date);
statusMessageLabel.setText("Logged in as "+ sUser+" "+dd);
currUser=sUser;
}
public class XYSeriesDemo extends ApplicationFrame {
public XYSeriesDemo(final String title,String tblname,int i,String X,String Y) {
super(title);
final XYSeries series = new XYSeries("Sensor Readings");
try
{
Class.forName("com.mysql.jdbc.Driver");
String connURL = "jdbc:mysql://localhost:3306/aics";
Connection con = DriverManager.getConnection(connURL,"root","0");
Statement stmt1=con.createStatement();
ResultSet rs=stmt1.executeQuery("select * from aics."+tblname);
PAGE NO: 53
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
while (rs.next())
{
Float fx=rs.getFloat(X);
Float fy=rs.getFloat(Y);
series.add(fx,fy);
}
}
catch(Exception e)
{ }
String graphTitle=Y+"-"+X+" Graph";
final XYSeriesCollection data = new XYSeriesCollection(series);
final JFreeChart chart = ChartFactory.createXYLineChart(
graphTitle,
X,
Y,
data,
PlotOrientation.VERTICAL,
true,
true,
false
);
PAGE NO: 54
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
case 9:jPanel9.add(chartPanel);break;
}
}
}
PAGE NO: 55
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 56
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SYSTEM TESTING
7. SYSTEM TESTING
PAGE NO: 57
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
its value, stress, and security. A series of tests are performed before the system is ready for
user acceptance testing.
Some of the testing methods used for testing the system are:
UNIT TESTING
INTEGRATION TESTING
BLACKBOX TESTING
VALIDATION TESTING
OUTPUT TESTING
Here we test each module individually and integrate the overall system.
Unit testing focuses verification effort even in the smallest unit of software development in
each module. This is also known as module testing. The modules of the system are tested
separately. This testing is carried out in the programming style itself. In this testing, each
module is focused to work satisfactorily as regard to expect output from the module.
PAGE NO: 58
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Data can be lost across on an interface, one module can have an adverse effect
on the other sub-functions, when combined may not produce the desired functions. Integrated
testing is the systematic testing to uncover the error within the interface. The testing is done
with simple data and the developed system can run successfully with this simple data. Here
the major intention is to find the overall system performance. The objective is to take unit
tested modules and build a program structure. All the modules are combined and tested as a
whole.
7.3 BLACKBOX TESTING
This is a software testing approach in which the tester doesn’t know the internal
working of the item being tested. For eg: in a black box test, on software design the tester only
knows the input and the expected outputs. He does not know how the program derives the
output. He doesn’t even imagine as to how, the coding is done. He need know only the
specifications.
The test is done from the point of view of the user, not the designer.
PAGE NO: 59
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
The test can be redundant if the software designer has already run a test
case.
PAGE NO: 60
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
PAGE NO: 61
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
SCREEN SHOTS
PAGE NO: 62
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Login
Control Desk
PAGE NO: 63
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Live Monitoring
PAGE NO: 64
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
Connection Tester
Add User
PAGE NO: 65
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
CONCLUSION
In India agriculture plays a vital role in helping millions to earn their livelihood. So
it is necessary to improve and maintain crops to fulfill their needs. The main challenge in front
of farmers is the variation in climatic conditions. Also the farmer needs to visit the farm daily
this may not be possible for those who own many acres of land. Lack of proper irrigation and
unscientific use of fertilizers led to destruction of crops.
Our project ‘Automatic Irrigation Control System’ can solve these problems. We
place temperature and humidity sensors on fields there by making monitoring easy. The
temperature and humidity of field is obtained and is stored in the database. Based on the
PAGE NO: 66
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
information available in database the user will irrigate the fields. Graphs are plotted using
values obtained using the sensors.
PAGE NO: 67
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
BIBLIOGRAPHY
1. Java2 The Complete Reference Third Edition. By Herbert Schildit & Patrick Naughton
2. Programming with Java A Primer By E.Balaguruswamy.
3. Head First Java 2nd Edition, by O'Reilly
4. Java 2 – The Complete Reference, by Herbert Schildit
5. Thinking in Java 3rd Edition, by Bruce Eckel
6. Roger S Pressman, Software Engineering – A Practitioners Approach, McGraw Hill
PAGE NO: 68
COMPUTER SCIENCE AND AUTOMATED IRRIGATION
SEMESTER:VIII
ENGINEERING CONTROL SYSTEM
1. www.java.sun.com
2. www.wikipedia.org
3. www.google.com
PAGE NO: 69