Sei sulla pagina 1di 37

IRRIGATION CONTROL BASED ON HUMIDITY

MINI PROJECT REPORT

submitted in partial fulfillment of the requirements for the award of the degree of

Bachelor of Technology

in

ELECTRONICS AND COMMUNICATION ENGINEERING

of

MAHATMA GANDHI UNIVERSITY

by

SHARON FRANCIS(12012989)

of MAHATMA GANDHI UNIVERSITY by SHARON FRANCIS(12012989) Department of Electronics and Communication Engineering

Department of Electronics and Communication Engineering

Rajagiri School of Engineering and Technology

Rajagiri Valley, Kakkanad, Kochi, 682039 2013

Rajagiri Valley, Cochin - 682 039 DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING CERTIFICATE Certified that

Rajagiri Valley, Cochin - 682 039

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

Certified that the mini project work titled ”IRRIGATION CONTROL BASED ON HUMIDITY” is a bonafide report of the mini project done by SHARON FRANCIS (Uni. Reg. No:12012989) of sixth semester Electronics and Communication Engineering in partial fulfillment of the require- ment for the award of degree of Bachelor of Technology in Electronics and Communication of the Mahatma Gandhi University, Kottayam, dur- ing the academic year 2014-2015

Project Guide

Internal Examiner

Place: Kakkanad

Date :

Head of The Department

External Examiner

i

ACKNOWLEDGEMENT

We are grateful to the almighty God for his blessings and for helping us complete this project successfully.

We would like to thank Rev. Dr Antony Kariyil CMI, Director, RSET, Kakkanad and Dr A.Unnikrishnan, Principal for providing us all the necessary facilities including a very well furnished lab.We would also like to thank Mr. Jaison Jacob, HOD, Department of Electronics and Communication for his constant and sincere efforts to help us bring out the best that we could.We are also grateful to our guide Ms.Maleeha Abdul Azeez, Asst. Professor, Department of Electronics and Communication for her valuable and most helpful guidance all through the course of the project.

This acknowledgement would be incomplete without thanking Mr.Sreekumar G., Mr. K Ramavarma, Mr. Abhishek Viswaku- mar, Asst. Professors, Department of Electronics and Communica- tion, RSET, Kakkanad for their constant encouragement and sup- port throughout the course of this project. We also thank other teaching and non teaching staff of Department of Electronics and Communication for helping us in some way or the other. Last but not the least we thank all our classmates in S6 ECE for helping us a lot with their valuable suggestions and for their whole hearted support.

ii

ABSTRACT

The purpose of this document is to help you build an automated irrigation system which is controlled based on humidity. When hu- midity falls below a desired level, the motor is switched on and the soil is watered. The system can also be controlled manually by sending an SMS(Short Message Service) to a given number. Start- ing with an overview of the project, this document provides a block diagram representing the different parts of the project, detailed de- scription of the hardware, the program, the circuit diagram and the PCB layout used.

iii

Contents

ACKNOWLEDGEMENT

 

ii

ABSTRACT

iii

1 Introduction

1

1.1 Objective

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

1

1.2 Project Definition .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

1

1.3 Working Methodology

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

2

2 System Overview

 

3

2.1 Block Diagram

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

3

2.2 Block Diagram Explanation

.

.

.

.

.

.

.

.

.

.

.

.

.

.

4

2.2.1 PIC Microcontroller

.

.

.

.

.

.

.

.

.

.

.

.

.

.

4

2.2.2 GSM Module

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

4

2.2.3 DC Motor

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

4

2.2.4 LCD Display

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

4

2.2.5 Regulated power supply

.

.

.

.

.

.

.

.

.

.

.

.

5

3 Hardware Implementation

 

6

3.1 Circuit Diagram .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

6

3.1.1 Power Supply circuit

.

.

.

.

.

.

.

.

.

.

.

.

.

.

6

3.1.2 Circuit Diagram

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

7

3.2 Components Description

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

8

3.2.1 PIC16F877A

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

8

3.2.2 IC7805 .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

8

3.2.3 DC MOTOR

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

8

3.2.4 L293D

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

9

3.2.5 LCD DISPLAY

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

9

3.2.6 GSM MODULE

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

10

3.2.7 MAX232

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

10

3.3 Circuit Operation .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

10

iv

4 Software Implementation

 

12

4.1 Program

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

12

4.2 Software Tools

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

21

4.2.1 Proteus

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

21

MPLAB

4.2.2 .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

21

4.2.3 DIPTRACE

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

22

5 PCB Design

23

5.1 PCB Technology

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

23

5.2 PCB Layout

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

25

5.2.1 Top Layer

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

25

5.2.2 Bottom Layer

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

26

6 Implementation and Circuit Testing

 

27

7 Applications

28

8 Conclusion

29

v

List of Figures

2.1

Block Diagram

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

3

3.1

Power Supply Circuit Diagram .

.

.

.

.

.

.

.

.

.

.

.

.

6

3.2

Complete circuit Diagram

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

7

5.1

Top Layer

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

25

5.2

Bottom Layer

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

26

vi

1

Introduction

1.1 Objective

Irrigation is the artificial application of water to the land or soil. It is used to assist in the growing of agricultural crops, maintenance of landscapes, and revegetation of disturbed soils in dry areas and during periods of inadequate rainfall. Irrigation has been a central feature of agriculture for over 5000 years and the result of work of many cultures. Water shortage is becoming one of the biggest problems in the world. Many different methods are developed for the conservation of water. Water is a basic necessity for all living beings.

Agriculture is one of the fields where water is required in tremen- dous quantities. But it also results in excess usage of water. Auto- matic irrigation systems are programmed to discharge precise amounts of water in targeted area, which promotes water conservation. Thus the objective of this project is to design a low cost, efficient, small scale irrigation system too prevent water loss and minimize the cost of labour.

1.2 Project Definition

In this system water content in the soil is continuously measured and is displayed to the customer through a LCD display. When the moisture content is less than the reference value the system auto- matically turns the motor on. The motor when turned on sprinkles water from a water tank to the soil. When the moisture content reaches the reference level, the motor is switched off. Along with this, the system can be operated manually when an SMS in a speci-

1

fied syntax is sent to a number.The logic is produced by the program written in Embedded C language using the software MPLAB. The program written is then converted in HEX code after simulation and burned on to PIC microcontroller.

1.3 Working Methodology

The project consist of a main control unit which is the microcon- troller. Moisture detector system is made by using two iron nails kept in the soil, where the moisture content is to be measured. The detector is also connected to the microcontroller. It detects the voltage variation which determines the moisture content in the soil. This variation is given to the Analog-to-Digital converter of the PIC controller. The digital output decides the working of the motor. The PIC controller is programmed to run the motor when the moisture content falls below a reference value. When the moisture content reaches that particular value, the motor is turned off. The LCD displays the instantaneous value of soil moisture content and the status of the pump.

The system also consists of a GSM module which allows manual operation of the device. The PIC controller is programmed to anal- yse the SMS received by the GSM module and based on this, the motor is operated.

2

2

System Overview

2.1 Block Diagram

2 System Overview 2.1 Block Diagram Figure 2.1: Block Diagram 3

Figure 2.1: Block Diagram

3

2.2 Block Diagram Explanation

2.2.1 PIC Microcontroller

The PIC microcontroller is the heart of the system. It is used to interface different devices used in the circuit and is responsible for controlling and co-ordinating all the activities and functions. PIC

is

a family of modified Harvard architecture microcontrollers. It

is

made by Microchip Technology, derived from the PIC1650 origi-

nally developed by General Instrument’s Microelectronics Division. The name PIC initially referred to ”Peripheral Interface Controller”. PIC 16f877A is used in our circuit.

2.2.2 GSM Module

A GSM module can be interfaced to the serial port of the microcon-

troller to send and receive message or to make a call . It is a spe-

cialized type of modem that accepts a SIM card, and operates over

a subscription to mobile operator, just like a mobile phone. From

the mobile operator perspective, a GSM module looks just like a mobile phone. The GSM module used is SIMCOM 300 which uses SIM memory to store the number of system owner or housemates and distributor or to whoever the messages have to be forwarded.

2.2.3 DC Motor

A DC motor is used here for the mechanical operation of the pump.

A DC motor in simple words is a device that converts direct current

(electrical energy) into mechanical energy. Thus rotating the motor

for a given value of moisture content, according to the output from the PIC microcontroller, turns the pump ON. A driver IC has to be used in order to provide the necessary current to the motor.

2.2.4 LCD Display

As the system performs controlling and monitoring operations, it

is primary requirement to put a display in the system which shows

various message such as status of the pump, moisture content in the soil and also displays the actions taken by microcontroller. Liq- uid Crystal Display (LCD) of 16X2 characters operating on +5Volt supply and operated in 4-bit mode is implemented for the task of dis- playing required messages .Interfacing with PIC16F877A and short code of programming makes it very useful to make system more user friendly.

4

2.2.5 Regulated power supply

A regulated power supply is one that controls the output voltage or current to a specific value; the controlled value is held nearly constant despite variations in either load current or the voltage sup- plied by the power supply’s energy source. A 7805 IC is used to get regulated power supply.

5

3

Hardware Implementation

3.1 Circuit Diagram

3.1.1 Power Supply circuit

3 Hardware Implementation 3.1 Circuit Diagram 3.1.1 Power Supply circuit Figure 3.1: Power Supply Circuit Diagram

Figure 3.1: Power Supply Circuit Diagram

6

3.1.2 Circuit Diagram

3.1.2 Circuit Diagram Figure 3.2: Complete circuit Diagram 7

Figure 3.2: Complete circuit Diagram

7

3.2 Components Description

3.2.1 PIC16F877A

The PIC16F877A is a RISC microcontroller. It is one of the most efficient microcontrollers which is the most suitable for the project. PICs are popular and common with both industrial devel- opers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availabil- ity of low cost or free development tools, and serial programming and re-programming (It can be reprogrammed and erased up to 10,000 times.) Therefore it is very good for new product develop- ment phase.

HIGH PERFORMANCE RISC CPU:

Only 35 single word instructions to learn

All single cycle instructions except for program branches, which are two cycle

Operating speed:

DC

20 MHz

DC

200 ns instruction cycle

Up to 8K x 14 words of Flash Program Memory,

Up to 368 x 8 bytes of Data Memory (RAM),

Up to 256 x 8 bytes of EEPROM Data Memory

Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers

3.2.2 IC7805

The regulator IC 7805,provides a regulated 5V positive supply at its third pin.The regulator IC converts unregulated DC current into regulated DC current. It can also be used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V from 12V).

3.2.3 DC MOTOR

A DC motor is one of the simplest component by which a rotory motion can be achieved.Its operation is based on the principle of

8

electromagnetism The Device is a monolithic integrated high volt- age, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoides, DC and stepping motors) and switching power transis- tors. To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. This device is suitable for use in switching applications at frequencies up to 5 kHz.

3.2.4 L293D

L293D is a dualH-bridgemotor driver integrated circuit (IC).It is a

monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoides, DC and stepping motors) and switching power transistors. A separate supply input is also provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. Motor drivers act as current amplifiers since they take a low-current control signal and provide

a higher-current signal. This higher current signal is used to drive the motors.Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input

is high, the associated driver gets enabled.

3.2.5 LCD DISPLAY

A liquid crystal display (LCD) is a electronic visual display that uses the light modulating properties of liquid crystals. It is an electroni- cally modulated optical device made up of any number of segments filled with liquid crystals and arrayed in front of a light source (back- light) or reflector to produce images in color or monochrome. Its low electrical power consumption enables it to be used in battery- powered electronic equipment. They are used in a wide range of applications, including computer monitors, television, instrument panels, aircraft cockpit displays, signage, etc. They are usually more energy efficient, compact, lightweight, portable, less expensive, more reliable, and easier on the eyes. They are available in a wider range of screen sizes.

9

3.2.6 GSM MODULE

GSM Module is used to establish communication between the mi- crocontroller and a GSM system.GSM is an architecture used for mo- bile communication in most of the countries.GSM module consists of a GSM modem assembled together with power supply circuit and communication interfaces(like RS-232,USB etc) for computer.The modem is soul of such modules.GSM module can collect some data and send it to the central place using SMS or GSM data call

3.2.7 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 drivers provide RS-232 voltage level out- puts (approx. 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for imple- menting 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.

3.3 Circuit Operation

The circuit is powered by a 12V DC supply for the motor and a 5V supply for PIC, LCD, MAX232N, moisture detector and motor. The 12V DC is provided as the input supply. The ripples in the resulting supply if any is filtered or smoothened by means of a capacitor. Capacitor serves as a filter blocking any ac component of the rectifier output. This voltage is fed to regulator IC 7805, which provides a regulated 5V positive supply at its third pin. The regulated output is given as VCC to the PIC16F877A, LCD etc. An LED is connected in the circuit to detect the presence of power supply in the circuit. The PIC is given an external clock signal using a crystal of frequency 11.0592 MHz. This explains the operation of the power supply and clock signal section.

The moisture detectors are connected to the pin 2 of PIC. This is an analog input pin which can detect voltage and convert it to 10 bit binary value corresponding to the input voltage between 0 and 5V. The DC motor is also connected to the output port of the PIC through the driving IC L293D. The GSM module uses serial communication and is connected to the serial port (pins 25 and 26)

10

of PIC. The GSM module uses RS232 logic for communication while the PIC uses TTL logic. A serial converter IC is used in between them for the conversion between the two logics.

When the circuit is powered on PIC constantly checks the output of the moisture detector. When it produces a low voltage, ie when the water content of the soil is below a reference value, the motor is turned on and water is pumped. When the moisture detector output is high, the PIC reads the input value at the analog pin and motor is switched off. The input to the analog pin is calibrated so as to display the water content and motor status on the LCD display.

11

4

Software Implementation

4.1

Program

#i n cl u d e <pi c . h>

#i n cl u d e #i n cl u d e #i n cl u d e #d ef i n e #d ef i n e #d ef i n e

” l c d

. h”

” s e r i a l

. h”

” pi c

a d c

. h”

IN1 RA3

IN2 RA5

EN RE0

i n t

i =0,t , dd=0,aa=0;

char

sms [ 2 ] ;

void

gsm init ()

{

RCIE=0;

CREN=0;

u

s a r t

t x s t r i n g (”AT” ) ;

u

s a r t

t r a n s m i t (0X0D ) ;

u

s a r t

t r a n s m i t (0X0A ) ;

delay ( 2 ) ;

u

s a r t

t x s t r i n g (”AT+CMGF=1”);

u

s a r t

t r a n s m i t (0X0D ) ;

u

s a r t

t r a n s m i t (0X0A ) ;

delay ( 2 ) ;

u

s a r t

t x s t r i n g (”AT+CNMI=2 ,2 ,0 ,0 ,0” );

u

s a r t

t r a n s m i t (0X0D ) ;

u

s a r t

t r a n s m i t (0X0A ) ;

12

delay ( 2 ) ;

u

s a r t

t x s t r i n g (”AT+CMGD=1”);

u

s a r t

t r a n s m i t (0X0D ) ;

u

s a r t

t r a n s m i t (0X0A ) ;

delay ( 2 ) ;

u

s a r t

t x s t r i n g (”AT+CMGD=2”);

u

s a r t

t r a n s m i t (0X0D ) ;

delay ( 2 ) ;

RCIE=1;

CREN=1;

}

void

main ()

{

ADCON1=0x0E ;

TRISD=0X00 ;

TRISA0=1;

TRISA3=0;

TRISA5=0;

TRISE0=0;

TRISC=0X80 ;

PORTB=0X00 ;

PORTE=0X00 ;

PORTA=0X00 ;

PORTC=0X00 ;

PORTD=0X00 ;

EN=1;

ADCON0=0X05 ;

ADCON1=0X8E;

GIE=1;

PEIE=1;

RCIE=1;

RCIF=0;

IN1=0;

IN2=0;

l c d

u s a r t gsm

i n i t i n i t

)

(

;

( )

init ( ) ;

;

13

lcd command (0 x80 ) ;

lcd

display (” I r r i g a t i o n

Based ” ) ;

lcd command (0 xc0 ) ;

l c d

d i s p l a y (”

On Humidity ” ) ;

delay (25000); lcd command (0 x01 ) ;

while (1)

{

lcd command (0 x80 ) ;

l c d

t=Adc10 Cha ( 0 ) ; t=t / 2 . 0 4 8 ;

d i s p l a y (”DRYNESS

//lcd command (0xCb ) ;

lcd

num ( t ) ;

=”);

i

f ( t=498&&t >=440)

{

aa=1;

RC1=1;

lcd command (0 xC0 ) ;

l c d

d i s p l a y (”

Pump ON

)

;

IN1=1;

 

IN2=0;

}

e l s e

{

 

aa=0;

}

i

f ( dd==1|| aa==1)

{

IN1=1;

 

IN2=0;

}

i

f ( ! dd

&&

! aa )

{

RC1=0;

 

lcd command (0 xC0 ) ;

IN1=0;

IN2=0;

 

lcd

display (”

” )

;

}

i

f ( i >1)

{

i

f ( sms[1]== ’Y’ )

{

dd=1;

 

lcd

lcd

command (0 x01 ) ; command (0 xC0 ) ;

 

l

c d

d i s p l a y (”Pump

ON” ) ;

RC1=1;

}

e

l s e

i f ( sms[1]== ’N’ )

{

lcd

command (0 x01 ) ;

 

lcd

command (0 xC0 ) ;

OFF” ) ;

RC1=0;

IN1=0;

IN2=0;

dd=0;

}

sms [1]= ’\0 ’; sms [0]= ’\0 ’;

l c d

d i s p l a y (”Pump

i

=0;

}

}

}

s

t a t i c

void

interrupt

i s r ()

{

}

i f (RCIF)

{

RCIF = sms [ i ]=

0 ; u s a r t

r e c e i v e ()

i f

e l s e

( sms [0]== ’ ’ ) i ++;

i =0;

15

;

#i n cl u d e #d ef i n e #d ef i n e

” l c d . h” RS RC2 E RC3

void

delay ( int

n)

{

while (n−−);

 

}

void

lcd command ( int

a)

{

PORTD=a ;

 

RS=0;

//RW=0;

 

E=1;

delay (100);

 

E=0;

}

void

lcd data ( char

a)

{

PORTD=a ;

 

RS=1;

//RW=0;

 

E=1;

delay (100);

 

E=0;

}

void

lcd

display ( const

char

s )

{

while (s )

 

{

lcd data

(s ) ;

s++;

}

} void

lcd num ( unsigned

int

x)

{

{

char

int

a

0 ]

i =0;

[ 1

;

while (x)

a [ i ]=x%10;

i ++;

x=

x

/10;

}

a [ i ]= ’\0 ’; i −−;

w hil e ( i >=0)

{

lcd data (a [ i ]+0x30 ) ; i −−;

}

lcd

}

void

display (”

l c d

i n i t ()

)

;

{

lcd

command (0 x38 ) ;

lcd

command (0 x01 ) ;

lcd

command (0 x0c ) ;

}

#i n cl u d e

” s e r i a l . h”

void

{

usart transmit ( char

TXREG=a ;

w hil e ( ! TXIF ) ;

TXIF=0;

}

char

{

char

w hil e ( ! RCIF ) ;

u s a r t

a ;

r e c e i v e ()

a)

a=RCREG;

 

return (a ) ;

}

void

u s a r t

t x s t r i n g (

const

char

s )

{

while (s )

 

{

usart transmit (s ) ;

s++;

}

}

void

u s a r t

i n i t ()

{

17

TXSTA=0X24 ;

 

RCSTA=0X90 ;

SPBRG=0X19 ;

}

#i n cl u d e ”

pi c

a d c . h”

Adc8 Cha ( unsigned Adc10 Cha ( unsigned

char ) ; char ) ;

unsigned

int

adc

hbit , a d c

l b i t ;

unsigned

int

adc temp , adc temp0 , adc val1 ;

unsigned

char

adc val , adc

j

;

Adc10 Cha ( unsigned

char

del , adc val )

 

{

ADFM=1;

adc del =25;

i

f ( val==0)

 

{

 

adc temp0=0;

 

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x00 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x05 ; w hil e (ADCON0!=0X01 ) ;

 

a d c h bi t=ADRESH;

 

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==1)

 

{

adc temp0=0;

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

{

ADCON0=0x08 ;

ADON=1;

while ( adc del −−); ADCON0 =0x0d ;

18

w hil e (ADCON0!=0X09 ) ;

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==2)

 

{

 

adc temp0=0;

 

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x10 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x15 ;

 
 

w

hil e (ADCON0!=0 x11 ) ;

 

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==3)

 

{

 

adc temp0=0;

 

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x18 ;

 

ADON=1;

 

while ( adc del −−);

 

ADCON0 =0x1d ;

 
 

w

hil e (ADCON0!=0 x19 ) ;

 
 

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==4)

 

{

adc temp0=0;

f o r ( a d c

j =0; a d c

19

j <10; a d c

j++)

 

{

 

ADCON0=0x20 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x25 ;

 
 

w

hil e (ADCON0!=0 x21 ) ;

 

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==5)

 

{

 

adc temp0=0;

 

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x28 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x2d ;

 
 

w

hil e (ADCON0!=0 x29 ) ;

 

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

e

l s e

i f ( val==6)

 

{

 

adc temp0=0;

 

f

o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x30 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x35 ;

 
 

w

hil e (ADCON0!=0 x31 ) ;

 

a d c

h bi t=ADRESH;

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

20

}

e

l s e

i f ( val==7)

 

{

 

adc temp0=0;

 

f o r ( a d c

j =0; a d c

j <10; a d c

j++)

 

{

 

ADCON0=0x38 ;

 

ADON=1;

 

while ( adc del −−); ADCON0 =0x3d ;

 
 

w hil e (ADCON0!=0 x39 ) ;

 

a d c h bi t=ADRESH;

 

a d c

l b i t=ADRESL;

 

adc

temp =

a d c

l b i t

+ (256adc

hbit ) ;

adc temp0=adc temp0+adc temp ;

 

}

}

a

d c v al 1=adc temp0 /10;

 

return

adc val1 ;

}

4.2 Software Tools

4.2.1 Proteus

Proteus is the embedded system simulation and developing platform developed by Britain Lab center Company. It is for microprocessor simulation, schematic capture, and printed circuit board (PCB) de- sign. It is developed by Labcenter Electronics. The Proteus Design Suite includes: * ISIS - A schematic capture tool with the possibil- ity to simulate programmable ICs like Microchip PIC, Atmel AVR (ATmega8, ATmega32, or ATtiny2313) etc. *ARES - for PCB lay- outs. We have used this software in our initial phases to draw the schematic and check basic working of our circuits using its simula- tion feature.

4.2.2 MPLAB

Microchip Technology developed an IDE for PIC microcontroller which is named MPLAB. This IDE provides C compiler, software simulator and debugger. MPLAB IDE also provides in-built custom libraries for not only PICs internal peripherals like ADC, USART, SPI, I2C etc, but also for external peripherals like LCD, 7-segment

21

etc. It is a full-featured C compiler for 5 different microcontroller architectures. It is the best solution for developing code for any microcontroller. It features intuitive IDE, powerful compiler with advanced SSA optimizations, lots of hardware and software libraries, and additional tools that will be very helpful. Our project coding is completely done using MPLAB.

4.2.3 DIPTRACE

Electronic design automation (EDA or ECAD) is a category of soft- ware tools for designing electronic systems such as printed circuit boards and integrated circuits. The tools work together in a design flow that chip designers use to design and analyze entire semicon- ductor chips.

DipTrace is an EDA software for creating schematic diagrams and printed circuit boards. In this project the PCB design software DipTrace was used to draw the schematic and obtain the board lay- out.This software offers user friendly, powerful and affordable solu- tions for PCB design, including Schematic, Capture, Board Layout and Autorouter. The PCB layout editor allows back annotation to the schematic and auto-routing to automatically connect traces based on the connections defined in the schematic. It also shows a 3D Preview of the PCB layout. We used DipTrace CAD to create our PCB design files and the layout for printing.

22

5

PCB Design

A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive path- ways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate. The design of PCB is considered as the last step in electronics circuit design as well as the first step in production of PCBs. It forms a distant factor in the circuits performance and reliability. The designing of the PCB consists of designing of the layout followed by generation of the artwork. The board is typically coated with a solder mask that is green in color. Other colors that are normally available are blue, black, white and red. Conducting layers are typically made of thin copper foil. In- sulating layers dielectric is typically laminated together with epoxy resin prepreg.Well known prepreg materials used in the PCB in- dustry are FR-2 (Phenolic cotton paper), FR-3 (Cotton paper and epoxy), FR-4 (Woven glass and epoxy), FR-5 (Woven glass and epoxy), FR-6 (Matte glass and polyester), G-10 (Woven glass and epoxy), CEM-1 (Cotton paper and epoxy), CEM-2 (Cotton paper and epoxy), CEM-3 (Non-woven glass and epoxy).

5.1 PCB Technology

Block level descriptions of the various terms associated with the technology of PCBs are as follows:

COPPER CLAD LAMINATES The board with copper on it is called ”copper-clad laminate”.

PATTERNING (ETCHING) The vast majority of printed cir- cuit boards are made by bonding a layer of copper over the entire substrate, sometimes on both sides, (creating a ”blank

23

PCB”) then removing unwanted copper after applying a tem- porary mask (e.g., by etching), leaving only the desired copper traces.

LAMINATION Some PCBs have trace layers inside the PCB and are called multilayer PCBs. These are formed by bonding together separately etched thin boards.

DRILLING Holes through a PCB are typically drilled with small-diameter drill bits made of solid coated tungsten carbide. Coated tungsten carbide is recommended since many board materials are very abrasive and drilling must be high RPM and high feed to be cost effective. These holes are often filled with annular rings (hollow rivets) to create vias. Vias allow the electrical and thermal connection of conductors on opposite sides of the PCB.

SCREEN PRINTING Line art and text may be printed onto the outer surfaces of a PCB by screen printing. Screen print is also known as the silk screen, or, in one sided PCBs, the red print.

PRINTED CIRCUIT ASSEMBLY After the printed circuit board (PCB) is completed, electronic components must be at- tached to form a functional printed circuit assembly, or PCA (sometimes called a ”printed circuit board assembly” PCBA).In through-hole construction, component leads are inserted in holes. In surface-mount construction, the components are placed on pads or lands on the outer surfaces of the PCB. In both kinds of construction, component leads are electrically and mechani- cally fixed to the board with a molten metal solder. Soldering techniques are used to attach components to a PCB.

TESTING While the power is on, in-circuit tests, where phys- ical measurements (i.e voltage, frequency) can be done. More- over while the power is on, functional test, just checking if the PCB does what it had been designed to do can also be done.

24

5.2 PCB Layout

5.2.1 Top Layer

5.2 PCB Layout 5.2.1 Top Layer Figure 5.1: Top Layer 25

Figure 5.1: Top Layer

25

5.2.2 Bottom Layer

5.2.2 Bottom Layer Figure 5.2: Bottom Layer 26

Figure 5.2: Bottom Layer

26

6

Implementation and Circuit Testing

The PCB circuit was designed and implemented. The circuit was tested on two soils - one watered and the other soil dry. Under normal condition the status of the pump and moisture content is diplayed on the display. The humidity sensor is inserted into the soil, when the moisture content is below 40 percent, the motor is rotated and the pump is turned on. After the moisture content reaches a value above the reference level, the motor stops rotating and the pump is turned off.

Thus, the proposed project of irrigation control based on humid- ity was successfully implemented and the circuit was tested to be working.

27

7

Applications

Applications The applications of irrigation control system based on humidity are :

It can be used to irrigate small scale farming.

It can be used in greenhouses and water roof gardens.

Since we use only one motor

in this system, it can be used only for a small scale farming. By increasing the number of motors, it can be facilitated in large farms. This project can be further developed as given below:

Along with water, mineral content in the soil can be detected and accordingly provided for the plants. This method can be efficient for large scale farming.

Other parameters such as ambient temperature, light intensity and humidity can be measured.

Problems faced and Future Scope

28

8

Conclusion

The Irrigation Control Based on Humidity was successfully imple- mented and tested. In this current scenario where there is shortage of water, this system can play a vital role in water conservation. This system when practically implemented would help users to ir- rigate their farms efficiently and timely. It can reduce the over-use of water, and also excessive irrigation and damaging of plants. This system have following advantages,

It reduces human intervention and still ensures proper irriga- tion.

It helps in water conservation.

It avoids over irrigation of the soil which may damage the plant crops.

It can be switched to manual mode whenever required.

29

Bibliography

[1] John B. Peatman, Design with PIC Microcontrollers, Prentice Hall, 1998

[2] Barnett, O’cull, and Cox, Embedded C Programming and the Microchip PIC, DELMAR CENGAGE Learning, 2004.

[3] Hayes,

Set”,

”GSM

modem

AT

Command

http://www.engineersgarage.com/tutorials/at-commands,

March 4, 2013

30