Sunteți pe pagina 1din 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)

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 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 requirement for the award of degree of Bachelor of Technology in Electronics
and Communication of the Mahatma Gandhi University, Kottayam, during the academic year 2014-2015

Project Guide

Head of The Department

Internal Examiner

External Examiner

Place: Kakkanad
Date :

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 Viswakumar, Asst. Professors, Department of Electronics and Communication, RSET, Kakkanad for their constant encouragement and support 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 humidity 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. Starting with an overview of the project, this document provides a block
diagram representing the different parts of the project, detailed description of the hardware, the program, the circuit diagram and the
PCB layout used.

iii

Contents
ACKNOWLEDGEMENT

ii

ABSTRACT

iii

1 Introduction
1.1 Objective . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Project Definition . . . . . . . . . . . . . . . . . . . .
1.3 Working Methodology . . . . . . . . . . . . . . . . .

1
1
1
2

2 System Overview
2.1 Block Diagram . . . . . . . . .
2.2 Block Diagram Explanation . .
2.2.1 PIC Microcontroller . .
2.2.2 GSM Module . . . . . .
2.2.3 DC Motor . . . . . . . .
2.2.4 LCD Display . . . . . .
2.2.5 Regulated power supply

.
.
.
.
.
.
.

3
3
4
4
4
4
4
5

.
.
.
.
.
.
.
.
.
.
.
.

6
6
6
7
8
8
8
8
9
9
10
10
10

3 Hardware Implementation
3.1 Circuit Diagram . . . . . . .
3.1.1 Power Supply circuit
3.1.2 Circuit Diagram . . .
3.2 Components Description . .
3.2.1 PIC16F877A . . . .
3.2.2 IC7805 . . . . . . . .
3.2.3 DC MOTOR . . . .
3.2.4 L293D . . . . . . . .
3.2.5 LCD DISPLAY . . .
3.2.6 GSM MODULE . . .
3.2.7 MAX232 . . . . . . .
3.3 Circuit Operation . . . . . .

iv

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

4 Software Implementation
4.1 Program . . . . . . . . .
4.2 Software Tools . . . . . .
4.2.1 Proteus . . . . .
4.2.2 MPLAB . . . . .
4.2.3 DIPTRACE . . .
5 PCB Design
5.1 PCB Technology . .
5.2 PCB Layout . . . . .
5.2.1 Top Layer . .
5.2.2 Bottom Layer

.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.

12
12
21
21
21
22

.
.
.
.

23
23
25
25
26

6 Implementation and Circuit Testing

27

7 Applications

28

8 Conclusion

29

List of Figures
2.1

Block Diagram . . . . . . . . . . . . . . . . . . . . .

3.1
3.2

Power Supply Circuit Diagram . . . . . . . . . . . . .


Complete circuit Diagram . . . . . . . . . . . . . . .

6
7

5.1
5.2

Top Layer . . . . . . . . . . . . . . . . . . . . . . . .
Bottom Layer . . . . . . . . . . . . . . . . . . . . . .

25
26

vi

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 tremendous quantities. But it also results in excess usage of water. Automatic 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 automatically 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 speci1

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 microcontroller. 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 analyse the SMS received by the GSM module and based on this, the
motor is operated.

System Overview
2.1

Block Diagram

Figure 2.1: Block Diagram

2.2
2.2.1

Block Diagram Explanation


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 originally developed by General Instruments 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 microcontroller to send and receive message or to make a call . It is a specialized 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. Liquid Crystal Display (LCD) of 16X2 characters operating on +5Volt
supply and operated in 4-bit mode is implemented for the task of displaying 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 supplied by the power supplys energy source. A 7805 IC is used to get
regulated power supply.

Hardware Implementation
3.1
3.1.1

Circuit Diagram
Power Supply circuit

Figure 3.1: Power Supply Circuit Diagram

3.1.2

Circuit Diagram

Figure 3.2: Complete circuit Diagram

3.2
3.2.1

Components Description
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 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 (It can be reprogrammed and erased up to
10,000 times.) Therefore it is very good for new product development 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

electromagnetism The Device 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. 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 electronically modulated optical device made up of any number of segments
filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. Its
low electrical power consumption enables it to be used in batterypowered 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.

3.2.6

GSM MODULE

GSM Module is used to establish communication between the microcontroller and a GSM system.GSM is an architecture used for mobile 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 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.

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

Software Implementation
4.1

Program

#i n c l u d e <p i c . h>
#i n c l u d e l c d . h
#i n c l u d e s e r i a l . h
#i n c l u d e p i c a d c . h
#d e f i n e IN1 RA3
#d e f i n e IN2 RA5
#d e f i n e 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;
}
v o i d 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;
lcd init ();
usart init ();
gsm init ( ) ;

13

lcd command ( 0 x80 ) ;


l c d d i s p l a y ( 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 d i s p l a y ( DRYNESS =);
t=Adc10 Cha ( 0 ) ;
t=t / 2 . 0 4 8 ;
// 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;
}
else {
aa =0;
}

i f ( dd==1|| aa==1)
{
IN1 =1;
IN2 =0;
}
i f ( ! dd && ! aa )
{
RC1=0;
lcd command ( 0 xC0 ) ;
14

IN1 =0;
IN2 =0;
l c d d i s p l a y (
}

);

i f ( i >1)
{
i f ( sms [1]== Y )
{
dd=1;
lcd command ( 0 x01 ) ;
lcd 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 ) ;
l c d d i s p l a y ( Pump OFF ) ;
RC1=0;
IN1 =0;
IN2 =0;
dd=0;
}
sms [ 1 ] = \ 0 ; sms [ 0 ] = \ 0 ;
i =0;
}
}
}

s t a t i c void i n t e r r u p t i s r ( )
{
i f (RCIF)
{
RCIF = 0 ;
sms [ i ]= u s a r t r e c e i v e ( ) ;
i f ( sms [ 0 ] = = ) i ++;
e l s e i =0;
}

15

#i n c l u d e l c d . h
#d e f i n e RS RC2
#d e f i n e E RC3
void delay ( i n t n)
{
w h i l e ( n);
}
v o i d lcd command ( i n t a )
{
PORTD=a ;
RS=0;
//RW=0;
E=1;
delay (100);
E=0;
}
v o i d l c d d a t a ( char a )
{
PORTD=a ;
RS=1;
//RW=0;
E=1;
delay (100);
E=0;
}
v o i d l c d d i s p l a y ( c o n s t char s )
{
w h i l e ( s )
{
l c d d a t a ( s ) ;
s++;
}
}
v o i d lcd num ( u n s i g n e d i n t x )
{
char a [ 1 0 ] ;
i n t i =0;
while (x)
{
a [ i ]=x%10;
i ++;
x= x / 1 0 ;
16

}
a [ i ]= \0 ;
i ;
w h i l e ( i >=0)
{
l c d d a t a ( a [ i ]+0 x30 ) ;
i ;
}
l c d d i s p l a y (
);
}
void l c d i n i t ( )
{
lcd command ( 0 x38 ) ;
lcd command ( 0 x01 ) ;
lcd command ( 0 x0c ) ;
}

#i n c l u d e s e r i a l . h
v o i d u s a r t t r a n s m i t ( char a )
{
TXREG=a ;
w h i l e ( ! TXIF ) ;
TXIF=0;
}
char u s a r t r e c e i v e ( )
{
char a ;
w h i l e ( ! RCIF ) ;
a=RCREG;
return (a ) ;
}
v o i d u s a r t t x s t r i n g ( c o n s t char s )
{
w h i l e ( s )
{
u s a r t t r a n s m i t ( s ) ;
s++;
}
}
void u s a r t i n i t ( )
{

17

TXSTA=0X24 ;
RCSTA=0X90 ;
SPBRG=0X19 ;
}

#i n c l u d e p i c a d c . h
Adc8 Cha ( u n s i g n e d char ) ;
Adc10 Cha ( u n s i g n e d char ) ;
unsigned i n t adc hbit , a d c l b i t ;
u n s i g n e d i n t adc temp , adc temp0 , a d c v a l 1 ;
u n s i g n e d char a d c v a l , a d c d e l , a d c j ;
Adc10 Cha ( u n s i g n e d char v a l )
{
ADFM=1;
a d c d e l =25;
i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x05 ;
w h i l e (ADCON0!=0X01 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x0d ;
18

w h i l e (ADCON0!=0X09 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x15 ;
w h i l e (ADCON0!=0 x11 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x1d ;
w h i l e (ADCON0!=0 x19 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==4)
{
adc temp0 =0;
f o r ( a d c j =0; a d c j <10; a d c j ++)
19

{
ADCON0=0x20 ;
ADON=1;
w h i l e ( a d c d e l );
ADCON0 =0x25 ;
w h i l e (ADCON0!=0 x21 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x2d ;
w h i l e (ADCON0!=0 x29 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x35 ;
w h i l e (ADCON0!=0 x31 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
20

}
e l s e i f ( v a l ==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;
w h i l e ( a d c d e l );
ADCON0 =0x3d ;
w h i l e (ADCON0!=0 x39 ) ;
a d c h b i t=ADRESH;
a d c l b i t=ADRESL;
adc temp = a d c l b i t + (256 a d c h b i t ) ;
adc temp0=adc temp0+adc temp ;
}
}
a d c v a l 1=adc temp0 / 1 0 ;
return adc val1 ;
}

4.2
4.2.1

Software Tools
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) design. It is developed by Labcenter Electronics. The Proteus Design
Suite includes: * ISIS - A schematic capture tool with the possibility to simulate programmable ICs like Microchip PIC, Atmel AVR
(ATmega8, ATmega32, or ATtiny2313) etc. *ARES - for PCB layouts. We have used this software in our initial phases to draw the
schematic and check basic working of our circuits using its simulation 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 software 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 semiconductor 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 layout.This software offers user friendly, powerful and affordable solutions 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

PCB Design
A printed circuit board, or PCB, is used to mechanically support and
electrically connect electronic components using conductive pathways, 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. Insulating layers dielectric is typically laminated together with epoxy
resin prepreg.Well known prepreg materials used in the PCB industry 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 circuit 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 temporary 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 attached 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 mechanically 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 physical measurements (i.e voltage, frequency) can be done. Moreover 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
5.2.1

PCB Layout
Top Layer

Figure 5.1: Top Layer

25

5.2.2

Bottom Layer

Figure 5.2: Bottom Layer

26

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 humidity was successfully implemented and the circuit was tested to be
working.

27

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

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:
Problems faced and Future Scope

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.

28

Conclusion
The Irrigation Control Based on Humidity was successfully implemented 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 irrigate 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 irrigation.
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, Ocull, and Cox, Embedded C Programming and the
Microchip PIC, DELMAR CENGAGE Learning, 2004.
[3] Hayes,
GSM
modem
AT
Command
Set,
http://www.engineersgarage.com/tutorials/at-commands,
March 4, 2013

30

S-ar putea să vă placă și