automated irrigation control system(aics)

91
SEMESTER:VII I COMPUTER SCIENCE AND ENGINEERING AUTOMATED IRRIGATION CONTROL SYSTEM FINAL YEAR PROJECT REPORT Automated Irrigation Control Automated Irrigation Control System System SUBMITTED BY SUBMITTED BY JOSE THOMAS.P JOSE THOMAS.P DON P DANIEL DON P DANIEL AJAYAN JOY AJAYAN JOY MARCH 2011 PAGE NO: 1

Upload: jose-thomas

Post on 24-Nov-2014

133 views

Category:

Documents


5 download

DESCRIPTION

Final Year project report of JOSE THOMAS P--->developed in netbeans using pic 16f877a microprocessor

TRANSCRIPT

Page 1: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

FINAL YEAR PROJECT REPORT

Automated Irrigation Control SystemAutomated Irrigation Control System

SUBMITTED BYSUBMITTED BY

JOSE THOMAS.PJOSE THOMAS.P

DON P DANIELDON P DANIEL

AJAYAN JOYAJAYAN JOY

MARCH 2011

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERINGToc H INSTITUTE OF SCIENCE & TECHNOLOGY

Arakkunnam P.O, Ernakulam District, KERALA –682 313

PAGE NO: 1

Page 2: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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 extend our gratitude to the Management of Toc H Institute of Science and Technology, for providing us great infrastructure necessary for the development of our project.

We would like to express our sincere thanks to Dr.Job.V.Kuruvilla, Principal, Toc H Institute of Science and Technology for his kind support for the completion of this venture.

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.

Thank You……..Thank You……..

PAGE NO: 2

Page 3: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Page 4: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PAGE NO: 4

Page 5: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Page 6: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

INTRODUCTION

PAGE NO: 6

Page 7: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

2.2 Scope of the project

Irrigation process can be automated.

Manual monitoring can be reduced to an extent

Time delay in irrigation can be avoided.

Entire irrigation process can be monitored through a single central system.

Temperature and Humidity details can be collected and appropriate actions can be

triggered

2.3 About the Project

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. The continuous extraction of water from earth is

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

PAGE NO: 7

Page 8: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

water due to which a significant amount of water goes waste. Water is considered to

be the basic need of human.

In order to overcome this problem automatic watering system use sensors

such as soil moisture sensor are used to control the watering system in a greenhouse. The

system also has the capability to control the water level. The main objective of this project is to

automatically control the watering system using humidity sensor. With the use of low cost

sensors and the simple circuitry makes this project a low cost product. This project is best

suited for places where water is scarce and has to be used in limited quantity.

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

A water conservation system that connects between a standard irrigation system

that is controlled by a clock, and the water control valves of that system in order to limit the

flow of water during timed irrigation cycles. When the timed watering cycles are initiated by the

standard irrigation system, the water conservation device senses the humidity in the soil,

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

PAGE NO: 8

Page 9: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Page 10: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

SYSTEM ANALYSIS

PAGE NO: 10

Page 11: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

2. SYSTEM ANALYSIS

The system environments with regard to an application project are the

environments which shaped the flesh and bones of the system from concepts and ideas to a

real working model. It is so crucial in selecting the various environments for the system

development since they plays a vital role in determining the properties and behavior of the new

system.

Basically, the system environment is divided into two.

Software requirements

Hardware requirements

2.1 Hardware Requirements

Hardware configuration is that the physical components used for developing

the project. The best hardware environment provides the developer with the best utilization of

the available resources.

Intel Pentium IV Processor or higher

1GB RAM

40 GB Hard disk

1024*768 Resolution Color Monitor

PICkit 2 Development Programmer/Debugger 

PAGE NO: 11

Page 12: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

Standard keyboard and mouse

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.

2.2 Software Requirements

Operating System used:

Windows XP or higher.

Software Packages used:

JDK Version 1.6

Netbeans IDE Version6.9

MPLab IDE 8.63

Technologies used:

JFC

IO Streams

Sockets

Threads

PAGE NO: 12

Page 13: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

SYSTEM STUDY

PAGE NO: 13

Page 14: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

The various tasks in the system analysis include the following.

Understanding application.

Planning.

Scheduling.

Developing candidate solution.

Performing trade studies.

Performing cost benefit analysis.

Recommending alternative solutions.

Selling of the system.

Supervising, installing and maintaining the system

3.1 STUDY OF EXISTING SYSTEM

Climates change triggers variability in terms of rainfall and temperature. India, the second

biggest populated country might face high intensity threat to livelihoods of poor and vulnerable

combined with fresh water scarcity. Existing system demands daily visit to field by farmer to evaluate

PAGE NO: 14

Page 15: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

the crops.this may be difficult for farmers who own acres of agricultural land. It is not possible for

farmer to monitor the entire land at the same time.

Advantage of existing system

Direct supervision is possible

Limitations of Existing System:

Accuracy is not reached

It is prone to errors

It is time consuming

No security is provide

Highly confusing

Employees are overloaded with work.

Inefficient, poorly managed, and Lacks Flexibility.

.

3.2 ANALYSIS OF PROPOSED SYSTEM

In order to overcome the limitations in traditional irrigation system automated irrigation system is

used. Owner of the farm land is the administrator, he can monitor the condition of land using this

software.He can add new employees and can monitor their work.temperature and humidity sensors are

placed on the field.they collect data and is forwaded to server and is stored in database.employee on

accessing the software can analyse this data.the data stored in database is then plotted in the form of a

graph.graphs plotted includes temperature plotted against time,humidity plotted against time and

temperature plotted against humidity.time at which a particular employee login to the software is noted

and entered into the database.

Advantages of the Proposed System:

Accuracy is attained

It is fast and consumes less time

Reduce manual intervention

Security is provided

PAGE NO: 15

Page 16: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

Less complexity

Confidentiality and anonymity issues.

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

Page 17: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PROJECT IMPLEMENTATION

PAGE NO: 17

Page 18: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.1 TOOLS & UTILITIES

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.

Today Java is both a programming language and an environment for executing

programs written in Java Language. Unlike traditional compilers, which convert source code

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

PAGE NO: 18

Page 19: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Java is an object-oriented programming language. As a programmer,

this means that you focus on the data in your application and methods that manipulate that

data, rather than thinking strictly in terms of procedures. If you're accustomed to procedure-

based programming in C, you may find that you need to change how you design your

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

PAGE NO: 19

Page 20: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

object-oriented features of Java, The object oriented language used to create executable

contents such as applications and applets.

(b) Interpreted

Java is an interpreted language: the Java compiler generates byte-codes

for the Java Virtual Machine (JVM), rather than native machine code. To actually run a Java

program, you use the Java interpreter to execute the compiled byte-codes. Because Java

byte-codes are platform-independent, Java programs can run on any platform that the JVM

(the interpreter and run-time system) has been ported to. In an interpreted environment, the

standard "link" phase of program development pretty much vanishes. If Java has a link phase

at all, it is only the process of loading new classes into the environment, which is an

incremental, lightweight process that occurs at run-time. This is in contrast with the slower and

more cumbersome compile-link-run cycle of languages like C and C++.

(c) Architecture Neutral and Portable

Because Java programs are compiled to an architecture neutral byte-code

format, a Java application can run on any system, as long as that system implements the Java

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."

PAGE NO: 20

Page 21: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

(d) Dynamic and Distributed

Java is a dynamic language. Any Java class can be loaded into a

running Java interpreter at any time. These dynamically loaded classes can then be

dynamically instantiated. Native code libraries can also be dynamically loaded. Classes in

Java are represented by the Class class , you can dynamically obtain information about a

class at run-time. This is especially true in Java 1.1, with the addition of the Reflection API.

Java is also called a distributed language. This means, simply, that it provides a lot of high-

level support for networking. Together, these features make it possible for a Java interpreter to

download and run code from across the Internet. This is what happens when a Web browser

downloads and runs a Java applet.

(e) Simple

Java is a simple language. The Java designers were trying to create a

language that a programmer could learn quickly. If you are a C or C++ programmer, you'll find

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.

PAGE NO: 21

Page 22: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

(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

One of the most highly touted aspects of Java is that it is a secure

language. Without an assurance of security, you certainly would not want to download code

from a random site on the Internet and let it run on your computer. Java was designed with

security in mind, and provides several layers of security controls that protect against malicious

code, and allow users to comfortably run untrusted programs such as applets. At the lowest

level, security goes hand-in-hand with robustness. By attaching a digital signature to Java

code, the origin of that code can be established in a cryptographically secure and unforgivable

way. Some security holes were found in early versions of Java, but these flaws were fixed

PAGE NO: 22

Page 23: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

almost as soon as they were found, and it seems reasonable to expect that any future holes

will be fixed just as quickly.

(h)High-Performance

Java is an interpreted language, so it is never going to be as fast as a

compiled language like C. Java 1.0 was said to be about 20 times slower than C. Java 1.1 is

nearly twice as fast as Java 1.0, however, so it might be reasonable to say that compiled C

code runs ten times as fast as interpreted Java byte-codes. Furthermore, the speed-critical

sections of the Java run-time environment, that do things like string concatenation and

comparison, are implemented with efficient native code. The Java byte-code format was

designed with these "just in time" compilers in mind, so the process of generating machine

code is efficient and it produces reasonably good code. The performance of Java's interpreted

byte-codes is much better than the high-level scripting languages (even Perl), but it still offers

the simplicity and portability of those languages.

(i) Multi threaded

In a GUI-based network application such as a Web browser, it's easy to

imagine multiple things going on at the same time. A user could be listening to an audio clip

while she is scrolling a page, and in the background the browser is downloading an image.

Java is a multi-threaded language; it provides support for multiple threads of execution

(sometimes called lightweight processes) that can handle different tasks. An important benefit

of multi threading is that it improves the interactive performance of graphical applications for

the user. you must instead create a thread that blocks on every I/O channel you are interested

in.

PAGE NO: 23

Page 24: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

(j) Java is garbage collected

Java programs do not have to worry about memory management. The Java

system has a built in program called the garbage collector, which scans the memory and

automatically frees the memory chunks that are not in use.

(k) Java Runtime Environment

The runtime environment used to execute the code. It is made up of the

java language and Java virtual machine. It is portable and it is platform neutral.

(l) Java tools

It is used by the developers to create java code. They include java

compiler, Java interpreter, classes, libraries and applet viewer.

(m) Java Application

Applications are programs written in java to carry out certain tasks on

standalone local computer. Execution of a standalone program involves two steps.

Compiling the source code into byte code using javac.

Executing byte code program using java interpreter.

(n) Java Applets

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.

(o) Java Virtual Machine

PAGE NO: 24

Page 25: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

It is a specification to which Java codes must be written. All Java code

is to be compiled to be used in this nonexistent virtual machine. Writing the code, which

compiles in JVM ensures platform independence.

5.1.2. NETBEANS

The NetBeans IDE is a free, open-source Integrated Development

Environment for software developers. The IDE runs on many platforms including Windows,

Linux, Solaris, and the MacOS. It is easy to install and use straight out of the box. The

NetBeans IDE provides developers with all the tools they need to create professional cross-

platform desktop, enterprise, web and mobile applications.

Using an Integrated Development Environment (IDE) for developing

applications saves you time by managing windows, settings, and data. In addition, an IDE can

store repetitive tasks through macros and abbreviations. Drag-and-drop features make

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

PAGE NO: 25

Page 26: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

MySQL is a relational database management system (RDBMS) which has more

than 11 million installations. The program runs as a server providing multi-user access to a

number of databases. MySQL is owned and sponsored by a single for-profit firm, the Swedish

company MySQL AB, now a subsidiary of Sun Microsystems, which holds the copyright to

most of the codebase. The project's source code is available under terms of the GNU General

Public License, as well as under a variety of proprietary agreements. "MySQL" is officially

pronounced (MySQL), not "My sequel". This adheres to the official ANSI pronunciation;

SEQUEL was an earlier IBM database language, a predecessor to the SQL language. The

company does not take issue with the pronunciation "My sequel" or other local variations.

There are 3 types of MySQL Server Compilations for Enterprise and Community users:

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.

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.

PAGE NO: 26

Page 27: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.2 The PIC16F877A microcontroller

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology,

derived from the PIC1640 originally developed by General Instrument's Microelectronics

Division. The name PIC initially referred to "Peripheral Interface Controller".

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.

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).

PAGE NO: 27

Page 28: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

This IC can be reprogrammed and erased up to 10,000 times. Therefore it is very good

for new product development phase.

Programs can also be written in assembly.

Code isn’t interpreted so it runs blazingly fast.

PIC16F877A pinout

The pinout of the PIC16F877A is:

PAGE NO: 28

Page 29: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PIC16F877A

PAGE NO: 29

Page 30: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.3 HD44780U DOT MATRIX LCD:-

PAGE NO: 30

Page 31: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Page 32: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

The commands for LCD initialization are

38- Two row 8-bit interface.

01-clear display. It clears DDRAM

0C-turns off display cursor

06- Increment the cursor position automatically

LCD accepts any command or data only if it is enabled. The EN signal has to be made

high and then send data or command and then disable it.

Fig: 4.d LCD Display

PAGE NO: 32

Page 33: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.6 MAX232

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals

suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver

and typically converts the RX, TX, CTS and RTS signals.

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

Page 34: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PROJECT DESIGN

PAGE NO: 34

Page 35: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

6.1 MODULE REQUIREMENTS

The project can be mainly divided into software and hardware part.

Software part consists of modules:

1. Login Module

2. DataBase Handler

3. Graph Generator

4. Data Analyzer

Hardware part consists of modules:

1. Sensor Module

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

PAGE NO: 35

Page 36: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

The different conditions for a hot, wet or chance of rain are being studied at

varied temperature and humidity conditions.

Dewpoint is calculated based on certain mathematical calculations. Also

irrigation after morning and before evening is avoided, which is inefficient/harmful for

crops

.

If the above conditions are satisfied, the system decides whether or not to switch

on the relay(which switch ONs the water pump).

Sensor Module

PAGE NO: 36

Page 37: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

6.2 DATAFLOW DIAGRAM

Dataflow diagram is used to define the flow of the system and their resources .It is the way of

expressing system requirements in a graphical manner. It is one of the most ingenious tools

used for structured analysis. It is the starting point of design

PAGE NO: 37

Page 38: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PAGE NO: 38

Page 39: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

6.3 DATABASE TABLES:

LOGIN

Field name

Data type Constraint Description

username varchar Primary key username

password varchar Password

Fullname varchar fullname

address varchar address

gender varchar gender

email varchar Email id

Mobile no

Big int Mobile no

Table: 4.d Employee login details

DAILY

Field name Data type Constraint Descriptiontime Small int Primary key timetemperature

varchar temperature

humidity humidityTable: 4.d Daily sensor readings

HOURLY

Field name Data type Constraint Description

PAGE NO: 39

Page 40: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

time Small int Primary key timetemperature

varchar temperature

humidity humidity

Table: 4.d Hourly sensor readings

MINUTELY

Field name Data type Constraint Descriptiontime Small int Primary key timetemperature

varchar temperature

humidity humidity

Table: 4.d Minutely sensor readings

SECONDLY

Field name Data type Constraint Descriptiontime Small int Primary key timetemperature

varchar temperature

humidity humidity

Table: 4.d Secondly sensor readings

PAGE NO: 40

Page 41: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PAGE NO: 41

Page 42: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.1 The PIC16F877A microcontroller

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology,

derived from the PIC1640 originally developed by General Instrument's Microelectronics

Division. The name PIC initially referred to "Peripheral Interface Controller".

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.

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).

PAGE NO: 42

Page 43: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

This IC can be reprogrammed and erased up to 10,000 times. Therefore it is very good

for new product development phase.

Programs can also be written in assembly.

Code isn’t interpreted so it runs blazingly fast.

PIC16F877A pinout

The pinout of the PIC16F877A is:

PAGE NO: 43

Page 44: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PIC16F877A

PAGE NO: 44

Page 45: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.5 HD44780U DOT MATRIX LCD:-

PAGE NO: 45

Page 46: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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

Page 47: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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.

The commands for LCD initialization are

38- Two row 8-bit interface.

01-clear display. It clears DDRAM

0C-turns off display cursor

06- Increment the cursor position automatically

LCD accepts any command or data only if it is enabled. The EN signal has to be made

high and then send data or command and then disable it.

Fig: 4.d LCD Display

PAGE NO: 47

Page 48: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

5.6 MAX232

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals

suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver

and typically converts the RX, TX, CTS and RTS signals.

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

Page 49: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

SOURCE CODE

PAGE NO: 49

Page 50: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

ASM CODE:

***** Program Header ************************************************

list P=PIC16F877a, F=INHX8M, ST=OFF, R=HEX, N=42, MM=OFF, B=6#include "p16f877a.inc"__config ( _CP_OFF & _PWRTE_ON & _HS_OSC & _WDT_OFF & _BODEN_ON & _LVP_OFF )errorlevel -302

;----------------- rs232 interrupt -----------------------------------

movlw '$'xorwf rectemp,wbtfss STATUS,Zgoto bkk2bsf rcflag,2movlw 0xa0movwf FSR goto back11

bkk2movlw 'T'xorwf rectemp,wbtfss STATUS,Zgoto itestbsf rcflag,0goto back11

itestmovlw 'H'xorwf rectemp,wbtfss STATUS,Zgoto btestbsf rcflag,1goto back11

btestmovlw 'B'xorwf rectemp,wbtfss STATUS,Zgoto ntestbsf rcflag,5goto back11

ntestmovlw 'N'xorwf rectemp,wbtfss STATUS,Zgoto onetestbsf rcflag,6

PAGE NO: 50

Page 51: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

goto back11

onetestmovlw '1'xorwf rectemp,wbtfss STATUS,Zgoto twotestbsf rcflag,3goto back11

twotestmovlw '0'xorwf rectemp,wbtfss STATUS,Zgoto back11bsf rcflag,4goto back11

coon; movwf INDTEMP

;movwf INDFxorlw '$'btfss STATUS,Zgoto coon1bcf rcflag,2goto initfsr

coon1movf rectemp,w;movf INDTEMP,wmovwf INDFincf FSR,fmovlw 0x1fxorwf FSR ,wbtfss STATUS,Zgoto back11

initfsrbsf rcflag,7movlw 0xa0movwf FSR

Control Desk:

import java.text.SimpleDateFormat;

PAGE NO: 51

Page 52: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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;

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;

PAGE NO: 52

Page 53: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

}

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);

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,

PAGE NO: 53

Page 54: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PlotOrientation.VERTICAL,

true,

true,

false

);

final ChartPanel chartPanel = new ChartPanel(chart);

chartPanel.setPreferredSize(new java.awt.Dimension(500, 200));

setContentPane(chartPanel);

switch(i)

{

case 8:jPanel8.add(chartPanel);break;

case 9:jPanel9.add(chartPanel);break;

}

}

}

boolean Emailvalid(String email)

{

//Pattern p = Pattern.compile(".+@.+\\.[a-z]+");

Pattern p=Pattern.compile("[a-zA-Z]+[[0-9]*|[a-zA-Z]*]+@[a-zA-Z]+[.[a-zA-Z]+]+");

Matcher m = p.matcher(email);

boolean matchFound = m.matches();

if (matchFound)

return true;

else

return false;

}

PAGE NO: 54

Page 55: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try{

final XYSeriesDemo Tgraph = new XYSeriesDemo("Temperature

Graph","second",8,"Time","Temp");

Tgraph.pack();

final XYSeriesDemo Hgraph = new XYSeriesDemo("Humidity

Graph","second",9,"Time","Humidity");

Hgraph.pack();

} catch(Exception e) {

}

}

PAGE NO: 55

Page 56: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

SYSTEM TESTING

PAGE NO: 56

Page 57: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

7. SYSTEM TESTING

Testing is the process of executing a program with the intention of

finding any error. A good test of course has the high portability of finding a yet undiscovered

error. A successful test is the one that uncovers a yet undiscovered error.

A test is vital to the success of any system. System test makes a

logical assumption that if all parts of the system are correct, then goal will be successfully

achieved. The candidate system is subjected to a variety of tests online like responsiveness,

its value, stress, and security. A series of tests are performed before the system is ready for

user acceptance testing.

System testing is the stage of implementation, which is aimed at

ensuring that the system works accurately and efficiently before live operation commences.

Testing is the process of executing the program with the intent of finding errors and missing

operations and also a complete verification to determine whether the objectives are met and

the user requirements are satisfied. The ultimate aim is quality assurance.

Tests are carried out and the results are compared with the expected

document. In the case of erroneous results, debugging is done. Using detailed testing

strategies a test plan is carried out on each module.

Some of the testing methods used for testing the system are:

UNIT TESTING

INTEGRATION TESTING

BLACKBOX TESTING

VALIDATION TESTING

OUTPUT TESTING

PAGE NO: 57

Page 58: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

7.1 UNIT 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.

7.2 INTEGRATION TESTING

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 advantages of this testing approach are-

The test is unbiased because the designer and tester is independent of

each other.

PAGE NO: 58

Page 59: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

The tester needs no specific knowledge on any programming language.

The test is done from the point of view of the user, not the designer.

The test can be designed as soon as the specifications are complete.

The disadvantages of this testing approach are-

The test can be redundant if the software designer has already run a test

case.

The test can be difficult to design.

Testing every possible input stream is unrealistic.

7.4 VALIDATION TESTING

At the culmination of integration, testing the software is completely assembled

as a whole package. Interfacing errors have been uncovered and corrected and the final series

of tests, ie validation begins. The validation test can be defines by the following simple

definition, that validation succeeds when the software functions in a manner that can be

reasonably accepted by the customer.

7.5 OUTPUT TESTING

After performing validation testing the next step is the output testing. The

system cannot be useful if it does not produce the required output. Asking the user about the

format in which the system is required, test the output that is displayed or generated by the

system under consideration. Here the output format is considered in two way. One is on

screen format and the other is the printed format. The output format on the screen is found to

be correct as the format was designed in the system phase according to user needs. As for

hard copy, the output comes according to the specification requested by the user. Here the

output testing does not result in any correction in the system.

PAGE NO: 59

Page 60: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

PAGE NO: 60

Page 61: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

SCREEN SHOTS

PAGE NO: 61

Page 62: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

Login

Control Desk

PAGE NO: 62

Page 63: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

Live Monitoring

PAGE NO: 63

Page 64: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

Connection Tester

Add User

PAGE NO: 64

Page 65: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

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: 65

Page 66: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

information available in database the user will irrigate the fields. Graphs are plotted using

values obtained using the sensors.

PAGE NO: 66

Page 67: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

BIBLIOGRAPHY

11.1 Reference books

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

Inter Editions 1991

PAGE NO: 67

Page 68: Automated Irrigation Control System(AICS)

SEMESTER:VIII C O M P U T E R S C I E N C E A N D E N G I N E E R I N G

A U T O M A T E D I R R I G A T I O N C O N T R O L S Y S T E M

11.2 Websites used

1. www.java.sun.com

2. www.wikipedia.org

3. www.google.com

PAGE NO: 68