75600403 automatic plant irrigation system

58
AUTOMATIC PLANT IRRIGATION SYSTEM A PROJECT REPORT Submitted by AMIT YADAV(08- TIB-1160) RAHUL DEV(08- TIB-1135) RAVINDER KUMAR(08-TIB-1166) SHWETANK SINGH(08-TIB-1144) submitted in the partial fulfillment of the requirements for the award of degree of Bachelor of Technology IN Electronics & Communication Engineering

Upload: mdmunnamoin

Post on 13-Apr-2015

77 views

Category:

Documents


4 download

TRANSCRIPT

AUTOMATIC PLANT IRRIGATION SYSTEMA PROJECT REPORT Submitted by

AMIT YADAV(08-TIB-1160) RAHUL DEV(08-TIB-1135) RAVINDER KUMAR(08-TIB-1166) SHWETANK SINGH(08-TIB-1144)submitted in the partial fulfillment of the requirements for the award of degree of

Bachelor of TechnologyIN

Electronics & Communication Engineering

The Technological Institute of Textile and Sciences, Bhiwani

MAHARISHI DAYANAND UNIVERSITY,ROHTAK(2008-12) Department of Electronics and Communication

CERTIFICATE OF APPROVALThe 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)

The Technological Institute of Textile and Sciences, BhiwaniCERTIFICATEThis 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 Technological Institute of Textile and Sciences, Bhiwani 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. Vikram Singh( Project Guide )

Mr. S.K.Jha( Project Coordinator )

Mr. Kamal Sardana( 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. Vikram Sing 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. Kamal Sardana ,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. S. K. Jha) ,who stood by us and helped in every way possible during the completion of this project.

Amit Yadav(08ec058)

Rahul Dev(08ec026)

Ravinder Kumar(08ec028)

Shwetank Singh(08ec041)

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.

TABLE OF CONTENTSAbstract TITLE 1. INTRODUCTION 2. WORKING 2.1 CIRCUIT DIAGRAM 2.2 CIRCUIT DESCRIPTION 2.2.1 COMPONENT LIST

2.2.2 COMPONENT DESRIPTION 2.3 INTRODUCTION TO 8051 CONTROLLER 2.4 BASICS OF CONTROLLER 2.5 BLOCK DIAGRAM OF 8051 2.6 WORKING OF PROJECT 3. PROCEDURE ADOPTED 3.1 PCB DESIGNING 3.2 COMPONENT MOUNTING ON PCB 3.2.1 TOOLS USED 3.3 BURNING HEX CODE TO MICROCONTROLLER 3.3.1 SOFTWARE USED 3.3.2 C PROGRAM FILE 4. APPLICATIONS 5. REFERENCES 6. EXTENTIONS IN THE PROJECT FOR 8th SEMESTER

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 DTMF .

WORKING CIRCUIT DIAGRAMS: 1). MICROCONTROLLER UNIT

2).POWER SUPPLY UNIT

3).SENSOR CKT. DIAGRAMS

CIRCUIT DESCRIPTION COMPONENT S LIST Transformer Voltage Regulator Op-amp Crystal oscillator Diode 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) LCD Stepper motor Relay Microcontroller ULN Water pump Switches Power cables & ribbon wires : 16 x 2 : step angle 7.5 degree, +12V : 220V/3-4A : AT89S52 : ULN 2003 : Step down transformer (220/12) : IC 7805 : LM741 : 11.0592 M Hz : IN 4007

COMPONENT DESCRIPTIONSTEP 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

OP-AMP An operational amplifier ("op-amp") is a DC-coupled high-gain electronic voltage amplifier with a differential input and, usually, a single-ended output. An op-amp produces an output voltage that is typically hundreds of thousands times larger than the voltage difference between its input terminals. Operational amplifiers are important building blocks for a wide range of electronic circuits. They had their origins in analog computers where they were used in many linear, non-linear and frequency-dependent circuits. Their popularity in circuit design largely stems from the fact that characteristics of the final op-amp circuits with negative feedback (such as their gain) are set by external components with little dependence on temperature changes and manufacturing variations in the op-amp itself. Op-amps are among the most widely used electronic devices today, being used in a vast array of consumer, industrial, and scientific devices. Many standard IC op-amps cost only a few cents in moderate production volume; however some integrated or hybrid operational amplifiers with special performance specifications may cost over $100 US in small quantities. Op-amps may be packaged as components, or used as elements of more complex integrated circuits. The op-amp is one type of differential amplifier. Other types of differential amplifier include the fully differential amplifier (similar to the op-amp, but with two outputs), the instrumentation amplifier (usually built from three op-amps), the isolation amplifier (similar to the

instrumentation amplifier, but with tolerance to common-mode voltages that would destroy an ordinary op-amp), and negative feedback amplifier (usually built from one or more op-amps and a resistive feedback network). PIN CONFIGURATION

CIRCUIT NOTATION

V+: non-inverting input V: inverting input Vout: output VS+: positive power supply VS: negative power supply

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

LCD

Liquid Crystal Display Liquid crystal displays (LCD) are widely used in recent years as compares to LEDs. This is due to the declining prices of LCD, the ability to display numbers, characters and graphics, incorporation of a refreshing controller into the LCD, their by relieving the CPU of the task of refreshing the LCD and also the ease of programming for characters and graphics. HD 44780 based LCDs are most commonly used. LCD pin description The LCD discuss in this section has the most common connector used for the Hitatchi 44780 based LCD is 14 pins in a row and modes of operation and how to program and interface with microcontroller is describes in this section. D7 The voltage VCC and VSS provided by +5V and ground respectively while VEE is used for controlling LCD contrast. Variable voltage between Ground and Vcc is used to specify the contrast (or "darkness") of the characters on the LCD screen. RS (register select) There are two important registers inside the LCD. The RS pin is used for their selection as

follows. If RS=0, the instruction command code register is selected, then allowing to user to send a command such as clear display, cursor at home etc.. If RS=1, the data register is selected, allowing the user to send data to be displayed on the LCD. R/W (read/write) The R/W (read/write) input allowing the user to write information from it. R/W=1, when it read and R/W=0, when it writing. EN (enable) The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high power, a high-to-low pulse must be applied to this pin in order to for the LCD to latch in the data presented at the data pins. D0-D7 (data lines) The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCDs internal registers. To displays the letters and numbers, we send ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making RS =1. There are also command codes that can be sent to clear the display or force the cursor to the home position or blink the cursor. We also use RS =0 to check the busy flag bit to see if the LCD is ready to receive the information. The busy flag is D7 and can be read when R/W =1 and RS =0, as follows: if R/W =1 and RS =0, when D7 =1(busy flag =1), the LCD is busy taking care of internal operations and will not accept any information. When D7 =0, the LCD is ready to receive new information. CODES COMMAND TO LCD INSTRUCTION (HEX) 1 2 4 6 5 7 8 A C 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

E F 10 14 18 1C 80 C0 38

Display on, cursor blinking Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to the left Shift the entire display to the right Force cursor to beginning of 1st line Force cursor to beginning of 2nd line 2 line and 5x 7 matrix

Pin Symbol I/O Description 1 VSS - Ground 2 VCC - +5V power supply 3 VEE - Power supply to control contrast 4 RS I RS=0 to select command register, RS=1 to select data register. 5 R/W I R/W=0 for write, R/W=1 for read 6 E I/O Enable 7 PB0 I/O The 8 bit data bus 8 PB1 I/O The 8 bit data bus 9 DB2 I/O The 8 bit data bus 10 DB3 I/O The 8 bit data bus 11 DB4 I/O The 8 bit data bus 12 DB5 I/O The 8 bit data bus 13 DB6 I/O The 8 bit data bus 14 DB7 I/O The 8 bit data bus

STEPPER MOTOR Motion Control, in electronic terms, means to accurately control the movement of an object based on either speed, distance, load, inertia or a combination of all these factors. There are numerous types of motion control systems, including; Stepper Motor, Linear Step Motor, DC Brush, Brushless, Servo, Brushless Servo and more.

A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. Stepper motor is a form of ac. motor .The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. For every input pulse, the motor shaft turns through a specified number of degrees, called a step. Its working principle is one step rotation for one input pulse. The range of step size may vary from 0.72 degree to 90 degree. In position control application, if the number of input pulses sent to the motor is known, the actual position of the driven job can be obtained. A stepper motor differs from a conventional motor (CM) as under: a. Input to SM is in the form of electric pulses whereas input to a CM is invariably from a constant voltage source. b. A CM has a free running shaft whereas shaft of SM moves through angular steps. c. In control system applications, no feedback loop is required when SM is used but a feedback loop is required when CM is used. d. A SM is a digital electromechanical device whereas a CM is an analog electromechanical device .

Step Angle & Steps per Revolution Movement associated with a single step, depends on the internal construction of the motor, in particular the number of teeth on the stator and the rotor. The step angle is the minimum degree of rotation associated with a single step. Step per revolution is the total number of steps needed to rotate one complete rotation or 360

degrees (e.g., 180 steps * 2 degree = 360) Since the stepper motor is not ordinary motor and has four separate coils, which have to be energized one by one in a stepwise fashion. We term them as coil A, B, C and D. At a particular instant the coil A should get supply and then after some delay the coil B should get a supply and then coil C and then coil D and so on the cycle continues. The more the delay is introduced between the energizing of the coils the lesser is the speed of the stepper motor and vice versa.

RELAY The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energised, by passing current through it, the core becomes temporarily magnetised. The magnetised core attracts the iron armature. The armature is pivoted which causes it to operate one or more sets of contacts.When the coil is de-energised the armature and contacts are released. The coil can be energised from a low power source such as a transistor while the contacts can switch high powers such as the mains supply. The relay can also be situated remotely from the control source. Relays can generate a very high voltage across the coil when switched off.This can damage other components in the circuit. To prevent this a diode is connected across the coil. As there are always some chances of high voltage spikes back from the switching circuit i.e. heater so an optocoupler/isolator MCT2e is used. It provides and electrical isolation between the microcontroller and the heater. MCT2e is a 6-pin IC with a combination of optical transmitter LED and an optical receiver as phototransistor. Microcontroller is connected to pin no 2 of MCT2e through a 470-ohm resistor. Pin no.1 is given +5V supply and pin no.4 is grounded. To handle the current drawn by the heater a power transistor BC-369 is used as a current driver. Pin no.5 of optocoupler is connected to the base of transistor. It takes all its output to Vcc and activates the heater through relay circuit. The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energized, by passing current through it, the core becomes temporarily magnetized. The magnetized core attracts the iron armature. The armature is pivoted which causes it to operate one or more sets of contacts. When the coil is de-energised the armature and contacts are released. Relays can generate a very high voltage across the coil when switched off. This can damage other components in the circuit. To

prevent this a diode is connected across the coil. Relay has five points. Out of the 2 operating points one is permanently connected to the ground and the other point is connected to the collector side of the power transistor. When Vcc reaches the collector side i.e. signal is given to the operating points the coil gets magnetized and attracts the iron armature. The iron plate moves from normally connected (NC) position to normally open (NO) position. Thus the heater gets the phase signal and is ON. To remove the base leakage voltage when no signal is present a 470-ohm resistance is used.

ULN 2003A

I.

SEVEN DARLINGTONS PER PACKAGE OUTPUT CURRENT 500mA PER DRIVER

II. III. IV. V.

(600mA PEAK) OUTPUT VOLTAGE 50V INTEGRATED SUPPRESSION DIODES FOR INDUCTIVE LOADS OUTPUTS CAN BE PARALLELED FOR HIGHER CURRENT TTL/CMOS/PMOS/DTL COMPATIBLE INPUTS INPUTS PINNED OPPOSITE OUTPUTS TO SIMPLIFY LAYOUT

DESCRIPTION

PIN CONFIGURATION

The ULN2001A, ULN2002A, ULN2003 andULN2004A are high voltage, high current darlington arrays each containing seven open collector darlingtonpairs with common emitters. Each channel rated at 500mA and can withstand peak currents of 600mA. Suppression diodes are included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout. The four versions interface to all common logic families a) ULN2001A General Purpose, DTL, TTL, PMOS,CMOS b) ULN2002A 14-25V PMOS c) ULN2003A 5V TTL, CMOS d) ULN2004A 615V CMOS, PMOS These versatile devices are useful for driving a wide range of loads including solenoids, relays DC motors, LED displays filament lamps, thermal printheads and high power buffers. The ULN2001A/2002A/2003A and 2004A are supplied in 16 pin plastic DIP packages with a copper leadframe to reduce thermal resistance. They are available also in small outline package (SO-16) as ULN2001D/2002D/2003D/2004D.

INTRODUCTION TO 8051 CONTROLLERThe 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 CONTROLLERBefore 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 PROJECTThe 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.

PROCEDURE ADOPTED PCB DESIGNINGSTEPS TO DESIGN PCB 1. LAYOUT PREPARATION Prepare the layout of the circuit diagram using software Proteus 7.1 / Express PCB. Take the print out of layout on transparent sheet or butter paper in inverted format. 2. LAYOUT IMPRESSION ON CLAD BORD Take the impression of layout on Clad board using carbon paper or electric iron. 3. ETCHING Now dip the clad board having printed layout into the etch solution. The etch solution removes the unwanted copper . Now we are able to get the required layout printed on PCB in the form of copper. 4. TESTING Now test the tracks using multimeter. 5. DRILLING/PUNCHING Now drill the required holes for component mounting.

LAYOUTS:

MIVROCONTROLLER UNIT LAYOUT

SENSOR LAYOUT

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 USEDKEIL 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 accurately on-chip

Debugger simulates

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.

PROLOAD V4.1 Burn the hex file to microcontroller using the Proload V4.1 software. Steps:

1. Connect the burner to PC using serial communication port 2. Browse the hex file . 3. Now burn the hex file to microcontroller using send command.

C PROGRAM FILE#include #include # define DATA P1 sbit e=P3^7; sbit rw=P3^6; sbit rs=P3^5; sbit s1=P2^0; sbit s2=P2^1; sbit s3=P2^2; sbit relay=P0^6; sbit s4=P2^3; void mov_stepper(unsigned char dir,unsigned char rot) { while(rot>0) { if(dir=='c') { P0=0X08; ms_delay(5);

P0=0X04; ms_delay(5); P0=0X02; ms_delay(5); P0=0X01; ms_delay(5); } if(dir=='a') { P0=0X01; ms_delay(5); P0=0X02; ms_delay(5); P0=0X04; ms_delay(5); P0=0X08; ms_delay(5); } rot--; } } void lcd_cmd(unsigned char temp) { DATA=temp; rs=0; rw=0; e=1; ms_delay(5); e=0; ms_delay(5); }

void lcd_data(unsigned char temp) { DATA=temp; rs=1; rw=0; e=1; ms_delay(5); e=0; ms_delay(5); } void lcd_init() { lcd_cmd(0x38); lcd_cmd(0x06); lcd_cmd(0x0e); lcd_cmd(0x01); lcd_cmd(0x80); } void lcd_puts(unsigned char *s) { lcd_init(); while(*s!='\0') { lcd_data(*s); s++; } }

void main() { P0=0X00; P2=0X00;

while(1) { if(s1==1) { mov_stepper('c',3); lcd_puts("FIELD A"); while(s1!=0) { relay=1;

} relay=0; mov_stepper('a',3); lcd_puts("MONITORING"); } if(s2==1) { mov_stepper('c',6); lcd_puts("FIELD B"); while(s2!=0) { relay=1;

} relay=0; mov_stepper('a',6); lcd_puts("MONITORING"); } if(s3==1) { mov_stepper('a',9);

lcd_puts("FIELD C"); while(s3!=0) { relay=1;

} relay=0; mov_stepper('c',9); lcd_puts("MONITORING"); } if(s4==1) {

lcd_puts("FIELD D"); while(s4!=0) { relay=1;

} relay=0;

lcd_puts("MONITORING"); } lcd_puts("MONITORING"); } }

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

REFERENCESMuhammad Ali Mazidi , The 8051 Microcontroller & Embedded Systems .

EXTENTIONS IN THE PROJECTThe 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.