Вы находитесь на странице: 1из 78

MONITOR AND CONTROL OF GREEN HOUSE

ENVIRONMENT
A PROJECT REPORT

Submitted in partial fulfillment of the requirements for the award of the degree of

DIPLOMA
IN

ELECTRICAL AND ELECTRONICS ENGINEERING


By

VODUGU VENKATESH VARMA

(15352-EE-054)

SANDEEP PAMARTHI (15352-EE-038) KAJA SHAIK (15352-EE-042)

SATISH KANTA (15352-EE-002) IMRAN GALIB SYED (15352-EE-049)

SUSHMA (15352-EE-002) SRILAKSHMI (15352-EE-002)

SAICHARAN KOLAKALETI (15352-EE-002) SRIKANTH (15352-EE-002)

Under the guidance of

Mr. JAMPANA SRIKANTH B.Tech.


Assistant Lecturer

DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY

Affiliated to JNTU Kakinada, Approved by AICTE, New Delhi


GANGURU-521139
2017-2018
ACKNOWLEDGEMENT
First and foremost we sincerely salute our esteemed institution DHANEKULA
INSTITUTE OF ENGINEERING AND TECHNOLOGY for giving this golden opportunity for
fulfilling our warm dreams of becoming engineer.

I hereby express our sincere gratitude to our incharge Mr. M PRAVEEN M.Tech, who has
rendered his constant encouragement and valuable suggestions in making my project report successful.

We are also thankful to Mrs. D Hema M.Tech, (PhD) Head of Electrical and Electronics
Engineering Department for her constant encouragement and valuable support throughout the course
of our project.

We are glad to express our deep sense of gratitude to Mr. J Srikanth B.Tech Assistant
Lecturer, our guide for his guidance and co-operation in completing this project report.

We thank one and all who have rendered help to us directly or indirectly in the completion of
this project report.

Project Associates.....

VODUGU VENKATESH VARMA (15352-EE-054)

SANDEEP PAMARTHI (15352-EE-038)

KAJA SHAIK (15352-EE-042)

SATISH KANTA (15352-EE-039)

IMRAN GALIB SYED (15352-EE-049)

SUSHMA (15352-EE-047)

SRILAKSHMI (15352-EE-046)

SAICHARAN KOLAKALETI (15352-EE-036)

SRIKANTH (14352-EE-051)
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

Contents
ABSTRACT...........................................................................................................................1
CURRENT SCENARIO...........................................................................................................2
MANUAL SET-UP:..........................................................................................................................2
PARTIALLY AUTOMATED SET-UP.....................................................................................................2
FULLY- AUTOMATED:.....................................................................................................................2
PROPOSED MODEL FOR AUTOMATION OF GREENHOUSE..............................................................2

SYSTEM MODEL..................................................................................................................4
PARTS OF THE SYSTEM:.................................................................................................................6
TRANSDUCERS (Data acquisition system):......................................................................................................6
ANALOG TO DIGITAL CONVERDER (ADC):........................................................................................................7
MICROCONTROLLER:........................................................................................................................................7
ACTUATORS:.....................................................................................................................................................7
DISPLAY UNIT:...................................................................................................................................................7

STEPS FOLLOWED IN DESIGNING THE SYSTEM:..............................................................................8

HARDWARE DESCRIPTION...................................................................................................9
TRANSDUCERS:............................................................................................................................10
SOIL MOISTURE SENSOR.............................................................................................................10
LIGHT SENSOR.............................................................................................................................12
HUMIDITY SENSOR......................................................................................................................15
TEMPERATURE SENSOR...............................................................................................................18

MICROCONTROLLER 89C52...............................................................................................20
FEATURES:....................................................................................................................................20
PIN DIAGRAM AND ITS DESCRIPTION:.........................................................................................20
THE ON-CHIP OSCILLATORS (CRYSTAL OSCILLATOR)......................................................................25
Program Memory Lock Bits:.........................................................................................................26
Program Counter and Data Pointer:.............................................................................................26
A & B Registers:...........................................................................................................................26
Flags and the Program Status Word (PSW):..................................................................................27
MEMORY ORGANISATION............................................................................................................27
Internal Memory:...........................................................................................................................................27
Internal RAM:.................................................................................................................................................27

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT
A-D CONVERTER................................................................................................................29
General Description:....................................................................................................................29
Features:......................................................................................................................................29
Key Specifications:.......................................................................................................................30
Functional Description:................................................................................................................31
CONVERTER CHARACTERISTICS:...................................................................................................31

LIQUID CRYSTAL DISPLAY..................................................................................................33


SIGNALS TO THE LCD...................................................................................................................33
PIN DESCRIPTION........................................................................................................................35

RELAYS..............................................................................................................................36
POWER SUPPLY:................................................................................................................39
BLOCK DIAGRAM:........................................................................................................................39

SYSTEMS USED IN WORK MODE........................................................................................42


DRIP IRRIGATION SYSTEM FOR CONTROLLING SOIL MOISTURE.................................................43
ARTIFICIAL GROWING LIGHTS FOR CONTROLLING ILLUMINATION.............................................44
TEMPERATURE CONTROLLERS.....................................................................................................45
HEATING EQUIPMENT..................................................................................................................46
HUMIDIFICATION SYSTEMS.........................................................................................................46

FLOWCHART......................................................................................................................47
FLOWCHART REPRESENTING THE WORKING OF THE SYSTEM:....................................................48

SOFTWARE DESCRIPTION..................................................................................................53
IN-SYSTEM PROGRAMMING:.......................................................................................................54
Programming the Flash – Parallel Mode:.......................................................................................................54
Programming the Flash – Serial Mode:..........................................................................................................55

Power-up sequence:....................................................................................................................55

RESULT ANALYSIS..............................................................................................................56
SOIL MOISTURE SENSOR.............................................................................................................57
LIGHT SENSOR.............................................................................................................................58
HUMIDITY SENSOR......................................................................................................................58
TEMPERATURE SENSOR...............................................................................................................59

ADVANTAGES AND LIMITATIONS........................................................................................61

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT
FUTURE SCOPE..................................................................................................................64
CONCLUSION.............................................................................................................................66

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

ABSTRACT
Appropriate environmental conditions are necessary for optimum plant growth,
improved crop yields, and efficient use of water and other resources. Automating the data
acquisition process of the soil conditions and various climatic parameters that govern plant
growth allows information to be collected at high frequency with less labor requirements. The
existing systems employ PC or SMS-based systems for keeping the user continuously informed
of the conditions inside the greenhouse; but are unaffordable, bulky, difficult to maintain and
less accepted by the technologically unskilled workers.

The objective of this project is to design a simple, easy to install, microcontroller-based


circuit to monitor and record the values of temperature, humidity, soil moisture and sunlight
of the natural environment that are continuously modified and controlled in order optimize
them to achieve maximum plant growth and yield. The controller used is a low power, cost
efficient chip manufactured by ATMEL having 8K bytes of on-chip flash memory. It
communicates with the various sensor modules in real-time in order to control the light,
aeration and drainage process efficiently inside a greenhouse by actuating a cooler, fogger,
dripper and lights respectively according to the necessary condition of the crops. An integrated
Liquid crystal display (LCD) is also used for real time display of data acquired from the various
sensors and the status of the various devices. Also, the use of easily available components
reduces the manufacturing and maintenance costs. The design is quite flexible as the software
can be changed any time. It can thus be tailor-made to the specific requirements of the user.
This makes the proposed system to be an economical, portable and a low maintenance
solution for greenhouse applications, especially in rural areas and for small scale agriculturists.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


1
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

CURRENT SCENARIO
Greenhouses in India are being deployed in the high-altitude regions where the sub- zero
temperature up to -40° C makes any kind of plantation almost impossible and in arid regions
where conditions for plant growth are hostile. The existing set-ups primarily are:

MANUAL SET-UP:
This set-up involves visual inspection of the plant growth, manual irrigation of plants,
turning ON and OFF the temperature controllers, manual spraying of the fertilizers and
pesticides. It is time consuming, vulnerable to human error and hence less accurate and
unreliable.

PARTIALLY AUTOMATED SET-UP:


This set-up is a combination of manual supervision and partial automation and is
similar to manual set-up in most respects but it reduces the labor involved in terms of
irrigating the set-up.

FULLY- AUTOMATED:
This is a sophisticated set-up which is well equipped to react to most of the climatic
changes occurring inside the greenhouse. It works on a feedback system which helps it to
respond to the external stimuli efficiently. Although this set-up overcomes the problems
caused due to human errors it is not completely automated and expensive.

PROPOSED MODEL FOR AUTOMATION OF GREENHOUSE


The proposed system is an embedded system which will closely monitor and control
the microclimatic parameters of a greenhouse on a regular basis round the clock for
cultivation of crops or specific plant species which could maximize their production over the
whole crop growth season and to eliminate the difficulties involved in the system by reducing
human intervention to the best possible extent. The system comprises of sensors, Analog to
Digital Converter, microcontroller and actuators.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


2
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

When any of the above mentioned climatic parameters cross a safety threshold which
has to be maintained to protect the crops, the sensors sense the change and the
microcontroller reads this from the data at its input ports after being converted to a digital
form by the ADC. The microcontroller then performs the needed actions by employing relays
until the strayed-out parameter has been brought back to its optimum level. Since a
microcontroller is used as the heart of the system, it makes the set-up low-cost and effective
nevertheless. As the system also employs an LCD display for continuously alerting the user
about the condition inside the greenhouse, the entire set-up becomes user friendly.

Thus, this system eliminates the drawbacks of the existing set-ups mentioned in the
previous section and is designed as an easy to maintain, flexible and low cost solution.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


3
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

SYSTEM MODEL

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


4
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

BASIC MODEL OF THE SYSTEM

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


5
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

PARTS OF THE SYSTEM:


• Sensors (Data acquisition system)
 Temperature sensor
 Humidity sensor
 Light sensor
 Moisture sensor

• Analog to Digital Converter ( ADC 0808/0809)

• Microcontroller (AT89C52)

• Liquid Crystal Display (Hitachi's HD44780)

• Actuators – Relays

• Devices controlled
 Water Pump
 Sprayer (simulated as a socket)
 Cooler (simulated as a fan)
 Artificial Lights (simulated as a bulb)

• Buzzer

TRANSDUCERS (Data acquisition system):

This part of the system consists of various sensors, namely soil moisture, humidity,
temperature and light. These sensors sense various parameters- temperature, humidity, soil
moisture and light intensity and are then sent to the Analog to Digital Converter.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


6
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT
ANALOG TO DIGITAL CONVERDER (ADC):

The analog parameters measured by the sensors are then converted to corresponding
digital values by the ADC.

MICROCONTROLLER:

The microcontroller is the heart of the proposed embedded system. It constantly


monitors the digitized parameters of the various sensors and verifies them with the
predefined threshold values and checks if any corrective action is to be taken for the
condition at that instant of time. In case such a situation arises, it activates the actuators to
perform a controlled operation.

ACTUATORS:

An array of actuators can be used in the system such as relays, contactors, and change
over switches etc. They are used to turn on AC devices such as motors, coolers, pumps,
fogging machines, sprayers. For the purpose of demonstration relays have been used to drive
AC bulbs to simulate actuators and AC devices. A complete working system can be realized
by simply replacing these simulation devices by the actual devices.

DISPLAY UNIT:

A Liquid crystal display is used to indicate the present status of parameters and the
respective AC devises (simulated using bulbs). The information is displayed in two modes
which can be selected using a push button switch which toggles between the modes. Any
display can be interfaced to the system with respective changes in driver circuitry and code.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


7
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT
STEPS FOLLOWED IN DESIGNING THE SYSTEM:

Three general steps can be followed to appropriately select the control system:

Step # 1: Identify measurable variables important to production.

• It is very important to correctly identify the parameters that are going to be measured
by the controller’s data acquisition interface, and how they are to be measured. The
set of variables typically used in greenhouse control is shown below:

Sl. No. Variable to be monitored Its Importance

1 Temperature Affects all plant metabolic functions.

Affects transpiration rate and the plant's thermal


2 Humidity
control mechanisms.

3 Soil moisture Affects salinity, and pH of irrigation water

Affects photosynthetic rate, responsible for most


4 Solar Radiation
thermal load during warm periods

Importance of the various parameters

An electronic sensor for measuring a variable must readily available, accurate, reliable
and low in cost. If a sensor is not available, the variable cannot be incorporated into the
control system, even if it is very important. Many times variables that cannot be directly or
continuously measured can be controlled in a limited way by the system. For example,
fertility levels in nutrient solutions for greenhouse production are difficult to measure
continuously.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


8
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

HARDWARE DESCRIPTION

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


9
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

HARDWARE DESCRIPTION

TRANSDUCERS:
A transducer is a device which measures a physical quantity and converts it into a
signal which can be read by an observer or by an instrument. Monitoring and controlling of a
greenhouse environment involves sensing the changes occurring inside it which can
influence the rate of growth in plants. The parameters which are of importance are the
temperature inside the greenhouse which affect the photosynthetic and transpiration
processes are humidity, moisture content in the soil, the illumination etc. Since all these
parameters are interlinked, a closed loop (feedback) control system is employed in
monitoring it. The sensors used in this system are:

1. Soil Moisture Sensor

2. Light Sensor ( LDR )

3. Humidity Sensor

4. Temperature Sensor

SOIL MOISTURE SENSOR


Features of the Soil moisture sensor:

1. The circuit designed uses a 5V supply, fixed resistance of 100Ω, variable resistance
of 10ΚΩ, two copper leads as the sensor probes, 2N222N transistor.
2. It gives a voltage output corresponding to the conductivity of the soil.

3. The conductivity of soil depends upon the amount of moisture present in it. It
increases with increase in the water content of the soil.
4. The voltage output is taken at the transmitter which is connected to a variable

resistance. This variable resistance is used to adjust the sensitivity of the sensor.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


10
MONITOR AND CONTROL OF GREEN
HOUSE ENVIRONMENT

Functional description of Soil moisture sensor:

The two copper leads act as the sensor probes. They are immersed into the specimen soil
whose moisture content is under test. The soil is examined under three conditions:

Case#1: Dry condition- The probes are placed in the soil under dry conditions and are
inserted up to a fair depth of the soil. As there is no conduction path between the two copper
leads the sensor circuit remains open. The voltage output of the emitter in this case ranges
from 0 to 0.5V.

Case#2: Optimum condition- When water is added to the soil, it percolates through the
successive layers of it and spreads across the layers of soil due to capillary force. This water
increases the moisture content of the soil. This leads to an increase in its conductivity which
forms a conductive path between the two sensor probes leading to a close path for the current
flowing from the supply to the transistor through the sensor probes. The voltage output of the
circuit taken at the emitter of the transistor in the optimum case ranges from 1.9 to 3.4V
approximately.

Case#3: Excess water condition- With the increase in water content beyond the optimum
level, the conductivity of the soil increases drastically and a steady conduction path is
established between the two sensor leads and the voltage output from the sensor increases no
further beyond a certain limit. The maximum possible value for it is not more than 4.2V.

DHANEKULA INSTITUTE OF ENGINEERING AND TECHNOLOGY


11
LIGHT SENSOR

Light Dependent Resistor (LDR) also known as photoconductor or photocell, is a


device which has a resistance which varies according to the amount of light falling on its
surface. Since LDR is extremely sensitive in visible light range, it is well suited for the
proposed application.

Light Dependent Resistor

Features of the light sensor:

• The Light Dependent Resistor (LDR) is made using the semiconductor Cadmium
Sulphide (CdS).
• The light falling on the brown zigzag lines on the sensor causes the resistance of
the device to fall. This is known as a negative co-efficient. There are some LDRs that
work in the opposite way i.e. their resistance increases with light (called positive co-
efficient).
• The resistance of the LDR decreases as the intensity of the light falling on it increases.
Incident photons drive electrons from the valence band into the conduction band.

Structure of a Light Dependent Resistor, showing Cadmium Sulphide track and an


atom to illustrate electrons in the valence and conduction bands
Functional description

• An LDR and a normal resistor are wired in series across a voltage, as shown in the
circuit below. Depending on which is tied to the 5V and which to 0V, the voltage at
the point between them, call it the sensor node, will either rise or fall with increasing
light. If the LDR is the component tied directly to the 5V, the sensor node will
increase in voltage with increasing light

• The LDR's resistance can reach 10 k ohms in dark conditions and about 100 ohms in
full brightness.

• The circuit used for sensing light in our system uses a 10 kΩ fixed resistor which is
tied to +5V. Hence the voltage value in this case decreases with increase in light
intensity.
• The sensor node voltage is compared with the threshold voltages for different levels
of light intensity corresponding to the four conditions- Optimum, dim, dark and night.

• The relationship between the resistance RL and light intensity Lux for a
typical LDR is:
RL = 500 / Lux kΩ

• With the LDR connected to 5V through a 10K resistor, the output voltage of the LDR
is :
Vo = 5*RL / (RL+10)

• In order to increase the sensitivity of the sensor we must reduce the value of the fixed
resistor in series with the sensor. This may be done by putting other resistors in
parallel with it.
HUMIDITY SENSOR

The humidity sensor HIH4000, manufactured by Honeywell is used for sensing the
humidity. It delivers instrumentation quality RH (Relative Humidity) sensing performance in
a low cost, solder able SIP (Single In-line Package). Relative humidity is a measure, in
percentage, of the vapour in the air compared to the total amount of vapour that could be held
in the air at a given temperature.

HIH-4000-001 Humidity Sensor

Features:
• Linear voltage output vs. %RH
• Laser trimmed interchangeability
• Low power design
• High accuracy
• Fast response time
Stable, low drift performance
• Chemically resistant
• The RH sensor is a laser trimmed, thermoset polymer capacitive sensing element with
on-chip integrated signal conditioning. The sensing element's multilayer construction
provides excellent resistance to most application hazards such as wetting, dust, dirt,
oils and common environmental chemicals.
1
Humidity sensor circuit

Functional description

• The sensor develops a linear voltage vs. RH output that is ratiometric to the supply
voltage. That is, when the supply voltage varies, the sensor output voltage follows in
the same proportion. It can operate over a 4-5.8 supply voltage range. At 5V supply
voltage, and room temperature, the output voltage ranges from 0.8 to 3.9V as the
humidity varies from 0% to 100% (noncondensing).
• The humidity sensor functions with a resolution of up to 0.5% of relative humidity
(RH).
• With a typical current draw of only 200 µA, the HIH-4000 Series is ideally suited for
low drain, battery operated systems.
• The change in the RH of the surroundings causes an equivalent change in the voltage
output. The output is an analog voltage proportional to the supply voltage.
Consequently, converting it to relative humidity (RH) requires that both the supply
and sensor output voltages be taken into account according to the formula:

RH = ((Vout / Vsupply) – 0.16) /0.0062, typical at 25°C ….(4.3)

• This voltage is converted to the digital form by the ADC and then sent as input to the
microcontroller which reads the data.
TEMPERATURE SENSOR

National Semiconductor’s LM35 IC has been used for sensing the temperature. It is
an integrated circuit sensor that can be used to measure temperature with an electrical output
o
proportional to the temperature (in C). The temperature can be measured more accurately
with it than using a thermistor. The sensor circuitry is sealed and not subject to oxidation, etc.

Fig. 4.6 LM35 temperature sensor


Features:

• Calibrated directly in ° Celsius (Centigrade)

• Linear + 10.0 mV/°C scale factor

• 0.5°C accuracy guaranteed (at +25°C)

• Rated for full −55° to +150°C range

• Suitable for remote applications

• Low cost due to wafer-level trimming

• Operates from 4 to 30 volts

• Less than 60 µA current drain

• Low self-heating, 0.08°C in still air

• Nonlinearity only ±1⁄4°C typical


Fig. 4.7 Temperature sensor circuit

Functional description:

o
• The sensor has a sensitivity of 10mV / C.

• The output of LM35 is amplified using a LM324 single power supply (+5V) op-amp.

• The op-amp is designed to have a gain of 5.

• The circuitry measures temperatures with a resolution of up to 0.5 degree Celsius.

• The output voltage is converted to temperature by a simple conversion factor. The


general equation used to convert output voltage to temperature is:

o o
Temperature ( C) = (Vout * 100 ) / 5 C …(4.4)
o
So if Vout is 5V, then, Temperature = 100 C

• The output voltage varies linearly with temperature.

MICROCONTROLLER 89C52:
FEATURES:
 Compatible with MCS-51 Products.
 8K Bytes of In-System Reprogrammable Flash Memory.
 Endurance: 1,000 Write/Erase Cycles.
 Fully Static Operation: 0 Hz to 24 MHz
 Three-level Program Memory Lock.
 256 x 8-Bit Internal RAM.
 32 Programmable I/O Lines.
 Three 16-bit Timer/Counters.
 Eight Interrupt Sources.
 Programmable Serial Channel.
 Low Power Idle and Power Down Modes

PIN DIAGRAM AND ITS DESCRIPTION:


The microcontroller generic part number actually includes a whole family of
microcontrollers that have numbers ranging from 8031to 8751 and are available in N-
Channel Metal Oxide Silicon (NMOS) and Complementary Metal Oxide Silicon (CMOS)
construction in a variety of package types.

PIN DIAGRAM

With
4Kbytes of Flash
Programmable and
Erasable Read Only Memory (PEROM). The device is manufactured using Atmel’s high
density nonvolatile memory technology and is compatible with the industry standard MCS-
51 instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a
powerful microcomputer which provides a highly flexible and cost effective solution to many
embedded control applications.

The AT89C52 provides the following standard features: 4 Kbytes of Flash, 256 bytes
of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt
architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the
AT89C52 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.

ARCHITECTURE OF 89C52

Port 0:

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance
inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during
accesses to external program and data memory. In this mode P0 has internal pull-ups. Port 0
also receives the code bytes during Flash programming, and outputs the code bytes during
program verification. External pull-ups are required during program verification

Port 1:

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled
high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1
also receives the low-order address bytes during Flash programming and program
verification.

Alternate functions of port 1

Port 2:

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

Port 3:

Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by
the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of
various special features of the AT89C52 as listed below:

Alternate functions of port 3

RST:

RST means RESET; 89C52 uses an active high reset pin. It must go high for two
machine cycles. The simple RC circuit used here will supply voltage (Vcc) to reset pin until
capacitance begins to charge. At a threshold of about 2.5V, reset input reaches a low level and
system begin to run.
ALE/PROG:

Address Latch Enable output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator
frequency, and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the
ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN:

Program Store Enable is the read strobe to external program memory. When the
AT89C52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external
data memory.

EA/VPP:

External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at OOOOH up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should
be strapped to Vcc for internal program executions. This pin also receives the 12-volt
programming enable voltage (Vpp) during Flash programming, for parts that require 12-volt
Vpp.
XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating
circuit

XTAL2: Output from the inverting oscillator amplifier.

T2: External count input to Timer/Counter 2, Clock out.

T2EX: Counter 2 capture/reload trigger & direction control.

THE ON-CHIP OSCILLATORS (CRYSTAL OSCILLATOR)


Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an
oscillator. The crystal frequency is basic internal clock frequency. The maximum and
minimum frequencies are specified from 1to 24MHZ.

Program instructions may require one, two or four machine cycles to be executed
depending on type of instructions. To calculate the time any particular instructions will take
to be executed, the number of cycles ‘C’,

T = C*12d / Crystal frequency

Here, we chose frequency as 11.0592MHZ. This is because,

baud= 2*clock frequency/(32d. 12d[256d-TH1]).The oscillator is chosen to help generate


both standard and nonstandard baud rates. If standard baud rates are desired, an 11.0592MHZ
crystal should be selected. From our desired standard rate, TH1 can be calculated. The
internally implemented value of capacitance is 33 pf.

Fig 3.4: On-Chip Oscillators


Program Memory Lock Bits:
On the chip there are three lock bits which can be left unprogrammed (U) or can be
programmed (P) to obtain the additional features .When lock bit 1 is programmed, the logic
level at the EA pin is sampled and latched during reset. If the device is powered up without a
reset, the latch initializes to a random value, and holds that value until reset is activated. It is
necessary that the latched value of EA be in agreement with the current logic level at that pin
in order for the device to function properly.

Program Counter and Data Pointer:


The 89C52 contains two 16-bit registers: the program counter (PC) and the data
pointer (DPTR), Each is used to hold the address of a byte in memory. The PC is the only
register that does not have an internal address. The DPTR is under the control of program
instructions and can be specified by its 16-bit name, DPTR, or by each individual byte name,
DPH and DPL. DPTR does not have a single internal address, DPH and DPL are each
assigned an address.

A & B Registers:
The 89C52 contains 34 general-purpose, working, registers. Two of these, registers A
and B, hold results of many instructions, particularly math and logical operations, of the
89C52 CPU. The other 32 are arranged as part of internal RAM in four banks, B0-B3, of
eight registers. The A register is also used for all data transfers between the 89C52 and any
external memory. The B register is used for with the A register for multiplication and division
operations.

Flags and the Program Status Word (PSW):


Flags may be conveniently addressed, they are grouped inside the program status
word (PSW) and the power control (PCON) registers.

The 89C52 has four math flags that respond automatically to the outcomes of math
operations and three general-purpose user flags that can be set to 1 or cleared to 0 by the
programmer as desired. The math flags include Carry (C), Auxiliary Carry (AC), Overflow
(OV), and Parity (P). User flags are named F0,GF0 and GF1, they are general-purpose flags
that may be used by the programmer to record some event in the program.
MEMORY ORGANISATION

Internal Memory:
The 89C52 has internal RAM and ROM memory for the functions. Additional
memory can be added externally using suitable circuits. This has a Hardware architecture,
which uses the same address, in different memories, for code and data.

Internal RAM:
The 256-byte internal RAM. The upper 128 bytes occupy a parallel address space to
the Special Function Registers. Instructions that use indirect addressing access the upper 128
bytes of RAM. Stack operations are examples of indirect addressing.

Internal Data Memory addresses are always one byte wide, which implies an address
space of only 256 bytes. However, the addressing modes for internal RAM can in fact
accommodate 384 bytes, using a simple trick. Direct addresses higher than 7FH access one
memory space, and indirect addresses higher than 7FH access a different memory space.
Thus Figure shows the Upper 128 and SFR space occupying the same block of addresses,
80H through FFH, although they are physically separate entities.

The Lower 128 bytes of RAM are present in all 89C52 devices as mapped in Figure.
The lowest 32 bytes are grouped into 4 banks of 8 registers. Program instructions call out
these registers as R0 through R7.

Two bits in the Program Status Word (PSW) select which register bank is in use. This
allows more efficient use of code space, since register instructions are shorter than
instructions that use direct addressing. The next 16 bytes above the register banks form a
block of bit addressable memory space. The 89C52 instruction set includes a wide selection
of single-bit instructions, and the 128 bits in this area can be directly addressed by these
instructions. The bit addresses in this area are 00H through 7FH. All of the bytes in the
Lower 128 can be accessed by either direct or indirect addressing.

The Upper 128 can only be accessed by indirect addressing. SFRs include the Port
latches, timers, peripheral controls, etc. These registers can only be accessed by direct
addressing. Sixteen addresses in SFR space are both byte- and bit-addressable. The bit-
addressable SFRs are those whose address ends in OH or 80H.
A-D CONVERTER
8-Bit μP Compatible A/D Converters with 8-Channel Multiplexer

General Description:
The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device with an
8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor compatible control
logic. The 8-bit A/D converter uses successive approximation as the conversion technique. The
converter features

a high impedance chopper stabilized comparator, a 256R voltage divider with analog switch tree
and a successive approximation register. The 8-channel multiplexer can

directly access any of 8-single-ended analog signals.

The device eliminates the need for external zero and full-scale
adjustments. Easy interfacing to microprocessors is provided by the latched and decoded
multiplexer address inputs and latched TTL TRI-STATE® outputs. The design of the ADC0808,
ADC0809 has been optimized by incorporating the most desirable aspects of several A/D
conversion techniques. The ADC0808, ADC0809 offers high speed, high accuracy, minimal
temperature dependence, excellent long-term accuracy and repeatability, and consumes minimal
power. These features make this device ideally suited to applications from process and machine
control to consumer and automotive applications. For 16-channel multiplexer with common
output (sample/hold port) see ADC0816 data sheet. (See AN-247 for more information.)

Features:
1 Easy interface to all microprocessors

2 Operates ratio metrically or with 5 VDC or analog span

3 adjusted voltage reference

4 No zero or full-scale adjust required

5 8-channel multiplexer with address logic

6 0V to 5V input range with single 5V power supply

7 Outputs meet TTL voltage level specifications

8 Standard hermetic or molded 28-pin DIP package

9 28-pin molded chip carrier package

10 ADC0808 equivalents to MM74C949

11 ADC0809 equivalents to MM74C949-1

Key Specifications:
1 Resolution 8 Bits

2 Total Unadjusted Error ±1⁄2 LSB and ±1 LSB

3 Single Supply 5 VDC

4 Low Power 15 mW

5 Conversion Time 100 μs


Functional Description:
Multiplexer.

The device contains an 8-channel single-ended analog signal multiplexer. A particular


input channel is selected by using the address decoder. Table 1 shows the input states for the
address lines to select any channel. The address is latched into the decoder on the low-to-high
transition of the address latch enable signal.

CONVERTER CHARACTERISTICS:
The Converter: The heart of this single chip data acquisition system is its 8-bit analog-to-digital
converter. The converter is designed to give fast, accurate, and repeatable conversions over a
wide range of temperatures. The converter is partitioned into 3 major sections: the 256R ladder
network, the successive approximation register, and the comparator. The converter’s digital
outputs are positive true.

The 256R ladder network approach (Figure 1) was chosen over the conventional R/2R
ladder because of its inherent monotonicity, which guarantees no missing digital codes.
Monotonicity is particularly important in closed loop feedback control systems. A non-monotonic
relationship can cause oscillations that will be catastrophic for the system. Additionally, the 256R
network does not cause load variations on the reference voltage.

The bottom resistor and the top resistor of the ladder network in Figure 1 are not the
same value as the remainder of the network. The difference in these resistors causes the output
characteristic to be symmetrical with the zero and full-scale points of the transfer curve. The first
output transition occurs when the analog signal has reached +1⁄2 LSB and succeeding output
transitions occur every 1 LSB later up to full-scale.

The successive approximation register (SAR) performs 8 iterations to approximate the


input voltage. For any SAR type converter, n-iterations are required for an n-bit converter. Figure
2 shows a typical example of a 3-bit converter. In the ADC0808, ADC0809, the approximation
technique is extended to 8 bits using the 256R network.

The A/D converter’s successive approximation register (SAR) is reset on the positive
edge of the start conversion (SC) pulse. The conversion is begun on the falling edge of the start
conversion pulse. A conversion in process will be interrupted by receipt of a new start conversion
pulse. Continuous conversion may be accomplished by tying the end-of-conversion (EOC) output
to the SC input. If used in this mode, an external start conversion pulse should be applied after
power up. End-of-conversion will go low between 0 and 8 clock pulses after the rising edge of
start conversion. he most important section of the A/D converter is the comparator. It is this
section which is responsible for the ultimate accuracy of the entire converter. It is also the
comparator drift which has the greatest influence on the repeatability of the device. A chopper-
stabilized comparator provides the most effective method of satisfying all the converter
requirements.

The chopper-stabilized comparator converts the DC input signal into an AC signal. This signal
is then fed through a high gain AC amplifier and has the DC level restored. This technique limits
the drift component of the amplifier since the drift is a DC component which is not passed by the
AC amplifier. This makes the entire A/D converter extremely insensitive to temperature, long
term drift and input offset errors. Figure 4 shows a typical error curve for the ADC0808 as
measured using the procedures outlined in AN-179.

LIQUID CRYSTAL DISPLAY


A liquid crystal display (LCD) is a thin, flat display device made up of any number of
color or monochrome pixels arrayed in front of a light source or reflector. Each pixel consists
of a column of liquid crystal molecules suspended between two transparent electrodes, and
two polarizing filters, the axes of polarity of which are perpendicular to each other. Without
the liquid crystals between them, light passing through one would be blocked by the other.
The liquid crystal twists the polarization of light entering one filter to allow it to pass through
the other.
Many microcontroller devices use 'smart LCD' displays to output visual information.
LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to
use, and it is even possible to produce a readout using the 8x80 pixels of the display. They
have a standard ASCII set of characters and mathematical symbols.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit
data bus it only requires the supply lines plus seven extra lines. When the LCD display is not
enabled, data lines are tri-state and they do not interfere with the operation of the
microcontroller.
Data can be placed at any location on the LCD. For 16×2 LCD, the address location are:

First line 80 81 82 83 84 85 86 through 8F

Second line C0 C1 C2 C3 C4 C5 C6 through CF

Address locations for a 2x16 line LCD


SIGNALS TO THE LCD

The LCD also requires 3 control lines from the microcontroller:

1) Enable (E)

This line allows access to the display through R/W and RS lines. When this line is
low, the LCD is disabled and ignores signals from R/W and RS. When (E) line is high, the
LCD checks the state of the two control lines and responds accordingly.

2) Read/Write (R/W)

This line determines the direction of data between the LCD and microcontroller.When it
is low data is written to the LCD. When it is high, data is read from the LCD.
3) Register select (RS)

With the help of this line, the LCD interprets the type of data on data lines. When it is
low, an instruction is being written to the LCD. When it is high, a character is being written
to the LCD.

Logic status on control lines:

• E - 0 Access to LCD disabled

- 1 Access to LCD enabled

• R/W - 0 Writing data to LCD

- 1 Reading data from LCD

• RS - 0 Instructions

- 1 Character

Writing and reading the data from the LCD:

Writing data to the LCD is done in several steps:

1) Set R/W bit to low

2) Set RS bit to logic 0 or 1 (instruction or character)


3) Set data to data lines (if it is writing)

4) Set E line to high

5) Set E line to low

Read data from data lines (if it is reading):

1) Set R/W bit to high


2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low

PIN DESCRIPTION
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins
(two pins are extra in both for back-light LED connections).

Pin diagram of 2x16 line LCD


Pin description of the LCD

RELAYS

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

Fig. 4.26 Sugar cube relay

Despite the speed of technological developments, some products prove so popular


that their key parameters and design features remain virtually unchanged for years. One such
product is the ‘sugar cube’ relay, shown in the figure above, which has proved useful to
many designers who needed to switch up to 10A, whilst using relatively little PCB area

Since relays are switches, the terminology applied to switches is also applied to
relays. A relay will switch one or more poles, each of whose contacts can be thrown by
energizing the coil in one of three ways:
1. Normally - open (NO) contacts connect the circuit when the relay is activate d; the
circuit is disconnected when the relay is inactive. It is also called a FORM A contact or
“make” contact.

2. Normally - closed (NC) contacts disconnect the circuit when the relay is activated;
the circuit is connected when relay is inactive. It is also called FORM B contact or”
break” contact

3. Change-over or double-throw contacts control two circuits ; one normally open


contact and one normally –closed contact with a common terminal. It is also called a Form
C “transfer “contact.
The following types of relays are commonly encountered:

"C" denotes the common terminal in SPDT and DPDT types


The Relay interfacing circuitry used in the application is:
POWER SUPPLY:
The Power Supply is a Primary requirement for the project work. The
required DC power supply for the base unit as well as for the recharging unit is derived from
the mains line. For this purpose center tapped secondary of 12V-012V transformer is used.
From this transformer we getting 5V power supply. In this +5V output is a regulated output
and it is designed using 7805 positive voltage regulator. This is a 3 Pin voltage regulator, can
deliver current up to 800 milliamps. Rectification is a process of rendering an alternating
current or voltage into a unidirectional one. The component used for rectification is called
‘Rectifier’. A rectifier permits current to flow only during positive half cycles of the applied
AC voltage. Thus, pulsating DC is obtained to obtain smooth DC power additional filter
circuits required.

BLOCK DIAGRAM:

CIR
CIRCUIT DIAGRAM:

Component Used

(a) Capacitors

(i) 100µF/25v for +12v

(ii) 2200µF/25v for +5v

(b) Step down transformer


(i) 230v / 12v- 0 -12v/ 500mA Transformer

(c) Diodes: 1N4007

A diode can be used as rectifier. There are various types of diodes. However,
semiconductor diodes are very popularly used as rectifiers. A semiconductor diode is
a solid-state device consisting of two elements is being an electron emitter or cathode,
the other an electron collector or anode. Since electrons in a semiconductor diode can
flow in one direction only-form emitter to collector-the diode provides the unilateral
conduction necessary for rectification. The rectified Output is filtered for
smoothening the DC, for this purpose capacitor is used in the filter circuit. The filter
capacitors are usually connected in parallel with the rectifier output and the load. The
AC can pass through a capacitor but DC cannot, the ripples are thus limited and the
output becomes smoothed. When the voltage across the capacitor plates tends to rise,
it stores up energy back into voltage and current. Thus, the fluctuation in the output
voltage is reduced considerable
CIRCUIT SCHEMATIC OF THE SYSTEM
SYSTEMS USED IN WORK MODE
DRIP IRRIGATION SYSTEM FOR CONTROLLING SOIL MOISTURE

Drip, or micro-irrigation, technology uses a network of plastic pipes to carry a low


flow of water under low pressure to plants.

Polyethylene tubing is run from the source of water to the plant, where the emitter is
attached for dripping water. Emitter line (poly tubing with pre-installed emitters) is used
where a continuous band of water is needed. Fittings are available to make sharp turns
(elbows), branch lines (tees), and to make the transition between different sizes of tubing.
When plants are removed or die, drip lines should be plugged.

Drip irrigation system

Drip irrigation (sometimes called trickle irrigation) works by applying water slowly,
directly to the soil. The high efficiency of drip irrigation results from two primary factors.
The first is that the water soaks into the soil before it can evaporate or run off. The second is
that the water is only applied where it is needed, (at the plant's roots) rather than sprayed
everywhere.

A drip irrigation system slowly provides water to the plant's root system. Regular
watering prevents plant dehydration, but roots don't get overly soaked and in turn, plant
growth can increase up to 50%. Drip systems irrigate all types of landscape: shrubs, trees,
Perennial beds, ground covers, annuals and lawns. Drip is the best choice to water roof
gardens, containers on decks and patios, row crops and kitchen gardens, orchards,
and vineyards.

ARTIFICIAL GROWING LIGHTS FOR CONTROLLING ILLUMINATION

Growing lights enable cultivators to extend daylight hours - useful for winter and
spring growing when levels of natural lights can be low, and one can therefore improve plant
growth. Three basic types of lamps used in greenhouse lighting are:
• Fluorescent lamps - These have the advantage of higher light efficiency with low
heat. This type of lamp is the most widely used for supplemental light. It is available
in a variety of colors but cool-white lamps are the most common. High intensity
(1500 ma) fluorescent tubes that require higher wattage are also commonly used to
reach 2000 foot candles.
• Incandescent lamps - These vary in size from 60 watts to 500 watts. The grower can
vary foot-candle levels by adjusting the spacing and mounting height above the
plants.
• High-intensity discharge (HID) lamps –These have a long life (5000 hours or more).
With improvements made possible by the addition of sodium and metal- halides,
the lamp has a high emission of light in the regions utilized by plants.

The following generally accepted cultural divisions describe light levels:


• Very high: Over 5000 foot candles--nearly full sun except at midday, when full
summer sun in most latitudes may reach 10,000 fc.
• High: 4000-5000 foot candles--bright light, just under 50% of the full midday sun.

• Intermediate: 1800-4000 foot candles--dappled sunlight.

• Low: 1000-1800 foot candles--reduced sunlight, so that if a hand is passed over the
leaves it does not produce a shadow.
One foot candle is equal to 10.76 lux, although in the lighting industry, typically this
is approximated as 1 foot candle being equal to 10 lux.

TEMPERATURE CONTROLLERS

COOLING EQUIPMENT
There are three primary cooling devices in most greenhouses. These are the vent system,
exhaust fan, and swamp cooler. Some greenhouses may make use of air conditioners and/or
misting systems as well.

• Vents are hinged or track connected panels in the roof or sides of greenhouses. They
open up the greenhouse to outside natural air. Hot air that builds up in the greenhouse
can escape, and fresh air can enter the house. The microcontroller can be used to
automate the opening and closing of these vents depending upon requirement.
But during hot summer days, venting alone will not get the job done.

• Exhaust fans can move a large volume of the hot greenhouse air out and pull fresh
air in through the rear vent. They're powerful for a reason, as full sun on a hot
summer day can cause temperatures inside the greenhouse to superheat. An exhaust
fan must be able to pull this air out, or the temperatures will continue to rise.

• Swamp coolers: come in different widths and lengths. They can be configured to the
appropriate size, as this varies depending on the length and width of the greenhouse,
location where you live, and type of plants you wish to grow.

HEATING EQUIPMENT

• Hot-water or steam heater: A hot-water system with circulator or a steam system


linked with automatic ventilation will give adequate temperature control. In some
areas, coal or natural gas is readily available at low cost. This fuel is ideal for hot-
water or a central steam system. Steam has an advantage in that it can be used to
sterilize growing beds and potting soils.

• Electric heaters: Overhead infrared heating equipment combined with soil cable heat
provides a localized plant environment, which allows plants to thrive even though the
surrounding air is at a lower than normal temperature. Electric resistance-type heaters
are used as space heaters or in a forced air system.

HUMIDIFICATION SYSTEMS
Many evaporative cooling and humidifying systems are available: Foggers, Mist systems,
Roof Sprinklers, and Pan & Fan Systems. They add watervapour to the air, and may
subsequently reduce the amount of water that the plants need to transpire.
• Roof sprinklers add water vapour and cool the incoming air. On large ranges, it is
possible to decrease the temperature by 3 – 5 C and increase the humidity by 5-10%.
• Pad and fan systems consist of porous wet pads at the inlet end of a fan ventilated

greenhouse. As the exhaust fans draw air through the wet pads, water evaporates, cooling
and humidifying the air. Temperatures tend to be coolest nearer the fans and hottest at the
exhaust when using these systems.
• Mist and fog systems produce tiny water droplets that evaporate, thereby cooling and
humidifying the greenhouse air. A misting system can provide needed moisture
to maintain a healthy humidity level of 50 to 70%.
FLOWCHART
FLOWCHART REPRESENTING THE WORKING OF THE SYSTEM:

START

INITIALISE THE LCD

DISPLAY INITIALISATION MESSAGE

B
INITIALISE THE ADC

OBTAIN THE SENSOR DATA

OBTAIN DIGITIZED DATA FROM ADC

STORE DIGITAL OUTPUT IN THE BUFFER MEMORY OF


THE MICROCONTROLLER

CLEAR THE LCD


IS MODE
YES
BUTTON
PRESSED

NO

DISPLAY THE DEVICE STATUS

DISPLAY THE SENSOR DATA

A
A
YES NO
SENSOR
THRESHOLD
CROSSED?

TURN ON ACTUATOR TURN OFF ACTUATOR


B

FLOWCHART FOR LCD INITIALIZATION

START

INTILIAZE THE LCD WITH 2LINES, 5X7 MATRIX

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

SET THE DISPLAY ON AND THE CURSOR ON

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY


CLEAR THE LCD AND SHIFT THE CURSOR TO RIGHT

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

SHIFT THE CURSOR AT LINE 1, POSITION 0

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

STOP

FLOWCHART FOR ADC INITIALIZATION

START
SELECT AN ANALOG CHANNEL BY SETTING
THE ADDRESS LINES A, B AND C

CLEAR THE OUTPUT ENABLE PIN

ACTIVATE THE ALE PIN WITH


A LOW TO HIGH PULSE

ACTIVATE THE START PIN BY A HIGH TO


LOW PULSE TO INITIATE CONVERSION
NO
IS YES

EOC =0? A
A

SET THE OUTPUT ENABLE PIN

CALL SOME DELAY

READ DATA OUT OF THE ADC CHIP

CLEAR THE OUTPUT ENABLE PIN

STOP
SOFTWARE DESCRIPTION

IN-SYSTEM PROGRAMMING:
The Atmel Microcontroller ISP Software is the primary means for performing in-system
programming (ISP) for the Atmel devices. It provides an intuitive interface for in-system
programming that can be run from your personal computer. The Atmel ISP Software has a
comprehensive set of features that allows you to view, program, and erase data from an
Atmel ISP device.
The Atmel Microcontroller ISP Software also allows you to load hex files containing the
code you want to add to the device. Using the software, you can manipulate this code, verify
it against the existing code on the device, and program the code onto the device.
Additionally, using the software, you can read any existing code from the device and
make minor changes to the code. You can then update the device with your changes or save
them to a hex file for use with other devices.
The software also allows you to protect third parties from accidentally reprogramming
the device and even allows you to lock the device so that the code cannot be read from it.
Atmel’s microcontroller ISP Software contains a variety of tools customized for Atmel ISP
devices

Programming the Flash – Parallel Mode:


The AT89C52 is shipped with the on-chip Flash memory array ready to be programmed.
The programming interface needs a high-voltage (12-volt) see (APPENDIX Figure 1)
program enable signal and is compatible with conventional third-party Flash or EPROM
programmers. The AT89C52 code memory array is programmed byte-by-byte.

Programming Algorithm:
To program the AT89C52, take the following steps:
1. Input the desired memory location on the address lines.
2. Input the appropriate data byte on the data lines.
3. Activate the correct combination of control signals.
4. Raise EA/VPP to 12V.
5. Pulse ALE/PROG once to program a byte in the flash array or the lock bits.

The byte-write cycle is self-timed and typically takes no more than 50 μs. Repeat
steps 1 through 5, changing the address and data for the entire array or until the end of the
object file is reached.
Programming the Flash – Serial Mode:
The Code memory array can be programmed using the serial ISP interface while RST is
pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output).
After RST is set high, the Programming Enable instruction needs to be executed first before
other operations can be executed. Before a reprogramming sequence can occur, a Chip Erase
operation is required. The Chip Erase operation turns the content of every memory location
in the Code array into FFH. Either an external system clock can be supplied at pin XTAL1 or
a crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock
frequency should be less than 1/16 of the crystal frequency. With 33 MHz oscillator clock,
the maximum SCK frequency is 2 MHz.
Serial Programming Algorithm:
To program and verify the AT89C52 in the serial programming mode, the
following sequence is recommended:

Power-up sequence:
1. Apply power between VCC and GND pins. Set RST pin to “H”. If a crystal is not
connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin
and wait for at least 10ms.
2. Enable serial programming by sending the Programming Enable serial instruction to pin
MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than
the CPU clock at XTAL1 divided by 16.
3. The Code array is programmed one byte at a time by supplying the address and data
together with the appropriate Write instruction. The write cycle is self-timed and typically
takes less than 1ms at 5V.
4. Any memory location can be verified by using the Read instruction which returns the
content at the selected address at serial output MISO/P1.6.
5. At the end of a programming session, RST can be set low to commence normal device
operation.
RESULT ANALYSIS

RESULT ANALYSIS
0
Readings taken at room temperature of 27 C

TRANSDUCER READINGS
SOIL MOISTURE SENSOR
Tolerance= ± 0.2 V

Table 8.1 Soil moisture sensor readings

Soil Condition Transducer

Soil is dry 0V

Optimum level of
1.9- 3.5V
soil moisture

Slurry soil >3.5V

LIGHT SENSOR
Tolerance = ±0.1V

Table 8.2 Light sensor readings


Illumination Status Transducer Optimum

OPTIMUM 0V-0.69V
ILLUMINATION

DIM LIGHT 0.7V-2.5V

DARK 2.5V- 3V

NIGHT 3V-3.47V

HUMIDITY SENSOR

FORMULA:
RH = ((Vout / Vcc) – 0.16 )/0.0062, typical at 25°C
where, Vsupply = 4.98V
Tolerance= ±0.1V

Table 8.3 Humidity sensor readings


Percentage RH Transducer Optimum Range
(RELATIVE HUMIDITY)
0% 0-0.8V

0% to 9.81% 0.8-1.1V

12.9% to 20.1% 1.2-1.45V

22.7% to 30.06% 1.5-1.725V

30.8% to 40.5% 1.75-2.05V

41.3%to50.3% 2.075-2.35V

51%to 60.02% 2.375-2.65

61.6%to70.5% 2.7-2.975V

71%to80.2% 3-3.275V

81.1%to 90% 3.3-3.6V

91%to 100% 3.6-3.9V

TEMPERATURE SENSOR
FORMULA:
o o
Temperature ( C ) = (Vout/5) *100( C/V)
Temperature sensor readings

Temperature range Temperature


in degree sensor
Celsius output(Vout

1 ) 0
1500to 200 C .
0.75-1.0V
20 0to 250 C 1.0-1.25V
250 to 30 0C 1.25-1.5V
30 0to 35 0C 1.5-1.75V
350 to 400 C 1.75-2.0V
400 to 45 0C 2.0-2.25V
450 to 500 C 2.25-2.5V
500 to 55 0C 2.5-2.75V
550 to 600C 2.75-3.0V
600 to 650 C 3.0-3.25V
650 to 70 0C 3.25-3.5V
70 0to 750 C 3.5-3.75V

75 0to 80 0C 3.75-4.0V

80 0to 850 C 4.0-4.25V

85 0to 900 C 4.25-4.5V

900 to 95 0C 4.5-4.75V

950 to 1000 C 4.75-5V


ADVANTAGES AND LIMITATIONS
ADVANTAGES AND LIMITATIONS

ADVANTAGES

1. Sensors used have high sensitivity and are easy to handle.

2. Low cost system, providing maximum automation.

3. Closed loop design prevents any chances of disturbing the greenhouse environment.

4. User is indicated for changes in actuator state thereby giving an option for manual
override.
5. Low maintenance and low power consumption.

6. The system is more compact compared to the existing ones, hence is easily portable.

7. Can be used for different plant species by making minor changes in the ambient
environmental parameters.
8. Can be easily modified for improving the setup and adding new features.

9. Labour saving.

10. Provides a user-friendly interface hence will have a greater acceptance by the
technologically unskilled workers.
11. In response to the sensors, the system will adjust the heating, fans, lighting, irrigation
immediately, hence protect greenhouse from damage.
12. Malfunctioning of single sensor will not affect the whole system.

13. Natural resource like water saved to a great extent.

LIMITATIONS
1. Complete automation in terms of pest and insect detection and eradication cannot
be achieved.

2. No self-test system to detect malfunction of sensors.

3. Requires uninterrupted power supply.

4. Facility to remotely monitor the greenhouse is not possible.


FUTURE SCOPE
SCOPE FOR FURTHER DEVELOPMENT

1) The performance of the system can be further improved in terms of the operating speed,
memory capacity and instruction cycle period of the microcontroller by using other
controllers such as AVRs and PICs. The number of channels can be increased to interface
more number of sensors which is possible by using advanced versions of
Microcontrollers.

2) The system can be modified with the use of a data logger and a graphical LCD panel
showing the measured sensor data over a period of time.
3) A speaking voice alarm could be used instead of the normal buzzer.

4) This system can be connected to communication devices such as modems, cellular phones
or satellite terminal to enable the remote collection of recorded data or alarming of certain
parameters.
5) The device can be made to perform better by providing the power supply with the help of
battery source which can be rechargeable or non-rechargeable, to reduce the requirement
of main AC power.
6) Time bound administration of fertilizers, insecticides and pesticides can be introduced.
7) A multi-controller system can be developed that will enable a master controller along with
its slave controllers to automate multiple greenhouses simultaneously.
CONCLUSION
CONCLUSION

A step-by-step approach in designing the microcontroller based system for


measurement and control of the four essential parameters for plant growth, i.e. temperature,
humidity, soil moisture, and light intensity, has been followed. The results obtained from the
measurement have shown that the system performance is quite reliable and accurate.
The system has successfully overcome quite a few shortcomings of the existing
systems by reducing the power consumption, maintenance and complexity, at the same time
providing a flexible and precise form of maintaining the environment.

The continuously decreasing costs of hardware and software, the wider acceptance of
electronic systems in agriculture, and an emerging agricultural control system industry in
several areas of agricultural production, will result in reliable control systems that will
address several aspects of quality and quantity of production. Further improvements will be
made as less expensive and more reliable sensors are developed for use in agricultural
production.

Although the enhancements mentioned in the previous chapter may seem far in the
future, the required technology and components are available, many such systems have been
independently developed, or are at least tested at a prototype level. Also, integration of all
these technologies is not a daunting task and can be successfully carried out.

Вам также может понравиться