Upload
vaghesh-patel
View
65
Download
3
Tags:
Embed Size (px)
Citation preview
ABSTRACT
India is agriculture country and require the system to increase
agriculture products with the help of existing environment conditions by
optimize use. Also to save the manpower, water resources, energy
resources, we need optimized system to increase the agriculture products.
Greenhouse is the best system in the world.
To monitor and controlling various parameters such as humidity,
temperature, light, water level etc. in the greenhouse, a low cost, effective
wireless system is required.
Zigbee is wireless sensor networks due to their low cost, simplicity
and mobility, is best suitable for the wireless system. In the current study,
we will compare the advantages of Zigbee with other two similar wireless
networking protocols like Wi-Fi &Bluetooth, and will propose a wireless
solution for greenhouse monitoring and controlling system based on
Zigbee technology.
i
LIST OF FIGURES
No. Figure Description Page
No.
2.1 The Greenhouse Effect
3.1 Basic Model Of System
3.2 Temperature Sensor
3.3 Humidity Sensor
3.4 Light Sensor
3.5 Circuit Diagram
3.6 Soil Moisture Sensor
3.7 Getting Data From Analog World
3.8 Block Diagram Of ADC0808/0809
3.9 Pin Diagram Of ADC 0808/0809
3.10 ADC 0808 Pin Detail Used For This
Application
3.11 Pin Diagram Of AT89S52
3.12 Block Diagram Of Microcontroller(AT89S52)
3.13 Power-On Reset Circuit
3.14 The Oscillator Clock Circuit
3.15 Pin Diagram Of LCD Display
3.16 Sugar Cube Relay
3.17 Relay Circuitry
3.18 Block Diagram Of Power Supply Connection
3.19 +5V Power Supply Connection
3.20 +12V Power Supply Connection
ii
3.21 Star Topology
3.22 Peer to Peer Topology
3.23 Cluster Tree Topology
3.24 Architecture Of Zigbee
iii
LIST OF TABLES
Table
No.
Name of Table Page No.
3.1 Selection Of The Input Channel
3.2 Alternate Function Of Port 3
3.3 Pin Description Of The LCD
3.4 Difference Between Zigbee, Wi-Fi &
Bluetooth
iv
TABLE OF CONTENT
Acknowledgement i
Abstract v
List of figures v
List of tables v
Table of content v
Company Profile
CHAPTER:1 Introduction 1-2
1.1 Project Objective 1
1.2 Overview 1
1.3 Aim Of Project 2
1.4 Literature Survey 2
CHAPTER :2 Greenhouse And Greenhouse effect 3-8
2.1 What Is Greenhouse? 3
2.2 Greenhouse Environment 4
2.2.1 Temperature 4
2.2.2 Moisture 4
2.2.3 Pest Control 5
2.2.4 Nutrition 5
2.3 Greenhouse Effect 5
2.3.1 What Is Greenhouse Effect? 6
2.3.2 Causes Of Greenhouse Effect 7
2.3.3 Problem Of Greenhouse Effect 7
v
2.3.4 Role Of Carbon Dioxide In Greenhouse Effect 8
CHAPTER:3 Design Element 9-45
3.1 Basic Model Of The System 9
3.2 Parts Of The System 10
3.3 Sensors 10
3.3.1 Temperature Sensor 11
3.3.1.1 Features 12
3.3.2 Humidity Sensor 12
3.3.2.1 Features 13
3.3.2.2 Specifications 14
3.3.3 Light Sensor 14
3.3.3.1 Features 15
3.3.3.2 Functional Description 15
3.3.4 Soil Moisture Sensor 16
3.3.4.1 Features 16
3.3.4.2 Functional Description 16
3.4 Analog To Digital Converter (ADC 0808/0809) 17
3.4.1 Description 17
3.4.2 Features 18
3.4.3 Pin Diagram Of ADC(0808/0809) 19
3.4.4 Selecting An Analog Channel 20
3.5 Microcontroller (AT89S52) 21
3.5.1 Criteria For Choosing A Microcontroller 21
3.5.2 Description 22
3.5.3 Features 23
3.5.4 Pin Diagram 24
3.5.5 Block Diagram 24
3.5.6 Pin Description 25
vi
3.5.6.1 Power-On Reset Circuit 26
3.5.6.2 Oscillator Clock Circuit 27
3.5.7 Special Function Registers 28
3.5.8 Timers And Counters 29
3.5.9 Interrupts 30
3.5.10 Microcontroller Configuration Used In Set-Up 30
3.6 Liquid Crystal Display 31
3.6.1 Signal To The LCD 31
3.6.1.1 Logic Status On Control Lines 32
3.6.1.2 Writing And Reading The Data From LCD 32
3.6.2 Pin Description 32
3.7 Actuators-Relays 33
3.8 Power Supply Connection 34
3.9 Zigbee Protocol 36
3.9.1 Introduction 36
3.9.2 Why It Is Called Zigbee? 37
3.9.3 Network Characteristics Of Zigbee Devices 37
3.9.4 Device Types 37
3.9.5 Network Topology 38
3.9.5.1 Star Topology 38
3.9.5.2 Peer To Peer Topology 39
3.9.5.3 Cluster Tree Topology 39
3.9.6 Architecture 40
3.9.6.1 Network & Application layer 40
3.9.6.2 Physical (PHY) Layer 41
3.9.6.3 Media Access Control (MAC) Layer 41
3.9.7 Difference Between Zigbee,Wi-Fi & Bluetooth 42
3.9.8 Why We Use Zigbee? 43
vii
3.10 Device Controlled 43
3.10.1 Temperature Controller In Greenhouse 43
3.10.1.1 Cooling Equipment 44
3.10.1.2 Heating Equipment 44
3.10.2 Humidity Control In Greenhouse 44
3.10.3 Artificial Light For Controlling Light 45
Conclusion 46
References 47
viii
COMPANY PROFILE:
Fig. Sahajanand Laser Technology Pvt. Ltd
Sahajanand Technologies (P) Ltd. was incorporated in 1993, is a name to reckon with as a
trendsetter in development of abreast diamond processing equipment’s, deploying
revolutionary Laser light. ‘Sahajanand’ name uniquely represents leadership in
technology transfer and innovation for quality product development. Established in the
year 1993 by Mr.Dhirajlal Kotadia, the company has emerged as a pioneer in the diamond
industry for its hi-end engineering products.
Company is driven by the motto of continuous innovation to develop products that deliver
cutting edge performance with value for money for our customers. We are committed to
develop technology solutions for client performance excellence. We have articulated a
distinct market sensing mechanism to analyze market trends, customer needs and industry
requirements. This brought a unique set of capabilities for us to develop customer centric
technology solutions. We are a leading manufacturer and exporter of Laser technology
centered capital equipment’s for diamond manufacturing industry. We present ‘Total
technology solutions for diamond industry under one roof.’ Our product portfolio broadly
includes Diamond Planner Systems, Laser driven Diamond Processing equipment’s, Auto
blocking & Polishing Machines etc. used at different stages of diamond manufacturing
process.
ix
Everyday we live the Sahajanand tradition of engineering excellence and core values of
quality, safety, integrity, understanding and responsibility. We are also committed to
bring these technologies within the reach of every Indian engaged in these industries. By
promoting indigenously manufactured technology products, we save valuable foreign
exchange and generate employment. We contribute immensely in the growth of the
society by actively doing the philanthropic activities in field of health, education and
community development.
Being in the industry for more than 15 years, we earned vast experience of dynamics of
Diamond Industry. We started from scratch & created a right platform in Indian market.
By virtue of this prolonged attachment with the industry & confidence in our capabilities
we believed that it is not impossible to develop such technology in India. We followed
our, instincts & developed a range of hi-tech-yet cost effective products. We have trained
our work force to harmonize with Diamond Industry trends & successfully educated
thousands of workers to use our machines
x
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
CHAPTER-1
INTRODUCTION
1.1. PROJECT OBJECTIVE
In this chapter introduction of the GREENHOUSE EFFECT MONITORING AND
CONTROLLING USING ZIGBEE TECHNOLOGY are discussed. It gives overall
view of the project design and the related literature and the environment to be considered.
At first we discuss the main processing done using 8051 microcontroller is and then what
is the process that can be automated which is within the scope of the work. Then we
discuss the implementation aspects.
1.2 OVERVIEW
We are using a Zigbee based network for Greenhouse effect monitoring and controlling.
This way of communication is actually done with Zigbee network topology. Each sensors
will senses the condition of Temperature, Humidity, soil moisture as well as light is
monitored and if there is any change in the condition of Temperature, Humidity, soil
moisture as well as light then it immediately sends that changed data through Zigbee to
the local system where the main module is connected to the computer to maintain the
status of the Greenhouse.
There are many sensors are used in greenhouse monitoring and controlling using Zigbee,
Likewise Temperature, Humidity, soil moisture, and Light sensors. These sensors sense
the Temperature, Humidity, soil moisture, And Light respectively. After it applied to the
Analog to Digital Converter (ADC), And it converts the Analog signal to Digital code.
And it applied to the Transmitter module of Zigbee. This Zigbee module sends to another
Receiver module of Zigbee through wireless communication. After receiving, this code is
applied to the Liquid Crystal Display (LCD) through Microcontroller. In LCD the
condition of Temperature, Humidity, Soil moisture, and light is displayed in terms of
digital code. If there is a change in Temperature, Humidity, soil moisture, and light then
for maintain a proper value we use the water pump, cooler, artificial light are used.
GTU-SPCE-7TH SEM-EC Page 1
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
1.3 AIM OF THE PROJECT
The main processes involved in this type of control system are to monitor the Greenhouse
effect status. Zigbee is a wireless connection network that is used to connect different
devices at a frequency of 2.4GHz. The Zigbee can communicate with the devices of
about 10-100m.
1.4 LITERATURE SURVEY
The technical brilliance and development in different fields has led to a drastic in our
lives, one among them is embedded systems. The application of these devices is to
monitor and control the Greenhouse effect status. Zigbee is a wireless connection network
that is used to connect different devices at a frequency of 2.4GHz. The Zigbee can
communicate with the devices of about 10-100m.
GTU-SPCE-7TH SEM-EC Page 2
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
CHAPTER-2
GREENHOUSE AND GREENHOUSE EFFECT
2.1 WHAT IS GREENHOUSE?
A greenhouse is a structural building with different types of covering materials, such as
a glass or plastic roof and frequently glass or plastic walls; it heats up because incoming
visible solar radiation (for which the glass is transparent) from the sun is absorbed by
plants, soil, and other things inside the building. Air warmed by the heat from hot interior
surfaces is retained in the building by the roof and wall.
In addition, the warmed structures and plants inside the greenhouse re-radiate some of
their thermal energy in the infrared spectrum, to which glass is partly opaque, so some of
this energy is also trapped inside the glasshouse. However, this latter process is a minor
player compared with the former (convective) process. Thus, the primary heating
mechanism of a greenhouse is convection. This can be demonstrated by opening a small
window near the roof of a greenhouse: the temperature drops considerably.
This principle is the basis of the auto vent automatic cooling system. Thus, the glass used
for a greenhouse works as a barrier to air flow, and its effect is to trap energy within the
greenhouse. The air that is warmed near the ground is prevented from rising indefinitely
and flowing away.
Although heat loss due to thermal conduction through the glass and other building
materials occurs, net energy (and therefore temperature) increases inside the greenhouse.
What is the purpose/function of a greenhouse?
The basic function is to provide a protective environment for
crop(plant) production.
GTU-SPCE-7TH SEM-EC Page 3
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
A structure, primarily of glass, in which temperature and humidity can be controlled
for the cultivation or protection of plants
2.2 GREENHOUSE ENVIRONMENT
What things make up the greenhouse environment?
Temperature
Moisture
Pest Control
Nutrition
2.2.1 TEMPERATURE
Different plants have different temperature “preferences” for optimum growth.
Some plants prefer cool or even cold temps
Some plants prefer warm or hot temps
The trick is to provide a temperature range that is conducive to plant growth.
Grow plants together that prefer the same temperature range.
Temperature ranges must be conducive to crop production
The cost of heat is the second highest expense of greenhouse plant production.
(labor is the greatest expense)
Greenhouses lose heat through the plastic, glass, etc. and additional heat has to
be provided especially in winter.
2.2.2 MOISTURE
Moisture must also be conducive to plant production
Some plants need dry environments, while others need very wet
environments.
How are moisture levels controlled?
Watering
GTU-SPCE-7TH SEM-EC Page 4
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Humidity
Level of water vapor in the air.
2.2.3 PEST CONTROL
Pest Control refers to the regulation or management of a species defined as a
pest, usually because it is perceived to detrimental to a person’s health, the
ecology or the economy.
One of the biggest problems growers face is pest control.
What types of pests? And Greenhouses must be kept free of:
Insects (aphids, whiteflies, etc)
Diseases (fungus, bacteria, viral)
Weeds (oxalis, henbit, etc)
Rodents (mice, rats)
2.2.4 NUTRITION
Nutrition is the provision, to cells and organisms, of the materials
necessary (in the form of food) to support life.
Plants, like animals, need nutrients to survive.
Growers provide plants with the nutrients they need by supplementing either
the water or soil with added nutrients.
Growers also have to ensure adequate ventilation.
Carbon dioxide
Nutrition must be monitored in:
Soil
Water
Air (ventilation is necessary to supply carbon dioxide)
2.3 GREENHOUSE EFFECT
GTU-SPCE-7TH SEM-EC Page 5
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Green House Effect is heating up of earth's atmosphere due to the trapping of intra-red
ray. (Reflected from the earth's surface) by the carbon dioxide layer in the atmosphere
is called green-house effect.
The green-house effect in the atmosphere occurs due to the presence of a blanket of
carbon-dioxide gas in the atmosphere. This blanket of carbon dioxide gas in the
atmosphere allows the sunlight to come in freely but does not allow the intra-red radiation
reflected by the earth's surface to go out. It is just because the sun light can come in freely
but the intra-red rays cannot go out freely that the temperature of earth's atmosphere is
raised.
The rise in temperature produce gas in the by green-house effect on earth's atmosphere
depends on the amount of carbon dioxide gas in the atmosphere. In other words, the
proportion of carbon dioxide in atmosphere affects the temperature of atmosphere. So, if
the proportion of carbon dioxide gas in the atmosphere increases, than the temperature of
earth's atmosphere will also rise further.
2.3.1 WHAT IS GREENHOUSE EFFECT?
“The greenhouse effect is a process by which thermal radiation from a planetary surface
is absorbed by atmospheric greenhouse gases, and is re-radiated in all directions. Since
part of this re-radiation is back towards the surface and the lower atmosphere, it results in
an
GTU-SPCE-7TH SEM-EC Page 6
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
elevation of the average surface temperature above what it would be in the absence of the
gases.”
Fig.2.1-The Greenhouse Effect
The sun emits the radiation to the Earth, radiating energy at very short wavelengths,
predominately in visible or near-visible (e.g. ultraviolet) part of spectrum.
Approximately one-third of the solar energy that reaches the top of Earth atmosphere is
reflected directly back to space. The remaining two-third is absorbed by the surface and,
to a lesser area, by the atmosphere.
To balance the absorbed incoming energy, the Earth must, on average radiate the same
amount of energy back to space. Because the Earth is much colder than the sun, it
radiates at much longer wavelengths, primarily in the infrared part of the spectrum (see
fig).Much of this thermal radiation emitted by the land and ocean is absorb by the
atmosphere, including clouds, and reradiated back to Earth. This is called the
Greenhouse effect.
The glass walls in a greenhouse reduce airflow and increase the temperature of the air
inside. But through a different physical process, the Earth’s greenhouse effect warms
the surface of the planet. Without the natural greenhouse effect, the average temperature
GTU-SPCE-7TH SEM-EC Page 7
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
at Earth’s surface would be below the freezing point of water. Thus, Earth’s natural
greenhouse effect makes life as we know it possible.
However, human activities, primarily the burning of fossil fuels and clearing of forests,
have greatly intensified the natural greenhouse effect, causing global warming.
2.3.2 CAUSES OF GREENHOUSE EFFECT
The principal cause of Green-House effect is the increase in the quantity of greenhouse
gases like CO2 in the atmosphere. The naturally occurring "Green House gases",
including carbon dioxide, methane, nitrous oxide and water vapor, keep ground
temperature at a global average of 150 Celsius.. The greenhouse gases keep the surface
warm because as incoming solar radiation strikes earths, the surface gives off infrared
radiation or heat that the gases temporarily trap and keep near ground level.
2.3.3 PROBLEM FROM GREENHOUSE EFFECT
The problem is that human activity may be making the greenhouse gas cover "thicker"
For example, burning tonsil fuel throws huge amounts of CO2 into the air, the destruction
of forests allows carbon stored in the trees to escape into the atmosphere and other
activities such as raising cattle and planting rice emit methane, nitrous oxide, and other
greenhouse gases. Until mankind began burning fossil fuels, green house gases that occur
naturally remained in relative balance. But the beginning of the Industrial Revolution in
Britain ushered in rapid industrialization that greatly increased man's assault on the
ecology.
2.3.4 ROLE OF CARBON DIOXIDE IN GREEN HOUSE EFFECT
The carbon dioxide in the atmosphere also performs another major role. The earth
receives light of different wavelengths from the sun. The Ozone in the upper atmosphere
absorbs most of the harmful ultraviolet radiation and lets the other wavelengths pass
through. However, some of the light incident on earth is reflected back in the form of
intra-red light that is light whose wavelength is greater than that of red light. Carbon
dioxide molecules have the ability to absorb the intra-red radiation reflected from the
earth. A layer of CO2 can, therefore, trap intra-red light in the atmosphere causing the
GTU-SPCE-7TH SEM-EC Page 8
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
atmosphere to heat up-This heating due to trapped radiation is called the Green House
effect.
Infect the name green house is derived from a glass structure used to cultivate putted
plants in some countries water vapors and ozone also have the ability to trap intra-red
radiation and also sometimes referred to as greenhouse gases. However, water vapors is
only found near the surface of the earth and ozone only in the upper reaches of the
atmosphere carbon dioxide which is much more evenly distributed in the atmosphere and
contributes to the greenhouse effect to a larger extent.
The proportion of carbon dioxide can therefore, effect the temperature of the atmosphere.
If this proportion increases, the temperature is liable to rise.
Green plants absorb most of the excess CO2 from the atmosphere and give back healthy
oxygen in return. By destroying green plants and trees we destroy those very agents that
clean our atmosphere. A forestation, that is, the replanting of destroyed trees and forests
is one solution for preserving a healthy proportion of CO2 in the atmosphere. If the green
house effect is understood correctly, this would have increased the average temperature of
the earth by it.
GTU-SPCE-7TH SEM-EC Page 9
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
CHAPTER-3
DESIGN ELEMENT
3.1 BASIC MODEL OF SYSTEM
Fig.3.1-Basic Model of system
GTU-SPCE-7TH SEM-EC Page 10
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
We are using a Zigbee based network for Greenhouse effect monitoring and controlling.
This way of communication is actually done with Zigbee network topology. Each sensors
will senses the condition of Temperature, Humidity, soil moisture as well as light is
monitored and if there is any change in the condition of Temperature, Humidity, soil
moisture as well as light then it immediately sends that changed data through Zigbee to
the local system where the main module is connected to the computer to maintain the
status of the Greenhouse.
There are many sensors are used in greenhouse monitoring and controlling using Zigbee,
Likewise Temperature, Humidity, soil moisture, and Light sensors. This sensors senses
the Temperature, Humidity, soil moisture, And Light respectively. After it applied to the
Analog to Digital Converter (ADC) and it converts the Analog signal to Digital code.
And it applied to the Transmitter module of Zigbee. This Zigbee module sends to another
Receiver module of Zigbee through wireless communication. After receiving, this code is
applied to the Liquid Crystal Display (LCD) through Microcontroller. In LCD the
condition of Temperature, Humidity, Soil moisture, and light is displayed in terms of
digital code. If there is a change in Temperature, Humidity, soil moisture, and light then
for maintain a proper value we use the water pump, cooler, artificial light are used.
3.2 PARTS OF THE STSTEM
Sensors (Data acquisition system)
Temperature sensor (LM35)
Humidity sensor
Light sensor (LDR)
Soil Moisture sensor
Analog to Digital Converter ( ADC0808/0809)
Microcontroller (AT89S52)
Liquid Crystal Display (Hitachi'sHD44780)
Actuators – Relays
Devices controlled
Water Pump (simulated as a bulb)
Sprayer (simulated as a bulb)
Cooler (simulated as a fan)
GTU-SPCE-7TH SEM-EC Page 11
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Artificial Lights (simulated as a bulb)
Zigbee
3.3 SENSORS
There are four sensors are used in the block diagram. There are
1. Temperature sensor
2. Humidity sensor
3. Light sensor
4. Soil moisture sensor
3.3.1 TEMPERATURE SENSOR
Fig 3.2-Temperature Sensor
Several temperature sensing techniques are currently in widespread usage. The most
common of these are RTDs, thermocouples, thermistors, and sensor ICs. The right one for
your application depends on the required temperature range, linearity, accuracy, cost,
features, and ease of designing the necessary support circuitry. In this section we discuss
the characteristics of the most common temperature sensing techniques. But the cost of
real time temperature sensor is not affordable. Hence in this project we used a
GTU-SPCE-7TH SEM-EC Page 12
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
potentiometer to display body temperature. By using this we are showing a prototype how
it can works when we use an LM35 sensor.
These sensors use a solid-state technique to determine the temperature. That is to say,
they don't use mercury (like old thermometers), bimetallic strips (like in some home
thermometers or stoves), nor do they use thermistors (temperature sensitive resistors).
Instead, they use the fact as temperature increases, the voltage across a diode increases at
a known rate. (Technically, this is actually the voltage drop between the base and emitter
- the Vbe - of a transistor. By precisely amplifying the voltage change, it is easy to
generate an analog signal that is directly proportional to temperature. There have been
some improvements on the technique but, essentially that is how temperature is measured.
Because these sensors have no moving parts, they are precise, never wear out, don't need
calibration, work under many environmental conditions, and are consistent between
sensors and readings. Moreover they are very inexpensive and quite easy to use.
3.3.1.1 FEATURES
i. Calibrated directly in °Celsius (Centigrade)ii. Linear + 10.0 mV/°C scale factor
iii. 0.5°C accuracy guaranteed (at +25°C)iv. Rated for full−55° to +150°C rangev. Suitable for remote applications
vi. Low cost due to wafer-level trimmingvii. Operates from 4 to 30 volts
viii. Less than 60µA current drainix. Low self-heating, 0.08°C in still airx. Nonlinearity only ±1⁄ 4°C typical
3.3.2 HUMIDITY SENSOR
GTU-SPCE-7TH SEM-EC Page 13
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig 3.3 Humidity Sensor
According to the measurement units, humidity sensors are divided into two types:
Relative humidity (RH) sensors and absolute humidity (moisture) sensors. Most humidity
sensors are relative humidity sensors.
As there no real physical standard for relative humidity calibration, humidity instruments
are not specified properly. And it makes it really difficult for a user to compare the
sensors from different manufacturers. This makes it mandatory for a user to go deeper
into the specifications and attempt to verify the claims of the instrument manufacturer.
Humidity is the presence of water in air. The amount of water vapor in air can affect
human comfort as well as many manufacturing processes in industries. The presence of
water vapor also influences various physical, chemical, and biological processes.
Humidity measurement in industries is critical because it may affect the business cost of
the product and the health and safety of the personnel. Hence, humidity sensing is very
important, especially in the control systems for industrial processes and human comfort.
Controlling or monitoring humidity is of principal importance in many industrial &
domestic applications. In semiconductor industry, humidity or moisture levels needs to be
properly controlled & monitored during wafer processing. In medical applications,
humidity control is required for respiratory equipments, sterilizers, incubators,
pharmaceutical processing, and biological products.
Humidity control is also necessary in chemical gas purification, dryers, ovens, film
desiccation, paper and textile production, and food processing. In agriculture,
measurement of humidity is important for plantation protection (dew prevention), soil
moisture monitoring, etc. For domestic applications, humidity control is required for
living environment in buildings, cooking control for microwave ovens, etc. In all such
applications and many others, humidity sensors are employed to provide an indication of
the moisture levels in the environment.
The humidity sensor HH10D is used for sensing humidity. Relative humidity is a
measure, in percentage of the vapour in the air compared to the total amount of vapour
GTU-SPCE-7TH SEM-EC Page 14
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
that could be held in the air at a given temperature.HH10D gives the output in terms
of frequency at a range of 5 kHz to 10 kHz from frequency out pin.
3.3.2.1 FEATURES
i. Relative humidity sensor.
ii.Two point calibrated with capacitor type sensor, excellent performance.
iii. Frequency output type can be easily integrated with user application system.
iv. Very low power consumption.
v. No extra components needed.
3.3.2.2 SPECIFICATION:-
Range: 0% to 95%
Power: 0.0002 A @5Vdc
Response Time (time for 90% change in reading):
In still air: 60 minutes (typical)
With vigorous air movement: 40 seconds (typical)
Resolution: 0.04% RH
Stored calibration:
Slop: 30.43% per Volt
Intercept: -25.81%
Total accuracy (With saturated salt calibration): ±2% RH
Total accuracy (With standard calibration): ±10% RH
Operating Temperature Range: 0 to 85°C
Temperature Effect on 0%RH voltage: ±0.007% RH/°C(negligible)
Temperature Effect on 50%RH voltage: –0.11% RH/°C
Temperature Effect on 95%RH voltage: –0.22% RH/°C
GTU-SPCE-7TH SEM-EC Page 15
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.3.3 LIGHT SENSOR(LIGHT DEPENDENT RESISTOR)
Fig 3.4-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.
3.3.3.1 FEATURES:
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. Fig. Structure of a Light Dependent Resistor, showing Cadmium
Sulphide track and an atom to illustrate electrons in the valence and conduction bands.
3.3.3.2 FUNCTIONAL DISCRIPTION
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 f all 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 100ohms in full brightness. The circuit used for
GTU-SPCE-7TH SEM-EC Page 16
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
sensing light in our system uses a 10 k Ω fixed resistor which is attached to +5V.
Hence the voltage value in this case decreases with increase in light intensity.
Fig 3.5- Circuit Diagram
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Ω…(3.1)
With the LDR connected to 5V through a 10KΩ resistor, the output voltage of the LDR
is:
Vo = 5*RL / (RL+10)… (3.2)
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.
3.3.4 SOIL MOISTURE SENSOR
3.3.4.1 FEATURES
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.
GTU-SPCE-7TH SEM-EC Page 17
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
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.
Fig 3.6-Soil moisture sensor
3.3.4.2 FUNCTIONAL DISCRIPTION:
The two copper leads act as the sensor probes. They are absorbed into the variety soil
whose moisture content is under test. The soil is examined under three conditions:
Condition 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.
Condition 1: 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 tube 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.
Condition 3: Overload water condition- With the increase in water content beyond the
optimum level, the conductivity of the soil increases significantly 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.
GTU-SPCE-7TH SEM-EC Page 18
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.4 ANALOG TO DIGITAL CONVERTER (ADC 0808/0809)
In physical world parameters such as temperature, pressure, humidity, and velocity are
analog signals. A physical quantity is converted into electrical signals. We need an analog
to digital converter (ADC), which is an electronic circuit that converts continuous signals
into discrete form so that the microcontroller can read the data. Analog to digital
converters are the most widely used devices for data acquisition.
Fig 3.7-Getting data from the analog world
3.4.1 DESCRIPTION
The ADC0808 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 design of the ADC0808 has been optimized by incorporating the most desirable
aspects of several A/D conversion techniques. The device offers high speed, high
accuracy, minimal temperature dependence, excellent long-term accuracy and
repeatability, and consumes minimal power. These features make it ideally suited for
applications from process and machine control to consumer and automotive
applications.
3.4.2 FEATURES
i. Easy interface to all microcontrollers.
ii. Operates ratio metrically or with 5 Vdc or analog span adjusted voltage reference.
iii. No zero or full-scale adjust required.
iv. 8-channel multiplexer with address logic.
GTU-SPCE-7TH SEM-EC Page 19
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
v. 0V to 5V input range with single 5V power supply.
vi. Outputs meet TTL voltage level specifications.
vii. 28-pin molded chip carrier package.
Block diagram of ADC 0808/0809
GTU-SPCE-7TH SEM-EC Page 20
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.8 Block Diagram of ADC 0808/0809
3.4.3 PIN DIAGRAM OF ADC 0808/0809
Fig.3.9 Pin diagram of ADC 0808/0809
We use A, B, C addresses to select IN0-IN7 and activate Address latch enable (ALE) to
latch in the address. SC is for Start Conversion. EOC is for End of Conversion and OE is
for Output Enable. The output pins D0-D7 provides the digital output from the chip.Vref
(-) and Vref (+) are the reference voltages.
GTU-SPCE-7TH SEM-EC Page 21
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.4.4 SELECTING AN ANALOG CHANNEL
How to select the channel using three address pins A, B, C is shown in Table
below:
Select Analog Channel C B A
IN0 0 0 0
IN1 0 0 1
IN2 0 1 0
IN3 0 1 1
IN4 1 0 0
IN5 1 0 1
IN6 1 1 0
IN7 1 1 1
Table 3.1 Selection of the input channels
The ADC 0804 is most widely used chip, but since it has only one analog input, ADC
0808 is chosen as this chip allows the monitoring of up to 8 different transducers using
only a single chip. The 8 analog input channels are multiplexed and selected according to
the requirement. But for the proposed application only the last 4 channels i.e., IN4, IN5,
IN6 and IN7 are used to monitor the four parameters- temperature, humidity, soil
moisture and light intensity. Hence the address line ADD_C is given to Vcc (+ 5V)as it is
always high in this case. Vref (+) and Vref (-) set the reference voltages. If Vref (-) = Gnd
and Vref (+) =5V, the step size is 5V/256=19.53.
Since there is no self-clocking in this chip, the clock must be provided from an external
source to the Clock (CLK) pin. The 8-bit output from the ADC is given to Port 0 of the
microcontroller and the control signals ADD_A,ADD_B,ADD_C,ALE,START,OE,EOC
are given to Port 1 as shown in figure below.
GTU-SPCE-7TH SEM-EC Page 22
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.10 ADC 0808 Pin Detail Used For this Application
At a certain point of time, even though there is no conversion in progress the ADC0809 is
still internally cycling through 8 clock periods. A start pulse can occur any time during
this cycle but the conversion will not actually begin until the converter internally cycles to
the beginning of the next 8 clock period sequence. As long as the start pin is held high no
conversion begins, but when the start pin is taken low the conversion will start within 8
clock periods. The EOC output is triggered on the rising edge of the start pulse. It, too, is
controlled by the 8 clock period cycle, so it will go low within 8 clock periods of the
rising edge of the start pulse. One can see that it is entirely possible for EOC to go low
before the conversion starts internally, but this is not important, since the positive
transition of EOC, which occurs at the end of a conversion, is what the control logic is
looking for. Once EOC does go high this signals the interface logic that the data resulting
from the conversion is ready to be read. The output enable (OE) is then raised high.
GTU-SPCE-7TH SEM-EC Page 23
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.5. MICROCONTROLLER (AT89S52)
3.5.1 CRITERIA FOR CHOOSING A MICROCONTROLLER
The basic criteria for choosing a microcontroller suitable for the application are:
1) The first and primary criterion is that it must meet the task at hand efficiently and
cost effectively. In analyzing the needs of a microcontroller-based project, it is seen
whether an 8-bit, 16-bit or 32-bit microcontroller can best handle the computing
needs of the task most effectively. Among the other considerations in this category
are:
ii. Speed: The highest speed that the microcontroller supports.
iii. Packaging: It may be a 40-pin DIP (dual inline package) or a QFP (Quad Flat
Package), or some other packaging format. This is important in terms of space,
assembling, and prototyping the end product.
iv. Power consumption: This is especially critical for battery-powered products.
iv. The number of I/O pins and the timer on the chip.
v. How easy it is to upgrade to higher –performance or lower consumption versions.
vi. Cost per unit: This is important in terms of the final cost of the product in which a
microcontroller is used.
2) The second criterion in choosing a microcontroller is how easy it is to develop
products around it. Key considerations include the availability of an assembler,
debugger, compiler, technical support.
3) The third criterion in choosing a microcontroller is its ready availability in needed
quantities both now and in the future. Currently of the leading 8-bitmicrocontrollers,
the 8051 family has the largest number of diversified suppliers. By supplier is meant a
producer besides the originator of the microcontroller. In the case of the 8051, this has
originated by Intel several companies also currently producing the 8051. Thus the
microcontroller AT89S52, satisfying the criterion necessary for the proposed
application is chosen for the task.
GTU-SPCE-7TH SEM-EC Page 24
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.5.2 DESCRIPTION:
The 8051 family of microcontrollers is based on an architecture which is highly
optimized for embedded control systems. It is used in a wide variety of applications from
military equipment to automobiles to the keyboard. Second only to the Motorola68HC11
in eight bit processors sales, the 8051 family of microcontrollers is available in a wide
array of variations from manufactures such as Intel, Philips, and Siemens. These
manufacturers have added numerous features and peripherals to the 8051 such as
I2Cinterfaces, analog to digital converters, watchdog timers, and pulse width modulated
outputs. Variations of the 8051 with clock speeds up to 40MHz and voltage requirements
down to 1.5 volts are available. This wide range of parts based on one core makes the
8051 family an excellent choice as the base architecture for a company’s entire line of
products since it can perform many functions and developers will only have to learn this
one platform.
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K
bytes of in-system programmable Flash memory. The device is manufactured using
Atmel’s high-density nonvolatile memory technology and is compatible with the
industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with in-system programmable
Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to many embedded
control applications. In addition, the AT89S52 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 con-
tents but freezes the oscillator, disabling all other chip functions until the next interrupt or
hardware reset.
3.5.3 FEATURES:
GTU-SPCE-7TH SEM-EC Page 25
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
8K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
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.
3.5.4 PIN DIAGRAM:-
Fig.3.11 Pin Diagram of AT89S52
GTU-SPCE-7TH SEM-EC Page 26
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.5.5 BLOCK DIAGRAM
Fig.3.12 Block diagram of Microcontroller (AT89S52)
3.5.6 PIN DESCRIPTION
VCC: Supply voltage.
GND: Ground.
Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-
impedance inputs. Port 0 can also be configured to be the multiplexed low-order
GTU-SPCE-7TH SEM-EC Page 27
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
address/data bus during accesses to external program and data memory. Port 0 also
receives the code bytes during Flash Programming, and outputs the code bytes during
program verification.
Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (IIL) because of the internal pull-ups.
Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2pins that
are externally being pulled low will source current (IIL) because of the internal pull-ups.
Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3pins that
are externally being pulled low will source current (IIL) because of the pull-ups. Port 3
receives some control signals for Flash programming and verification. A high on this
input pin for two machine cycle, while the oscillator running resets the device. Port 3also
serves the functions of various special features of the AT89S52, as shown in the
following table.
P3 Bit Function Pin
P3.0 R×D (serial input port) 10
P3.1 T×D (serial output port) 11
P3.2 (external interrupt) 12
P3.3 (external interrupt) 13
P3.4 T0 (Timer/Counter 0 external i/p) 14
P3.5 T1(Timer/Counter 1 external i/p) 15
P3.6 (external data memory write strobe) 16
P3.7 (external data memory read strobe) 17
GTU-SPCE-7TH SEM-EC Page 28
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Table 3.2- Alternate functions of Port 3
RST: A high on this pin for two machine cycles while the oscillator is running resets. the
device. This pin drives high for 98 oscillator periods after the watchdog times out.
3.5.6.1 POWER –ON RESET CIRCUIT
Fig. 3.13 Power-on reset circuit
In order for the RESET input to be effective, it must have a minimum duration of two
machine cycles.
ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte of
the address during accesses to external memory. This pin is also the program pulse input
(PROG) during Flash programming. In normal operation, ALE is emitted at a constant
rate of 1/6 the oscillator frequency and may be used for external timing or clocking
purposes. Note, however, that one ALE pulse is skipped during each access to external
data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location
8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction.
Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.
GTU-SPCE-7TH SEM-EC Page 29
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
PSEN: Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 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 0000H up to
FFFFH. EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming.
XTAL1: Input to the inverting oscillator amplifier and input to the internal
clock operating circuit.
XTAL2: Output from the inverting oscillator amplifier. A crystal may be connected
between XTAL2 and XTAL1.
3.5.6.2 OSCILLATOR CLOCK CIRCUIT
Fig 3.14 The Oscillator Clock Circuit
It uses a quartz crystal oscillator.
• We can observe the frequency on the XTAL2 pin.
• The crystal frequency is the basic internal frequency of the microcontroller.
• The internal counters must divide the basic clock rate to yield standard
communication bit per second (baud) rates.
GTU-SPCE-7TH SEM-EC Page 30
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
• An 11.0592 megahertz crystal, although seemingly an odd value, yields a crystal
frequency of 921.6 kilohertz, which can be divided evenly by the standard
communication baud rates of 19200, 9600, 4800, 2400, 1200, and 300 hertz.
3.5.7 SPECIAL FUNCTION REGISTERS
The Special Function Registers (SFRs) contain memory locations that are used for special
tasks. Each SFR occupies internal RAM from 0x80 to 0xFF.They are 8-bits wide. The
SFR memory consists of important registers like accumulator, B register, interrupt control
register, PSW, timer/counter, power control, four I/O ports, and serial control. Some of
these registers are bit addressable while remaining are byte addressable.
• The A (accumulator) register or accumulator is used for most ALU operations and
Boolean Bit manipulations.
• Register B is used for multiplication & division and can also be used for general
purpose storage.
• PSW (Program Status Word) is a bit addressable register.
• PC or program counter is a special 16-bit register. It is not part of SFR. Program
instruction bytes are fetched from locations in memory that are addressed by the PC. It
is used to hold the address of a instruction in the memory.
• Stack Pointer (SP) register is eight bits wide. It is incremented before data is stored
during PUSH and CALL executions. While the stack may reside anywhere in on-chip
RAM, the Stack Pointer is initialized to 07H after a reset. This causes the stack to begin
at location 08H.
• DPTR or data pointer is a special 16-bit register that is accessible as two independent 8-
bit registers: DPL and DPH, which are used to furnish memory addresses for internal
and external code access and external data access.
• Control Registers: Special Function Registers IP, IE, TMOD, TCON, SCON, and
PCON contain control and status bits for the interrupt system, the Timer/Counters, and
the serial port.
• Timer Registers: Register pairs (TH0, TL0) and (TH1, TL1) are the 16-bit Counter
registers for Timer/Counters 0 and 1, respectively.
3.5.8 TIMERS AND COUNTERS
GTU-SPCE-7TH SEM-EC Page 31
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Many microcontroller applications require the counting of external events such
as the frequency of a pulse train, or the generation of precise internal time delays
between computer actions. Both of these tasks can be accomplished using
software techniques, but software loops for counting or timing keep the
processor occupied so that, other perhaps
More important, functions are not done. Hence the better option is to use
interrupts & the two 16- bit count- up timers. The microcontroller can
programmed for either of the following:
1. Count internal - acting as timer
2. Count external - acting as counter
All counter action is controlled by the TMOD (Timer Mode) and the TCON
(Timer/Counter Control) registers. TCON Timer control SFR contains timer 1&
2 overflow flags, external interrupt flags, timer control bits, falling edge/low
level selector bit etc.
TMOD timer mode SFR comprises two four-bit registers (timer #1, timer#0)
used to specify the timer/counter mode and operation. The timer may operate in
any one of four modes that are determined by modes bits M1and M0 in the
TMOD register:
TIMER MODE-0:Setting timer mode bits to 00b in the TMOD register results in using the
TH register as an 8-bit counter and TL as a 5-bit counter. Therefore mode0 is a
13-bit counter.
TIMER MODE-1:Mode-1 is similar to mode-0.But only difference is that in mode 0 the
timer/counter was 13 bit timer/counter, but in mode 1 it is a 16 bit timer/counter.
It except TL is configured as a full 8-bit counter when the mode bits are set to
01b in TMOD.
TIMER MODE-2:In this mode the timer/counter register is configured as an 8-bit counter
(TL) with auto reload facility. Setting the mode bits to 10b in TMOD configures
the timer to use only the TL counter as an 8-bit counter. TH is used to hold a
value that is loaded into TL every time TL overflows from FFh to 00h. The
timer flag is also set when TL overflows.
GTU-SPCE-7TH SEM-EC Page 32
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
TIMER MODE-3:In mode-3, timer-1 simply hold its count, where as timer 0 registers TL0
and TH0 are used as two separate 8-bit counters. TL0 uses the Timer-0 control
bits. TH0 counts machine cycles and takes over the use of TR1 and TF1 from
Timer-1.
3.5.9 INTERRUPTS
A computer has only two ways to determine the conditions that exist in internal and
external circuits. One method uses software instructions that jump to subroutines on the
states of flags and port pins. The second method responds to hardware signals, called
interrupts that force the program to call a subroutine.
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and
INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. Each of
these interrupt sources can be individually enabled or disabled by setting or clearing a
bit in Special Function Register IE. IE also contains a global disable bit, EA, which
disables all interrupts at once. Each interrupt forces the processor to jump at the interrupt
location in the memory. The interrupted program must resume operation at the instruction
where the interrupt took place. Program continuation is done by storing the interrupted
PC address onto stack. RETI instruction at the end of ISR will restore the PC address.
3.5.10 MICROCONTROLLER CONFIGURATION USED IN THE SET-UP
The microcontroller is interfaced with the ADC in polling mode. INT0 is used for the
LCD mode selection switch in order to switch between two modes of display: 1) Sensor
output display
2) Actuator status display Port details:
Port 0: Interfaced with the LCD data lines.
Port 1: Interfaced with the ADC data lines
Port 2: Interfaced with the LCD Control lines and AC Interface control
Port 3: Interfaced with the ADC control lines
3.6. LIQUID CRYSTAL DISPLAY
GTU-SPCE-7TH SEM-EC Page 33
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
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 low-cost, 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:
First line 80 81 82 83 84 85 86 through 8F
Second line C0 C1 C2 C3 C4 C5 C6 through CF
3.6.1 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 selects (RS): With the help of this line, the LCD interprets the type of
data on data lines. When it is low, an instruction is
GTU-SPCE-7TH SEM-EC Page 34
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
being written to the LCD. When it is high, a character is
being written to the LCD.
3.6.1.1 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
-1Character
3.6.1.2 Writing and reading the data from the LCD:
1. 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
2. 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
3.6.2 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).
GTU-SPCE-7TH SEM-EC Page 35
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.15 Pin diagram of LCD display
Table 3.3 .Pin description of the LCD
3.7 ACTUATORS-RELAYS
It was invented by Joseph Henry in 1835. “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. 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.
GTU-SPCE-7TH SEM-EC Page 36
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.16 Sugar Cube Relay
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 Relay interfacing circuitry used in the application is:
Fig.3.17 Relay circuitry
3.8 POWER SUPPLY CONNECTION
GTU-SPCE-7TH SEM-EC Page 37
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.18 Block diagram of Power Supply Connection
The power supply section consists of step down transformers of 230V primary
to 9V and 12V secondary voltages for the +5V and +12V power supplies respectively.
The stepped down voltage is then rectified by 4 1N4001 diodes. The high value of
capacitor 470µF charges at a slow rate as the time constant is low, and once the
capacitor charges there is no resistor for capacitor to discharge. This gives a constant
value of DC. IC 7805is used for regulated supply of +5 volts and IC 7812 is used to
provide a regulated supply of +12 volts in order to prevent the circuit ahead from any
fluctuations. The filter capacitors connected after this IC filters the high frequency
spikes. These capacitors are connected in parallel with supply and common so that
spikes filter to the common. These give stability to the power supply circuit.
As can be seen from the above circuit diagrams, the rectified voltage from the 4
diodes is given to pin 1 of the respective regulators. Pin 2 of the regulators is connected
to ground and pin 3 to Vcc. With sufficient heat falling the regulator can deliver 1A
output current. If internal power dissipation becomes too high for the heat sinking
provided, the thermal shutdown circuit takes over preventing the IC from overheating.
GTU-SPCE-7TH SEM-EC Page 38
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.19 +5V power supply connection
Fig.3.20 +12V power supply connection
3.9 ZIGBEE PROTOCOL
3.9.1 INTRODUCTION
ZigBee is a low date rate, low cost, low power consumption, and wireless
networking protocol targeted towards automation and remote applications.
ZigBee is a wireless communications protocol based on the 802.15.4 standard is
designed for low speed communication between two or more devices, you can network
with thousands of devices communicating with each other, making it ideal for many
applications.
ZigBee is developed by the ZigBee alliance. The ZigBee Alliance also defines a
so-called application profiles, which specify how ZigBee devices must operate /
communicate within a given field / market. For example home automation profile
GTU-SPCE-7TH SEM-EC Page 39
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
described as a temperature sensor must send their readings to a thermostat, and how it
would control such as a radiator. This way you can integrate devices from different
manufacturers for a specific task.
It is based on the 802.15.4 communications standard that defines the hardware
and software physical layer (PHY) and media access control (MAC). Each layer is
responsible for a number of functions necessary for communication, ZigBee adds layers
on the two previous layers of 802.15.4, a layer does not know anything about the layer
above it and add each layer adds a number of functions to the base of the lower.
Any device from a manufacturer that supports this standard communications and
pass the corresponding certification, you can communicate with another device from a
different manufacturer. ZigBee device would comprise a 802.15.4 standard radius
according to a microcontroller connected with the stack (stack) ZigBee, where the
layers are deployed above the 802.15.4. This battery is designed to be implemented in
8-bit microcontrollers.
3.9.2 WHY IT IS CALLED ZIGBEE?
It can be suggested that the name variable, the Zig-Zag patterns of the bees
follows as that return pollen, Similar to the way packet would move through mesh
network.
Using communication system, whereby the bee dances in Zig-Zag pattern, worker
bee is able to share information such as the location, distance, And direction of a newly
discovered food source to her fellow colony members. Instinctively implementing the
Zigbee principle, bees around the world actively sustain productive reaction and promote
future generations of colony members.
3.9.3 NETWORK CHARACTERISTICS OF ZIGBEE DEVICES
Network characteristics / ZigBee devices are as follows:
Transmission speed between 25-250 kbps.
Asynchronous protocol, half duplex, standardized, enabling products from
different manufacturers work together.
It can be networked devices containing from two to hundreds.
The devices of these networks can operate in a low power mode, which means
year of their batteries.
GTU-SPCE-7TH SEM-EC Page 40
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Operates in the frequency of 2.4 GHz (16 channels)(Worldwide) and also at
frequencies of 868 MHz(Europe) and 915 MHz(USA).
It is a reliable protocol, the network is organized and automatically repaired and
the packets are routed dynamically.
It is a secure protocol can be implemented as encryption and authentication.
3.9.4 DEVICE TYPE
There are three different Zigbee device types that operate on these layers in any
self-organizing application network. These devices have 64-bit IEEE addresses. With
option to enable shorter address to reduce packet size and work in either of two
addressing modes star and peer to peer.
The Zig-bee(PAN)coordinator node:-
The most capable device, the coordinator forms the root of the network tree and might
bridge to other networks. It is able to store information about the network. There is one
and only one Zigbee coordinator in each network to act as the router to other network. It
also acts as the repository for security keys.
The Full Function Device(FFD):-
The FFD is an intermediately router transmitting data from other devices. It needs lesser
memory than the Zigbee coordinator node and entails lesser manufacturing costs. It can
operate in all topologies and can act as a coordinator.
The Reduced Function Device(RFD):-
This device is just capable of taking in the network. It cannot relay data from other device
requiring even less memory (no flash very little ROM and RAM),an RFD will thus be
cheaper than an FFD.This device takes only to a network coordinator and can be
implemented very simply in star topology .
An FFD can talk to RFDS or other FFD, while an RFD can talk only to an FFD.an RFD is
intended for applications that are extremely simple, such as a light switch or a passive
infrared sensor, they do not have need to send large amounts of data and may only
associate with a single FFD at a time consequently, the RFD can be implemented using
minimal resources and memory capacity.
GTU-SPCE-7TH SEM-EC Page 41
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.9.5 NETWORK TOPOLOGY
Zigbee supports: star topology, peer to peer topology &cluster to tree
3.9.5.1 STAR TOPOLOGY:-
Fig.3.21 Star Topology
In star topology the communication is established between device and a single
central controller, called the PAN coordinator. The PAN coordinator may be mains
powered while the devices will most likely be battery powered application that benefit
from this topology include home automation, Personal Computer (PC) peripherals, toys
and games, after FFD is activated for the first time, it may establish its own network and
become the PAN coordinator. Each star network chooses a PAN identifies, which is not
currently used by any other network within the radio sphere of influence. This allows
each star network.
3.9.5.2 PEER TO PEER TOPOLOGY
GTU-SPCE-7TH SEM-EC Page 42
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.22 Peer To Peer Topology
In peer to peer topology, there is also on PAN coordinator. In contrast to star
topology, any device as long as they are in range of one another. A peer to peer network
can be ad hoc, self-organizing and self-heading. Applications such as industrial control
and monitoring, wireless sensor networks of peer to peer topology.
3.9.5.3 CLUSTER- TREE TOPOLOGY
Fig.3.23 Cluster- Tree Topology
Cluster-tree network is a special case of peer-to-peer network in which most
devices are FFDs and an RFD may connect to a cluster-tree network as a leave node at
the end of a branch. Any of the FFD can act as a co-coordinator and provide
synchronization services to other devices and coordinators.
3.9.6 ARCHITECTURE
GTU-SPCE-7TH SEM-EC Page 43
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Fig.3.24 Architecture of Zigbee
The LR-WPAN architecture is defined in terms of a number of blocks in order to
simplify the standard. These blocks are called layers. Each layer is responsible for one
part of the standard and offers services to the higher layers. The layout of the block is
based on the Open Systems Interconnection (OSI) seven-layer model. The interfaces
between the layers serve to define the logical link between layers.
An LR-WPAN device comprises a PHY, which contains the Radio Frequency
(RF) transreceives along with its low-level control mechanism, and a MAC sub layer that
provides access to the physical channel for all type of transfer.
3.9.6.1 NETWORK AND APPLICATION LAYER
The network layer permits growth of network without power transmitter. This
layer can handle huge number of nodes.
This level in the Zigbee architecture includes.
I. The Zigbee Device Object(ZDO)
II. User-defined application profile (S)
III. The Application Support (APS) sub layer.
GTU-SPCE-7TH SEM-EC Page 44
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
I. The Zigbee device object (ZDO):-
The responsibility of determining the nature of the device (coordinator/FFD or
RFD) in the network, commencing and replying to binding requests and ensuring
a secure relationship between devices rests with the ZDO (Zigbee Define Object)
II. User defined application profile (S):-
The user defined application refers to the end device that conforms to the Zig-Bee
standard.
III. The application support (APS) sub-layer:-
The APS sub-layer’s responsibilities include maintenance of that enable matching
between two devices and communication among them.
3.9.6.2 PHYSICAL (PHY) LAYER:-
The PHY service enables the transmission and reception of PHY Protocol Data
Units (PPDU) across the physical radio channel. The feature of the IEEE 802.15.4 PHY
physical layer are activation and deactivation of the radio trancreceiver, Energy Detection
(ED) , Link Quality Indication (LQI), channel selection ,Clear Channel Assessment
(CCA) and transmitting as well as receiving packets across the physical medium.
3.9.6.3 MEDIA ACCESS CONTROL (MAC) LAYER:-
The MAC service enables the transmission and reception of MAC protocol data
units (MPDU) across the PHY data service. The feature of MAC sub layer are become
management, channel access, GTS management, frame validation acknowledged frame
delivery, association and disassociation
3.9.7 DIFFERENCE BETWEEN ZIGBEE, WI-FI, AND BLUETOOTH
Parameter Zigbee Wi-Fi Bluetooth
Range 10-100meters 50-100meters 10-100meters
GTU-SPCE-7TH SEM-EC Page 45
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
Operating
frequency
868 MHz (Europe)
915 MHz (USA),
2.4GHz(worldwide)
2.4 and 5 GHz 2.4 GHz
Complexity Low High High
Power
Consumption
Very low High Medium
Data Rate 20,40,and250Kbits/s 11 & 54
Mbits/sec
1 Mbits/s
Channel
bandwidth
0.3/0.6MHz,2 MHz 22 MHz 22 MHz
Networking
Topology
Peer to peer,
star, or mesh
Point to hub Very small
networks
Nominal Tx
power
(-25)-0 dBm 15-20 dBm 0-10 dBm
Number of RF
Channel
1(868MHz)
10(915MHz)
16(2.4GHz)
14(2.4GHz) 79 (2.4GHz)
Max. no. of cell
node
>65000 2007 8
Data protection 16 -bit CRC(cyclic
redundancy check)
32-bit CRC 16-bit CRC
Modulation
type
BPSK(+ASK),
O-QPSK
BPSK,QPSK,M-
QAM
GFSK
System
resources
4KB-32KB 1MB 16KB
Bandwidth 20 KB/s-250 KB/s 11,000 KB/s 720 KB/s
Battery Life 100-1000 days 0.5-5 days 1-7 days
Success Metrics Reliability,Power,cost Speed,Flexibility Cost,Convenience
Other
Information
Devices can join an
existing network in
under 30ms
Device
connection
requires 3-5
Device connection
requires up to 10
seconds
GTU-SPCE-7TH SEM-EC Page 46
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
seconds
Typical
Applications
Industrial control and
monitoring, sensor
networks, building
automation, home
automation
Wireless LAN
connectivity,
broadband
Internet access
Wireless
connectivity
between devices
such as phones,
PDA,laptops,
headsets
Table 3.4 Differences Between Zigbee, Wi-Fi & Bluetooth
3.9.8 WHY WE USE ZIGBEE?
Due to the following advantages of Zigbee other than two wireless protocols such as
Wi-Fi &Bluetooth, We use Zigbee protocol which suitable for proposed application.
Low cost (US$1 or less)
Low data rate(Zigbee is sufficient for green house(250kbps))
Low current consumption(30mA)
Long battery life
Small size
High reliability
3.10 DEVICES CONTROLLED
3.10.1 TEMPERATURE CONTROLLER IN GREENHOUSE
Temperature is pivot a major role in Greenhouse. There are two type of effect to
greenhouse by temperature: heating and cooling. In case, heating temperature is increased
to more than required temperature than we require the cooling equipment for controlling
the hot temperature. And in case, cooling temperature is increased to more than required
GTU-SPCE-7TH SEM-EC Page 47
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
temperature than we require the heating equipment for controlling the cooling
temperature. So, the heating equipment and cooling equipment describe as below:
3.10.1.1 COOLING EQUIPMENT
There are two primary cooling devices in most greenhouses. These are the vent system,
exhaust fan. 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 run
away, and fresh air can enter the greenhouse. 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.
3.10.1.2 HEATINGEQUIPMENT
Hot-water or steam heater:
A hot-water system with circulator or a steam system linked with automatic ventilation
will give sufficient 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.
GTU-SPCE-7TH SEM-EC Page 48
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
3.10.2 HUMIDITY CONTROL IN GREENHOUSE
One of the biggest challenges in maintaining a greenhouse is humidity control. Most
plants enjoy a humidity of 50 to 60 percent, and this is a challenge to manage at times.
The main goal is to avoid condensation on plants, which promotes mould and fungus
growth. Low humidity leads to leaf dehydration, more frequent watering and pest
infestation.
1. Vent your greenhouse to help a good exchange of air. Good circulation is the key
to humidity control. Hot, humid air exits the greenhouse, allowing cooler, dryer
air to enter. If the temperature rises above 80 degrees F or the humidity gets close
to 100 percent, there must be around 50 exchanges of air per hour to keep the
humidity down. To accomplish this, a roof vent and a side vent close to the floor
are the best solution.
2. Turn on a fan to circulate the air and force the humid air to move up and out
through the vents. It doesn't take much air movement to make a difference.
3. Shade your greenhouse in the hot summer to keep it from overheating. Hot air
escapes through the vents when the greenhouse heats up, causing plants to wilt as
they lose valuable moisture. There are shade cloths available from bunnings to
drape over the top of your greenhouse if you don't have any trees to provide
shade.
4. Mist your greenhouse to add humidity when it begins to warm up and vent the hot
air out. Installing a misting system is one option, but there are a few precautions to
consider if you do. Only mist during the day because as the greenhouse cools at
night, the humidity is raised, encouraging disease. A timer, set to turn off a few
hours before sunset, is a good idea if you install a misting system and make sure
you place the misting nozzles under the plant shelves, to avoid soaking the plants.
Spraying the floor with water in the morning will also raise the humidity levels
during the day.
5. Avoid condensation when the weather is cold outside. It occurs when the plants are
colder than the air around them. Venting and air circulation controls humidity in
GTU-SPCE-7TH SEM-EC Page 49
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
the warm months, but during the winter, venting alone causes the temperature to
drop. Therefore, heat must be included with air movement and ventilation to
control the humidity.
3.10.3 ARTIFICIAL LIGHTS FOR CONTROLLING LIGHT
Lights enable to expand 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:
1. Fluorescent lamps-
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. These have the advantage of higher light efficiency with low heat.
2. Bright 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.
3. High-Intensity Discharge (HID) lamps -
These have a long life (5000 hours or more). It is made with possible improvement by
the addition of sodium and Metal-halides, this 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,000fc.
•High: 4000-5000 foot candles--bright light, just under 50% of the full twelve noon 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
GTU-SPCE-7TH SEM-EC Page 50
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
the lighting industry, typically this is approximated as 1 foot candle being equal to
10lux.
GTU-SPCE-7TH SEM-EC Page 51
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
REFERENCES
GTU-SPCE-7TH SEM-EC Page 52
GREENHOUSE MONITORING AND CONTROLLING USING ZIGBEE
BOOKS:
1. Kenneth J Ayala, The 8051 Microcontroller Architecture, Programming &
Applications, Penram international, 2nd Edition,1996.
2. Muhammad Ali Mazidi, Junice Gillispie Mazidi, Rolin D.Mckinlay,The
Microcontroller & Embedded Systems, Pearson Edication Inc.2nd Edition,2008.
3. Harish G. Narula, U.S.Shah, Microcontroller And Interfacing, Tech-Max
Publication Inc. 2nd Revised Edition, June 2011.
IEEE PAPERS:
1. Stipanicev D.,Marasovic J., Networked embedded greenhouse monitoring and
control, Proceeding of 2003, IEEE Conference On Control Application, June
2003.
2. White paper entitled “Understanding 802.15.4 and Zigbee Networking” by
Daintree networks.
3. Jon T.Adams, Zigbee Wireless Technology And The IEEE 802.15.4 Radio-
Enabling Simple Wireless, Texas Wireless Symposian, 2005.
WEB SOURCES:
1. http://www.greenhousesonline.com.au/pages.php?pageid=9
2. http://www.engineersgarage.com/electronic-components/16x2-lcd-module-
datasheet
3. http://www.national.com/ds/AD/ADC0808.pdf
4. http://www.google.co.in/
5. http://laris.fesb.hr/PDF/stipanicev-marasovic-2003.pdf
GTU-SPCE-7TH SEM-EC Page 53