Você está na página 1de 47

Greenhouse Monitoring

System Using GSM


Final Graduation Project (2)

2014

Greenhouse Monitoring System Using GSM

Prepared by:
Asma Ghannam and Maram Azzam

Submitted to:
Jamal Kharrousheh

Report presented in Partial Fulfillment of the Requirements


for Bachelor degree in telecommunication engineering
Project II (69590)

Departments of Telecommunication and Electrical


Engineering
Faculty of Engineering
An-Najah National University

April , 2013

Contents
ABSTRACT............................................................................................................... 4
CH1. INTRODUCTION................................................................................................ 5
1.1
1.2
1.3
1.4
1.5

OVERVIEW...................................................................................................... 5
BENEFITS OF GREENHOUSES AND SMART GREENHOUSE................................................6
OPERATION SYSTEM........................................................................................... 7
OPJECTIVES AND MOTIVATIONS.............................................................................7
REPORT ORGANIZATION.....................................................................................8

CH2. STANDARDS AND CONSTRAINTS.......................................................................8


2.1 CONSTRAINTS..................................................................................................... 8
2.1.1 Strengths................................................................................................ 8
2.1.2 Weaknesses............................................................................................8
2.1.3 Opportunities..........................................................................................8
2.1.4 Threats................................................................................................... 9
2.2 STANDARDS..................................................................................................... 9
2.2.1
IEEE standards...................................................................................9
2.2.2
GSM standards...................................................................................9
2.3 EARLIER COURSEWORK........................................................................................14
CH3. LITERATURE REVIEW......................................................................................16
3.1 INTRODUCTION............................................................................................... 16
3.1.1 89s52.................................................................................................... 16
3.1.2 GSM Module............................................................................................. 18
3.1.3 Push Button Switch......................................................................................20
3.1.4 Sensors..................................................................................................... 21
3.1.5 Valve..................................................................................................... 24
3.1.6 Fan....................................................................................................... 24
3.1.7 Light..................................................................................................... 25
3.1.8 Relays.................................................................................................... 26
3.1.10 Pump................................................................................................... 26
3.1.9 Liquid Crystal Display (LCD)......................................................................27
3.2 SIMILAR GREENHOUSE AUTOMATED SYSTEM..........................................................28
3.3 PROPOSED SYSTEM..........................................................................................29
CH4. METHODOLOGY AND IMPLEMENTATION..........................................................30
4.1 INTRODUCTION............................................................................................... 31
4.2 SIGNAL DETECTION..........................................................................................32
4.2.1 Light Dependent Resistor............................................................................32
4.2.2 Humidity and Temperture Sensor..................................................................34
4.2.3 Soil Moisture sensor..................................................................................35
4.3 HARDWARE CONTROLLING.................................................................................35
4.3.1 Push Button Switch...................................................................................40
4.3.2
Interfacing LCD with Arduino............................................................41

4.4 SMS SERVICE FOR GREENHOUSE CONTROLLING.......................................................42


4.4.2
SIM Interface.....................................................................................42
4.5 SOFTWARE DESCRIPTION...................................................................................43
CH5. RESULTS AND DISCUSSION..............................................................................44
CH6. CONCLUSIONS AND RECOMMENDATION..........................................................57
REFERENCES.......................................................................................................... 57

List Of Figures
Y

FIGURE 1.1 PROPOSED MODEL OF GREEN HOUSE SYSTEM..........................7


FIGURE 1.2 GENERAL FLOW DIAGRAM OF SYSTEM.....................................8
FIGURE1.3 INPUT-OUTPUT OF OUR SYSTEM..............................................8
FIGURE 3.1 TMEGA 2560..................................................................17
FIGURE 3.2 ARDUINO PIN MAPPING......................................................18
FIGURE 3.3 GSM MODEL HAVE SPECIFIC INTERFACE WITH ARDUINO............20
FIGURE 3.4 SIM ELECTRICAL CHARACTERISTICS......................................21
FIGURE 3.5 PUSH BUTTON..................................................................21
FIGURE 3.6 LDR RESISTOR.................................................................22
FIGURE 3.7 LDR CIRCUIT....................................................................22
FIGURE 3.8 RHT03 SENSOR...............................................................23
FIGURE 3.9 RHT03 AND LDR SENSORS...............................................23
FIGURE 3.10 SOIL MOISTURE SENSOR...................................................24
FIGURE 2.11 VALVE...........................................................................25
FIGURE 3.12 FAN..............................................................................26
FIGURE 3.13 LIGHT...........................................................................27
FIGURE 3.14 RELAYS.........................................................................27
FIGURE 3.15 PUMP............................................................................28
FIGURE 3.16 LCD.............................................................................28
FIGURE3.17 TOP GREENHOUSE'S PROJECTS AROUND THE GLOBE................30
FIGURE 3.18 BLOCK DIAGRAM OF SYSTEM..............................................31
FIGURE 4.1 PROJECT IDEA...................................................................32
FIGURE 4.2 SYSTEM PROCESS..............................................................33
FIGURE 4.3 SENSOR CONNECTION.........................................................33
FIGURE 4.4 LDR AND ARDUINO CONNECTION.........................................34
FIGURE 4.5 LDR INTIER CIRCUIT..........................................................35
FIGURE 4.6 SENSOR INTERFACE............................................................35
FIGURE 4.7 HUMIDITY AND TEMPERTURE SENSOR INTERFACE.....................36
FIGURE 4.8 SOIL SENSOR CIRCUIT DIAGRAM...........................................36

FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE
FIGURE

4.9 DEVICE CONNECTION.........................................................37


4.10 OVERALL FLOW CHART FOR ARDUINO..................................38
4.11 FLOW CHART OF SWITCH CONTROL.....................................39
4.12 FLOW CHART FOR TEMPERATURE SENSOR.............................40
4.13 FLOW CHART FOR SOIL.....................................................41
4.14 FLOW CHART FOR PHOTOCELL SENSOR................................41
4.15 PUSH BUTTON SWITCH CIRCUIT..........................................42
4.16 LCD CONNECTION...........................................................43
4.17 LCD INTERFACE..............................................................43
4.18 GSM INTERFACE.............................................................44
4.19 SIMULATION DESIGN........................................................45

List Of Tabels
TABEL
TABEL
TABEL
TABEL
TABEL
TABLE
TABEL
TABEL
TABLE

2.1 GSM FREQUENCY BANDS.....................................................10


2.2 PROJECT SPECIFICATIONS......................................................13
2.3 RELAYS............................................................................13
2.4 ARDUINO DETAILS...............................................................13
2.5 PRELIMENTRY PARTS LIST.....................................................14
3.1 ARDUINO DETAILS...............................................................18
3.2 SIM PIN DESCRIPTION.........................................................19
3.3 SIM ELECTRICAL CHARACTERISTICS.......................................20
3.4 PIN DEFINITION.................................................................23

Abstract
The system proposed in this project is Green House which is a smart technology to
provide plants and trees the required nourishment from the sunlight and to prevent the
same from the harmful effects.
System components used are temperature sensor, soil moisture sensor, temperature
sensor, light sensor, Transistor switches, relay nodes for automatic control, to control
greenhouse information. The system is implemented using low power wireless
components, and easy to install . To make this more efficient a GSM has been linked
with the system.
A model of greenhouse is achieved .It was possible to do control plant growth through
closely studying relationship between indoor environmental information and monitored
information on crop itself. It is made possible to collect information and control
effectively and automatically greenhouse in the site or from a remote place through
GSM modem.

Ch1. Introduction
1.1

Overview

A greenhouse is a structure with a glass or plastic roof and frequently glass or plastic
walls ; the incoming solar radiation from the sun warms plants, soil, and other things
inside the building [1]. Moreover , a greenhouse protects and a controlls environment
for raising plants indoors. As we know, most of the gar-dener uses manual system of
watering to their plant in the garden and also in the greenhouse. This system is
inefficient since when we manually do this, the possibility to get some plant can
drown.In order to overcome this problem, automatic greenhouse used .
The greenhouse automatic control system will fully automate the management of a
greenhouse using the latest pervasive systems and technology. The proposed system
controls and monitors light intensity, soil and air humidity using a controller and GSM
modules.
A temperature sensor, humidity sensor, soil moisture and light sensor which are
automatically controlled are used in our project . The concern with a lot of consumer
needs and demand for the agriculture products has stimulated awareness among the
farmer that increases their products in the market by implementing advance
technologies in this industry.
This project uses sensors and Global System for Mobile Communication (GSM) and
short message service (SMS) to carry out data from the green house with sensors
directly alert the farmers to their mobile phone. Therefore, this makes controlling plants
easier by directly sending alert notification messages to farmers using GSM and SMS
technology. So, this project aims to design a smart greenhouse model controlled
automatically by a keypad. Parameters like humidity, temperature and lightning will be
controlled by 89S52 microcontroller. Each of these parameters is measured by a sensor
that is set at a specific range, if this sensor signals any change in that range, the system
will take the appropriate action required, and the system sends a daily report to the user
by SMS.

Figure 1.1 Proposed Model of Green House System

Figure 1.1. denote that the main system identified the hazardous condition then GSM
modem activated and send the message to another modem which is connected to
computer system and Computer system store the log of SMS received and send and
New SMS send to first GSM and after receiving SMS, main unit can starting the
operation on green house system.

1.2

Benefits of greenhouses and smart greenhouse


Benefits of greenhouses

Greenhouses allow you to control the temperature and humidity, a manipulation that
allows you to grow vegetables year round. In these closed microcosm, you can mimic
the climate of any section of the world. You also have more control of the climate,
.leading to better crops [2]
Benefits of smart greenhouses
1. Saves money, time, and effort.
2. Provides a better environment to the plant to prevent it from damage and to
increase its productivity.
3. Some plants require a longer period of lighting than other plants; the smart
greenhouse will provide the right amount of lighting.
4. Automatically controls the amount of water needed for each plant.

1.3

Operation system

This system measures input levels by various sensors; each sensor will be calibrated to a
preprogrammed level.

Many items are measured by the sensors; each one is processed separately and then
provides a suitable output that runs one of the mechanic systems to adjust this measured
value.
The following diagram explains that if the main system detects the signal, system will
analyzed the signal and detect the problem then send SMS message to system that will
start its operation to prevent the hazards[3] .

Figure 1.2 General flow diagram of system

1.4

Opjectives and Motivations

Design a hardware unit of the prototype of the system that is monitoring and controlling
the greenhouse environment and build a small greenhouse model :

Temperature

89S52
&GSM
system

Soil moisture
Gas sensor
Light sensor

Figure1.3 Input-Output of our system

1.5

Report Organization

We organised our report as follows. The second chapter mentions the standards ,
strength and weakness points. Chapter three highlights literature review .After that in
chapter four a full description will made on experimental methods taken by using
flow charts for the system procedure and approximate design simulation for the
system . Then results and analysis will be shown and discussed .Finally, conclusion
and our recommendations.

Ch2. Standards and Constraints


Constraints 2.1
2.1.1 Strengths
This project is a pioneer in Palestinian agri -business.The owners are very
experienced in the agricultural sector.
Regarding the implementation, 89s52 programming is easy concept to deal with
The project finally done .

2.1.2 Weaknesses
Modeling the greenhouses could face some limitations :
a. The tools we are dealing with are very sensible , they need to
be carefull and so the project may be a bit costly.
b. Failure to supply the essential factors for optimum growth
such as light, moisture, carbon dioxide and heat in amounts
necessary for each individual crop and this problem faces
greenhouses in general .
c. Palestine still faces a problem in marketing the plants.

2.1.3 Opportunities
Greenhouses represent a means of greatly improving agricultural production .There is
increasing demand for natural medical remedies.

2.1.4 Threats
1. The possible deterioration in the political and security situation in the
Palestinian territoriesThere is competition from non-natural products.
2. There is a lack of overall planning in the Palestinian agricultural sector.

Strategic Benets to Palestine:


The project will strengthen the agricultural sector in Palestine.Moreover, this will
generate 20 permanent jobs in manufacturing.

Standards

2.2

IEEE standards

2.2.1

Since greenhouse automation is a very specific and not widely recognized topic there
.are currently no IEEE standard governing greenhouse automation

2.2.2

GSM standards

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services. GSM differs from
first generation wireless systems in that it uses digital technology and Time Division
Multiple Access (TDMA) transmission methods. GSM is a circuit-switched system
that divides each 200kHz channel into eight 25kHz time-slots. GSM operates in the
900MHz and 1.8GHz bands in Europe and the 1.9GHz and 850MHz bands in the US.
The 850MHz band is also used for GSM and 3GSM in Australia, Canada and many
South American countries. GSM supports data transfer speeds of up to
9.6 kbit/s, allowing the transmission of basic data services such as SMS (Short
Message Service). Another major benefit is its international roaming capability,
allowing users to access the same services when travelling abroad as at home. This
gives consumers seamless and same number connectivity in more than 210 countries.
GSM satellite roaming has also extended service access to areas where terrestrial
.coverage is not available[4]
Global System for Mobile Communications. The first European digital standard,
developed to establish cellular compatibility throughout Europe. It's success has

spread to all parts of the world and over 80 GSM networks are now operational. It
operates at 900 MHz.
Tabel 2.1 GSM frequency bands

Type
GSM850

Channels
128-251

Uplink[MHZ]
824-849

Downlink[MHZ]
869-894

GSM 900
Classical extended
GSM 1800

0-124,955-1023
124channels
channels 49+
512-885

876-915
890-915
880-915
1710-1785

921-960
935-960
925-960
1805-1880

GSM1900

512-810

1850-1910

1930-1990

GSM-R
Exclusive

955-1024
0-124
channels 69

876-915
876-880

921-960
921-925

Additionally:GSM400(also named GSM 450 or GSM 480 at 450-458/460-468 or479-486/489 -464MHZ)


-.Note: frequency ranges may vary depending on the country
Channels at the lower/upper frequency edge of the frequency .bands are typically not used[5]

GSM radio frequency spectrum


In the frequency range specified for GSM-900 System mobile radio networks, 124
frequency channels with a bandwidth of 200 KHz are available for both the uplink
and downlink direction. The uplink (mobile station to BTS) uses the frequencies
between 890 MHz and 915 MHz and the downlink (BTS to mobile station) uses the
frequencies between 935 MHz and 960 MHz. The duplex spacing, the spacing
between the uplink and downlink channel, is 45 MHz. The E-GSM band adds 50
frequency channels and the R-GSM another 20 frequency channels to the spectrum.
For the specific channel number to frequency mapping refer to the table
.on
the
next
page
In the frequency range specified for GSM-1800 System mobile radio networks, 374
frequency channels with a bandwidth of 200 KHz are available for both the uplink
and downlink direction. The uplink uses the frequencies between 1710 MHz and 1785
MHz and the downlink uses the frequencies between 1805 MHz and 1880 MHz. The
.duplex spacing is 95 MHz[6]

Multiple access techniques


In cellular and cordless terminology the three main types of multiple access used to
divide the radio frequency spectrum between the cell site radios and the mobile
:stations are
:Frequency Division Multiple Access (FDMA)
.Each call is carried on a separate frequency channel
:Time Division Multiple Access (TDMA)
Each frequency channel is further divided into a set of timeslots; each timeslot carries
.the data of a voice call
:Code Division Multiple Access (CDMA)
A spread-spectrum technology is used, in which the radio signals associated with a
call are spread across a single broad frequency spectrum (1.25 MHz). Each call in the
spectrum is differentiated from other calls in that spectrum by assigning a unique code
to each call's signal. At the receiving end (mobile station or cell site), the specific
call's signal is isolated by decoding the full received signal using the code assigned to
.that call's signal[7]

Multiplexing techniques
:The two multiplexing techniques used in cellular and cordless terminology are
Frequency Division Duplexing (FDD)
In FDD two symmetric frequency bands are used, one containing the uplink channels
.and the other the downlink channels
Time Division Duplexing (TDD)
TDD means that the uplink of the voice call is time multiplexed on the same
.frequency channel as the downlink of the voice call[8]

Coding techniques

In wireless networks, however, digital transmission cannot be used. Here, the binary
bit-stream has to be translated into an analog signal rst . The three basic methods for
this translation are

amplitude shift keying (ASK) the most simple digital modulation scheme.
The two binary values, 1 and 0, are represented by two different amplitudes.
frequency shift keying (FSK) . The simplest form of FSK, also called binary
(BFSK), assigns one frequency f1 to the binary 1 and another frequency f2 to
the binary 0
phase shift keying (PSK) uses shifts in the phase of a signal to represent data

GSM Data Rates

GSM Data Rates are Global.The standard of maximum data rate in GSM is
9.6 kbps.
GSM data rates with GPRS are in all operator cases across the globe
are between 30-40kb/s.
CDMA 1X user data rates vary from up to 90kb/s in a fragmented Korean
market where they have a mixture of proprietary solutions to 43kb/s in the US,
which has been measured by Nokia
GSM/EDGE user data rates will be 80-100kb/s with the first handsets and then
160 to 200kb/s by end of 2003
WCDMA networks are already in working trials and the terminals have passed
regulatory type approval (dual mode) in Europe and Japan
Immediacy of service will have the biggest impact on the network load and
impact costs[9].

DEVICE

ACCURACY

UNITS

RANGE UNITS

RESOLUTION

UNITS

12V Main
Supply
5V Switching
supply
RHT-22 humidity
& temperatur
sensor

volts

500mA min

5.

volts

mA min 250

2
1

%
digree

mA
1-1.5

A
40-50

standby
current

Tabel 2.2 Project specifications

Tabel 2.3 Relays

DEVICE

SWITCHING VOLTAGE

SWITCHINGCURRENT

Relays:

277VAC
125VAC

10A
12A

Tabel 2.4 Arduino details


Microcontroller

ATmega2560

Operating Voltage
Input Voltage (recommended)
Input Voltage (limits)
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
DC Current for 3.3V Pin
Flash Memory
SRAM
EEPROM
Clock Speed

5V
7-12V
6-20V
54 (of which 15 provide PWM output)
16
40 mA
50 mA
256 KB of which 8 KB used by bootloader
8 KB
4 KB
16 MHz

Device

Tabel 2.5 Prelimentry parts list


Price
Number

Total price

Power supply

19.99$

19.99$

Arduino Mega

100$

100$

GSM modem

100$

100$

Soil moisture
sensor
Humidity &
temprature
sensor

17$

17$

18$

18$

LDR sensor
LCD

14$
15$

1
1

14$
15$

Fan

15.5$

5.5$

Valves

11$

22$

LEDs

0.3$

15

4.5$

Push button
switch
Resistances

1$

4$

0.5$

2.5$

Transistors

1$

5$

Transformer

1.5$

6$

relay

1$

5$

The outer body


of the house
Control Box

40$

40$

20$

20$

Boards

11$

11$

: The total cost is

2.3 Earlier coursework


This project mainly based on Electrical Measurements and Sensors , Electronic
circuits and Cellular Communication Systems courses . Electrical Measurements and
Sensors cource since this project depends alot on knowledge of sensors types and
their functions . Cellular Communication Systems course helps to understands the
background of GSM system that definitely used in this project . In addition , we used
the papers on internet and specialized books to understand how the system works and
other sites that talking about the plants and the suitable growth conditions.

Ch3. Literature Review

3.1

Introduction

Greenhouse Automation Solution which senses, processes and stores


temperature values. Managing temperature by comparing the measured values
with the expected ones and take action if it is necessary. The solution aims are
flexibility, maintainability and usefulness. Following terms associated with it
and infused into the system.

Introduction to 8051 microcontrollers


This tutorial is specially tailored to electronics and robotics hobbyists that have
already realized some simple electronics projects and want to go a step further
and start using microcontrollers in their projects, more precisely the 89S52
.microcontroller
This first part introduce the main aspects and characteristics of the 89S52,
providing to the absolute beginners a base of knowledge, which will help them
.to understand more advanced issues in the next part of the tutorial
Introduction to micro-controllers
A micro-controller can be compared to a small stand alone computer, it is a very
powerful device, which is capable of executing a series of pre-programmed
tasks and interacting with other hardware devices. Being packed in a tiny
integrated circuit (IC) whose size and weight is usually negligible, it is
becoming the perfect controller for robots or any machines requiring some kind
of intelligent automation. A single microcontroller can be sufficient to control a
small mobile robot, an automatic washer machine or a security system. Any
microcontroller contains a memory to store the program to be executed, and a
number of input/output lines that can be used to interact with other devices, like
.reading the state of a sensor or controlling a motor
Nowadays, microcontrollers are so cheap and easily available that it is common
to use them instead of simple logic circuits like counters for the sole purpose of
gaining some design flexibility and saving some space. Some machines and
robots will even rely on a multitude of microcontrollers, each one dedicated to a
certain task. Most recent microcontrollers are In System Programmable,
meaning that you can modify the program being executed, without removing the
.microcontroller from its place

Today, microcontrollers are an indispensable tool for the robotics hobbyist as


well as for the engineer. Starting in this field can be a little difficult, because
you usually cant understand how everything works inside that integrated
circuit, so you have to study the system gradually, a small part at a time, until
.you can figure out the whole image and understand how the system works
The 8051 micro-controller architecture
The 8051 is the name of a big family of microcontrollers. The device which we
are going to use along this tutorial is the AT89S52which is a typical 8051
microcontroller manufactured by Atmel. Note that this part doesnt aim to
explain the functioning of the different components of an 89S52
microcontroller, but rather to give you a general idea of the organization of the
chip and the available features, which shall be explained in detail along this
.tutorial
The block diagram provided by Atmel in their datasheet showing the
architecture the 89S52 device can seem very complicated, and since we are
going to use the C high level language to program it, a simpler architecture can
.be represented as the figure 1.2.A

figure 1.2.A

This figure shows the main features and components that the designer can
interact with. You can notice that the 89S52 has four different ports, each one
having eight Input/output lines providing a total of 32 I/O lines. Those ports can
be used to output DATA and orders do other devices, or to read the state of a
sensor, or a switch. Most of the ports of the 89S52 have dual function meaning
that they can be used for two different functions: the fist one is to perform
input/output operations and the second one is used to implement special features
of the microcontroller like counting external pulses, interrupting the execution
of the program according to external events, performing serial data transfer or
.connecting the chip to a computer to update the software
Each port has eight pins, and will be treated from the software point of view as
an 8-bit variable called register, each bit being connected to a different
.Input/output pin
You can also notice two different memory types: RAM and EEPROM. Shortly,
RAM is used to store variable during program execution, while the EEPROM
memory is used to store the program itself, thats why it is often referred to as
the program memory. The memory organization will be discussed in detail
.later
The special features of the 89S52 microcontroller are grouped in the blue box at
the bottom of figure 1.2.A. At this stage of the tutorial, it is just important to
note that the 89S52 incorporates hardware circuits that can be used to prevent
the processor from executing various repetitive tasks and save processing power
for more complex calculations. Those simple tasks can be counting the number
.of external pulses on a pin, or generating precise timing sequences
It is clear that the CPU (Central Processing Unit) is the heart of the
microcontrollers; it is the CPU that will Read the program from the FLASH
memory and execute it by interacting with the different peripherals discussed
.above

figure 1.2.B

Figure 1.2.B shows the pin configuration of the 89S52, where the function of
each pin is written next to it, and, if it exists, the dual function is written
between brackets. The pins are written in the same order as in the block diagram
of figure 1.2.A, except for the VCC and GND pins which I usually note at the
.top and the bottom of any device
Note that the pin that has dual functions can still be used normally as an
input/output pin. Unless you program uses their dual functions, all the 32 I/O
.pins of the microcontroller are configured as input/output pins
Most of the function of the pins of the 89S52 microcontroller will be discussed
in detail, except for the pins required to control an external memory, which are
the pins number 29, 30 and 31. Since we are not going to use any external
memory, pins 29 and 30 will be ignored through all the tutorial, and pin 31 (EA)
always connected to VCC (5 Volts) to enable the micro-controller to use the
internal on chip memory rather than an external one (connecting the pin 31 to
ground would indicate to the microcontroller that an external memory is to be
.used instead of the internal one)
Memory organization
A RAM stands for Random Access Memory, it has basically the same purpose

of the RAM in a desktop computer, which is to store some data required during
the execution time of different programs. While an EEPROM, also called
FLASH memory is a more elaborated ROM (Read Only Memory) which is the
memory where the program being executed is stored. Even if thats not exactly
true, you can compare an EEPROM to the Hard-Disk of a desktop computer
from a general point of view. The EEPROM term stands for Electronically
.Erasable and Programmable Read Only Memory
In microcontrollers, like in any digital system, memory is organized
in Registers, Which is the basic unit of construction of a memory. Each register
is composed of a number of bits (usually eight) where the data can be stored. In
the 8051 family of microcontrollers for example, most registers are 8-bit
register, capable of storing values ranging from 0 to 255. In order to use bigger
values, various register can be used simultaneously. Figure 1.3.A shows a
typical 8-bit registers, where the notation D0 to D7 stands for the 8 DATA bits
.of the register

figure 1.3.A

As you shall see, the RAM memory of the 89S52, which contains 256 registers,
is divided into to main parts, the GPR part, and the SFR part. GPR stands for
General Purpose Register and are the registers that you can use to store any
data during the execution of your program. SFRs (Special function Register) are
registers used to control the functioning of the microcontroller and to assist the
processor through the various operations being executed. For example, SFRs
can be used to control Input/Output lines, to retrieve data transmitted through
the serial port of a desktop computer, or to configure one of the on-chip counters
.and timers
In a memory each register has a specific address which is used by the processor
to read and write from specific memory location. Figure 1.3.B shows the
memory organization of the 256 registers of the RAM of the 89S52
microcontroller. The address is noted in Hexadecimal format as this notation
simplifies digital logic calculations for the designers, 00 corresponds to the first
.location and FF which is equal to 256 corresponds to the last location

3.3

proposed system

In our system, will be solve this problems by make a system controlled more than one
parameter not only irrigation, and in our system the farmer get report about the condition
in the greenhouse by receiving text message at his mobile.
The system below measures the values of temperature, humidity, light, and soil
moistures in the greenhouse by sensors and sends the data that was measured to the
Arduino. The Arduino processes the data and controls the fan, irrigation, sprinkler and
light to maintain suitable conditions in the greenhouse .

Figure 3.18 Block diagram of system

The Arduino controls the device by case:


1- If the values of temperature and humidity is greater than optimum, it opens the fan
to decrease the temperature and humidity in the greenhouse, When the values of
temperature and humidity is less than optimum, it opens the sprinkler to increase the
temperature and humidity in the greenhouse until a suitable value is reached.
2- If the value of soil moisture is less than optimum, the value will open irrigation
and when it is greater, irrigation will be closed.

3-if value of light is less than the optimum, the lamp turns on and closes after the
period is finished (period is the time needed by the plain each day ) and when the
value is grater the lamp will be turned off.
4-The GSM model sends an SMS to the user about the value that system measures.

Ch4. Methodology and Implementation

4.1

Introduction

Implementation encompasses all the processes involved in getting new software or


hardware operating properly in its environment, including installation, running,
testing and making necessary changes. As such, implementation is the action that
must follow any preliminary thinking in order for something to actually happen. The
project worked in divided into three sub parts , signal detection , hardware controlling
and SMS Service for Green House Controlling .
The main part that evaluated to develop control and automatic greenhouse control
system is a microcontroller called arduino. The following block diagram describe the
idea of system :

Figure 4.1 Project idea

The system above consists of three input (temperature, humidity and LDR sensor) and
three output (fan, water pump and Lamp). PIC controller as a main brain for this
system because it control the overall system in a greenhouse. Temperature sensor used
to detect the temperature in a greenhouse. When the temperature sensor detect the
high temperature, microcontroller will send the signal to the fan to stable the

greenhouse condition. Then, when LDR sensor detect no light, microcontroller will be
send the signal to the lamp and lamp will be on automatically. Water pump is used to
supply water to the sprinkler and make sure the sprinkler watered the plants in a
greenhouse.
As we see in figure 4.1 , the arduino controls circuit that will be connected to the soil
sensor, humidity sensor, and temperature sensor .the Arduino uno receives the value
from sensor and analyses and then compares it with the threshold value stored in the
Arduino memory , based on this value the Arduino takes the appropriate procedures ,
and also controls the output device based on these values, the Arduino sends the
report by the GSM model to the farmer's phone.

Figure 4.2 System process

4.2

Signal detection

As soon as the change of temperature or humidity absence of air for instance has been
detected, GSM modem sends SMS on a number provided in the GSM code. Through
this section user can manage Greenhouse Hardware or manage the SMS service.
To make this real various sensors used to measure and detect the signals .Figure
below describes the Sensors Methodology used :

Figure 4.3 sensor connection

Following sensors associated and infused into the system :


4.2.1

Light Dependent Resistor

LDR device has a resistance which varies according to the amount of light falling on its
surface. Since LDR is extremely sensitive in visible light range.
Now in our system this sensor measure value of light in the Greenhouse to take a value
and send it to the ADC port at the Arduino to compared this value with the threshold and
decide which device must be run and send 5V to the relay that was connect with the
Lamp.

4.3.2

Interfacing LCD with Arduino

Figure 4.16 LCD connection

LCD use to display the value of condition in the green house ,the LCD include register
select (Rs) pin, read/write (r/w) pin, enable (EN) pin, 8 pins for data and we are using 4
data pin connect with Ardiuo port , and 3pins for power.
The RS pin and EN pin connect with Arduino port , the R/W pin connect with ground
,Vdd pin and led+ connect with 5 volt ,Vss pin and Vee connect with ground .
In figure below we make asimulation of LCD interfacing with arduino usin VBB()
Figure 4.17 LCD interface

Figure 4.19 Simulation design

Ch5. Results and Discussion


The result we obtained is the hardware model of greenhouse monitoring system :

The arduino code :

#include <SerialGSM.h>
#include <SoftwareSerial.h>
SerialGSM cell(2,3);
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
char inchar;

int cr=0;
char phoneNumber[] ="0598560775";
LiquidCrystal lcd(33, 30, 29, 26, 25,22);
const int buttonpin1 = 46;
const int buttonpin2=47;
const int buttonpin3=48;
//const int buttonpin4=49;
int g=0, v,f, count, val1, htemp=25, ltemp=23, hhum=70, lhum=20, val2,
val3, val4, count11=0;
float temp=0,hum=0,light=0,soil=0;
float photo=A1;
int sprinkler=A3;
int lamp=A4;
int fan33=A2;
int irr=A5;
float soilmois=A0;
#include "DHT.h" // RHT03 sensor library
#define DHTPIN 4 // RHT03 sensor is connected to digital pin 2
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
dht.begin();
lcd.print("Smart greenhouse");
pinMode(buttonpin1,INPUT);
pinMode(buttonpin2,INPUT);
pinMode(buttonpin3,INPUT);

pinMode(sprinkler,OUTPUT);
pinMode(fan33,OUTPUT);
pinMode(lamp,OUTPUT);
pinMode(irr,OUTPUT);
Serial.println(" Starting SM5100B Communication...");
cell.begin(9600);
waitTil("+SIND: 4");
Serial.println("Module ready");
delay(2000);
lcd.print(" ");
}

void loop()
{
float hum = dht.readHumidity();
float temp =dht.readTemperature();
lcd.setCursor(0,0);
lcd.print ("Temp=") ;
lcd.print (temp);
lcd.setCursor(7, 0);
lcd.print ("Hum=" ) ;
lcd.print (hum) ;
light=analogRead(photo);
delay(50);
light=light/200;
soil=analogRead(soilmois);
soil=soil/200;
val2 = digitalRead(buttonpin1);

Serial.println(soil);
Serial.println(light);
if (val2 == HIGH) {
count11=count11+1;
count11=count11%5;
}
if(count11==0){
lcd.setCursor(0, 1);
lcd.print(" ");
}
else {
(htemp,ltemp,hhum,lhum)=controll();
{ test(temp,hum,light,soil);
delay (50);
}
}
///control function
///////////////////////////////////////////////////////////////////
int controll(){
if( count11 ==1) {
Serial.print("high temp");
lcd.setCursor(2, 1);
lcd.print("htemp") ;
if(digitalRead(buttonpin2)==HIGH ) {
htemp=htemp-1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);

lcd.print(htemp) ;
delay(50);
Serial.println(htemp);
}
if(digitalRead(buttonpin3)==HIGH) {
htemp=htemp+1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(htemp) ;
Serial.println(htemp);
delay(50);
}
}
if (count11==2) {
Serial.print("low temp");
lcd.setCursor(2, 1);
lcd.print("ltemp") ;
if(digitalRead(buttonpin2)==HIGH ) {
ltemp=ltemp-1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(ltemp) ;
Serial.println(ltemp);
delay(50); }
if(digitalRead(buttonpin3)==HIGH) {
ltemp=ltemp+1;

lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(ltemp) ;
Serial.println(ltemp);
delay(50); }
if( count11 ==3)//humdity control {
Serial.print("high hum");
lcd.setCursor(2, 1);
lcd.print("hhum") ;
if(digitalRead(buttonpin2)==HIGH ) {
hhum=hhum-1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(hhum) ;
delay(50);
Serial.println(hhum); }
if(digitalRead(buttonpin3)==HIGH) {
hhum=hhum+1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(hhum) ; }
}
if (count11==4) {
Serial.print("low hum");
lcd.setCursor(2, 1);

lcd.print("lhum") ;
if(digitalRead(buttonpin2)==HIGH ) {
lhum=lhum-1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(lhum) ;
Serial.println(lhum);
delay(50); }
if(digitalRead(buttonpin3)==HIGH) {
lhum=lhum+1;
lcd.setCursor(8, 1);
lcd.print(" ");
lcd.setCursor(8, 1);
lcd.print(lhum) ;
Serial.println(lhum);
delay(50); }
}
return (htemp,ltemp,hhum,lhum);
}
void test(int temp,int hum,int light,int soil) {
Serial.println(temp);
Serial.println(htemp);
Serial.println(hum);
Serial.println(ltemp);
Serial.println(light);
if(temp<ltemp) {
Serial.println("sprinkler temp high");

delay(50); v=1;
waring(temp,ltemp);//hot>>>>>>>>>>>>>>>>>>>>>>>>>>>
}
else {
Serial.println("sprinkler temp low");
delay(50);
v=-1; }
if(temp>htemp ) {
Serial.println("fan temp high");
delay(50);
f=1; //digitalWrite(fan33,HIGH);
waring(temp,htemp);////>>>>>>>>>>>>>>>>>>>>>>>>
}
else {
Serial.println("fan temp low");
delay(50);
f=-1; }
if(ltemp<=temp && temp<=htemp) {
Serial.println(temp);
Serial.println(htemp);
Serial.println(ltemp);
(f,v)= humidity(hum); }
delay(200);
if(f>0 ) {
Serial.println("fan temp high");
delay(50);
digitalWrite(fan33,HIGH); }
else {

Serial.println("fan temp low");


delay(50);
digitalWrite(fan33,LOW);///>>>>>>>>>>>>>>>>>>>>>>
}
if(v>0) {
Serial.println("sprinkler temp high");
delay(50);
digitalWrite(sprinkler, HIGH); }
else {
Serial.println("sprinkler temp low");
delay(50);
digitalWrite(sprinkler, LOW); }
{
if(light<2.5) {
lcd.setCursor(12, 1);
lcd.print("night") ;
delay(100);
Serial.println("night");
digitalWrite(lamp, HIGH); //cool>>>>>>>>>>>>>>>>>>>>>>>>
delay(50); }
else {
Serial.println("day");
lcd.setCursor(12, 1);
lcd.print("day..") ;
delay(100);
digitalWrite(lamp,
LOW);//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
delay(50); }
}

Serial.println("soil");
Serial.println(soil);
if(soil<1.5) {
g=1;
Serial.println("irrigation on");
digitalWrite(irr, HIGH);
delay(50);
}
if(soil>2.5) {
digitalWrite(irr, LOW);
Serial.println("irrigation off");
g=2;//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
delay(50); }
if(soil<=4.5 &&soil>=1.5) {
if(g==1) {
Serial.println("irrigation on");
digitalWrite(irr, HIGH);}
if(g==2){
Serial.println("irrigation off");
digitalWrite(irr, LOW);
}} }
////////////////////////////////
int humidity(int hum) {
Serial.println(hum);
Serial.println(hhum);
delay(100);
if(hum<lhum) {
Serial.println("sprinkler hum high");

delay(50);
v=2;
waring(hum/5,lhum/5);//hot>>>>>>>>>>>>>>>>>>>>>>>>>>>
}
else {
Serial.println("sprinkler hum low");
delay(50);
v=-2;
waring(hum/5,hhum/5); }
if(hum>hhum) {
Serial.println("fan hum high");
delay(50);
f=2; }
else {
Serial.println("fan hum low");
delay(50);
f=-2; }
return (f,v); }
void waring(float x,float y){
float k;
k=x-y;
if(k<0){
k=-k; }
if (k>5) {
if(cr==0){
lcd.setCursor(0, 1);
lcd.print("wait sendin sms");
delay(5000);

SM5100B_SMS(temp,hum,light,soil);
delay(35000);
lcd.setCursor(0, 1);
lcd.print(" ");
cr=30000;
Serial.println("send");}
cr=cr-1;
}}
void SM5100B_SMS(double temp,double hum,double light,double soil) {
cell.println("AT");
delay(200);
cell.println("AT+CMGF=1");// set SMS mode to text
Serial.println("AT+CMGF=1");
delay(200);
cell.print("AT+CMGS="); // now send message...
Serial.println("AT+CMGS=");
cell.write((byte)34);// ASCII equivalent of "
cell.print(phoneNumber);
cell.write((byte)34); // ASCII equivalent of "
cell.println();
delay(200);
cell.print("temp :");
cell.print(temp);
Serial.print("temp :");
cell.println();
cell.print("hum: ");
cell.print(hum);
Serial.print("hum :");

cell.println();
cell.print("light :");
cell.print(light);
Serial.print("light :");
cell.println();
cell.print("soil :");
cell.print(soil);
Serial.print("soil :");
cell.println(); // our message to send
cell.write((byte)26); // ASCII equivalent of Ctrl-Z
cell.println();
delay(15000);
}
String getMessage() {
String s=" ";
while(1) {
if(cell.available()>0) {
s = s+(char)cell.read();
if (s.length()>1 && s[s.length()-2]=='\r' && s[s.length()-1]=='\n') { //if
last 2 chars are \r\n
if (s==" \r\n" || s=="\r\n") { // skip these, move on
s="";
}
else { // we have a message!
Serial.println(s.substring(0,s.length()-2));
return s.substring(0,s.length()-2);
}}}}}
void waitTil(String s) {
String message;

while (1) {
message = getMessage();
if (message == s){
delay(100); // cause we're probably about to send another command
return;
}}}

Ch6. Conclusions and Recommendation


This project offers a design of fully automated greenhouse management system. From
the experiment it could be seen that it is fulfilling all requirements related greenhouse
monitoring. The automatic greenhouse sensor design could help in increasing the
productivity of plants.
As it has been mentioned earlier, we are not only providing automatic control over the
devices like light, motor pump but also we have a mechanism to alert farmers
regarding the parameter changes in the greenhouse so that early precaution steps can
be taken. Thus this construction, productivity of cropping can be continuously
increased so it can handle famine problem around the world. Thus we can say that the
greenhouse monitoring system using GSM is far better than the same system using the
different technologies.
Future Work
The system could be developed by different ways such as sending emails when an
alarm happens , or using different devices such as PLCs , in addition to measure the
conditions that have been mentioned , other conditions may be included like shade
and fire detection .
During the hot summer day , the bright sun may cause the temperature inside the
greenhouse rises to an extreme heat. With the arduino , the authorized user can open
up the vents to allow the fresh air enter the greenhouse by simply calling the arduino
unit. Or we could use Air Conditioner if it is possible.

References
[1] PRAKASH .H.P ATIL, CHAITALI BORSE, SNEHAL GAIKWAD , SHILPA PATIL,
2013, G REENHOUSE MONITORING SYSTEM USING GSM, I NTERNATIONAL

JOURNAL OF SCIENTIFIC & ENGINEERING RESEARCH, VOLUME 4, ISSUE 6,


ISSN 2229-5518.4
[2] ADVANTAGES & DISADVANTAGES OF GREENHOUSE . RETRIEVED FROM
THE EHOW O NLINE WEBSITE: HTTP://WWW. EHOW. COM
[3] SUMIT A. KHANDELWAL ET AL, 2012, A UTOMATED GREEN HOUSE
MANAGEMENT USING GMS MODEM, (IJCSIT) I NTERNATIONAL JOURNAL OF
C OMPUTER SCIENCE AND INFORMATION TECHNOLOGIES , VOL. 3 (1) ,
3099 3102.

GSM TUTORIAL. RETRIEVED FROM THE WEBSITE: [4 ]


.HTTP://ECEE.COLORADO .EDU/~ECEN4242/GSM /INDEX.HTM
[5] JOCHEN H. SCHILLER . (2003) .MOBILE COMMUNICATIONS .2ND
EDITION . ADDISON-WESLEY . 492 PAGES
[6] GSM CHARACTERISTICS . RETRIEVED FROM THE GSM SERVER O NLINE
WEBSITE : HTTP :// GSMSERVER .COM /ARTICLES / GSM _CHARACT .PHP
[7] GSM CHARACTERISTICS . RETRIEVED FROM THE GSM SERVER O NLINE
WEBSITE : HTTP :// GSMSERVER .COM /ARTICLES / GSM _CHARACT .PHP
[8] GSM CHARACTERISTICS . RETRIEVED FROM THE GSM SERVER O NLINE
WEBSITE : HTTP :// GSMSERVER .COM /ARTICLES / GSM _CHARACT .PHP
[9] DATA RATES IN GSM. R ETRIEVED FROM SCRIBD THE ONLINE WEBSITE :
HTTP :// SCRIBD .COM /DOC /22846633/D ATA -R ATES -IN-GSM

[10] R ETRIEVED FROM THE ONLINE WEBSITE :HTTP://ARDUINO. CC/


[11] ARDUINO MEGA.RETRIEVED FROM THE ONLINE WEBSITE
HTTP :// ARDUINO . CC/EN/M AIN /ARDUINO B OARD MEGA

[12] WHAT IS A GSM MODEM .RETRIEVED FROM THE WEBSITE :


HTTP :// WWW . NOWSMS .COM .

[13] DR. LONGMONT .(2008). GSM/GPRS M ODULE . LINKSPRITE


TECHNOLGIES , CO 80503, 13
[14] MINI PUSH BUTTON SWITCH. R ETRIEVED FROM ROBOT STOP
WEBSITE : HTTP :// WWW .ROBOTSHOP .COM /CA /EN
[15] V. RYAN . LIGHT DEPENDENT RESISTORS.( 2002 - 04) , FROM
HTTP :// WWW . TECHNOLOGYSTUDENT .COM /ELEC 1/ LDR1. HTM

[16] HUMIDITY AND TEMPERATURE SENSOR . RETRIEVED FROM THE ONLINE


WEBSITE : HTTPS :// WWW .SPARKFUN . COM

[17] GROVE - MOISTURE SENSOR .RETRIEVED FROM


HTTPS :// WWW . SEEEDSTUDIO .COM /WIKI/G ROVE _-_M OISTURE _S ENSOR

[18]COOLING & VENTILATION BUYER'S GUIDE .RETRIEVED FROM THE


DESIGN OF F ARMTEK G ROWERS SUPPLY ONLINE WEBSITE :
HTTPS :// WWW.GROWERSSUPPLY .COM /FARM/ SUPPLIES/ HOME
[19] GREENHOUSE LIGHTING . R ETRIEVED FROM THE TWO WESTS &
ELLIOT O NLINE WEBSITE: HTTP ://WWW.TWOWESTS. CO. UK

[20]GARDEN PUMPS. R ETRIEVED FROM THE TWO WESTS & ELLIOT


O NLINE WEBSITE: HTTP ://WWW.TWOWESTS. CO. UK
[21] KU. PRACHI & V.B HALERAO . GSM BASED SECURITY SYSTEM
FOR EXAMINATION PAPER.
INTERNATIONALJOURNALFORENGINEERINGAPPLICATIONSAND
TECHNOLOGY,( 62-65) ,4
[22] TOP GREENHOUSES LTD. RETRIEVED FROM THE ONLINE WEBSITE :
HTTP :// WWW . TOP .PRO

[23] HOW_DO _YOU_MEASURE _LIGHT_INTENCITY ?.R ETRIEVED FROM


HTTP :// WIKI. ANSWERS .COM

[24] MOISTURE SENSOR (SKU:SEN0114). R ETRIEVED FROM


HTTP :// WWW . DFROBOT .COM /WIKI/ INDEX .PHP ?
TITLE =MOISTURE_SENSOR _(SKU:SEN0114)

[25] GSM TECHNICAL SPECIFICATION .(1995). GSM 11.11.V.


5.0.0 ,P.1-91

Appendix
Appendix A: ARDUINO UNO ATMEGA328P

Appendix B: GSM MODEM

Appendix C: Humidity and Temperature Sensor RHT03

Appendix D :. The arduino full codes for the system