You are on page 1of 59

MICRO CONTROLLER BASED AUTOMATIC GARDEN IRRIGATION

SYSTEM

ABSTRACT
The main aim of this paper is to provide automatic irrigation to the plants which
helps in saving money and water. The entire system is controlled using PIC micro
controller which is programmed as giving the interrupt signal to the sprinkler.
Temperature sensor are connected to internal ports of micro controller, Whenever
there are a change in temperature of the surroundings these sensors senses the
change in temperature and gives an interrupt signal to the micro-controller and thus
the sprinkler is activated.
BLOCK DIAGRAM:

POWERSUPPLY

LCD DISPLAY

MICROCONTROLLER

LCD

TEMPERATURE
SENSOR

WATER LEVEL
SENSOR

MOTOR
DRIVERS

WATE
RPUM
PS

HARDWARE USED:
Micro Controller
Motor
Power supply
LCD
Temperature sensor
Water level sensor

CIRCUIT
U1

LCD1

7805

BR1

LM016L

D1

C2
104

1
2
3

12-0-12/1AMPS

D0
D1
D2
D3
D4
D5
D6
D7

1K

7
8
9
10
11
12
13
14

R1

RS
RW
E

22PF

4
5
6

C1

VSINE

VO

V1

VI
GND

VSS
VDD
VEE

TR1

LED

PRESET

C5

10K
R3

VOUT

1K

X1

27.0

4MHZ
2

2
3
4
5
6
7

C6
3

U2
13
14
1

LM35
22PF

8
9
10

+5V

OSC1/CLKIN
OSC2/CLKOUT
MCLR/Vpp/THV

RA0/AN0
RA1/AN1
RA2/AN2/VREFRA3/AN3/VREF+
RA4/T0CKI
RA5/AN4/SS
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
RE0/AN5/RD
RC2/CCP1
RE1/AN6/WR
RC3/SCK/SCL
RE2/AN7/CS
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
RC7/RX/DT

.
PROBE

RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7

RV1
10K

C1
22PF

+5V

RB0/INT
RB1
RB2
RB3/PGM
RB4
RB5
RB6/PGC
RB7/PGD

PIC16F877

33
34
35
36
37
38
39
40
15
16
17
18
23
24
25
26
19
20
21
22
27
28
29
30

R2

Q1

+88.8

22PF

BC547

1k

12v

kRPM

U3

POWER SUPPLY
The power supply unit is used to provide a constant 5V of DC supply from a 230V
of AC supply. These 5V DC will acts as power to different standard circuits. It mainly
uses 3 devices
1. Bridge wave rectifier
2. Voltage regulator

Figure 3.1: Block Diagram Of Power Supply

BRIDGE WAVE RECTIFIER


A rectifier is an electrical device that converts alternating current (AC) to direct
current (DC), a process known as rectification. The term rectifier describes a diode that is
being used to convert AC to DC.

A bridge-wave rectifier converts the whole of the input waveform to one of


constant polarity (positive or negative) at its output. Bridge-wave rectifier converts both
polarities of the input waveform to DC (direct current), and is more efficient. However,
in a circuit with a center tapped transformer (9-0-9) is used.

Figure 3.2: Bridge Wave Rectifier

For single-phase AC, if the transformer is center-tapped, then two diodes back-toback(i.e. anodes-to-anode or cathode-to-cathode) can form a full-wave rectifier. Many
windings are required on the transformer secondary to obtain the same output voltage.
In this only two diodes are activated at a time i.e. D1 and D3 activate for positive
cycle and D2 and D4 activates for negative half cycle. D2 and D4 convert negative cycle
to positive cycle as it as negative supply and negative cycle as positive cycle at its output.
VOLTAGE REGULATOR
This is most common voltage regulator that is still used in embedded designs. LM7805
voltage regulator is a linear regulator. With proper heat sink these LM78xx types can
handle even more than 1A current. They also have Thermal overload protection, Short
circuit protection.

This will connect at the output of rectifier to get constant Dc supply instead of ripple
voltages. It mainly consists of 3 pins

1. Input voltage
2. Output voltage
3. Ground
The capacitor C2 is used to get thee ripple voltage as input to regulator instead of
full positive cycles.

Vr = I load/Xc

Figure 3.3: Voltage Regulator

For some devices we require 12V/9V/4V Dc supply at that time we go for


7812/7809/7804 regulator instead of 7805 regulator. It also have same feature and pins
has 7805 regulator except output is of 12V/9V/4V instead of 5V.
The general circuit diagram for total power supply to any embedded device is as
shown below.

Figure 3.4: Circuit Diagram Of Power Supply

MICROCONTROLLER

A micro controller is a true computer on a chip. The design incorporates all


the features found in a microprocessor such as CPU, ALU,PC,SP and registers. It
also has some added features needed to make a complete computer ROM, RAM,
parallel I/o, serial I/o, counters and clock circuit.
The prime use of a micro controller is to control the operation of a machine
using a fixed program that is stored in ROM and that does not change over the life
time of the system. The architecture and instruction set of the micro controller are
optimized to handled data in bit and byte size.

The areas if applications of micro controllers include control process,


manufacturing process, medicine, instrumentation etc.

PIC

PIC stands for peripheral interface controller as coined by microchip


technology inc., USA

PIC is a very popular microcontroller world wide

Microchip is the first manufacturer of 8 pin RISC MCU. Microchip is the


worlds second largest chip manufacturer.
Focus on high performance cost-effective, field programmable embedded
control solutions.

Variety of end-user applications-specific standard products(ASSP)

&application specific integrated circuits.


Global network of manufacturing and customer support facilities.

PIN DIAGRAM

ARCHITECTURE

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 clock input 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

Analog Features:
10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
Brown-out Reset (BOR)
Analog Comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference (VREF) module
- Programmable input multiplexing from device inputs and internal voltage
reference

- Comparator outputs are externally accessible

Peripheral Features:

Timer0: 8-bit timer/counter with 8-bit prescaler


Timer1: 16-bit timer/counter with prescaler, can be incremented during
Sleep via external crystal/clock
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and
postscaler
Two Capture, Compare, PWM modules
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
Synchronous Serial Port (SSP) with SPI (Master mode) and I2C
(Master/Slave)
Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI)
with 9-bit address detection
Parallel Slave Port (PSP) 8 bits wide with external RD, WR and CS
controls (40/44-pin only)
Brown-out detection circuitry for Brown-out Reset (BOR)

Special Microcontroller Features:


100,000 erase/write cycle Enhanced Flash program memory typical
1,000,000 erase/write cycle Data EEPROM memory typical
Data EEPROM Retention > 40 years
Self-reprogrammable under software control
In-Circuit Serial Programming (ICSP) via two pins
Single-supply 5V In-Circuit Serial Programming
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable
operation
Programmable code protection
Power saving Sleep mode
Selectable oscillator options
In-Circuit Debug (ICD) via two pins

CMOS Technology:

Low-power, high-speed Flash/EEPROM technology


Fully static design
Wide operating voltage range (2.0V to 5.5V)
Commercial and Industrial temperature ranges
Low-power consumption
I/O PORTS

Some pins for these I/O ports are multiplexed with an alternate function for
the peripheral features on the device. In general, when a peripheral is enabled, that
pin may not be used as a general purpose I/O pin. Additional information on I/O
ports may be found in the PICmicro Mid-Range.

PORTA and the TRISA Register


PORTA is a 6-bit wide, bidirectional port. The corresponding data direction
register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA
pin an input (i.e., put the corresponding output driver in a High-Impedance mode).
Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e.,
put the contents of the output latch on the selected pin). Reading the PORTA
register reads the status of the pins, whereas writing to it will write to the port
latch. All write operations are read-modify-write operations. Therefore, a write to a

port implies that the port pins are read; the value is modified and then written to
the port data latch.
Pin RA4 is multiplexed with the Timer0 module clock input to become the
RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open-drain
output. All other PORTA pins have TTL input levels and full CMOS output drivers.
Other PORTA pins are multiplexed with analog inputs and the analog VREF input
for both the A/D converters and the comparators. The operation of each pin is
selected by clearing/setting the appropriate control bits in the ADCON1 and/or
CMCON registers.
PORTB and the TRISB Register

PORTB is an 8-bit wide, bidirectional port. The corresponding data direction


register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB
pin an input (i.e., put the corresponding output driver in a High-Impedance mode).
Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e.,
put the contents of the output latch on the selected pin). Three pins of PORTB are
multiplexed with the In-Circuit Debugger and Low-Voltage Programming function:
RB3/PGM, RB6/PGC and RB7/PGD. Each of the PORTB pins has a weak internal
pull-up. A single control bit can turn on all the pull-ups. This is performed by
clearing bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned
off when the port pin is configured as an output. The pull-ups are disabled on a
Power-on Reset.

PORTC and the TRISC Register


PORT C is an 8-bit wide, bidirectional port. The corresponding data
direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding
PORTC pin an input (i.e., put the corresponding output driver in a High-Impedance
mode). Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an
output (i.e., put the contents of the output latch on the selected pin). PORTC is
multiplexed with several peripheral functions. PORTC pins have Schmitt Trigger
input buffers. When the I2C module is enabled, the PORTC<4:3> pins can be
configured with normal I2C levels, or with SM Bus levels, by using the CKE bit
(SSPSTAT<6>). When enabling peripheral functions, care should be taken in
defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to
make a pin an output, while other peripherals override the TRIS bit to make a pin
an input. Since the TRIS bit override is in effect while the peripheral is enabled,
read-modify write instructions (BSF, BCF, XORWF) with TRISC as the
destination, should be avoided. The user should refer to the corresponding
peripheral section for the correct TRIS bit settings.

PORT-D PIN DETAILS

PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is
individually configurable as an input or output. PORTD can be configured as an 8-

bit wide microprocessor port (Parallel Slave Port) by setting control bit,
PSPMODE (TRISE<4>). In this mode, the input buffers are TTL.

PORTE PIN DETAILS

PORT D has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7)


which are individually configurable as inputs or outputs. These pins have Schmitt
Trigger input buffers. The PORTE pins become the I/O control inputs for the
microprocessor port when bit PSPMODE (TRISE<4>) is set. In this mode, the user
must make certain that the TRISE<2:0> bits are set and that the pins are configured
as digital inputs. Also, ensure that ADCON1 is configured for digital I/O. In this
mode, the input buffers are TTL. Register 4-1 shows the TRISE register which also
controls the Parallel Slave Port operation. PORTE pins are multiplexed with analog
inputs. When selected for analog input, these pins will read as 0s. TRISE controls
the direction of the RE pins, even when they are being used as analog inputs. The
user must make sure to keep the pins configured as inputs when using them as
analog inputs.

TIMER-0 MODULE

The Timer0 module timer/counter has the following features:


8-bit timer/counter
Readable and writable
8-bit software programmable prescaler
Internal or external clock select
Interrupt on overflow from FFh to 00h
Edge select for external clock
In block diagram of the Timer0 module and the prescaler shared with the WDT.
Additional information on the Timer0 module is available in the PICmicro MidRange MCU Family Reference Manual (DS33023). Timer mode is selected by
clearing bit T0CS (OPTION_REG<5>). In Timer mode, the Timer0 module will
increment every instruction cycle (without prescaler). If the TMR0 register is
written, the Increment is inhibited for the following two instruction cycles. The
user can work around this by writing an adjusted value to the TMR0 register.
Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In
Counter mode, Timer0 will increment either on every rising or falling edge of pin
RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge
Select bit, T0SE (OPTION_REG<4>). Clearing bit T0SE selects the rising edge.

The prescaler is mutually exclusively shared between the Timer0 module and the
Watchdog Timer. The prescaler is not readable or writable.

TIMER 0 BLOCKDIAGRAM

TIMER 1 MODULE
The Timer1 module is a 16-bit timer/counter consisting of two 8-bit registers
(TMR1H and TMR1L) which are readable and writable. The TMR1 register pair
(TMR1H:TMR1L) increments from 0000h to FFFFh and rolls over to 0000h. The
TMR1 interrupt, if enabled, is generated on overflow which is latched in interrupt
flag bit, TMR1IF (PIR1<0>). This interrupt can be enabled/disabled by
setting/clearing TMR1 interrupt enable bit, TMR1IE (PIE1<0>). Timer1 can
operate in one of two modes:
As a Timer
As a Counter
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>).
In Timer mode, Timer1 increments every instruction cycle. In Counter mode, it
increments on every rising edge of the external clock input. Timer1 can be
enabled/disabled by setting/clearing control bit, TMR1ON (T1CON<0>). Timer1
also has an internal Reset input. This Reset can be generated by either of the two
CCP modules (Section 8.0 Capture/Compare/PWM Modules).

TIMER2 MODULE
Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as
the PWM time base for the PWM mode of the CCP module(s). The TMR2 register
is readable and writable and is cleared on any device Reset. The input clock
(FOSC/4) has a prescale option of 1:1, 1:4 or 1:16, selected by control bits
T2CKPS1:T2CKPS0 (T2CON<1:0>). The Timer2 module has an 8-bit period
register, PR2. Timer2 increments from 00h until it matches PR2 and then resets to
00h on the next increment cycle. PR2 is a readable and writable register. The PR2
register is initialized to FFh upon Reset. The match output of TMR2 goes through
a 4-bit postscaler (which gives a 1:1 to 1:16 scaling inclusive) to generate a TMR2
interrupt (latched in flag bit, TMR2IF (PIR1<1>)).
Timer2 can be shut-off by clearing control bit, TMR2ON (T2CON<2>), to
minimize power consumption.

INSTRUCTION SET SUMMARY


The PIC16 instruction set is highly orthogonal and is comprised of three
basic categories:
Byte-oriented operations
Bit-oriented operations
Literal and control operations
Each PIC16 instruction is a 14-bit word divided into an opcode which specifies the
instruction type and one or more operands which further specify the operation of
the instruction. For byte-oriented instructions, f represents a file register
designator and d represents a destination designator. The file register designator
specifies which file register is to be used by the instruction.

The destination designator specifies where the result of the operation is to be


placed. If d is zero, the result is placed in the W register. If d is one, the result is
placed in the file register specified in the instruction.
For bit-oriented instructions, b represents a bit field designator which
selects the bit affected by the operation, while f represents the address of the file
in which the bit is located.
For literal and control operations, k represents an eight or eleven-bit
constant or literal value One instruction cycle consists of four oscillator periods;
for an oscillator frequency of 4 MHz, this gives a normal instruction execution
time of 1and 0s. All instructions are executed within a single instruction cycle,
unless a conditional test is true, or the program counter is changed as a result of an
instruction. When this occurs, the execution takes two instruction cycles with the
second cycle executed as a NOP. Any instruction that specifies a file register as
part of the instruction performs a Read-Modify-Write (R-M-W) operation. The
register is read, the data is modified, and the result is stored according to either the
instruction or the destination designatord. A read operation is performed on a
register even if the instruction writes to that register.

GENERAL FORMAT FOR INSTRUCTIONS

Liquid Crystal Display [LCD]


We examine an intelligent LCD display of two lines, 16 characters per line that is
interfaced to the 8051.The protocol (handshaking) for the display is as shown. The

display contains two internal byte-wide registers, one for commands (instructions)
(RS=0) and the second for characters (data) to be displayed (RS=1).It also contains a
user-programmed RAM area (the character RAM) that can be programmed to generate
any desired character that can be formed using a dot matrix. To distinguish between these
two data areas, the hex command byte 80 will be used to signify that the display RAM
address 00h will be chosen Port1 is used to furnish the command or data type, and ports
3.2 to 3.4 furnish register select and read/write levels.
The display takes varying amounts of time to accomplish the functions as listed.
LCD bit 7 is monitored for logic high (busy) to ensure the display is overwritten. A
slightly more complicated LCD display (4 lines*40 characters) is currently being used in
medical diagnostic systems to run a very similar program.

Liquid Crystal Display

Figure: 10.1 Liquid Crystal Display


Pins Description
1 Ground

2 Vcc

3 Contrast Voltage

4"R/S"_Instruction(0)/data(1) Select

5 "R/W" Read(1)/Write(0) LCD Registers

6 "E" Clock

7 - 14 Data I/O Pins

8 A(anode) back light power supply 5V

9 K(cathode) back light power supply GND


Gnd

+5v Vdd
1

15

16

16x2 Liquid Crystal Display

RS R/W En

11

4
12

RELAY

5
13

D0 D1 D2
60D
6
14

D3 D4

D5 D6 D7

10

Introduction:A relay is an electrical switch that opens and closes under control of another electrical
circuit. In the original form, the switch is operated by an electromagnet to open or close
one or many sets of contacts. It was invented by Joseph Henry in 1835. Because a relay
is able to control an output circuit of higher power than the input circuit, it can be
considered, in a broad sense, to be a form of an electrical amplifier.

Operation:-

When a current flows through the coil, the resulting magnetic field attracts an armature
that is mechanically linked to a moving contact. The movement either makes or breaks a

connection with a fixed contact. When the current to the coil is switched off, the
armature is returned by a force approximately half as strong as the magnetic force to its
relaxed position. Usually this is a spring, but gravity is also used commonly in industrial
motor starters. Most relays are manufactured to operate quickly. In a low voltage
application, this is to reduce noise. In a high voltage or high current application, this is to
reduce arcing.

If the coil is energized with DC, a diode is frequently installed across the coil, to
dissipate the energy from the collapsing magnetic field at deactivation, which would
otherwise generate a spike of voltage and might cause damage to circuit components. If
the coil is designed to be energized with AC, a small copper ring can be crimped to the
end of the solenoid. This "shading ring" creates a small out-of-phase current, which
increases the minimum pull on the armature during the AC cycle.
By analogy with the functions of the original electromagnetic device, a solid-state relay is
made with a thyristor or other solid-state switching device. To achieve electrical isolation,
a light-emitting diode (LED) is used with a photo transistor.

Types of relay:-

Figure: 11.1: latching relay


1) Latching relay:-

A latching relay has two relaxed states (bistable). These are also called 'keep' relays.
When the current is switched off, the relay remains in its last state. This is achieved with
a solenoid operating a ratchet and cam mechanism, or by having two opposing coils with
an over-center spring or permanent magnet to hold the armature and contacts in
position while the coil is relaxed, or with a remnant core. In the ratchet and cam
example, the first pulse to the coil turns the relay on and the second pulse turns it off.

In the two coil example, a pulse to one coil turns the relay on and a pulse to the
opposite coil turns the relay off. This type of relay has the advantage that it consumes
power only for an instant, while it is being switched, and it retains its last setting across a
power outage.

2) Reed relay:-

A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which
protects the contacts against atmospheric corrosion. The contacts are closed by a
magnetic field generated when current passes through a coil around the glass tube. Reed

relays are capable of faster switching speeds than conventional relays. See also reed
switch.

2.1) Mercury-wetted relay:-

A mercury-wetted relay is a form of reed relay in which the contacts are wetted with
mercury. Such relays are used to switch low-voltage signals (one volt or less) because of
its low contact resistance, or for high-speed counting and timing applications where the
mercury eliminated contact bounce. Mercury wetted relays are position-sensitive and
must be mounted vertically to work properly. Because of the toxicity and expense of
liquid mercury, these relays are rarely specified for new equipment. See also mercury
switch.

3) Polarized relay:-

A Polarized Relay placed the armature between the poles of a permanent magnet to
increase sensitivity. Polarized relays were used in middle 20th Century telephone
exchanges to detect faint pulses and correct telegraphic distortion. The poles were on
screws, so a technician could first adjust them for maximum sensitivity and then apply a
bias spring to set the critical current that would operate the relay.

4) Machine tool relay:-

A machine tool relay is a type standardized for industrial control of machine tools,
transfer machines, and other sequential control. They are characterized by a large
number of contacts (sometimes extendable in the field) which are easily converted from
normally-open to normally-closed status, easily replaceable coils, and a form factor that

allows compactly installing many relays in a control panel. Although such relays once
were the backbone of automation in such industries as automobile assembly, the
programmable logic controller mostly displaced the machine tool relay from sequential
control applications.

5) Contactor relay:-

A contactor is a very heavy-duty relay used for switching electric motors and lighting
loads. With high current, the contacts are made with pure silver. The unavoidable arcing
causes the contacts to oxidize and silver oxide is still a good conductor. Such devices are
often used for motor starters. A motor starter is a contactor with an overload protection
devices attached. The overload sensing devices are a form of heat operated relay where
a coil heats a bi-metal strip, or where a solder pot melts, releasing a spring to operate
auxiliary contacts. These auxiliary contacts are in series with the coil. If the overload
senses excess current in the load, the coil is de-energized. Contactor relays can be
extremely loud to operate, making them unfit for use where noise is a chief concern.

Pole & Throw:-

Circuit symbols of relays. "C" denotes the common terminal in SPDT and DPDT types.
Since relays are switches, the terminology applied to switches is also applied to relays.
According to this classification, relays can be of the following types:

* SPST - Single Pole Single Throw. These have two terminals which can be switched
on/off. In total, four terminals when the coil is also included.
* SPDT - Single Pole Double Throw. These have one row of three terminals. One
terminal (common) switches between the other two poles. It is the same as a single
change-over switch. In total, five terminals when the coil is also included.
* DPST - Double Pole Single Throw. These have two pairs of terminals. Equivalent to
two SPST switches or relays actuated by a single coil. In total, six terminals when the coil
is also included. This configuration may also be referred to as DPNO.

* DPDT - Double Pole Double Throw. These have two rows of change-over terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. In total, eight
terminals when the coil is also included.
* QPDT - Quadruple Pole Double Throw. Often referred to as Quad Pole Double Throw,
or 4PDT. These have four rows of change-over terminals. Equivalent to four SPDT

switches or relays actuated by a single coil or two DPDT relays. In total, fourteen
terminals when the coil is also included.

The contacts can be either Normally Open (NO), Normally Closed (NC), or change-over
(CO) contacts.

* Normally-open contacts connect the circuit when the relay is activated; the circuit is
disconnected when the relay is inactive. It is also called Form A contact or "make"
contact. Form A contact is ideal for applications that require to switch a high-current
power source from a remote device.
* Normally-closed contacts disconnect the circuit when the relay is activated; the
circuit is connected when the relay is inactive. It is also called Form B contact or "break"
contact. Form B contact is ideal for applications that require the circuit to remain closed
until the relay is activated.
* Change-over contacts control two circuits: one normally-open contact and one
normally-closed contact with a common terminal. It is also called Form C contact or
"transfer" contact.

Applications:-

Relays are used:-

* To control a high-voltage circuit with a low-voltage signal, as in some types of


modems,
* To control a high-current circuit with a low-current signal, as in the starter solenoid of
an automobile,

* To detect and isolate faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays),
* To isolate the controlling circuit from the controlled circuit when the two are at
different potentials, for example when controlling a mains-powered device from a lowvoltage switch. The latter is often applied to control office lighting as the low voltage
wires are easily installed in partitions, which may be often moved as needs change.

* To perform logic functions. For example, the Boolean AND function is realized by
connecting NO relay contacts in series, the OR function by connecting NO contacts in
parallel. The change-over or Form C contacts perform the XOR (exclusive or) function.
Similar functions for NAND and NOR are accomplished using NC contacts. Due to the
failure modes of a relay compared with a semiconductor, they are widely used in safety
critical logic, such as the control panels of radioactive waste handling machinery.
* To perform time delay functions. Relays can be modified to delay opening or delay
closing a set of contacts. A very shorts (a fraction of a second) delay would use a copper
disk between the armature and moving blade assembly. Current flowing in the disk
maintains magnetic field for a short time, lengthening release time. For a slightly longer
(up to a minute) delay, a dashpot is used. A dashpot is a piston filled with fluid that is
allowed to escape slowly. The time period can be varied by increasing or decreasing the
flow rate. For longer time periods, a mechanical clockwork timer is installed.

Protective relay:-

A protective relay is a complex electromechanical apparatus, often with more than one
coil, designed to calculate operating conditions on an electrical circuit and trip circuit
breakers when a fault was found. Unlike switching type relays with fixed and usually illdefined operating voltage thresholds and operating times, protective relays had wellestablished, selectable, time/current (or other operating parameter) curves.

Such relays were very elaborate, using arrays of induction disks, shaded-pole magnets,
operating and restraint coils, solenoid-type operators, telephone-relay style contacts, and
phase-shifting networks to allow the relay to respond to such conditions as over-current,
over-voltage, reverse power flow, over- and under- frequency, and even distance relays
that would trip for faults up to a certain distance away from a substation but not beyond
that point. An important transmission line or generator unit would have had cubicles
dedicated to protection, with a score of individual electromechanical devices.

Each of the protective functions available on a given relay is denoted by standard ANSI
Device Numbers. For example, a relay including function 51 would be a timed over
current protective relay.

Design and theory of these protective devices is an important part of the education of
an electrical engineer who specializes in power systems. Today these devices are nearly

entirely replaced (in new designs) with microprocessor-based instruments (numerical


relays) that emulate their electromechanical ancestors with great precision and
convenience in application. By combining several functions in one case, numerical relays
also save capital cost and maintenance cost over electromechanical relays. However,
due to their very long life span, tens of thousands of these "silent sentinels" are still
protecting transmission lines and electrical apparatus all over the world.

Temperature sensor
The LM35 series are precision integrated-circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin,
as the user is not required to subtract a large constant voltage from its output to
obtain convenient Centigrade scaling.
The LM35 does not require any external calibration or trimming to provide
typical accuracies of 1/4C at room temperature and 3/4C over a full -55 to
+150C temperature range. Low cost is assured by trimming and calibration at the
wafer level. The LM35s low output impedance, linear output, and precise inherent
calibration make interfacing to readout or control circuitry especially easy. It can
be used with single power supplies, or with plus and minus supplies. As it draws
only 60 A from its supply, it has very low self-heating, less than 0.1C in still air.

The LM35 is rated to operate over a -55 to +150C temperature range, while the
LM35C is rated for a -40 to +110C range (-10 with improved accuracy). The
LM35 series is available packaged in hermetic TO-46 transistor packages, while
the LM35C, LM35CA, and LM35D are also available in the plastic TO-92
transistor package. The LM35D is also available in an 8-lead surface mount small
outline package and a plastic TO-220 package.
Features
Calibrated directly in Celsius (Centigrade).
Linear + 10.0 mV/C scale factor.
0.5C accuracy guarantee able (at +25C).
Rated for full -55 to +150C range.

Suitable for remote applications.


Low cost due to wafer-level trimming.
Operates from 4 to 30 volts.
Less than 60 A current drain.
Low self-heating, 0.08C in still air.
Nonlinearity only 1/4C typical one.
The LM35 can be applied easily in the same way as other integrated-circuit
temperature sensors. It can be glued or cemented to a surface and its temperature
will be within about 0.01C of the surface temperature. These devices are
Sometimes soldered to a small light-weight heat fin, to decrease the thermal time
Constant and speed up the response in slowly-moving air. On the other hand, a
Small thermal mass may be added to the sensor, to give the steadiest reading
Despite small deviations in the air temperature. This is especially true if the circuit
May operate at cold temperatures where condensation can occur.
SOIL SENSOR CIRCUIT

OUT
PROBE

RV1
10K

C1
22PF

+5V

PCB DESIGN AND FABRICATION

Designing of a PCB is a major slip in the production of PCBs. It forms a


distinct factor n electronic performance and reliability. The productivity of a PCB
with assembly and serviceability also depends on design.
STEPS INVOLVED
1. Prepare the required circuit diagram
2. List out the components, their sizes etc.
3. Draft it onto a graph sheet
4. Place all pads and finish thin tracks
5. Put it on the mylor sheet and then on the graph sheet
6. Place parts including screw holes with the help of knife.
7. Fix all the tracks.
8. Keep one component as the key.
CONVERSION OF CIRCUIT DIAGRAM
1. Cutting lines, mounting lines are done
2. List all the components their length diameter thickness code names etc.
3. Keep one component as key component
4. Keep key component first and their supporting tools
5. All tracks are straight lines
6. In between ICs no signal lines should be passed
7. Mark the pin number of IC on the lay out for avoiding dislocations
8. The length of the conductor should be as low as possible
9. Place all the components, resistors, diodes etc. parallel to each other

LAY OUT APPROACHES


First the board outlines and the connectors are marked on a sheet of paper
followed by sketching of the component outlines with connecting point and
conductor patterns. Prepare the layout as viewed from the component side first, so
as to avoid any confusion. The layout is developed in the direction of signal flow
as far as possible. Among the components the larger ones are filled first and the
space between is filled with smaller ones. Components, rewiring input, output
connections came near the connectors. All the components are placed in such a
manner that de-soldering of the component is not is not necessary, if they have to
be re placed. While designing the conductors, the minimum spacing requirement
for the final network should be known. Transforming the lay out to copper. The lay
out made on the graph sheet should be redrawn on the copper clad using paint or
nail polish.

ETCHING
The final copper pattern is formed by selective removal of the unwanted
copper which is not protected by an electric rebist. FeCl3 solution is popularly
used etching solution. FeCl3 powder is made into a solution using water and kept
in a plastic tray. Immerse the marked copper clad in this solution for two or three
hours. Due to the reaction solution will became weak and it is not recommended
for further etching process. Take out the etched sheet from the tray and dry out for
in sunlight for an hour.
ETCHANTS

Many factors have to be considered to choose the most suitable etchant


system for a PCB process. Some commonly used etchants are FeCl3, Cupric
chloride, Chromic acid etc. After etching FeCl3 is washed from the board and
cleaned dry. Paint is removed using suitable from the component insertion. Holes
are drilled into appropriate position and the components are soldered into PCB
carefully.
Take a copper clad of the required dimensions. Transfer the circuit layout to
the copper clad using cotton paper. The layout area should be marked with nail
polish. Put the copper clad into FeCl3 solution and warm it. Stage by stage
transformation of the copper clad occurs. Warm the solution intermittently
according to the requirement. After about 4 hours etching will be completed. Wash
the board using soap solution to remove the remaining of FeCl3 solution. Scrap off
the nail polish and drill holes wherever required using appropriate drill bits. PCB is
fabricated.

SOFTWARE USED:
Embedded C
MPLAB IDE
PROTUES
PIC KIT2
SOFTWARE TOOLS
1. MPLAB
MPLAB IDE is an integrated development environment that provides
development engineers with the flexibility to develop and debug firmware for
various Microchip devices
MPLAB IDE is a Windows-based Integrated Development Environment for the
Microchip Technology Incorporated PICmicrocontroller (MCU) and dsPIC digital
signal controller (DSC) families. In the MPLAB IDE, you can:

Create source code using the built-in editor.

Assemble, compile and link source code using various language tools. An
assembler, linker and librarian come with MPLAB IDE. C compilers are
available from Microchip and other third party vendors.

Debug the executable logic by watching program flow with a simulator, such
as MPLAB SIM, or in real time with an emulator, such as MPLAB ICE.
Third party emulators that work with MPLAB IDE are also available.

Make timing measurements.

View variables in Watch windows.

Program firmware into devices with programmers such as PICSTART Plus


or PRO MATE II.

Find quick answers to questions from the MPLAB IDE on-line Help.

2. MPLAB SIMULATOR
MPLAB SIM is a discrete-event simulator for the PIC microcontroller (MCU)
families. It is integrated into MPLAB IDE integrated development environment.
The MPLAB SIM debugging tool is designed to model operation of Microchip
Technology's PIC microcontrollers to assist users in debugging software for these
devices

4. COMPILER-HIGH TECH C
A program written in the high level language called C; which will be converted
into PICmicro MCU machine code by a compiler. Machine code is suitable for use
by a PICmicro MCU or Microchip development system product like MPLAB IDE.

PIC SIMULATION QUICK TUTORIAL


THE CIRCUIT
The circuit to be simulated is shown here, consisting of a PIC 16F877A
microcontroller unit (MCU)
THE SCHEMATIC
The ISIS user interface is shown here, consisting of edit, overview and object
select windows, with edit toolbars. Components are added to the object list from
the libraries provided, dropped onto the schematic, and connected up using virtual
wiring. Components can be labelled and their simulation properties
SELECT COMPONENTS
Components are found in the libraries accessed via the pick button P in the object
select window. The MCU is selected from Microprocessors ICs category, PIC16
Family sub-category. The other components are added to the pick list from the
appropriate categories. These are then selected and dropped on the schematic
within the blue border.

4 WRITE PROGRAM
The MCU needs a program to work as required. From the Source menu, select
add source file, new and open the source file GPS.C in folder GPS. Select code
generation tool MPASM. Open the source edit window by selecting the new file

from the source menu, and enter the source code listed here Save the source file
code file GPS.C in the project folder.
ASSEMBLE PROGRAM
Save the source code when complete. From the Source menu, select Build All. The
message window should confirm build OK. If not, correct syntax errors in the
source code by reference to PIC programming rules. A hex file is produced as
shown, GPS.HEX, which contains the MCU machine code.The machine code
program GPS.HEX is stored automatically in the project folder with the source
code.
ATTACH PROGRAM
This hex file must be attached to the MCU in the schematic. Right click, then left
click on the PIC chip to open the Edit Component dialogue. Click on the Program
File folder tab and select the GPS.HEX file from the project folder. Set the
Processor Clock Frequency to 4MHz. Note that the external components do not
affect the simulation clock frequency. The Port B output LEDs should operate
when the run/step/pause/stop controls are clicked (the buttons on the schematic
have no effect with this program). Save the completed design file.
TEST PROGRAM
Pause the program and from the Debug menu check the PIC CPU Source Code
option to display the program with the execution point highlighted. Use the Step
Into button in the source code window to single step the program. Note that the
initialisation instructions are executed once, and the loop then repeats endlessly
this is the usual program operating sequence for control applications. The source

code window has buttons to run, single step (into, over and out of subroutines) and
set breakpoints.Correct any logical program errors detected.
DEBUG PROGRAM
To monitor program progress, the MCU registers can be displayed, and other
changes monitored, using:

Special function register display

RAM register display

Register watch window

Execution clock

Simulation logs

The effect of the program on the registers and status flags, and program timing can
thus be checked.
Save the test window arrangement using save preferences.
DOWNLOAD PROGRAM
When all logical errors have been resolved, the program can be downloaded to the
real hardware using the programming tools in MPLAB, for example, using the
PICKIT2 programmer unit. Alternatively, the ICD system allows in-circuit
programming and debugging, requiring the purchase of the MPLAB ICD2 module.

PIC SIMULATIOR IDE SOFTWARE WORKING STEPS

1.
2.
3.
4.
5.
6.

Write and compile programme in MPLAB IDE


Start PIC Simulator IDE.
Click on Options\Select Microcontroller.
Select 'PIC16F8xxA' and click on Select button.
Click on File\Load Program.
Select project.hex file and click on Open. That will load the program into

PIC program memory.


7. Click on Tools\LCD Displays Panel. That will open the window with 1 LCD
Display.
8. Click on Setup button to configure the PORT PINS.
9. Click on Tools\Microcontroller View. That will open the Microcontroller
View window.
10.Select the Rate\Extremely Fast simulation rate.
11.Click on Simulation\Start. The simulation will start immediately
12.The simulation can be stopped any time by clicking on Simulation\Stop.

DESIGNING A PCB USING PROTEUS


PCB stands for Printed Circuit Board. The naming convention will be clear once
steps for the design are understood. On a lower level of project, PCBs are usually
designed on a board whose one side is lined with copper. But on the industrial
scale or on a professional level, it is preferred to have a double sided PCB. This
also complexes the procedure through which PCBs are made. This document only
emphasizes on PCB designing in PROTEUS 7.10 sp0. Other versions of
PROTEUS may have similar steps but you might need to be cautious anyway.

Proteus ISIS:
Open the ISIS Professional from PROTEUS. This is the application where the
simulations of the circuits can be tested. But the same file can be further processed

to transform it into a layout. Layout is the final design which is needed in order to
make the PCB of a circuit. To make the schematic, first we must have its raw
design. Below is the schematic, that this documents uses to explain the steps to
make the PCB.

Proteus ARES:
ARES Professional will open automatically once the previous step is done. This
is the application where the final layout will be made. Once the layout is made, the
work on the software will be finished. Proceed with the following steps to make
the PCB layout.

Introduction
What

is

PICKIT

2?

The PICKIT 2 is a low-cost in-circuit debugger (ICD) and in-circuit serial


programmer (ICSP). PICKIT 2 is intended to be used as an evaluation, debugging
and programming aid in a laboratory environment. The PICKIT 2 offers these
features: Real-time and single-step code execution
Breakpoints, Register and Variable Watch/Modify

In-circuit debugging

Target VDD monitor

Diagnostic LEDs

MPLAB IDE user interface

USB interface to a host PC / USB POWERED

40 Pin Target Board With FRC Cable

ICSP FRC connecter Easy to interface to all our boards

SOFTWARE CODE
#include "config.c"
#include "pic16f877a.c"
__CONFIG(0X1F72);
#define SOIL RA4
#define RL1 RC5
void newline();
unsigned char pc;
void main()
{

ADCON1=0x07;
TRISA=0XFF;
TRISB=0X00;
TRISC=0X00;

// All analog pins are used as digital

TRISD=0X01;
TRISE=0X00;
PORTA=PORTB=0;
PORTC=PORTD=PORTE=0;
lcd_init();
usart_initialise();

while(1)
{
lcdcmd(0x80);
lcddatawrt(" Soil Moisture ");

if(SOIL==0)
{
lcdcmd(0xC0);
lcddatawrt(" Low - Pump-ON ");
RL1=1;
GSM();
GSM1();
}
else if(SOIL==1)

{
lcdcmd(0xC0);
lcddatawrt(" Normal-Pump-OFF");
RL1=0;
}
}

// end of main

//------------------------------------------------------------------------------------------------------------------------------------static void interrupt isr()


{
if(RCIF==1)
{
if(RCREG=='%' || RCREG=='^') // system input
{
pc=RCREG;
RCIF=0;

}
}
//------------------------------------------------------------------------------------------------------------------------------------//

CONCLUSION

BIBILOGRAPHY

1. Sedra and Smith, Microelectronic Circuits, fourth edition , Oxford


University Press, 1998
2.

R.S. Sedha, 2002. A Text Book of Applied Electronics, S. Chand and

Company Ltd., New Delhi


3. Theodore S. Rappaport, Wireless Communications, second edition, PHI.
New Delhi Draft EN (GSM 03.40) v6.0.0

WEBREFERENCES:

1.
2.
3.
4.
5.
6.

www.electronicstutorials.com
www.aimglobal.com
www.kernel.org
www.egtechprojects.com
www.microchip.com
www.google.com

CONCLUSION
The system provides with several benefits and can operate with less manpower.
The system supplies water only when the humidity in the soil goes below the
reference. Due to the direct transfer of water to the roots water conservation takes
place and also helps to maintain the moisture to soil ratio at the root zone constant

to some extend. Thus the system is efficient and compatible to changing


environment.

ADVANTAGES
1. Saves water - Studies show that drip irrigation systems use 30 - 50% less water
than conventional watering methods, suchas sprinklers.
2. Improves growth - Smaller amounts of water applied over a longer amount of
time provide ideal growing conditions. Drip irrigation extends watering times for
plants, and prevents soil
erosion and nutrient runoff. Also, because the flow is continuous, water penetrates
deeply into the soil to get well down into the root zone.
3. Discourages weeds - Water is only delivered where it's needed.
4. Saves time - Setting and moving sprinklers is not required. A timer delay as per
environment can be added to the system for automatic watering.
5. Helps control fungal diseases, which grow quickly under moist conditions. Also,
wet foliage can spread disease.
6. Adaptable - A drip irrigation system can be modified easily to adjust to the
changing needs of a garden or lawn.
7. Simplest Method - Start by drawing a map of your garden and yard, showing the
location of plantings. Measure the distances required for lengths of hose or plastic
tubing to reachthe desired areas.

You might also like