75600403 automatic-plant-irrigation-system


Published on

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

75600403 automatic-plant-irrigation-system

  1. 1. 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 The Technological Institute of Textile and Sciences, Bhiwani MAHARISHI DAYANAND UNIVERSITY,ROHTAK (2008-12) Department of Electronics and Communication
  2. 2. CERTIFICATE OF APPROVALThe foregoing project work report entitled “AUTOMATIC PLANTIRRIGATION SYSTEM” is a hereby approved as a creditable work and hasbeen presented in a satisfactory manner to warrant its acceptance as prerequisite tothe degree for which it has been submitted.It is understood that for this approval ,the undersigned do not necessarily endorseany conclusion drawn or opinion expressed therein, but approve the project workfor the purpose for which it is submitted.(Internal Examiner) (External Examiner) (Head of the Department)
  3. 3. The Technological Institute of Textile and Sciences, Bhiwani CERTIFICATEThis is to certify that the work presented in the project report entitled“AUTOMATIC PLANT IRRIGATION SYSTEM” in the partial fulfillmentof the requirement for the award of Degree of Bachelor of Technology inElectronics and Communication of The Technological Institute of Textile andSciences, Bhiwani is an authentic work carried out under my supervision andguidance.To the best of my knowledge ,the content of this project work not form a basis forthe award of any previous Degree to any one else.Date:Mr. Vikram Singh Mr. S.K.Jha( Project Guide ) ( Project Coordinator ) Mr. Kamal Sardana ( Head of the Department )
  4. 4. ACKNOWLEDGEMENTKnowledge is an experience gained in life. It is the choicest possession,which should not beshelved but should be happily shared with others. In this regard We are extremely fortunate inhaving Mr. Vikram Sing as my project guide .It was he ,who provided proper direction in thecompletion of this project work.I have often been guilty of encroaching upon the privacy of this home but not even once We weredisappointed .His willingness to share his experience and spontaneous suggestion on anyproblem encourage me tremendously to achieve my goal .We are sure his directive will show usthe 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 andblessing of our mother and sister.Last but not the least ,words can hardly express our heartfelt gratitude towards our projectcoordinator(Mr. S. K. Jha) ,who stood by us and helped in every way possible during thecompletion of this project.Amit Yadav(08ec058)Rahul Dev(08ec026)Ravinder Kumar(08ec028)Shwetank Singh(08ec041)
  5. 5. ABSTRACTThe project we have undertaken is “Automatic Plant Irrigation System”. Thisproject is taken up as India is an agriculture oriented country and the rate at whichwater resources are depleting is a dangerous threat hence there is a need of smartand efficient way of irrigation. In this project we have implemented sensors whichdetect the humidity in the soil (agricultural field) and supply water to the fieldwhich has water requirement. The project is 8051 microcontroller based designwhich controls the water supply and the field to be irrigated. There are sensorspresent in each field which are not activated till water is present on the field. Oncethe field gets dry sensors sense the requirement of water in the field and send asignal to the microcontroller. Microcontroller then supply water to that particularfield which has water requirement till the sensors is deactivated again. In case,when there are more than one signal for water requirement then the microcontrollerwill prioritize the first received signal and irrigate the fields accordingly.
  7. 7. INTRODUCTIONIn the fast paced world human beings require everything to be automated. Our lifestyle demands everything to be remote controlled. Apart from few things man hasmade his life automated. And why not ? In the world of advance electronics, life ofhuman beings should be simpler hence to make life more simpler and convenient,we have made “AUTOMATIC PLANT IRRIGATION SYSTEM”. A model ofcontrolling irrigation facilities to help millions of people. This model uses sensortechnology with microcontroller to make a smart switching device .The model shows the basic switching mechanism of Water motor/pump usingsensors from any part of field by sensing the moisture present in the soil. Our basicmodel can be extended to any level of switching & controlling by using DTMF .
  10. 10. CIRCUIT DESCRIPTION COMPONENT S LISTTransformer : Step down transformer (220/12)Voltage Regulator : IC 7805Op-amp : LM741Crystal oscillator : 11.0592 M HzDiode : IN 4007LEDResistor : 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 : 16 x 2Stepper motor : step angle 7.5 degree, +12VRelay : 220V/3-4AMicrocontroller : AT89S52ULN : ULN 2003Water pumpSwitchesPower cables & ribbon wires
  11. 11. 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 7805This is most common voltage regulator that is still used in embedded designs. LM7805 voltageregulator is a linear regulator made by several manufacturers like Fairchild, or STMicroelectronics. They can come in several types of packages. For output current up to 1A theremay 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 alsohave Thermal overload protection, Short circuit protection.
  12. 12. If your design won’t exceed 0.1A current you may chose regulator LM78L05 with smallerpackages and lower maximum current up to 0.1A. They come in three main types of packagesSO-8, SOT-89 and TO-92OP-AMPAn operational amplifier ("op-amp") is a DC-coupled high-gain electronic voltage amplifierwith a differential input and, usually, a single-ended output. An op-amp produces an outputvoltage that is typically hundreds of thousands times larger than the voltage difference betweenits input terminals.Operational amplifiers are important building blocks for a wide range of electronic circuits. Theyhad their origins in analog computers where they were used in many linear, non-linear andfrequency-dependent circuits. Their popularity in circuit design largely stems from the fact thatcharacteristics of the final op-amp circuits with negative feedback (such as their gain) are set byexternal components with little dependence on temperature changes and manufacturingvariations in the op-amp itself.Op-amps are among the most widely used electronic devices today, being used in a vast array ofconsumer, industrial, and scientific devices. Many standard IC op-amps cost only a few cents inmoderate production volume; however some integrated or hybrid operational amplifiers withspecial performance specifications may cost over $100 US in small quantities. Op-amps may bepackaged 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 thefully differential amplifier (similar to the op-amp, but with two outputs), the instrumentationamplifier (usually built from three op-amps), the isolation amplifier (similar to the
  13. 13. instrumentation amplifier, but with tolerance to common-mode voltages that would destroy anordinary op-amp), and negative feedback amplifier (usually built from one or more op-amps anda resistive feedback network).PIN CONFIGURATIONCIRCUIT NOTATION  V+: non-inverting input  V−: inverting input  Vout: output  VS+: positive power supply  VS−: negative power supply
  14. 14. CRYSTAL OSCILLATOR IMAGE SYMBOLA crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of avibrating crystal of piezoelectric material to create an electrical signal with a very precisefrequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), toprovide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radiotransmitters and receivers. The most common type of piezoelectric resonator used is the quartzcrystal, 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 ofmegahertz. More than two billion (2×109) crystals are manufactured annually. Most are used forconsumer devices such as wristwatches, clocks, radios, computers, and cellphones. Quartzcrystals are also found inside test and measurement equipment, such as counters, signalgenerators, and oscilloscopes.DIODESYMBOL
  15. 15. The 1N4007 series (or 1N4000 series) is a family of popular 1.0 amp general purpose siliconrectifier diodes commonly used in AC adapters for common household appliances. Blockingvoltage 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. Thesediodes come in the larger DO-201 axial package.These are fairly low-speed rectifier diodes, being inefficient for square waves of more than 15kHz. The series was second sourced by many manufacturers. The 1N4000 series were in theMotorola Silicon Rectifier Handbook in 1966, as replacements for 1N2609 through 1N2617. The1N5400 series were announced in Electrical Design News in 1968, along with the now lesserknown 1.5-ampere 1N5391 series.These devices are widely used and recommended. The table below shows the maximumrepetitive reverse blocking voltages of each of the members of the 1N4000 and 1N5400 seriesIMAGE OF DIODESLEDA light-emitting diode (LED) is a semiconductor device that emits visible light when an electriccurrent passes through it. The light is not particularly bright, but in most LEDs it ismonochromatic, occurring at a single wavelength. The output from an LED can range from red
  16. 16. (at a wavelength of approximately 700 nanometers) to blue-violet (about 400 nanometers). SomeLEDs emit infrared (IR) energy (830 nanometers or longer); such a device is known as aninfrared-emitting diode (IRED). An LED or IRED consists of two elements of processed materialcalled P-type semiconductors and N-type semiconductors. These two elements are placed indirect contact, forming a region called the P-N junction. In this respect, the LED or IREDresembles most other diode types, but there are important differences. The LED or IRED has atransparent package, allowing visible or IR energy to pass through. Also, the LED or IRED has alarge PN-junction area whose shape is tailored to the application.Benefits of LEDsLow 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 inthe desired form, with minimal heat production.Long life: When properly installed, an LED or IRED can function fordecades.RESISTORA resistor is an electrical component that limits or regulates the flow of electrical current in anelectronic circuit. Resistors can also be used to provide a specific voltage for an active devicesuch as a transistor. All other factors being equal, in a direct-current (DC) circuit, the currentthrough a resistor is inversely proportional to its resistance, and directly proportional to thevoltage across it. This is the well-known Ohms Law. In alternating-current (AC) circuits, thisrule also applies as long as the resistor does not contain inductance or capacitance.
  17. 17. Resistors can be fabricated in a variety of ways. The most common type inelectronic devices andsystems is the carbon-composition resistor. Finegr anulated carbon (graphite) is mixed with clayand 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 carbon-composition 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 affectperformance in DC circuits, but can have an adverse effect in AC circuits because inductancerenders the device sensitive to changes in output.CAPACITORA 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 maintainan electric charge. There are several types of insulators used in capacitors. Examples include
  18. 18. 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 isoften used to store analogue signals and digital data. Another type of capacitor is used in thetelecommunications equipment industry. This type of capacitor is able to adjust the frequencyand tuning of telecommunications equipment and is often referred to a variable capacitor. Acapacitor is also ideal for storing an electron. A capacitor cannot, however, make electrons. Acapacitor measures in voltage, which differs on each of the two interior plates. Both plates of thecapacitor 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, oneof the two plates becomes filled with a steady flow of current. At the same time, the currentflows away from the other plate. To understand the flow of voltage in a capacitor, it is helpful tolook at naturally occurring examples. Lightning, for example, is similar to a capacitor. The cloudrepresents one of the plates and the ground represents the other. The lightning is the chargingfactor moving between the ground and the cloud.IMAGE OF ELECTROLYTIC CAPACITORUNPOLARISED / CERAMIC CAPACITORSA non-polarized ("non polar") capacitor is a type of capacitor that has no implicit polarity -- itcan be connected either way in a circuit. Ceramic, mica and some electrolytic capacitors are non-polarized. Youll also sometimes hear people call them "bipolar" capacitors. SYMBOL
  19. 19. IMAGE OF CERAMIC CAPACITORLCDLiquid Crystal DisplayLiquid crystal displays (LCD) are widely used in recent years as compares to LEDs. This is dueto 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 ofrefreshing the LCD and also the ease of programming for characters and graphics. HD 44780based LCDs are most commonly used.LCD pin descriptionThe LCD discuss in this section has the most common connector used for the Hitatchi 44780based LCD is 14 pins in a row and modes of operation and how to program and interface withmicrocontroller is describes in this section.D7The voltage VCC and VSS provided by +5V and ground respectively while VEE is used forcontrolling LCD contrast. Variable voltage between Ground and Vcc is used to specify thecontrast (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
  20. 20. follows. If RS=0, the instruction command code register is selected, then allowing to user to senda 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 readand 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 issupplied to data pins, a high power, a high-to-low pulse must be applied to this pin in order to forthe 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 theLCD„s internal registers. To displays the letters and numbers, we send ASCII codes for theletters A-Z, a-z, and numbers 0-9 to these pins while making RS =1. There are also commandcodes that can be sent to clear the display or force the cursor to the home position or blink thecursor. We also use RS =0 to check the busy flag bit to see if the LCD is ready to receive theinformation. 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 internaloperations and will not accept any information. When D7 =0, the LCD is ready to receive newinformation.CODES COMMAND TO LCD INSTRUCTION(HEX) Register1 Clear display screen2 Return home4 Decrement cursor(shift cursor to left)6 Increment cursor(shift cursor to right)5 Shift display right7 Shift display left8 Display off, cursor offA Display off, cursor onC Display on, cursor off
  21. 21. E Display on, cursor blinkingF Display on, cursor blinking10 Shift cursor position to left14 Shift cursor position to right18 Shift the entire display to the left1C Shift the entire display to the right80 Force cursor to beginning of 1st lineC0 Force cursor to beginning of 2nd line38 2 line and 5x 7 matrixPin Symbol I/O Description1 VSS - Ground2 VCC - +5V power supply3 VEE - Power supply to control contrast4 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 read6 E I/O Enable7 PB0 I/O The 8 bit data bus8 PB1 I/O The 8 bit data bus9 DB2 I/O The 8 bit data bus10 DB3 I/O The 8 bit data bus11 DB4 I/O The 8 bit data bus12 DB5 I/O The 8 bit data bus13 DB6 I/O The 8 bit data bus14 DB7 I/O The 8 bit data busSTEPPER MOTORMotion Control, in electronic terms, means to accurately control the movement of an objectbased on either speed, distance, load, inertia or a combination of all these factors. There arenumerous types of motion control systems, including; Stepper Motor, Linear Step Motor, DCBrush, Brushless, Servo, Brushless Servo and more.
  22. 22. A stepper motor is an electromechanical device which converts electrical pulses into discretemechanical movements. Stepper motor is a form of ac. motor .The shaft or spindle of a steppermotor rotates in discrete step increments when electrical command pulses are applied to it in theproper sequence. The motors rotation has several direct relationships to these applied inputpulses. The sequence of the applied pulses is directly related to the direction of motor shaftsrotation. The speed of the motor shafts rotation is directly related to the frequency of the inputpulses 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, calleda step. Its working principle is one step rotation for one input pulse. The range of step size mayvary from 0.72 degree to 90 degree. In position control application, if the number of input pulsessent 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 aconstant 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 afeedback loop is required when CM is used.d. A SM is a digital electromechanical device whereas a CM is an analog electromechanicaldevice .Step Angle & Steps per RevolutionMovement associated with a single step, depends on the internal construction of the motor, inparticular the number of teeth on the stator and the rotor. The step angle is the minimum degreeof rotation associated with a single step.Step per revolution is the total number of steps needed to rotate one complete rotation or 360
  23. 23. degrees (e.g., 180 steps * 2 degree = 360)Since the stepper motor is not ordinary motor and has four separate coils, which have tobe energized one by one in a stepwise fashion. We term them as coil A, B, C and D. At aparticular instant the coil A should get supply and then after some delay the coil B should get asupply and then coil C and then coil D and so on the cycle continues. The more the delay isintroduced between the energizing of the coils the lesser is the speed of the stepper motor andvice versa.RELAYThe electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form anelectromagnet. When the coil is energised, by passing current through it, the core becomestemporarily magnetised. The magnetised core attracts the iron armature. The armature is pivotedwhich causes it to operate one or more sets of contacts.When the coil is de-energised thearmature and contacts are released. The coil can be energised from a low power source such as atransistor while the contacts can switch high powers such as the mains supply. The relay can alsobe situated remotely from the control source. Relays can generate a very high voltage across thecoil when switched off.This can damage other components in the circuit. To prevent this a diodeis 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 themicrocontroller and the heater. MCT2e is a 6-pin IC with a combination of optical transmitterLED and an optical receiver as phototransistor. Microcontroller is connected to pin no 2 ofMCT2e through a 470-ohm resistor. Pin no.1 is given +5V supply and pin no.4 is grounded. Tohandle the current drawn by the heater a power transistor BC-369 is used as a current driver. Pinno.5 of optocoupler is connected to the base of transistor. It takes all it„s output to Vcc andactivates 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 currentthrough it, the core becomes temporarily magnetized. The magnetized core attracts the ironarmature. The armature is pivoted which causes it to operate one or more sets of contacts. Whenthe coil is de-energised the armature and contacts are released. Relays can generate a very highvoltage across the coil when switched off. This can damage other components in the circuit. To
  24. 24. prevent this a diode is connected across the coil. Relay has five points. Out of the 2 operatingpoints one is permanently connected to the ground and the other point is connected to thecollector side of the power transistor. When Vcc reaches the collector side i.e. signal is given tothe operating points the coil gets magnetized and attracts the iron armature. The iron plate movesfrom normally connected (NC) position to normally open (NO) position. Thus the heater gets thephase signal and is ON. To remove the base leakage voltage when no signal is present a 470-ohmresistance is used.ULN 2003A I. SEVEN DARLINGTONS PER PACKAGE OUTPUT CURRENT 500mA PER DRIVER II. (600mA PEAK)III. OUTPUT VOLTAGE 50V INTEGRATED SUPPRESSION DIODES FORIV. INDUCTIVE LOADS OUTPUTS CAN BE PARALLELED FOR HIGHER CURRENT V. TTL/CMOS/PMOS/DTL COMPATIBLE INPUTS INPUTS PINNED OPPOSITE OUTPUTS TO SIMPLIFY LAYOUT
  25. 25. DESCRIPTION PIN CONFIGURATIONThe ULN2001A, ULN2002A, ULN2003 andULN2004A are high voltage, high currentdarlingtonarrays each containing seven open collector darlingtonpairs with common emitters. Each channelrated at 500mA and can withstand peak currents of 600mA. Suppression diodes are included forinductive 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 6–15V CMOS, PMOSThese versatile devices are useful for driving a wide range of loads including solenoids, relaysDC motors, LED displays filament lamps, thermal printheads and high power buffers. TheULN2001A/2002A/2003A and 2004A are supplied in 16 pin plastic DIP packages with a copperleadframe to reduce thermal resistance. They are available also in small outline package (SO-16)as ULN2001D/2002D/2003D/2004D.
  26. 26. INTRODUCTION TO 8051 µCONTROLLERThe Intel 8051 is an 8-bit microcontroller which means that most available operations are limitedto 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short andStandard chips are often available in DIP (dual in-line package) form, but the Extended 8051models often have a different form factor, and are not "drop-in compatible". All these things arecalled 8051 because they can all be programmed using 8051 assembly language, and they allshare 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 CONFIGURATIONPIN 9: PIN 9 is the reset pin which is used reset the microcontroller‟s internal registers and portsupon starting up. (Pin should be held high for 2 machine cycles.)
  27. 27. PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect acrystal 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 +5V500mA to function properly, although there are lower powered versions like the Atmel 2051which 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 flashmemory. In order to program this we need to supply a voltage of +12V at pin 31. If externalmemory is connected then PIN 31, also called EA/VPP, should be connected to ground toindicate the presence of external memory. PIN 30 is called ALE (address latch enable), which isused when multiple memory chips are connected to the controller and only one of them needs tobe 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 lowvoltage (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 fora variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additionalfunctions 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 additionalfunctions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counterinputs, 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 noexternal memory is present, but if external memory access is required then PORT P2 will act asan address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15, as can be seen from fig 1.1PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no externalmemory is present, but if external memory access is required then PORT P0 acts as a
  28. 28. multiplexed address and data bus that can be used to access external memory in conjunction withPORT P2. P0 acts as AD0-AD7, PIN DIAGRAM BASICS OF µCONTROLLERBefore actually going through this tutorial let me tell you something about number systems usedin Computer Systems. As you know human know the decimal number system 1,2,3---9, but howwill 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 isnothing but a way of representing a binary number. Similarly we have a ASCII System forinformation 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
  29. 29. is read only memory and data stored in it is permanent. CPU (Central Processing Unit iscombination of ALU Arithmetic Logic Unit & Control Unit. The A.L.U. (Arithmetic and LogicUnit) performs all the calculations.BLOCK DIAGRAMData and Program MemoryThe 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number ofother high-level languages. Many compilers even have support for compiling C++ for an8051.Program memory in the 8051 is read-only, while the data memory is considered to beread/write accessible. When stored on EEPROM or Flash, the program memory can be rewrittenwhen the microcontroller is in the special programmer circuit.Program Start AddressThe 8051 starts executing program instructions from address 0000 in the program memory.Direct MemoryThe 8051 has 256 bytes of internal addressable RAM, although only the first 128 bytes areavailable 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 RegisterThe Special Function Register (SFR) is the upper area of addressable memory, from address0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data orprogram storage, but is instead a series of memory-mapped ports and registers. All port input andoutput 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 the8051, and changing some operational parameters of the 8051.General Purpose RegistersThe 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that thereare essentially 32 available general purpose registers, although only 8 (one bank) can be directlyaccessed at a time. To access the other banks, we need to change the current bank number in theflag status register.
  30. 30. A and B RegistersThe A register is located in the SFR memory location 0xE0. The A register works in a similarfashion to the AX register of x86 processors. The A register is called the accumulator, and bydefault it receives the result of all arithmetic operations. The B register is used in a similarmanner, 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 extrageneral-purpose register. BLOCK DIGRAM OF 8051 µCONTROLLER
  31. 31. WORKING OF PROJECTThe deficiency of water in the field is sensed by the op-amp based sensor. Whenever there isneed of water in the particular field, the high signal(„1‟) appears on the output pin of the sensorof that particular field. The output pins of all the sensors are connected to the PORT 2 ofmicrocontroller. The high signsl(logic 1) from the sensor is entertained by the microcontroller ata particular pin. By knowing the position of the pin on which signal appears , the microcontrollerrotates the water funnel type cup at the desired angle (i.e. 90 ,180 ,270) by using stepper motorconnected 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 ofwatering 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 theprevious angle to bring the funnel cup in its initial position . now uc starts sensing the signal atPORT 2. Whenever there is signal at any pin the uc repeats the above process. So this processcontinues & we get the automatic irrigation the fields by using intelligent device uc 8051. PROCEDURE ADOPTEDPCB DESIGNINGSTEPS TO DESIGN PCB1. 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.
  33. 33. COMPONENTS MOUNTING ON PCBTOOLS USED:Soldering ironA soldering iron is a hand tool most commonly used insoldering. It supplies heat to melt the solder so that it can flowinto the joint between two workpieces.A soldering iron is composed of a heated metal tip and aninsulated handle. Heating is often achieved electrically, bypassing an electric current (supplied through an electrical cord orbattery cables) through the resistive material of a heating element. Another heating methodincludes combustion of a suitable gas, which can either be delivered through a tank mounted onthe iron (flameless), or through an external flame.Less common uses include pyrography (burning designs into wood) and plasticwelding.Soldering irons are most often used for installation, repairs, and limited productionwork. High-volume production lines use other soldering methods.Wire StripperWire stripper is used to strip off wire insulator from its conductor before it is used to connect toanother wire or soldered into the printed circuit board. Some wire stripper or wire cutter has ameasurement engraved on it to indicate the length that will be stripped.Side-Cutting PlierA 4-inch side cutting plier will come in handy as one of theelectronic tools when one need to trim off excess component leadson the printed circuit board. It can also be used to cut wires intoshorter length before being used. Tweezer
  34. 34. Small tweezer is used to hold small components especially when doing soldering and de-soldering of surface mount components.COMPONENT MOUNTINGNow mount all the components on the PCBs using the above mentioned tools. SOFTWARES USEDKEIL uVision 3The Keil 8051 Development Tools are designed to solve the complex problems facing embeddedsoftware 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 (I²C, 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.
  35. 35. 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.1Burn the hex file to microcontroller using the Proload V4.1 software.Steps:
  36. 36. 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<reg51.h>#include<delay.h># define DATA P1sbit 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);
  37. 37. 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);}
  38. 38. 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;
  39. 39. 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);
  40. 40. 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");}}
  42. 42. EXTENTIONS IN THE PROJECTThe working of above project is basically dependent on the output of the humidity sensors. Whenever there isneed of excess water in the desired field(RICE crops) then it will not be possible by using sensor technology. Forthis we will have to adopt the DTMF technology. By using this we will be able to irrigate the desired field & indesired amount.This technology will be implemented in this project in the next (8th ) semester . this will be our extention to theproject for the the next semester.