Vous êtes sur la page 1sur 46

Chapter I

Introduction
Now days, water shortage is becoming one of the biggest problem in the world. Many
different methods are developed for conservation of water. We need water in each and every
field. Agriculture is one of the fields where water is required in tremendous quantity. In the
field of agriculture, it is very important to maintain the level of water or moisture in
the soil where crops are planted. Excess or deficiency in water may harm the growth
of plants which results in loss to farmers.

Irrigation is an artificial application of water to the soil. It is usually used to assist the
growing of crops in dry areas and during periods of inadequate rainfall.
There are several pains in operating the irrigation systems in traditional ways. Water
pumps, tanks and farms are distantly located at different places away from the operators house.
The irrigation operator has to operate these systems against a series of hurdles like erratic
power supply, long travel over difficult terrain and fear of animals on the way to pumps.
These hurdles create inefficiency in the pump operations leading to heavy wastage of water
and electricity. Excess water erase the soil and damages the civil structures of water tanks. All
in all, there is a huge loss of energy in many ways. Considering this, automating the irrigation
sector is vital.
Auto irrigation system keeps information about moisture level in land and
keeps moisture to permissible limit. Moisture sensor is used to measure moisture
level in soil. According to measured moisture level, water pumps turn on or off.

Automatic irrigation systems are convenient, especially for those who travel. If installed
and programmed properly, automatic irrigation systems can even save you money and help in
water conservation.
EMBEDDED SYSTEMS:
An Embedded system is a special-purpose system in which the computer is completely
encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose
1

computer, such as a personal computer, an embedded system performs one or a few predefined
tasks, usually with very specific requirements. Since the system is dedicated to specific tasks,
design engineers can optimize it, reducing the size and cost of the product. Embedded systems
are often mass-produced, benefiting from economies of scale.
Physically, embedded systems ranges from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a single
microcontroller chip, to very complex with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.
Examples of Embedded Systems:

Avionics, such as inertial guidance systems, flight control hardware/software and other
integrated systems in aircraft and missiles.

Cellular telephones and telephone switches.

Engine controllers and antilock brake controllers for automobile.

Home automation products, such as thermostats, air conditioners, sprinklers, and security
monitoring systems.

Household appliances, including microwave ovens, washing machines, television sets,


DVD players and recorder.

Computer peripherals such as routers and printers.

Handheld calculators.

Handheld computers.

Medical equipment.

Personal digital assistant.

Videogame consoles.

Fig. Embedded system.

Chapter II
Automatic Irrigation System
In the fast paced world human beings require everything to be automated. Our life style
demands everything to be remote controlled. Apart from few things man has made his life
automated. And why not? In the world of advance electronics, life of human beings should
be simpler hence to make life simpler and convenient; we have made AUTOMATIC
IRRIGATION SYSTEM. A model of controlling irrigation facilities to help millions of
people. This model uses sensor technology with microcontroller to make a smart switching
device.
The model shows the basic switching mechanism of Water motor/pump using sensors
from any part of field by sensing the moisture present in the soil. Our basic model can be
extended to any level of switching & controlling by using DTMF.

List of Components

AT89C51 controller

AT89C51 programming board.

16*2 LCD

5V Relay

4 Moisture Sensors

Resistor 330 ohm

BC 547

AC Motor
3

Pot 10k

Programming cable

Connecting wires

Block Diagram
Micro Controller (AT89S52) is interfaced with 16x2 LCD. LCD indicates the water level through
its display. Moisture sensors are connected to the controller to indicate the water level by
resistance variation. Relay is connected to motor and is interfaced with the micro controller.
When LCD displays tank is full, motor stops automatically.

Circuit Diagram

Circuit Description
The main heart of this project is AT89C51 microcontroller. The moisture level probes (level
sensors) are connected to the P3.3, P3.4, P3.5, and P3.6. Port P2 connected to the data pins of
LCD and control pins RS, RW and EN of LCD are connected to the P1.0, P1.1, and P1.2
respectively.
Initially when field is dry, LCD will display the message Dry Field and motor runs automatically.
When field A is wet, LCD displays Field_A and still motor runs. When field A, field B are wet,
LCD displays Field_A_B and the motor runs. For further levels, LCD displays the messages
Field_C, Field_D, Field_A_B_C, Field_A_B_D, Field_A_C_D etc.
The motor pump stops when whole field is wet that is Field A, Field B, Field C and Field D,
LCD displays Wet Field. The motor starts again running when at least one field is dry.

Working Principle of Automatic Irrigation System


This system mainly works on a principle that water conducts electricity. The four
moisture sensors which are placed in the 4 fields will indicate the moisture levels of fields. Based
on the outputs of these sensors, microcontroller displays wet fields names on LCD as well as
controls the motor.

Algorithm for Automatic Irrigation System

First configure the controller pins P3.3, P3.4, P3.5 and P3.6 as inputs and P3.7 as output.

Now initialize the LCD.

Continuously check the moisture level input pins P3.3, P3.4, P3.5, and P3.6

If all the pins are low then display Dry Field on LCD and motor starts running
automatically.

High pulse on the pin P3.3 indicates Field _A is Wet, display the same thing on LCD.

If P3.4 is high then Field_B is wet.

If P3.5 is high then Field_C is wet.

If P3.6 is high then Field_D is wet.

If P3.3 and P3.4 are high then Field_A_B are wet.

If P3.3 and P3.5 are high then Field_A_C are wet.

If P3.4 and P3.5 are high then Field_B_C are wet.

If P3.3, P3.4 and P3.5 are high then Field_A_B_C are wet.

If P3.6 and P3.3 are high then Field_A_D are wet.

If P3.6 and P3.4 are high then Field _B_D are wet.

If P3.6, P3.4 and P3.3 are high then Field_A_B_D are wet.

If P3.6 and P3.5 are high then Field_C_D are wet.

If P.6, P3.5 and P3.3 are high then Field_A_C_D are wet.

If P3.6, P3.5 and P3.4 are high then Field_B_C_D are wet.

If P3.3, P3.4, P3.5 and P3.6 are high then LCD indicates Wet Field and motor stops
running.

Process to operate Automatic Irrigation System using 8051 Microcontroller


1.

Initially burn the program to the controller.

2.

Now give the connections as per the circuit diagram.

3.

While giving the connections, make sure that there is no common connection between
AC and DC supplies.

4.

Place the 4 moisture level sensors in four different fields.

5.

Switch on the supply, now the motor will run automatically as the field is dry.

6.

Now pour the water, when the moisture level exceeds then LCD displays the
corresponding field as wet field on LCD.

7.

For further levels it will displays combination of fields as wet.

8.

When all fields all wet then LCD displays Wet field and motor stops working.

9.

Switch off the motor supply and board supply.

Chapter III
Components Description
Micro Controller (AT89S52)
Features:

Compatible with MCS-51 Products.


8K Bytes of In- System Reprogrammable Flash Memory.
Endurance: 1000 Write/Erase Cycles.
Fully Static Operation: 0Hz to 24MHz.
Three-Level Program Memory Lock.
256 x 8-Bit Internal RAM.
32 Programmable I/O Lines.
Three 16-bit Timer/Counter.
Eight Interrupt Sources.
Programmable Serial Channel.
Low Power Idle and Power Down Modes.

1. Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes
of in-system programmable Flash Memory. The device is manufactured using Atmels highdensity nonvolatile memory technology and is compatible with the industry-standard 80C51
instruction set and pin out. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip,
the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications.

Pin Diagram

10

Pin Description
VCC

Supply Voltage

GND

Ground

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high-impedance inputs.

11

Port 0 can also be configured to be the multiplexed low-order address/data bus


during accesses to external program and data memory. In this mode, P0 has
internal pull-ups
Port 0 also receives the code bytes during Flash programming and outputs the
code bytes during program verification. External pull-ups are required during
program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port
1 pins that are externally being pulled low will source current(I IL) because of the
internal pull-ups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external
count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively, as shown in the following table.
Port 1 also receives the low-order address bytes during Flash programming and
verification.
Port Pin

Alternate Functions

P1.0

T2 (external count input to Timer/Counter 2), clock-out

P1.1

T2EX(Timer/Counter 2 capture/reload trigger and direction control)

P1.5

MOSI (used for In-System Programming)

P1.6

MISO (used for In-System Programming)

P1.7

SCK (used for In-System Programming)

Port 2
12

Port 2 is an 8-bit directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port
2 pins that are externally being pulled low will source current (IIL ) because of the
internal pull-ups.
Port 2 emits the high-order address byte during fetches from external program
memory and during accesses to external data memory that use 16-bit addresses
(MOVX@DPTR). In this application, Port 2 uses strong internal pull-ups when
emitting 1s. During accesses to external data memory that use 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some control signals during
Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port
3 pins that are externally being pulled low will source current (I IL) because of the
pull-ups.
Port 3 receives some control signals for Flash programming and verification.
Port 3 also serves the functions of various special features of the AT89S52, as
shown in the following table.

Port Pin

Alternate Functions

P3.0

RXD(serial input port)

P3.1

TXD(serial output port)

P3.2

13

(external interrupt 0)

P3.3

P3.4

T0 (timer 0 external input)

P3.5

T1 (timer 1 external input)

P3.6
P3.7

(external interrupt 0)

WR
(external data memory write strobe)

RD
(external data memory read strobe)

RST
Reset input. A high on this pin for two machines cycles while the oscillator is
running resets the device. This pin drives high for 98 oscillator periods after the
watchdog times out. The DISTO bit in SFR AUXR (address 8EH) can be used to
disable this feature. In the default state of bit DISTRO, the RESET HIGH out
feature is enabled.

ALE/ PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse

input ( PROG ) during Flash programming.


In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and
may be used for external timing or clocking purposes. Note, however, that one ALE pulse
is skipped during each access to external data memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the
bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is
weekly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in
external execution mode.

EA

/VPP

14

External Access Enable.

EA

must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H
up to FFFFH. Note, however, that if lock bit 1 is programmed,

EA

will be

internally latched on reset.


This pin should be strapped to Vcc for internal program executions.
This pin also receives the 12-volt programming enable voltage (Vpp) during Flash
programming.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.

XTAL2
Output from the inverting oscillator amplifier.

Data Memory
The AT89S52 implements 256bytes of on-chip RAM. The upper 128bytes occupy
Parallel address space to the Special Function Registers. This means that the
upper 128bytes have the same addresses as the SFR space but are physically
separate from SFR space.

Watchdog Timer (one-time Enabled with Reset-out)


The WDT is intended as a recovery method in situations where the CPU may be
subjected to software upsets. The WDT consists of a 14-bit counter and the
Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from
existing reset. To enable the WDT, a user must write 01EH and 0E1H in sequence
to the WDTRST register (SFR location 0A6H). When the WDT timeout period is
dependent on the external clock frequency. There is no way to disable the WDT
15

except through reset (either hardware reset or WDT overflow reset). When WDT
overflows, it will drive an output RESET HIGH pulse at the RST pin.

Liquid Crystal Display


In 1968, RCA Laboratories developed the first liquid crystal display (LCD). Since then,
LCDs have been implemented on almost all types of digital devices, from watches to computer
to projection TVs. LCDs operate as a light valve, blocking light or allowing it to pass
through. An image in an LCD is formed by applying an electric field to alter the chemical
properties of each LCC (Liquid Crystal Cell) in the display in order to change a pixels light
absorption properties. These LCCs modify the image produced by the backlight into the screen
output as requested by the controller. Through the end output may be in color, The LCCs are
monochrome, and the color is added later through a filtering process. Modern laptop computer
displays can produce 65,536 simultaneous colors at resolution of 800x600.

LCD (Liquid Crystal display) screen is an electronic display module. A 16x2 LCD
display is very basic module and is very commonly used in various devices and circuits.
These modules are preferred over seven segments and othet multi segment LEDs. The
reasons are being:

Economical
Easily Programmable

16

Have no limitation of displaying special & even custom characters (unlike in seven
segments)

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely,
Command and Data.
The Command register stores the command instructions given to the LCD. A command is an
instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the
cursor position, controlling display etc. The data register stores the data to be displayed on the
LCD. The data is the ASCII value of the character to be displayed on the LCD.
Pin Diagram

17

Pin Description

LCD Command Codes


Code (Hex)

Command to LCD Instruction Register

Clear Display Screen

Return Home

Decrement Cursor (shift cursor to left)

Increment Cursor (shift cursor to right)

Shift Display Right

Shift Display Left

Display off, Cursor off

Display off, Cursor on

Display on, Cursor off

Display on, cursor blinking

Display on, cursor on


18

10

Shift cursor position to left

14

Shift cursor position to right

18

Shift the entire display to the left

1C

Shift the entire display to the right

80

Force cursor to beginning of 1st line

C0

Force cursor to beginning of 2nd line

38

2 lines and 5x7 matrix

Capacitors
Capacitor is a basic storage device to store electrical charges and release it as it is
required by the circuit. Capacitors are widely used in electronic circuits to perform variety of
tasks, such as smoothing, filtering, bypassing etc. One type of capacitor may not be suitable
for all applications. Ceramic capacitors are generally superior than other types and therefore can
be used in a vast ranges of application. The following superior than other types and therefore can
be used in a vast ranges of application. The following is the typical capacitor application in
electronics industries.
DC blocking capacitor:
In this application the capacitor blocks the passage of DC current (after completely
charged) and yet allows the AC to pass at certain portion of a circuit.
Capacitor as a filter:
Capacitors are the main elements of filters. There are several types of filters that are used
in electronic circuits, such as LPF (Low Pass Filter), HPF (high Pass Filter), BPF (Band Pass
Filter), etc. Since the reactance of the capacitor is inversely related to the frequency, therefore
it can be used to increase or decrease the impedance of the circuit at certain frequencies and
therefore does the filtration job.
Capacitor as a discharge unit:

19

Capacitors used as a charging unit and the release of the charge (discharge energy) is used
for triggering, ignition, and in high scale as a power source.
By Pass capacitor:
The reactance of capacitor decreases as the frequency increases. Therefore in certain
application it is used in parallel with other components to bypass it at a specified frequency.
Coupling capacitor:
The ability of capacitor to pass AC signal, allows it to couple a section of an electronic
circuit to another circuit.
Decoupling capacitor:
In high speed electronic logic switching causes draw of significant amount of current
which in turn would cause disturbance in the logic voltage level. Decoupling capacitor is
typically located very close to the IC output and serves as a local energy source to provide the
needed extra current and therefore minimizes the noise and disturbances to the logic signal.

20

Snubber capacitor:
In some application, relays or SCR (Silicon controlled rectifier) are to drive a high
inductance loads. In these circumstances, when the relay or the SCR opens, a major transient
voltage could be induced in the contact of the relay or across the junction of SCR, which in turn
either shows as an arc on the relay contacts or may damage the internal SCR junction. Therefore
snubber capacitor is used to limit the high voltage transient across the circuit. There are also
other applications such as Tuned circuits, signal processing, etc...
Formula for Capacitance
The capacitance (C) is a measure of the amount of charge (Q) stored on each plate for a
given potential difference or voltage (V) which appears between the plates
C = Q/V

Resistors
21

A resistor is a passive two terminal electrical component that opposes current flow by
lowering the voltage levels within the circuits. In electronic circuits, resistors are used to limit
current flow, to adjust signal level, bias active elements and terminate transmission lines among
other uses. High-power resistors, that can dissipate many watts of electrical power as heat, may
be used as part of motor controls, in power distribution systems, or as test loads for generators.
The electrical resistance is equal to the voltage across the resistor divided by the current
through resistor.
R = V/I
Fixed resistors have resistances that only change slightly with temperature, time or
operating voltage. Variable resistors can be used to adjust circuit elements (such as a volume
control or a lamp dimmer), or as sensing devices for heat, light, humidity, force, or chemical
activity.

Identifying Resistors
Most axial resistors use a pattern of colored stripes to indicate resistance. Surface-mount
ones are marked numerically. Resistance can also be calculated using multimeter.
Electronic Color code
Four-band identification is the most commonly used color coding scheme on all resistors. It
consists of four colored bands that are painted around the body of the resistor. The first two
numbers are the first two significant digits of the resistance value, the third is a multiplier, and
the fourth is the tolerance of the value. Each color corresponds to certain number as shown
below.

22

Transistors
A transistor is a semiconductor device, commonly used as an amplifier or an electrically
controlled switch. The transistor is the fundamental building block of the circuitry in computers,
cellular phones, and all other modern electronic devices.
Because of its fast response and accuracy, the transistor is used in a wide variety of digital and
analog functions, including amplification, switching, voltage regulation, signal modulation, and
oscillators. Transistors may be packaged individually or as part of an integrated circuit.

23

Diode
A diode is a two-terminal electronic component that conducts primarily in one direction
(asymmetric conductance) it has low (ideally zero) resistance to the flow of current in one
direction, and high (ideally infinite) resistance in the other. A semiconductor diode is a crystalline
piece of semiconductor with a p-n junction connected to two electrical terminals. A vacuum tube
has two electrodes, a plate (anode) and a heated (cathode).
The most common function of a diode is to allow an electric current to pass in one
direction (called the diodes forward direction), while blocking current in the opposite direction
(the reverse direction). Thus, the diode can be viewed as an electronic version of a check valve.
This unidirectional behavior is called rectification, and is used to convert alternating current to

24

direct current, including extraction of modulation from radio signals in radio receivers these
diodes are forms of rectifiers.
Diodes can have more complicated behavior than this simple on-off action, due to their nonlinear
current-voltage characteristics. Semiconductor diodes begin conducting electricity only if a
certain threshold voltage or cut-in voltage is present in the forward direction (a state in which the
diode is said to be forward-biased). The voltage drop across a forward-biased diode varies only a
little with the current, and is a function of temperature, this effect can be used as a temperature
sensor or as a voltage reference.

POWER SUPPLY:
The power supplies are designed to convert high voltage AC mains electricity to
a suitable low voltage supply for electronic circuits and other devices. A RPS (Regulated
25

Power Supply) is the Power Supply with Rectification, Filtering and Regulation being done
on the AC mains to get a Regulated power supply for Microcontroller and for the other
devices being interfaced to it.
A power supply can be broken down into a series of blocks, each of which
performs a particular function. A D.C power supply which maintains the output voltage
constant irrespective of A.C mains fluctuations or load variations is known as Regulated
D.C Power Supply.

Transformer:
The transformer is a device that transfers electrical energy from one electrical circuit to
another electrical circuit through the medium of magnetic field and without a change in the
frequency. The electric circuit which receives energy from the supply mains is called primary
winding and the other circuit which delivers electric energy to the load is called the secondary
winding.
With it, the voltage and current can be multiplied and divided in AC circuits.
Transformer is of two types step up and step down. In this project a step down transformer is
used. A step down transformer: is one whose secondary voltage is less than its primary voltage.
26

It is designed to reduce the voltage from the primary winding to the secondary winding. This
kind of transformer steps down the voltage applied to it.
As a step-down unit, the transformer converts high-voltage, low-current power into low-voltage,
high-current power. The larger-gauge wire used in the secondary winding is necessary due to the
increase in current. The primary winding, which doesnt have to conduct as much current, may
be made of smaller-gauge wire.

Bridge Rectifier
A bridge rectifier is an arrangement of four or more diodes in a bridge circuit
configuration which provides the same output polarity for either input polarity. It is used for
converting an alternating current (AC) input into a direct current (DC) output.

27

A bridge rectifier is an arrangement of four or more diodes in a bridge circuit configuration


which provides the same output polarity for either input polarity. It is used for converting an
alternating current (AC) input into a direct current (DC) output. A bridge rectifier provides fullwave rectification from a two-wire AC input, therefore resulting in lower weight and cost when
compared to a rectifier with a 3-wire input from a transformer with a center-tapped secondary
winding. The load resistance is connected between the other two ends of the bridge. For the
positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas diodes D2 and D4
remain in the OFF state. The maximum efficiency of a Bridge Rectifier is 81.2%

Voltage Regulators:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or
variable output voltages. The maximum current they can pass also rates them. Negative
voltage regulators are available, mainly for use in dual supplies. Most regulators include
some automatic protection from excessive current ('overload protection') and overheating
('thermal protection'). Many of the fixed voltage regulators ICs have 3 leads and look like
power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is
28

simple to use. You simply connect the positive lead of your unregulated DC power supply
(anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the
Common pin and then when you turn on the power, you get a 5 volt supply from the output
pin.

LM 358 OPERATIONAL AMPLIFIER


The LM158 series consists of two independent, high gain, internally frequency
compensated operational amplifiers which were designed specifically to operate from a
single power supply over a wide range of voltages. Operation from split power supplies is
also possible and the low power supply current drain is independent of the magnitude of the
power supply voltage.

Fig. Op Amp Pin Diagram


29

Application areas include transducer amplifiers, dc gain blocks and all the
conventional op amp circuits which now can be more easily implemented in single power
supply systems. For example, the LM158 series can be directly operated off of the standard
+5V power supply voltage which is used in digital systems and will easily provide the
required interface electronics without requiring the additional 15V power supplies.
3.7 MOISTURE SENSORS:
A soil moisture sensor is a water conservation accessory for conventional
automatic irrigation systems with the potential for eliminating excessive irrigation cycles.

Fig. Moisture Sensor


Soil moisture sensors measure the water that contains in the soil. A soil
moisture probe is made up of multiple soil moisture sensors. One common type of soil
moisture sensor is in commercial use & a frequency domain sensors such as a capacitance
sensor. Another sensor the neutron moister gauge, utilize the modulator properties of water
for neutron. By simply inserting the soil moisture sensors in the soil to be tested and
volumetric water content of soil is reported in percent. Soil moisture sensors are used to
conduct experiments in ecology, environmental science and agricultural science,
horticulture, biology and more.
3.8 MOTOR DRIVING CIRCUIT:

30

Motor driving circuit is a relay is an electrical switch that opens and closes
under the 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.
RELAY:
Relay is an electrically operated switch. Current flowing through the coil of the
relay creates a magnetic field which attracts a lever and changes the switch contacts. The
coil current can be on or off so relays have two switch positions and they are double throw
(changeover) switches.

Relays allow one circuit to switch a second circuit which can be completely
separate from the first. For example a low voltage battery circuit can use a relay to switch a
230V AC mains circuit. There is no electrical connection inside the relay between the two
circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower voltages.
Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the
small IC current to the larger value required for the relay coil. The maximum output current
for the popular 555 timer IC is 200mA so these devices can supply relay coils directly
without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of switch
contacts, for example relays with 4 sets of changeover contacts are readily available. For
further information about switch contacts and the terms used to describe them please see
the page on switches.

31

Most relays are designed for PCB mounting but you can solder wires directly to
the pins providing you take care to avoid melting the plastic case of the relay. Relay coils
produce brief high voltage 'spikes' when they are switched off and this can destroy
transistors and ICs in the circuit. To prevent damage you must connect a protection diode
across the relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can see
a lever on the left being attracted by magnetism when the coil is switched on. This lever
moves the switch contacts. There is one set of contacts (SPDT) in the foreground and
another behind them, making the relay DPDT.

Fig. Connecting a Relay


The relay's switch connections are usually labeled as COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay coil is
on.
Connect to COM and NC if you want the switched circuit to be on when the relay coil is
off.
Choosing a relay:
You need to consider several features when choosing a relay:

32

a) Physical size and pin arrangement If you are choosing a relay for an existing PCB you
will need to ensure that its dimensions and pin arrangement are suitable. You should find
this information in the supplier's catalogue.
b) Coil voltage the relay's coil voltage rating and resistance must suit the circuit powering
the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are
also readily available. Some relays operate perfectly well with a supply voltage which is a
little lower than their rated value.
c) Coil resistance the circuit must be able to supply the current required by the relay coil.
You can use Ohm's law to calculate the current:
supply voltage

Relay coil current =

coil resistance

Switch ratings (voltage and current) the relay's switch contacts must be suitable
for the circuit they are to control. You will need to check the voltage and current ratings.
Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V
AC".
Switch contact arrangement (SPDT, DPDT etc). Most relays are SPDT or DPDT
which are often described as "single pole changeover" (SPCO) or "double pole
changeover" (DPCO). For further information please see the page on switches
Protection diodes for relays:
Transistors and ICs (chips) must be protected from the brief high voltage 'spike'
produced when the relay coil is switched off. The diagram shows how a signal diode (e.g.
1N4148) is connected across the relay coil to provide this protection. Note that the diode is
connected 'backwards' so that it will normally not conduct. Conduction only occurs when
the relay coil is switched off, at this moment current tries to continue flowing through the
coil and it is harmlessly diverted through the diode. Without the diode no current could
flow and the coil would produce a damaging high voltage 'spike' in its attempt to keep the
current

flowing.

Relays and transistors compared.


33

Like relays, transistors can be used as an electrically operated switch. For


switching small DC currents (< 1A) at low voltage they are usually a better choice than a
relay. However transistors cannot switch AC or high voltages (such as mains electricity)
and they are not usually a good choice for switching large currents (> 5A). In these cases a
relay will be needed, but note that a low power transistor may still be needed to switch the
current for the relay's coil! The main advantages and disadvantages of relays are listed
below:
Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Relays can switch many contacts at once.

Disadvantages of relays:
Relays are bulkier than transistors for switching small currents.
Relays cannot switch rapidly (except reed relays), transistors can switch many times per
second.
Relays use more power due to the current flowing through their coil.
Relays require more current than many chips can provide, so a low power transistor may be
needed to switch the current for the relay's coil.

Chapter IV
Hardware Designing and Software Implementation

Hardware Designing
Proteus7.7 Tool
Proteus7.7 best simulation software for various designs with microcontroller. It is mainly
popular because of availability of almost all microcontrollers in it. So it is a handy tool to test
34

programs and embedded designs for electronics. You can simulate your programming of
microcontroller in Proteus7.7 Simulation Software.
After simulating your circuit in Proteus 7.7 Software you can directly make PCB design with it
so it could be a all in one package.

Steps to create a Project

Double click on ISIS shortcut.


Go to File menu click on save design.
Save the design by creating a new folder with specified project name.
Go to Library menu Pick the Device symbol.
Pick the component to be placed from the library list.
Place the selected Component on the Schematic sheet with grids.
Select all the required components and place them on the schematic sheet.
Connect the components.
For connecting power and ground go to Terminal Mode.
After the Design completion.
Load the .hex file which is generated from Keil software.
Start the simulation button.
If the design and code are appropriate simulation gives the valid output.
For further modification stop the simulation, modify the circuit.
To modify the .hex file modify the code in Keil build the code then hex while will be
manipulated.

Software Implementation
Keil IDE
The Keil 8051 Development Tools are designed to solve the complex problems facing
embedded software developers.
Keil IDE is basically an assembler and a compiler. Assembly or C language code can be
written and compiled in Keil. Furthermore, it supports many of the 8051 variants.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART,
SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051
device. Simulation helps you understand hardware configurations and avoids time wasted on

35

setup problems. Additionally, with simulation, you can write and test applications before target
hardware is available.

Steps to create a project

Double click on Keil shortcut.


Click on run option.
Go to Project menu select new Vision project.
Save the project in above ISIS folder with the same project name.
Right click on Target1 select options for target target1.
Change Xtal (MHz) value as 11.0592MHz.
Go to output menu in the same window Tick the create hex file option.
Click on OK.
Create a new empty document by click on tool below file menu.
Save that document with .c extension as it a c code.
Save the code in the same folder.
Right click on Source Group Select Add Files to Group Source Group1.
Add the .c file to that source group.
Click on Close option.
Edit the code in .c file.
Build the code.
If the code is appropriate code is compiled without any errors.
After compilation hex file is generated.
This generated .hex file is embedded on microcontroller in ISIS tool for software

testing
If simulation results are perfect the .hex file is loaded into real-time micro controller chip.

COMPONENTS MOUNTING ON PCB


TOOLS USED:
Soldering iron
A soldering iron is a hand tool most commonly used in soldering. It supplies
heat to melt the solder so that it can flow into the joint between two workpieces.

36

A soldering iron is composed of a heated metal tip and an insulated


handle. Heating is often achieved electrically, by passing an electric
current (supplied through an electrical cord or battery cables)
through the resistive material of a heating element. Another heating method
includes combustion of a suitable gas, which can either be delivered through a tank
mounted on the iron (flameless), or through an external flame.
Less common uses include pyrography (burning designs into wood) and
welding. Soldering irons are most often used for installation, repairs, and limited
production work. High-volume production lines use other soldering methods.

Wire Stripper:
Wire stripper is used to strip off wire insulator from its conductor before it is
used to connect to another wire or soldered into the printed circuit board. Some wire
stripper or wire cutter has a measurement engraved on it to indicate the length that will be
stripped.
Side-Cutting Plier:
A 4-inch side cutting plier will come in handy as one
of the electronic tools when one need to trim off excess
component leads on the printed circuit board. It can also be used
to cut wires into shorter length before being used. Tweezer
Small tweezer is used to hold small components especially when doing
soldering and de-soldering of surface mount components.

PCB Designing and Working


PCB Layout

37

The entire circuit can be easily assembled on a general purpose PCB board respectively.
Layout of desired diagram and preparation is first and most important operation in any printed
circuit board manufacturing process. First of all layout of component side is to made in
accordance with available components dimensions. The following points are to be observed
while forming the layout of PCB.
1. Between two components, sufficient space should be maintained.
2. High voltage/max dissipated components should be mounted at sufficient distance
from semiconductor and electrolytic capacitors.
3. The most important points are the components layout is making proper
compromise with copper side circuit layout. Printed circuit board is used to avoid
most of all the disadvantages of conventional breadboard. These are small in size
and efficient in performance.
Preparing Circuit Layout
First of all the actual size circuit layout is to be drawn on the copper side of the copper clad
board. Then enamel paint is applied on the tracks of connection with the help of a shade brush.
We have to apply the paints surrounding the point at which the connection is to be made. It
avoids the disconnection between the leg of the component and circuit track. After completion of
painting work, it is allowed to dry.
Drilling
After completion of painting work, holes 1/23inch (1mm) diameter are drilled at desired points
where we have to fix the components.
Etching
The removal of excess of copper on the plate apart from the printed circuit is known as etching.
From this process the copper clad board with printed circuit is placed in the solution of FeCl with
3-4 drops of HCL in it and is kept so for about 10 to 15 minutes and is taken out when all the
excess copper is removed from the PCB. After etching, the PCB is kept in clean water for about
half an hour in order to get PCB away from acidic field, which may cause poor performance of

38

the circuit. After the PCB has been thoroughly washed, paint is removed by soft piece of cloth
dipped I thinner or turbine. Then PCB is checked as per the layout, now the PCB is ready for use.
Soldering
Soldering is the process of joining two metallic conductor the joint where two metal
conductors are to be join or fused is heated with a device called soldering iron and then as allow
of tin and lead called solder is applied which melts and converse the joint. The solder cools and
solidifies quickly to ensure is good and durable connection between the joined metal converting
the joint solder also present oxidation.
Soldering And Desoldering Techniques.
There are basically two soldering techniques.

Manual soldering with iron.


Mass Soldering.

Soldering with Iron


The surface to be soldered must be cleaned and fluxed. The soldering iron switched on and
bellowed to attain soldering temperature. The solder in form of wire is allied hear the component
to be soldered and heated with iron. The surface to be soldered is filled, iron is removed and joint
is cold without disturbing.
Solder Joint are Supposed to:
1.
2.
3.
4.

Provide permanent low resistance path.


Make a robust mechanical link between PCB and leads of components.
Allow heat flow between component, joining elements and PCB.
Retain adequate strength with temperature variation. The following precaution should be
taken while soldering:
Use always an iron plated copper core tip for soldering iron.
Slightly for the tip with a cut file when it is cold.
Use a wet sponge to wipe out dirt from the tip before soldering.
Tighten the tip screw if necessary before iron is connected to poor supply.
Clean component lead and copper pad before soldering.
Apply solder between component leads, PCB pattern and tip of soldering iron.
39

Iron should be kept in contact with the joint for 2-3 seconds only instead of

keeping for very long or very small time.


Use optimum quantity of solder.

CHAPTER V
CONCLUSION & FUTURE SCOPE
5.1 RESULT
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 the changing environment.
In present days especially farmers are facing major problems in watering
their agriculture fields, its because they have no proper idea about when the power is
40

available so that they can pump water. Even after then they need to wait until the field is
properly watered, which makes them to stop doing other activities. Here is an idea which
helps not only farmers but also for watering the gardens , which senses the soil moisture
and switches the pump automatically when the power is ON.
Electronic Gardner is a prototype for an automatic irrigation system that can be
used in wide landscapes. Properly installed, maintain and managed system can be
implemented in large fields like public gardens, lawns, golf fields etc.

5.2 ADVANTAGES
1. Reduced run-off of water and nutrients:
Automation can help keep fertilizer on farm by effectively reducing run-off
from the property. Retaining fertilizer on farm has both economic and environmental
benefits.
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. Reduced Labour:
As the irrigator is not required to constantly monitor the progress of irrigation,
the irrigator is available to perform other tasks un-interrupted.
4. Saves time:
Setting and moving sprinklers are not required. A timer delay as per
environment can be added to the system for automatic watering.
5. Improved Life Style

41

The irrigator is not required to constantly check the progress of water down the
base being irrigated. The irrigator is able to be away from the property, relax with the
family and sleep through the night.
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 reach the
desired areas.
8. More timely irrigation:
Irrigators with automation are more inclined to irrigate when the plants need
water, not when it suits the irrigator

9. More accurate cut-off:


Automation of the irrigation system allows cut-off of water at the appropriate
point in the bay. This is usually more accurate than manual checking because mistakes can
occur if the operator is too late or too early in making a change of water flow.

5.3 DIS-ADVANTAGES
1. Reliability:
Sometimes failures will occur often these failures are because of human error in
setting and maintaining the systems. A reuse system is good insurance to collect any excess
run off when failures occur

42

2. Increased Channel Maintenance:


There is a need to increase maintenance of channels and equipments to ensure
the system works correctly. Channels should be fenced to protect the automatic units from
stock damage.
3. Slopes in the fields:
These systems require careful study of all the relevant factors like land
topography, Soil, Water, Crop and agro-climatic conditions and suitability of irrigation
system and its components
Due to rust of sensors we cannot predict the water level after a period of time.

5.4 APPLICATIONS
1. Irrigation in fields.
2. Irrigation in gardens, parks and golf fields
3. Very efficient for paddy (Rice) fields.
4. Picsiculture.

43

5.5 FUTURE SCOPE


With a numerous fields of application and various advantages of the system has
made it one of the major option available for the farmers. The increasing interest in this
area of research may bring about more and more consumer efficient system. Water scarcity
the major problem is well handled by the system. The changing climatic condition and
global warming issues prevailing throughout the world can be overcome only through this
system. The automatic irrigation system will be every farmers choice in a decade or so.
The improper advertising was the sole reason for the late adoption and acquaintance of the
system that took place in the late eighties. But with the awareness spreading all over the
globe the system is earning acceptance and so, a number of scientist are investing their time
to perfect the system we can implement this module in golf fields and public gardens.
Electronic Gardner is a prototype for an automatic irrigation system that can be used in
wide landscapes.
The main advantage of this module is without observation of farmer the motor
pump automatically switches the motor on or off by using the moisture sensors. Saves time,
Saves water. An automatic irrigation system can save you literally thousands of gallons of
water a year simply by remembering to turn itself off at the right time. Protects your
financial investment. An attractively landscaped exterior, with lush growth and healthy
plants, helps your house project that fresh.

44

45

References

1. Muhammad Ali Mazidi , The 8051 Microcontroller & Embedded Systems .


2. http://www.electronicshub.org/interfacing-16x2-lcd-8051/
3. http://www.buildcircuit.com/how-to-use-a-relay/
4. http://www.electronics-tutorials.ws/

46

Vous aimerez peut-être aussi