Professional Documents
Culture Documents
Smart Iot Garden
Smart Iot Garden
PRESENTED BY:
Haider Hamad Allah, Hossam
AbdelZahra, & Malik Hammoud
2ND STAGE (EVENING STUDY)
DR. OMAR YOUSSEF
TABLE OF CONTENTS:
INTRODUCTION…………………………………………….2-5
SYSTEM DISCRIPTION………………………………………….5-6
REQUIREMENTS ……………………………………………....…….6-7
WIRING ……….…………………………………....7-9
CONNECTING………………………………9-10
BLYNK ……………….……….11-14
CODE……………………………………………….…………15-19
1
SMART IOT GARDEN
INTRODUCTION:
2
controlled remotely in network infrastructure. Internet of
earth like pruning trees for developing tall structures and this
3
relieving the impact, cultivating like planting trees and
4
provide needs to environment. The system vision is to
SYSTEM DISCRIPTION:
5
garden we have many types of herbs, shrubs and climbers.
for the needy so this system with the help of soil and
REQUIREMENTS:
1) NodeMCU
3) Transistor
5) Power Source
Sensors:
6
Physical:
10) Resistors
12) Smartphone
7
Use two jumpers to connect the 5V and the GND of the
shown above.
Use the 3 jumpers to connect the sensor to the 5V, GND and
shown above.
shown above.
8
Transistor
Water Pump
Connect the '+' of the 12V power supply to the '+' of the
water pump.
CONNECTING:
Take a long 3/4' pipe; Block one end of the pipe, and mount
the other end to the water pump; makes some holes along
9
put the soil sensor in the soil. Note that the warning line of
10
BLYNK APPLICATION
the system. It will let you know when the system operates the
11
2) Soil Humidity scale - Provides you information about the
the land.
the plants.
12
E. Very dry - in this situation watering the soil as soon as
* You can change the Water humidity level and air humidity
level that the plants are exposed to. The ideal light level
garden.
your plants.
to 'Very Dry'.
13
6) Amount - by pressing '+' or '-' you can choose the amount
SYSTEM IN ACTION:
Note that of you turn the Auto-Irrigation ON, the system will
auto irrigate your garden as soon as the soil gets 'Very Dry'.
is not too strong (for example only in late in the night) so the
If the system decides to auto irrigate the garden it will let you
14
CODE:
#include <CD74HC4067.h>
#include <Arduino.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <MPU6050.h>
#include <SPI.h>
#include <Ethernet.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#define BLYNK_PRINT Serial
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define WIFI_SSID "IDC-Wireless"
#define WIFI_PASSPHRASE ""
char auth[] = "16333a9728d94a4dbf5f49adf90f9e7d";
////////////////////////////////// mpu mpu mpu TEMP
MPU6050 mpu;
int SCL_PIN = D4;
int SDA_PIN = D3;
////////////////////////////////// bye mpu
#define PUMP_PIN D0
#define SOIL_PIN A0
//DEFULT SETTINGS
int val = 0;
float timeForIrr = 0;
const float DEFAULT_LITERS = 1;
// LIGHT DEFAULT VALUES
15
int light = 0;
const int MaxLight = 1024; //you need to test this value with your sensor
16
//button
BLYNK_WRITE(V2) {
readFromBlynkAmount = param.asInt();
timeForIrr = (float)readFromBlynkAmount / 0.368055;
}
//amount
BLYNK_WRITE(V4) { // getting Blynk button information
readFromBlynkButton = param.asInt();
//Serial.println(readFromBlynkV2);
if (readFromBlynkButton) {
pump_on(timeForIrr);
}
}
void loop() {
Blynk.run();
/////////////////////////////////////////////////////////////// soil sensor
mux.channel(0);
val = analogRead(0); //connect sensor to Analog 0
int hum = map(val, 0, 1024, 1024, 0);
int hum_precentage = ((hum * 100) / AirValue);
Serial.print("This is the hum level: ");
Serial.print(hum_precentage); //print the value to serial port
Serial.println("%");
delay(100);
Blynk.virtualWrite(V0, hum_precentage);
////////////////////////////////////////////////////////////// bye soil
////////////////////////////////////////////////////////////// light sensor
mux.channel(2);
light = analogRead(0); //connect sensor to Analog 0
int sunny = map(light, 0, 1024, 1024.0, 0.0);
int sunny_precentage = ((sunny * 100) / MaxLight);
Serial.print("light power: ");
Serial.print(sunny_precentage); //print the value to serial port
Serial.println("%");
delay(100);
Blynk.virtualWrite(V2, sunny_precentage);
////////////////////////////////////////////////////////////// bye light
//////////////////////////////////////////////////////////////
17
soilMoistureValue = val; //put Sensor insert into soil
if (soilMoistureValue < (WaterValue + intervals))
{
Serial.println("Very Wet");
Blynk.virtualWrite(V1, "Very Wet");
flag = 1;
}
else if (soilMoistureValue > (WaterValue + intervals) && soilMoistureValue <
(WaterValue + (2 * intervals)))
{
Serial.println("Wet");
Blynk.virtualWrite(V1, "Wet");
flag = 1;
}
else if (soilMoistureValue > (WaterValue + (2 * intervals)) && soilMoistureValue <
(WaterValue + (3 * intervals)))
{
Serial.println("Ideal");
Blynk.virtualWrite(V1, "Ideal");
flag = 1;
}
else if (soilMoistureValue > (WaterValue + (3 * intervals)) && soilMoistureValue <
(WaterValue + (4 * intervals)))
{
Serial.println("Dry");
Blynk.virtualWrite(V1, "Dry");
flag = 1;
}
else if (soilMoistureValue < AirValue && soilMoistureValue > (AirValue - intervals))
{
Serial.println("Very Dry");
Blynk.virtualWrite(V1, "Very Dry");
veryDry = true;
if(flag == 1){ // send IFTT msg only once
Blynk.virtualWrite(V9, 0); // trigged webhook and send need to irrigate msg
flag = 0;
}
}
18
delay(100);
19