Professional Documents
Culture Documents
2014
Prepared by:
Asma Ghannam and Maram Azzam
Submitted to:
Jamal Kharrousheh
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
List Of Figures
Y
List Of Tabels
TABEL
TABEL
TABEL
TABEL
TABEL
TABLE
TABEL
TABEL
TABLE
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 Humidity & temperature sensor, soil moisture sensor,
temperature sensor, light sensor, Transistor switches, relay nodes for automatic control,
and arduino 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 Arduino 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 ARDUINO UNO 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. 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
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] .
1.4
Design a hardware unit of the prototype of the system that is monitoring and controlling
the greenhouse environment and build a small greenhouse model :
Arduin
o
&GSM
system
Temperature
Irrigation
Light
Sprinkler
System
Fan
Soil moisture
Humidity
Light sensor
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.
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.
Industry Highlights:
Greenhouses are rapidly gaining momentum in Palestine. Farmers are increasingly
aware of the benets of planting under greenhouses.
Greenhouses yield more production per m than open farming. Currently there is no
local provider of suitable plastic sheets so they are imported from Israel. With
approximately 25,000 hectares of agricultural land in Palestine, there is a large
potential for this factory to satisfy the market.
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
Type
GSM850
Channels
128-251
Uplink[MHZ]
824-849
Downlink[MHZ]
869-894
GSM 900
Classical extended
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
GSM 1800
GSM1900
512-810
1850-1910
1930-1990
GSM-R
Exclusive
955-1024
0-124
channels 69
876-915
876-880
921-960
921-925
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 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
DEVICE
SWITCHING VOLTAGE
SWITCHINGCURRENT
Relays:
277VAC
10A
125VAC
12A
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
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$
40$
40$
20$
20$
Boards
11$
11$
3.1
Introduction
Memory
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is
used for the boot loader), 8 KB of SRAM and 4 KB of EEPROM (which can be
read and written with the EEPROM) and that is enough of our system
Power
The Arduino Mega can be powered via the USB connection or with an external
.power supply. The power source is selected automatically
External (non-USB) power can come either from an AC-to-DC adapter (wallwart) or battery. The adapter can be connected by plugging a 2.1mm centerpositive plug into the board's power jack. Leads from a battery can be inserted
.in the Gnd and Vin pin headers of the POWER connector
The board can operate on an external supply of 6 to 20 volts. If supplied with
less than 7V, however, the 5V pin may supply less than five volts and the board
may be unstable. If using more than 12V, the voltage regulator may overheat
. and damage the board. The recommended range is volts
VIN. The input voltage to the Arduino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltage
via the power jack, access it through this pin.
5V. This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V), the
USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage
via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We
don't advise it.
Microcontroller
ATmega2560
Operating Voltage
5V
Input Voltage (recommended)
7-12V
Input Voltage (limits)
6-20V
Digital I/O Pins
54 (of which 15 provide PWM output)
Analog Input Pins
16
DC Current per I/O Pin
40 mA
DC Current for 3.3V Pin
50 mA
Flash Memory
256 KB of which 8 KB used by boot loader
SRAM
8 KB
EEPROM
4 KB
Clock Speed
16 MHz
A wireless modem behaves like a dial-up modem. The main difference between
them is that a dial-up modem sends and receives data through a fixed telephone
line while a wireless modem sends and receives data through radio waves. Like
a GSM mobile phone, a GSM modem requires a SIM card from a wireless
carrier in order to operate.
GSM modem is a specialized type of modem which accepts a SIM card, and
operates over a subscription to a mobile operator, just like a mobile phone. From
the mobile operator perspective, a GSM modem looks just like a mobile
phone;GSM modems can be a quick and efficient way to get started with SMS,
because a special subscription to an SMS service provider is not required.In most
parts of the world, GSM modems are a cost effective solution for receiving SMS
messages, because the sender is paying for the message delivery[12]
SIM Interface
Tabel 3.2 SIM Pin Description
# Pin
Pin name
29
SIM_DA
27
SIM_CLK
21
SIM_RST
51
SIM_VCC
Type
I/O
O
O
P
# PIN
1,3,5,7
Ripple max
50mVpp for
f<200KHz
2mVpp for
f>200kHz
When supplying the module with a battery, the total impedance (battery +
protections + PCBS) should be less than 150mOhms.
In our project will be used push button switch to insert the values of variable
( high temperature value, low temperature value, high relative humidity value ,low
relative humidity value ,period of light need and the time GSM send sms report)
[14].
3.1.4 Sensors
Sensor is a device which measures a physical value and converts it into a signal
which can be read by instrument.
LDR- Light Dependent Resistor
Light Dependent Resistors (LDR sensor) used to measure amount of light, LDR
are very useful in light/dark sensor circuits, felled on it and send at output
analog value to be convert to digital by ADC device. LDR device has a
resistance which varies according to the amount of light falling on its surface.
Since LDR is extremely sensitive in visible ligh range[15].
3.3-6V Input
+-2% RH accuracy
+-0.5 degrees C
3.1.5
Pin
Definition
VCC
5V
GND
GND
DO
AO
Valve
We will use electric solenoid water valve 24v DC, orbit brand featured, the current
recommended valve is
this little unit from Orbit. There are many type of this valve (latching / nonlatching), but all type use 24v
DC. This valve has standard headphones plug (1/8in). So we just use a standard
audio jack connecting this valve to system we need.
3.1.6
Fan
To maintain plant health during warm summer months, fans and air coolers
should be used. It will be used in our project for cool climate inside the
greenhouse. So we will use the fan that use in pc computer for mini model, Fans
are available in many sizes and capacities. Typically square 120mm and this fan
cool vary good use in power supply and there many size for example (140mm) and
may we use it.
Air pressure is most important for cooling. It indicates cooling power per unit area.
If the diameter of fan is constant, than more air pressure indicate more air flow.
This fan need 12V DC voltage to run then we will use relay to provide it voltage
that need .
Air temperature
Moisture level
Moisture condensation on surfaces
Air temperature uniformity
Air speed across plants
Odor and gas concentrations
Airborne dust and disease organism levels
Combustion fumes from un-vented heaters [18].
3.1.7
Light
Being able to control the outdoor lighting in your garden, your greenhouse or your
allotment should be viewed as just as important as being able to control
temperature, ventilation and humidity. Outdoor lighting can be used to provide you
with more time in the greenhouse or it can be used to affect the growth of your
plants.
3.1.8
Relays
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet
to open or close one or many sets of contacts. Because a relay is able to control an
output circuit of higher power than the input circuit.
3.1.10
Pump
Greenhouse Pumps can be used to move large quantities of water from one place
to another - for example you could fill your water butt with water taken from a
well, river or stream. Where water pressure is poor or mains water is not available,
a pump can be used to take stored water, increase the pressure, and deliver the
water to your plants via a hosepipe. Greenhouse Pumps can also be used to take
water from a tank or water butt to increase the water pressure to run an Overhead
Spray Kit or a Deluxe Misting Kit[20]. The pump we use works at 12V DC.
3.1.9
In our project will be used LCD (type Basic 16x2 Character LCD 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
When it is low, data is written to the LCD. When it is high, data is read from the
LCD .Writing data to the
LCD is done in several steps:
o Set R/W bit to low
o Set RS bit to logic 0 or 1 (instruction or character)
o Set data to data lines (if it is writing)
o Set E line to high
o Set E line to low
3.2
Through our search at a similar system work at the same way of our system, we
are found only one company in the Middle East Al-khaizaran project has
. automatic irrigation systems that were installed by this company
every stage along the way. Project delivery is a significant milestone, but Top
Greenhouses continues its involvement through the first growing cycle, to
.ensure the continued success of the project
Experienced in establishing profitable projects in a wide range of environmental
conditions, Top Greenhouses is eager to share its expertise with clients globally,
including in developing countries, those with severe water shortages and places
.where healthy food sources are needed most [22]
This company offers a map showing the distribution of projects related to
: GreenHouse the around the world
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 .
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.
4.1
Introduction
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.
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 :
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- The sensor node voltage is make a comparison with the threshold voltages of different
levels to the light intensity corresponding to the standard four conditions- Optimum,
dim, dark and night.
5- The equation that describes the relationship between the resistance RL and the light
intensity Lux of a typical LDR is:
RL = 500 / Lux k [23]
6- When the LDR is connected to 5V through to 10K resistor, the output voltage of the
LDR is:
Vo = 5*RL / (RL+10). [23]
In figure below , we made a simulation of LDR connection with arduino using a tool
called Fritzing software :
4.2.2
Again we make aconnection between Humidity and Temprature sensor using Fritzing
4.2.3
This sensor measure the humidity in the soil , the sensor use two probes that pass current
through the soil, and measure the resistance of soil to get the moisture level. More water
makes the soil conduct electricity more easily (less resistance), while dry soil conducts
electricity poorly (more resistance).
The circuit designed uses a 5V supply, two resistances 100, two copper leads as the
sensor probes, 2N222N transistor. The sensor has three pins, the first pin is an output
pin, second pin is a ground pin, and third pin to input.
So we must connect the first pin with analog Arduinopin , and the third pin with 5 volt.
When the output between 0-1.9v dry soil, when the output between 1.9-3.5v humid soil
and when the output greater than 3.5v over humidity(24).
4.3
Hardware controlling
Hardwares are used to control environmental condition and provide optimal condition
to the plain which are kept in Green House.
Figure4.9show the connection of the device with relay and connection relay with port.
The relay will be used in our project as driver ,so the input port of relay connect with the
Arduino that send +5 volt or 0 ,and the Vcc pin in relay connect with power supply that
provide the voltage that need to run the device . Also, the output pin of a relay connects
with the output device as Fan, Valve, and Lamp.
Data pins for temperature,humidity, light and soil moisture sensors will be connected
with analog pins in Arduino where relays will be connected to the digital pins in
arduino. The Arduino convert the analog data to digital data by using analog digital
converter embedded with Arduino.
Figure 4.10 show the flow chart how system program work, in the beginning system
receive analog data was measured by the sensor. the system convert the analog data to
digital data by using analog digital converter in Arduino ,then apply function of control
switch to chose the value of variable, then apply all function of system after finish check
display the value of parameter in the LCD and check it is me to send report for user.
Now , Figure 4.11 shows the flow chart of the control switch function ,this function use
to enter the value of high temperature ,low temperature, high relative humidity ,low
relative humidity ,time of SMS report and the period of light , when press the control
switch the Variable change and when press the increase switch the variable value
increase , and when press the decrease switch the variable value decrease.
Figure4.12 shows a flow chart, the program read the value of temperature if the value is
greater than maximum temperature value, the microcontroller active the pin was
connected with fan to decrease the temperature. and when the value is less than
minimum temperature microcontroller active the pin connect with valve of sprinkler to
increase the temperature .when the temperature value set between minimum and
maximum temperature value ,the microcontroller deactivate the pins connect with fan
and valve.
when the humidity value is greater than maximum threshold, the microcontroller active
the pin connect with fan to decrease humidity and when the value is less than minimum
humidity value active the pin connect with valve of sprinkler to increase the humidity,
when the humidity value is between low humidity value and high humidity value the
microcontroller deactivate the pins connect with fan and valve
Note: we control the humidity when the temperature in optimum range.
Figure 4.13 show the flow chart for the soil function sensor, program read the value of
soil monitor sensor ,if the value of voltage out less than 1.9v active the pin that
connect with valve of irrigation and when the value of voltage out greater than 1.9 v
deactivate the pin that connect with valve of irrigation.
Push button switch used in this project to make a system more reliable and flexible by
using it to enter the input data of the system . In our simulation we are explain how we
using this switches, first one to change the parameter , second one to increase the value
of each parameter , and third switch to decrease these value.
Push button switch connect with GND and resister that connect with 5volt , so when the
switch was pressed the pin will be connect with GND and sent input voltage for Arduino
equal zero.
4.3.2
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()
4.4
Here for controlling Hardware through SMS Service, we have to use GSM module.
4.4.1
The Arduino platform designed as an easy to use and implement device for embedded
applications.
By connecting the Tx/Rx serial pins of the GSM device with the Rx/Tx serial pins of the
Arduino, will be able to communicate messages between pla3tforms with as little as 4
pins (Tx/Rx/5V/GND).
This will create a GSM text message server that can receive up to 140 bytes of control
data that allows the microcontroller to decide what to do with each text message (25).
4.4.2
SIM Interface
The SIM interface is compatible with the ISO 7816-3 IC card standard required by the
GSM11.11 Phase 2+ standard. The module also supports Release 99 of the SIM Toolki
recommendation and supports a Fixed Dialling Number directory (25).
4.5
Software Description
Arduino.
LM35 and LDR sensors.
Motor istead of fan
LED represents a lamp.
LCD.
#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);
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);
References
[1] PRAKASH .H.P ATIL, CHAITALI BORSE, SNEHAL GAIKWAD , SHILPA PATIL,
2013, G REENHOUSE MONITORING SYSTEM USING GSM, INTERNATIONAL
JOURNAL OF SCIENTIFIC & ENGINEERING RESEARCH, VOLUME 4, ISSUE 6,
ISSN 2229-5518.4
[2] ADVANTAGES & DISADVANTAGES OF GREENHOUSE . RETRIEVED FROM
THE EHOW ONLINE WEBSITE : HTTP://WWW. EHOW. COM
Appendix