Sei sulla pagina 1di 51

AUTOMATIC PLANT IRRIGATION SYSTEM

A PROJECT REPORT
Submitted by

xxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
submitted in the partial fulfillment of the requirements for the award of degree
of

Bachelor of Technology
IN

Electronics & Communication Engineering

XXXX Engineering college of science and technology


(201x-xx)
Department of Electronics and Communication

CERTIFICATE OF APPROVAL

The

foregoing

project

work

report

entitled

AUTOMATIC

PLANT

IRRIGATION SYSTEM is a hereby approved as a creditable work and has


been presented in a satisfactory manner to warrant its acceptance as prerequisite to
the degree for which it has been submitted.
It is understood that for this approval ,the undersigned do not necessarily endorse
any conclusion drawn or opinion expressed therein, but approve the project work
for the purpose for which it is submitted.

(Internal Examiner)

(External Examiner)

(Head of the Department)

Xyz Institute of science and technology

CERTIFICATE
This is to certify that the work presented in the project report entitled
AUTOMATIC PLANT IRRIGATION SYSTEM in the partial fulfillment
of the requirement for the award of Degree of Bachelor of Technology in
Electronics and Communication of The Xyz Institute of science and technology,
Warangal, is an authentic work carried out under my supervision and guidance.
To the best of my knowledge ,the content of this project work not form a basis for
the award of any previous Degree to any one else.
Date:

Mr. xxxxxxxxxxxxx

Mr. xxxxxxxx

( Project Guide )

( Project Coordinator )

Mr. xxxxxxxxxxxxx
( Head of the Department )

ACKNOWLEDGEMENT

Knowledge is an experience gained in life. It is the choicest possession, which should not be
shelved but should be happily shared with others. In this regard We are extremely fortunate in
having Mr. xxxxxxxx as my project guide .It was he ,who provided proper direction in the
completion of this project work.
I have often been guilty of encroaching upon the privacy of this home but not even once We were
disappointed .His willingness to

share his experience and spontaneous suggestion on any

problem encourage me tremendously to achieve my goal .We are sure his directive will show us
the light in future also.
We are very much thankful to Mr. xxxxxxxxxxx ,HOD ,ECE deptt for his encouragement
,valuable suggestion and moral support provided by him.
At the juncture,We feel at the deepest of our heart to acknowledge the encouragement and
blessing of our mother and sister.
Last but not the least ,words can hardly express our heartfelt gratitude towards our project
coordinator(Mr. xxxxxxxxx) ,who stood by us and helped in every way possible during the
completion of this project.

xxxxxxxxx(1111111111111)

xxxxxxxxxxx(111111111111)

xxxxxxxxxxxxxx(111111111111)

xxxxxxxxxxxxx(11111111111111)

ABSTRACT
The project we have undertaken is Automatic Plant Irrigation System. This
project is taken up as India is an agriculture oriented country and the rate at which
water resources are depleting is a dangerous threat hence there is a need of smart
and efficient way of irrigation. In this project we have implemented sensors which
detect the humidity in the soil (agricultural field) and supply water to the field
which has water requirement. The project is 8051 microcontroller based design
which controls the water supply and the field to be irrigated. There are sensors
present in each field which are not activated till water is present on the field. Once
the field gets dry sensors sense the requirement of water in the field and send a
signal to the microcontroller. Microcontroller then supply water to that particular
field which has water requirement till the sensors is deactivated again. In case,
when there are more than one signal for water requirement then the microcontroller
will prioritize the first received signal and irrigate the fields accordingly.

INTRODUCTION
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 more simpler and convenient,
we have made AUTOMATIC PLANT 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 Advance
techniques.

WORKING CIRCUIT DIAGRAMS:


1).

1). MICROCONTROLLER UNIT

2).POWER SUPPLY UNIT

3).SENSOR CKT. DIAGRAMS

COMPONENT S LIST
Transformer

: Step down transformer (220/12)

Voltage Regulator

: IC 7805

Amp

: BC548

Crystal oscillator

: 11.0592 M Hz

Diode

: IN 4007

Memory

: 24C08

LED
Resistor

: 470 ohm (for LED) , 8.2 K (for power on reset


C kt. ), 10 K (for sensors) , potentiometer(100K)

Capacitor

: 1000 u f (for Power supply),10 u f ( reset ckt.)


33p F( for crystal oscillator)

Relay

: 220V/7A

Microcontroller

: AT89C4051

Water pump
Switches
Power cables & ribbon wires

COMPONENT DESCRIPTION
This project plays a very important role in controlling an irrigation motor in the form field. This
project consists of a water sensor and the timer. The water sensors are a deep immersive type
sensors connecter to the embedded system. One of the probe is connected to the Vcc with 100K
resister in series and the other probe is connected to the base of transistor which indicates the
presence of the water to the MCU (AT89C2051). When water touches the probes the positive
supply flows from one probe to other till the transistor, the transistor BC548 gets in saturated
condition and the MCU reads the LOW at the sensor pin. This condition is suitable for the motor
to run due to presence of water. When pump drains out the water from form well the sensors
float out from water, which disables the transistor BC548, then MCU reads HIGH indicating
absence of water. The relay which is connecter to the starter or motor directly disconnects the
circuit which protects the motor against dry run.
This project also incorporates the timer function which enables the former to run his motor to
stipulated time. This feature comes handy in rainy season when only small amount of water is
required for the form field. The timer is implemented in the program dumper in the MCU. The
internal clock cycles are counted to generate the delay. 921 dummy loops are required to
generate 1 Mille second, then X1000 yields 1 Second, then X60 gives one Minute and so on. 1-4
hours selectable delay time period is provided with the selector switch.

Literature Survey:
A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O
interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition
interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single
silicon chip.
If a system is developed with a microprocessor, the designer has to go for external
memory such as RAM, ROM, EPROM and peripherals. But controller is provided with all these
facilities on a single chip. Development of a Micro controller reduces PCB size and cost of
design.
One of the major differences between a Microprocessor and a Microcontroller is that a
controller often deals with bits not bytes as in the real world application.

Microcontroller circuit description


The microcontroller is the heart of the circuit and will control the total main logic depending on
the sensor inputs. The microcontroller used here is AT89S52 which is 40 pin DIP IC. This
microcontroller has 4 ports with each 8 bit parallel and only PORT3 has serial data transference
capability. The ports namely are PORT0, PORT1, PORT2, PORT3. PORT 1, 2, 3 are bidirectional and bit-wise ports and Port 0 is Uni-directional and bit- wise port. Pin no. 1-8 is Port
1, Pin 9 is reset, Pin 10-17 is Port3, Pin 18 & 19 is clock, Pin 20 is VSS (Gnd), Pin 21-28 is Port
2, Pin 29,30,31 are external interrupts, Pin 32-39 is Port 0 and pin 40 is Vcc (+5.1V).

Reset : The program counter inside the MC is a 16-bit register with a static flash memory which
holds the address of the next incoming instruction passed to the ALU. This address stored in the
PC will be stored even after the power down to the MC, in turn when the MC is started next time
the program counter pushes the stored instruction address in the ALU resulting in the
malfunction and then seizure of the processes. To overcome this problem the PC has to be
flushed and default address should be loaded into the PC every time u start the MC, to achieve
this, a falling edge (NGT-Negative going transition) should be passed to the pin 9 of the
microcontroller. A RC network is used to pass a NGT to pin 9 every time you start the MC. The
10 uf capacitor C3 is connected across the pin 9 to Vcc and a 10K resister R1 from pin 9 to Vss.
When power supply is passed the capacitor C3 holds the positive charge and thus the same is
passed to pin 9 of MC, the 10K resister R1 connected across the pin 9 to ground discharges the
positive charge from the capacitor to ground with the delay of few milliseconds which loads the
PC with the default value 0000H. Now the MC will fetch the instructions from the scratch and
thus program runs smoothly without any hassles.
Clock : Every digital circuit needs a clock pulse to synchronizes all the processes control and
data transference across the different section within the main circuit. The Intel 8051 family
microcontrollers do not have the internal clock circuitry. So an external clock signal within the
range of 1 Mhz to 33 Mhz is to fed to pin 18 of the microcontroller from signal generator. In
case, the onboard clock circuit is required, a crystal oscillator X1 with 11.0592Mhz can be
connected across pin 18 and 19 with 33 pf discharge capacitors C1 and C2 connected to Gnd.
In general, a crystal oscillator of value 11.0592 Mhz is connected to pin 18 to 19, the two
discharge capacitors of 33Pf each will be connected to Gnd from pin 18 and pin 19.

Play/Pause : Pin 31 is a external interrupt, when this pin is pulled high the MC will start
working and when pulled to low the MC will pause the working instruction. Pin 20 will be tied
to and Gnd and pin 40 to Vcc.

Power supply :
Most of all digital circuits needs 5.1V regulated voltage. Any sort of fluctuation in the
power supply is not tolerated by the digital circuits. To processes clean DC of 5V we need a
voltage regulated IC.
The stepped down 12V AC output from the transformer or a 12V DC from a battery can
be used. This voltage is given to the voltage regulator through 1N4007 rectifier diode D1, this
practice helps protect the circuit when reverse terminals are connected. The same rectifier diode
D1 will convert the 12V AC to DC when connected to transformer. The converted dc supply will
be now filtered using a 100uf capacitor C3 across the cathode of diode and gnd. Then this half
waved rectified power supply is given to pin 1 of the voltage regulator 7805

RELAY DRIVER:
Relay is an electro-mechanical switch which can be controlled by an electronic circuit. Relay
consists of contact points and electromagnetic coil. In most of the cases there will be a need of a
device switchs the electrical appliance on or off depending on the logic produced by a electronic
circuit board which runs on few volts of DC. In such scenario, relays are used which isolate high
voltage AC from DC logic sections.
The relay has a high quality contact points which can bare more amps of current. The common
relay coil is designed for 5-6V of operation. The output pin of the microcontroller is given to the
current amplifier through 1K resister

Why AT89C2051:
The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with
2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is
manufactured using Atmels high-density nonvolatile memory technology and is compatible with
the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on
a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highlyflexible and cost-effective solution to many embedded control applications.

The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes
of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a
full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry. In
addition, the AT89C2051 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The
power-down mode saves the RAM contents but freezes the oscillator disabling all other chip
functions until the next hardware reset.
AT89C2051 has 2k bytes of flash memory which is sufficient for our application.
Whereas AT89C51 has 4 Kb on chip flash memory. The on-chip Flash ROM allows the program
memory to be reprogrammed in system or by conventional non-volatile memory Programmer.
Moreover ATMEL is the leader in flash technology in todays market place and hence using AT
89C2051 is the optimal solution.

Features :
. Compatible with MCS-51 Products
2K Bytes of Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles

2.7Vto6VOperatingRange
Fully Static Operation: 0 Hz to 24 MHz
Two-level Program Memory Lock
128 x 8-bit Internal RAM
15 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial UART Channel
Direct LED Drive Outputs
On-chip Analog Comparator
Low-power Idle and Power-down Modes

The 8051 family of microcontrollers, initially introduced by Intel, are now offered by a
host of manufacturers such as Atmel, Philips and Dallas. Atmel 89c51, 89c52 and 89c2051
microcontrollers happen to be workhorses today. These microcontrollers contain internal flash
memory (EEPROM), which makes it possible to store the program internally inside the chip. for
developing any application using these microcontrollers, one need to have access to a
programmer board.
This is simple programmer that can be used to program 89c51, 89c52 and 89c2051
microcontrollers. The fancy here is that programmer itself deploys an 89c2051 chip containing
the necessary firmware.

STEP DOWN TRANSFORMER


Power supply is a reference to a source of electrical power. A device or system that supplies
electrical or other types of energy to an output load or group of loads is called a power
supply unit or PSU. The term is most commonly applied to electrical energy supplies, less
often to mechanical ones, and rarely to others.
Here in our application we need a 5v DC power supply for all electronics involved in the
project. This requires step down transformer, rectifier, voltage regulator, and filter circuit for
generation of 5v DC power. Here a brief description of all the components are given as
follows:

VOLTAGE REGULATOR IC 7805


This is most common voltage regulator that is still used in embedded designs. LM7805 voltage
regulator is a linear regulator made by several manufacturers like Fairchild, or ST
Microelectronics. They can come in several types of packages. For output current up to 1A there
may be two types of packages: TO-220 (vertical) and D-PAK (horizontal).

With proper heat sink these LM78xx types can handle even more than 1A current. They also
have Thermal overload protection, Short circuit protection.
If your design wont exceed 0.1A current you may chose regulator LM78L05 with smaller
packages and lower maximum current up to 0.1A. They come in three main types of packages
SO-8, SOT-89 and TO-92

TRANSISTORS
A transistor is a semiconductor device commonly used to amplify or switch electronic
signals. A transistor is made of a solid piece of a semiconductor material, with at least three
terminals for connection to an external circuit. A voltage or current applied to one pair of the

transistor's terminals changes the current flowing through another pair of terminals. Because the
controlled (output) power can be much larger than the controlling (input) power, the transistor
provides amplification of a signal. The transistor is the fundamental building block of modern
electronic devices, and is used in radio, telephone, computer and other electronic systems. Some
transistors are packaged individually but most are found in integrated circuits.

NPN transistors
Code

Structure

Case
style

IC

VCE hFE

Ptot

max. max. min. max.

Category

Possible

(typical use)

substitutes

BC107

NPN

TO18 100mA 45V 110 300mW Audio, low power

BC108

NPN

TO18 100mA 20V 110 300mW

BC547B

NPN

TO92C 100mA 45V 200 500mW Audio, low power

BC548B

NPN

TO92C 100mA 30V 220 500mW

BC549B

NPN

TO92C 100mA 30V 240 625mW

General purpose,

BC108C BC183

low power

BC548

General purpose,
low power
Audio (low noise),

NPN General Purpose Amplifier


BC548/BC548A/BC548B/BC548C
This device is designed for use as general purpose amplifiers
and switches requiring collector currents to 300 mA

BC182 BC547

low power

BC107B
BC108B

BC109

From this table we note that BC546 are suitable for applications that need more voltage
than BC547. BC548 transistor is made for applications with less voltage variations, but more
current than BC546/BC547 circuits.

Advantages

Small size and minimal weight, allowing the development of miniaturized electronic
devices.

Highly automated manufacturing processes, resulting in low per-unit cost.

Lower possible operating voltages, making transistors suitable for small, battery-powered
applications.

No warm-up period for cathode heaters required after power application.

Lower power dissipation and generally greater energy efficiency.

Higher reliability and greater physical ruggedness.

Extremely long life

Disadvantages

The electron mobility is higher in a vacuum, so that high power, high frequency operation
is easier in tubes.

Compared to vacuum tubes, they are highly sensitive to electromagnetic pulses.

CRYSTAL OSCILLATOR

IMAGE

SYMBOL

A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a very precise
frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to
provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio
transmitters and receivers. The most common type of piezoelectric resonator used is the quartz
crystal, so oscillator circuits designed around them became known as "crystal oscillators."

Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of
megahertz. More than two billion (2109) crystals are manufactured annually. Most are used for
consumer devices such as wristwatches, clocks, radios, computers, and cellphones. Quartz
crystals are also found inside test and measurement equipment, such as counters, signal
generators, and oscilloscopes.

DIODE

SYMBOL

The 1N4007 series (or 1N4000 series) is a family of popular 1.0 amp general purpose silicon
rectifier diodes commonly used in AC adapters for common household appliances. Blocking
voltage varies from 50 to 1000 volts. This diode is made in an axial-lead DO-41 plastic package.
The 1N5400 series is a similarly popular series for higher current applications, up to 3 A. These
diodes come in the larger DO-201 axial package.
These are fairly low-speed rectifier diodes, being inefficient for square waves of more than 15
kHz. The series was second sourced by many manufacturers. The 1N4000 series were in the
Motorola Silicon Rectifier Handbook in 1966, as replacements for 1N2609 through 1N2617. The
1N5400 series were announced in Electrical Design News in 1968, along with the now lesser
known 1.5-ampere 1N5391 series.
These devices are widely used and recommended. The table below shows the maximum
repetitive reverse blocking voltages of each of the members of the 1N4000 and 1N5400 series

IMAGE OF DIODES
LED
A light-emitting diode (LED) is a semiconductor device that emits visible light when an electric
current passes through it. The light is not particularly bright, but in most LEDs it is
monochromatic, occurring at a single wavelength. The output from an LED can range from red
(at a wavelength of approximately 700 nanometers) to blue-violet (about 400 nanometers). Some
LEDs emit infrared (IR) energy (830 nanometers or longer); such a device is known as an
infrared-emitting diode (IRED). An LED or IRED consists of two elements of processed material
called P-type semiconductors and N-type semiconductors. These two elements are placed in
direct contact, forming a region called the P-N junction. In this respect, the LED or IRED
resembles most other diode types, but there are important differences. The LED or IRED has a
transparent package, allowing visible or IR energy to pass through. Also, the LED or IRED has a
large PN-junction area whose shape is tailored to the application.

Benefits of LEDs
Low power requirement: Most types can be operated with battery powersupplies.
High efficiency: Most of the power supplied to an LED or IRED isconverted into radiation in
the desired form, with minimal heat production.
Long life: When properly installed, an LED or IRED can function for

decades.

RESISTOR
A resistor is an electrical component that limits or regulates the flow of electrical current in an
electronic circuit. Resistors can also be used to provide a specific voltage for an active device
such as a transistor. All other factors being equal, in a direct-current (DC) circuit, the current
through a resistor is inversely proportional to its resistance, and directly proportional to the
voltage across it. This is the well-known Ohm's Law. In alternating-current (AC) circuits, this
rule also applies as long as the resistor does not contain inductance or capacitance.
Resistors can be fabricated in a variety of ways. The most common type inelectronic devices and
systems is the carbon-composition resistor. Finegr anulated carbon (graphite) is mixed with clay
and hardened. The resistance depends on the proportion of carbon to clay; the higher this ratio,
the lower the resistance.
Another type of resistor is made from winding Nichrome or similar wire onan insulating form.
This component, called a wire wound resistor, is able to handle higher currents than a carboncomposition resistor of the same physical size. However, because the wire is wound into a coil,
the component acts as an inductors as well as exhibiting resistance. This does not affect
performance in DC circuits, but can have an adverse effect in AC circuits because inductance
renders the device sensitive to changes in output.

CAPACITOR
A capacitor is a tool consisting of two conductive plates, each of which hosts an opposite charge.
These plates are separated by a dielectric or other form of insulator, which helps them maintain
an electric charge. There are several types of insulators used in capacitors. Examples include
ceramic, polyester, tantalum air, and polystyrene. Other common capacitor insulators include air,
paper, and plastic. Each effectively prevents the plates from touching each other. A capacitor is
often used to store analogue signals and digital data. Another type of capacitor is used in the
telecommunications equipment industry. This type of capacitor is able to adjust the frequency
and tuning of telecommunications equipment and is often referred to a variable capacitor. A
capacitor is also ideal for storing an electron. A capacitor cannot, however, make electrons. A
capacitor measures in voltage, which differs on each of the two interior plates. Both plates of the
capacitor are charged, but the current flows in opposite directions. A capacitor contains 1.5 volts,
which is the same voltage found in a common AA battery. As voltage is used in a capacitor, one
of the two plates becomes filled with a steady flow of current. At the same time, the current

flows away from the other plate. To understand the flow of voltage in a capacitor, it is helpful to
look at naturally occurring examples. Lightning, for example, is similar to a capacitor. The cloud
represents one of the plates and the ground represents the other. The lightning is the charging
factor moving between the ground and the cloud.

IMAGE OF ELECTROLYTIC CAPACITOR


UNPOLARISED / CERAMIC CAPACITORS
A non-polarized ("non polar") capacitor is a type of capacitor that has no implicit polarity -- it
can be connected either way in a circuit. Ceramic, mica and some electrolytic capacitors are nonpolarized. You'll also sometimes hear people call them "bipolar" capacitors.

SYMBOL

IMAGE OF CERAMIC CAPACITOR

5v Relay:
A 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 most have double throw (changeover)
switch contacts

The relay's switch connections are usually labelled 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.

We can think of a relay as an electromagnetic switch. Apply a voltage to the coil and a
magnetic field is generated. This magnetic field sucks the contacts of the relay in, causing them
to make a connection. These contacts can be considered to be a switch. They allow current to
flow between 2 points thereby closing the circuit.
6 volt relays solve the need for running electrical appliances smoothly. Technology has
become really advanced these days and an example of this is the 12 volt relay.
A relay is simply a device that separates two electrical circuits. In its quintessential form,
a relay includes a coil that is used to switch on and off switch contacts. Since the two circuits are
not connected, a 6 volt relay is required to produce energy in the coil. This relay contains a direct
current of up to 6 volts.
These days, relays are used in all kinds of electrical devices like water pumps, audio
amplifiers and automobiles. It is very important for the running of electrical currents.

Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.

Relays can switch higher voltages than standard transistors.

Relays are often 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 ICs can provide, so a low power transistor may be
needed to switch the current for the relay's coil.

ADVANTAGES:
high sensitive
works according to the soil condition
fit and forget system
low cost and reliable circuit
complete elimination of manpower
can handle heavy loads up to 7A
This is very useful to all climatic conditions any it is economic friendly
Here we are using micro controllers because these are error free
DISADVANTAGES
1. Require frequent maintenance for efficient operation
2. Have limited life after installation due to the deterioration of the plastic components in a
hot, arid climate when exposed to ultraviolet light

INTRODUCTION TO 8051 CONTROLLER


The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited
to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and
Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051
models often have a different form factor, and are not "drop-in compatible". All these things are
called 8051 because they can all be programmed using 8051 assembly language, and they all
share certain features (although the different models all have their own special features).
Some of the features that have made the 8051 popular are:

4 KB on chip program memory.

128 bytes on chip data memory(RAM).

4 reg banks.

128 user defined software flags.

8-bit data bus

16-bit address bus

32 general purpose registers each of 8 bits

16 bit timers (usually 2, but may have more, or less).

3 internal and 2 external interrupts.

Bit as well as byte addressable RAM area of 16 bytes.

Four 8-bit ports, (short models have two 8-bit ports).

16-bit program counter and data pointer.

1 Microsecond instruction cycle with 12 MHz Crystal.

8051 models may also have a number of special, model-specific features, such as UARTs, ADC,
OpAmps, etc...

PIN CONFIGURATION
PIN 9: PIN 9 is the reset pin which is used reset the microcontrollers internal registers and ports
upon starting up. (Pin should be held high for 2 machine cycles.)
PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.
PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel 2051
which is a scaled down version of the 8051 which runs on +3V.
PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to
indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is
used when multiple memory chips are connected to the controller and only one of them needs to
be selected.We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is
"program store enable". In order to use the external memory it is required to provide the low
voltage (0) on both PSEN and EA pins.
There are 4 8-bit ports: P0, P1, P2 and P3.
PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for
a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional
functions associated with them based upon the context of their usage.
PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional
functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter
inputs, read and write pins for memory access.
PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will act as

an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8A15, as can be seen from fig 1.1
PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external
memory is present, but if external memory access is required then PORT P0 acts as a
multiplexed address and data bus that can be used to access external memory in conjunction with
PORT P2. P0 acts as AD0-AD7,

PIN DIAGRAM

BASICS OF CONTROLLER
Before actually going through this tutorial let me tell you something about number systems used
in Computer Systems. As you know human know the decimal number system 1,2,3---9, but how
will computer understand our language hence we use binary system which uses 0 & 1.
Computers understand the language of 0 & 1. We also have a hexadecimal system which is

nothing but a way of representing a binary number. Similarly we have a ASCII System for
information sharing between computers.
Memory inside computer system: There are Basically two types of memories RAM & ROM.
RAM as you know is Random Access Memory and data stored in it is temporary whereas ROM
is read only memory and data stored in it is permanent. CPU (Central Processing Unit is
combination of ALU Arithmetic Logic Unit & Control Unit. The A.L.U. (Arithmetic and Logic
Unit) performs all the calculations.
BLOCK DIAGRAM
Data and Program Memory
The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of
other high-level languages. Many compilers even have support for compiling C++ for an
8051.Program memory in the 8051 is read-only, while the data memory is considered to be
read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten
when the microcontroller is in the special programmer circuit.
Program Start Address
The 8051 starts executing program instructions from address 0000 in the program memory.
Direct Memory
The 8051 has 256 bytes of internal addressable RAM, although only the first 128 bytes are
available for general use by the programmer. The first 128 bytes of RAM (from 0x00 to 0x7F)
are called the Direct Memory, and can be used to store data.
Special Function Register
The Special Function Register (SFR) is the upper area of addressable memory, from address
0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data or
program storage, but is instead a series of memory-mapped ports and registers. All port input and
output can therefore be performed by memory mov operations on specified addresses in the SFR.
Also, different status registers are mapped into the SFR, for use in checking the status of the
8051, and changing some operational parameters of the 8051.

General Purpose Registers


The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there
are essentially 32 available general purpose registers, although only 8 (one bank) can be directly
accessed at a time. To access the other banks, we need to change the current bank number in the
flag status register.
A and B Registers
The A register is located in the SFR memory location 0xE0. The A register works in a similar
fashion to the AX register of x86 processors. The A register is called the accumulator, and by
default it receives the result of all arithmetic operations. The B register is used in a similar
manner, except that it can receive the extended answers from the multiply and divide operations.
When not being used for multiplication and Division, the B register is available as an extra
general-purpose register.

BLOCK DIGRAM OF 8051 CONTROLLER

WORKING OF PROJECT
The deficiency of water in the field is sensed by the op-amp based sensor. Whenever there is
need of water in the particular field, the high signal(1) appears on the output pin of the sensor
of that particular field. The output pins of all the sensors are connected to the PORT 2 of
microcontroller. The high signsl(logic 1) from the sensor is entertained by the microcontroller at
a particular pin. By knowing the position of the pin on which signal appears , the microcontroller
rotates the water funnel type cup at the desired angle (i.e. 90 ,180 ,270) by using stepper motor
connected at PORT 0 in clockwise direction. & switch ON the RELAY (i.e. Water pump)
connected at port 0. Now water starts flowing into the required field . after completion of
watering the sensor sends low signal (logic 0) to microcontroller. When uc receives this signal ,
it switches OFF the water pump & rotates the stepper motor in anticlockwise direction to the
previous angle to bring the funnel cup in its initial position . now uc starts sensing the signal at
PORT 2. Whenever there is signal at any pin the uc repeats the above process. So this process
continues & we get the automatic irrigation the fields by using intelligent device uc 8051.

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.
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 plastic
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 desoldering of surface mount components.
COMPONENT MOUNTING
Now mount all the components on the PCBs using the above mentioned tools.

SOFTWARES USED
KEIL uVision 3
The Keil 8051 Development Tools are designed to solve the complex problems facing embedded
software developers.
1) When starting a new project, simply select the microcontroller you use from the Device
Database and the Vision IDE sets all compiler, assembler, linker, and memory options
for you.
2) Numerous example programs are included to help you get started with the most popular
embedded 8051 devices.

3) 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 setup problems. Additionally, with simulation, you can write and test
applications before target hardware is available.

VARIOUS STEPS TO USE THE KEIL COMPILER


1) Open keil from the start menu.
2) Select a new project from the project menu.
3) Make a new folder in any drive.
4) Name the project as ABC and then click save.
5) Right click on target, then options for the target, then choose the device, set the crystal
frequency, click on the create hex file option to create hex file at the output.
6) Then create a new file from the file menu and save it with the same name of project using
extension .c or .asm.
7) Right clicks on the source group, then click on add files option to add the files and then
click on close.
HOW TO DEBUG THE PROGRAM
1) After writing the code, click on file menu and select save.
2) Click on project menu and rebuild all target files.
3) In build window, it should report as 0 Error(s), 0 Warning(s).
4) Click on debug menu and select start/stop debug session.

5) Click on peripherals, select I/O ports like as port 1.


6) A new window will pop up, which represents the port and pins.

Fig: parallel port

7) Now to execute the program stepwise click on F10 key.


8) To exit out click on debug menu and select start/stop debug session.

C PROGRAM FILE
#include<stdio.h>
#include<reg51.h>
#include<i2c.h>
void deley(int);
void one_sec();
sbit sens=P1^2;
sbit rel=P3^2;
sbit led=P3^1;
int n=0,j=0,m=0;
void main()
{
sens=0x01;
rel=0x01;
led=0x00;
deley(30000);

deley(30000);
led=0x01;
for(;;)
{
m=read_i2c(0x00);
if(m<120)
{
rel=0x00;
one_sec();
led=~led;
m++;
write_i2c(0x00,m);
deley(10);

}
if(sens==0x01)
{
write_i2c(0x00,0);
rel=0x00;
for(j=1;j<=120;j++)
{
one_sec();
led=~led;
write_i2c(0x00,j);
deley(10);
}
rel=0x01;
led=0x00;
}
rel=0x01;
led=0x00;

}
}
void deley(k)
{
int i;
for(i=0;i<=k;i++);
}
void one_sec()
{
for(n=1;n<=1275;n++)
{
nop();
}
}

Snap shots of Keil microvision and Microflash programmer

APPLICATIONS
1.IRRIGATION IN FIELDS.
2.IRRIGATION IN GARDENS,PARKS.
3.VERY EFFICIENT FOR PADDY(RICE) FIELDS.
4.PICSICULTURE.

REFERENCES
1. The 8051 Microcontroller and Embedded systems by Muhamman ali mazidi
2. The 8051 Microcontroller - Kenneth J. Ayala
3. http://www.8051microcontrollers.com
4. http://www.extremeelectronics.co.in
5. Peripheral interfacing with microcontroller by Rolin D.McKinlay
6. http://www.engineersgarage.com/microcontroller
7. http://www.futureelectronics.com/en/Microcontrollers/microcontrollers.aspx
8. http://www.ti.com/lsds/ti/microcontroller/overview.page
9. http://www.atmel.com/products/microcontrollers/default.aspx
10. http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/overview.page?247SEM

EXTENTIONS IN THE PROJECT


The working of above project is basically dependent on the output of the humidity sensors. Whenever there is
need of excess water in the desired field(RICE crops) then it will not be possible by using sensor technology. For
this we will have to adopt the DTMF technology. By using this we will be able to irrigate the desired field & in
desired amount.
This technology will be implemented in this project in the next (8th ) semester . this will be our extention to the
project for the the next semester.