Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

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

SYSTEM IN ACTION ……………….……….14

CODE……………………………………………….…………15-19

1
SMART IOT GARDEN

INTRODUCTION:

Automation rules the world nowadays. It is a technique

of using computers or mobile phones in monitoring and

controlling the simple parameters of day to day life. The

standard of our life will be nourished by the practice of using

automation for simple things. Using the concept of IOT we

make sensors to communicate with each other which are

powerful in automation. The important aspect of this

prototype is that it saves cost and ensures safety. When

people try to make plantings and set up their own garden,

they were cautious in maintenance at only in their beginning

stages. As days go on due to lack of maintenance the plants

get destroyed. This prototype will help people to

automatically monitor the parameters and ensures

maintenance of the garden. It plays a vital role and serves as

a good companion for plants. IOT provides solutions for

various problems and it allows things to be sensed or

2
controlled remotely in network infrastructure. Internet of

Things (IOT) is all about collecting information from the

world with the help of network devices which are connected

and capable of collecting the information, and the

information which are collected by the sensors are then

shared on cloud Network devices includes sensors and other

physical devices. Internet of things alludes to a system which

comprises physical gadgets, vehicles, structures and

different things which are implanted with hardware,

programming, sensors and so on... Web of things empowers

these gadgets to associate with one another and trade

information. Internet of things is one area which is

blossoming nowadays which are making our lives simple, we

use web of things in different areas, for example, Home

robotization, wearable's, Smart framework, horticulture,

shrewd retail, social insurance and so on... Modernization the

earth like pruning trees for developing tall structures and this

outcome in natural lopsidedness and climatic changes. For

3
relieving the impact, cultivating like planting trees and

bushes will turn out to be increasingly more significant than

an interest. Greenhouse needs in learning about the

necessity of plant that the supplement and the measure of

water to be showered to improve the development of the

plant. Moreover, the upkeep of the greenhouse is tedious

and it is additionally a repetitive procedure. In normal, the

plant specialist will need learning about the prerequisites of

plant like having appropriate supplement and measure of

legitimate water to be showered for the improvement of its

development. With respect to this, it is fundamental for

structure a self-ruling cultivating for the plants. The main

goal of the project is to provide a smart control of the garden,

by irrigating the garden based on data collected by the

sensors. The definition provides an overview about the

system requirement and specification. Aim of the project is

to develop a smart garden system environment able to auto

monitoring the humidity and water amount in the garden and

4
provide needs to environment. The system vision is to

connect a growing bed via sensors to an Arduino board such

that we can measure moisture and temperature and stores

that data. This will enable to determine the minimal feasible

amount of watering. This application has many feature which

benefits both the user and garden. This system focuses to

make the user maintain the garden.

(Temperature, moisture, humidity) used in this project

interface with the Raspberry Pi controller. And this

information about the garden can be directly monitored and

controlled by the owner of the garden through his or her

smart phone using IoT.

SYSTEM DISCRIPTION:

This system is based on Internet of things which aims at

connecting maximum devices through internet. We are

surrounded by Plants and tress it provide us with oxygen,

food etc. In this Smart garden monitoring system water is

provided to the plant with the help of pump motor. In our

5
garden we have many types of herbs, shrubs and climbers.

But in our busy schedule we don’t have time to take care of

these plants which provides beauty to the nature and foods

for the needy so this system with the help of soil and

moisture sensor checks the fertility of the soil and provide it

with water through the pump. It has temperature sensor

which checks the temperature of plants.

REQUIREMENTS:

1) NodeMCU

2) 2 (or more) channel analog multiplexer

3) Transistor

4) Water Pump (we used 12V Blige Pump 350GPH)

5) Power Source

Sensors:

6) Light Sensor (Light Dependent Resistor)

7) MPU-6050 sensor (or any temperature sensor)

8) Capacitive Soil Moisture Sensor

6
Physical:

9) 3/4" water pipe

10) Resistors

11) Wires and Extensions

12) Smartphone

13) Blynk App

WIRING - BOARD AND SENSORS:

Board and MultiPlexer

Place the NodeMCU and the multiplexer on the breadboard

as shown in the diagram.

7
Use two jumpers to connect the 5V and the GND of the

NodeMCU to the '+' and '-' column of the breadboard

respectively, and connect the multiplexer to the NodeMCU as

shown above.

Connecting the sensors

1) Light Sensor (Light Dependent Resistor) - You will need

three jumpers and 100K Resistor.

Use the 3 jumpers to connect the sensor to the 5V, GND and

to the Y2 of the multiplexer as shown above.

2) MPU-6050 sensor - You will need four jumpers to connect

the sensor to the 5V, GND, and D3, D4 of the NodeMCU as

shown above.

3) Capacitive Soil Moisture Sensor (CSMS) - Connect the CSMS

with 3 jumpers, to the 5V, GND and Y0 of the multiplexer as

shown above.

Now, connect the USB cable to the NodeMCU.

8
Transistor

Use 3 Jumpers to connect the transistor as follows:

1. Middle leg to the '-' of the water pump;

2. Left leg to the '-' of the 12V power Supply;

3. Right leg to D0 of the MCU;

Water Pump

Connect the '+' of the 12V power supply to the '+' of the

water pump.

CONNECTING:

We recommend to put the breadboard along with all other

components except the pump in a nice box.

The Should be inside bucket of water.

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

the pipe, and deploy it near the plants;

9
put the soil sensor in the soil. Note that the warning line of

the sensor should be outside the soil.

You may take a look at the picture above to see how we

placed the system.

10
BLYNK APPLICATION

BLYNK application contains the following features:

1) LCD - the lcd will provide you relevant information about

the system. It will let you know when the system operates the

water pump and irrigating the plants.

11
2) Soil Humidity scale - Provides you information about the

humidity of the soil.

The scale shows the humidity in percentage such that zero

percent represents is the average humidity level of the air,

and 100 percent represents moisture of water.

We also added a verbal description of the humidity level

represented by five options:

A. Very wet - when the soil is floated with water.

B. Wet - between the normal and the flooded. This situation

is expected to occur for some time after we have irrigated

the land.

C. Ideal - when the soil contains an ideal amount of water for

the plants.

D. Dry - When the soil begins to dry. However, in most plants

there is no need to irrigate yet.

12
E. Very dry - in this situation watering the soil as soon as

possible (Note that if Auto irrigation mode is ON, the System

will automatically irrigate the garden when Soil is very dry).

* Of course the ideal level of soil humidity is depending on

the specific plants you have in your garden.

* You can change the Water humidity level and air humidity

level in accordance as explained above.

3) Sunny scale - Provides you information about the light

level that the plants are exposed to. The ideal light level

needed is depends of which type of plants you have in your

garden.

4) Temp - provides you the temp in the surroundings area of

your plants.

5) Auto Irrigate - when this button is ON, the system will

automatically irrigate the plants when the soil humidity gets

to 'Very Dry'.

13
6) Amount - by pressing '+' or '-' you can choose the amount

of water (in liters) for irrigating the plants.

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'.

the System can be configured to irrigate only when the sun

is not too strong (for example only in late in the night) so the

water will not be wasted!!!

If the system decides to auto irrigate the garden it will let you

know on the lcd of the application (if it's open on your

smartphone), and it will also send you an Email.

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

// HUMIDITY DEFAULT VALUES


const int AirValue = 900; // HUMIDITY VALUE IN AIR - you need to test this value
with your sensor
const int WaterValue = 380; // HUMIDITY IN VALUE WATER need to test this value
with your sensor
int intervals = (AirValue - WaterValue) / 5; // verydry/dry/normal/wet/water
int soilMoistureValue = 0;
// MUX
CD74HC4067 mux(D5, D6, D7, D8);
// LCD
WidgetLCD lcd(V5);
//BLYNK
int readFromBlynkButton;
int readFromBlynkAmount;
int readFromBlynkAuto;
boolean veryDry = false;
int flag = 0;
void setup() {
WiFi.forceSleepBegin(); // turn off ESP8266 RF
Serial.begin(9600);
Blynk.begin(auth, WIFI_SSID, WIFI_PASSPHRASE);
delay(1);
//Serial.println("Initialize MPU6050");
pinMode(PUMP_PIN, OUTPUT);
lcd.clear();
while (!mpu.beginSoftwareI2C(SCL_PIN, SDA_PIN, MPU6050_SCALE_2000DPS,
MPU6050_RANGE_2G, MPU6050_ADDRESS)) {
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
}
//auto
BLYNK_WRITE(V6) { // getting Blynk button information
readFromBlynkAuto = param.asInt();
}

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);

if (readFromBlynkAuto && veryDry)


{
auto_pump();
Blynk.virtualWrite(V8, 0); // trigged webhook and sent irrigation msg
}
////////////////////////////////////////////////////////////////// temp
sensor
float temp = mpu.readTemperature();
Blynk.virtualWrite(V3, temp);
}

19

You might also like