# Smart Greenhouse

1,889

29

1

Smart

greenhouse is a based greenhouse automation that support all type of equipment used in greenhouse and have the ability of evaluating analogue, humidity, temperature etc. and digital, rain sensor, light sensor, position check switch etc. inputs.The system is implemented by pneumatic actuator, so system is clear, safe, and easy to implement.

## Step 1: THE Idea

The idea it's turn around how we can get the special environment by controlling the two parameter

1- Humidity .

2- Temperature .

we have to actuator heat & cool system that take their steps from the Arduino that compare between the desire value and actual value that getting from the DHT11 sensor .

This Idea can used for agriculture at special cause,also for many cause that need special environment, and we can develop this idea to add rain sensor, light sensor, etc ..

## Step 2: The Material

- Arduino Atmage

- LCD 2*16

-relay two Chanel

## Step 3: Work

1-

we will connected the LCD as below

LCD pin

- 2&15 to +5V

- 1,3,5,16 to GND

- 6,4,11,12,13,14 to arduino pin 7,6,5,4,3,2

2 -

connected the Keypad to arduino pin 22,24,26,28,30,32,34,36

3-

connected the DHT11 to pin 9

4-

connected the relay Chanel to arduino pin A0 & A1

## Step 4: Programming

1 -define the pins , include the lab. , and mapping the keypad as below :-

#include

#include

#include

dht DHT;

int h,t,dh,dt;

int v;

LiquidCrystal lcd(7,6,5,4,3,2);

#define DHT11_PIN 9

const byte ROWS = 4; //four rows

const byte COLS = 4; //four columns

char keys[ROWS][COLS] = {

{'D','C','B','A'},

{'#','9','6','3'},

{'0','8','5','2'},

{'*','7','4','1'}

};

byte rowPins[ROWS] = {22,24,26,28}; //connect to the row pinouts of the keypad

byte colPins[COLS] = {30,32,34,36}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

2 - Start the LCD and set time hold for keypad as below :

lcd.begin(16,2);

pinMode(A0,OUTPUT);

pinMode(A3,OUTPUT);

digitalWrite(A0,1);

digitalWrite(A1,1);

//note we use the analog output as digital output to provide us with suitable current and save our arduino

3 - Enter the temperature and convert the char. to int. parameter for compare with actual value to make decision

to give actuator an order to work .

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Enter Temp");

for (int i = 0;i<2;i++){

char key1 = keypad.waitForKey();

switch (key1) {

case '0':if (i==0) dt=0;if (i==1) dt=(dt*10+0);break;

case '1':if (i==0) dt=1;if (i==1) dt=(dt*10+1);break;

case '2':if (i==0) dt=2;if (i==1) dt=(dt*10+2);break;

case '3':if (i==0) dt=3;if (i==1) dt=(dt*10+3);break;

case '4':if (i==0) dt=4;if (i==1) dt=(dt*10+4);break;

case '5':if (i==0) dt=5;if (i==1) dt=(dt*10+5);break;

case '6':if (i==0) dt=6;if (i==1) dt=(dt*10+6);break;

case '7':if (i==0) dt=7;if (i==1) dt=(dt*10+7);break;

case '8':if (i==0) dt=8;if (i==1) dt=(dt*10+8);break;

case '9':if (i==0) dt=9;if (i==1) dt=(dt*10+9);break;

}

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Temp=");

lcd.setCursor(7+i,0);

lcd.print(dt);

}

4 - Now read the parameter from sensor and compare between actual and desire to make decision at end

t=DHT.temperature;

h=DHT.humidity;

//start comparter

if(t < dt){

digitalWrite(A3,0);

digitalWrite(A0,1);

}

if(t > dt){

digitalWrite(A0,0);

digitalWrite(A3,1);

}

if(t == dt){

digitalWrite(A0,1);

digitalWrite(A3,1);

}

lcd.clear();

lcd.setCursor(0,0);

lcd.print("D Temp=");

lcd.setCursor(7,0);

lcd.print(dt);

lcd.setCursor(10,0);

lcd.print("C");

lcd.setCursor(0,1);

lcd.print("C Temp=");

lcd.setCursor(7,1);

lcd.print(t);

lcd.setCursor(12,1);

lcd.print("C");

delay(1500);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("D Humi=");

lcd.setCursor(7,0);

lcd.print(dh);

lcd.setCursor(11,0);

lcd.print("%");

lcd.setCursor(0,1);

lcd.print("C Humi=");

lcd.setCursor(7,1);

lcd.print(h);

lcd.setCursor(12,1);

lcd.print("%");

delay(1500);

lcd.clear();

lcd.setCursor(0,0);

lcd.setCursor(0,1);

lcd.print("C to Change");

delay(1000);

}