Project tutorial
Plant Recomender & Irrigation System Using IOT

Plant Recomender & Irrigation System Using IOT © CC BY-NC-ND

The System predict which plants can be grown in your garden's soil , also provide live monitoring & controlling from all around the globe.

  • 3,576 views
  • 3 comments
  • 23 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Updated for 2019 China-US Young Maker Competition

Conditions in your garden are constantly changing. Know what’s happening in real time so you can keep your plants healthy. The Smart vegetable Garden tracks light, humidity, temperature, soil moisture from sensors and then cross-references this information through Wi-Fi with plant databases on server, and the nearest weather station to give customized gardening guidance about irrigation and plant’s health on smart phone through application.

This is what it means "Your Garden has just got smarter!

Chosen System Architecture

The selected system architecture is based on three layers which are listed below in the diagram these three layers includes physical layer, network layer and application layer. Physical layer includes all the hardware device such as sensors, actuators, microcontrollers & Wi-Fi modules. After that network layer comes it contains networking components present in the system .It provides transmission of data between users and hardware devices through remote server also provides resource handling and high level processing. At top level there is application layer which is based on major features provided by system which are as follow plant monitoring, irrigation/light controlling and recommendations about plants and it also focus on interface shown up at user level which will be further explained in section 4.

Deployment Diagram

The following Deployment diagram represent the view of physical components of system. It contains all the hardware devices and architecture of smart vegetable garden system as deployed in real world environment. As shown in figure on the leftmost side there are light and moisture sensors which are connected through analog input with microcontroller same as humidity, camera and temperature sensors are connected through digital input. On the other hand actuators (water pump and lights) are connected to serial output of microcontroller, here microcontroller work as a centralized device which takes input from sensors and transmit this information towards server through internet. Server process the data provided by microcontroller so that users can view it through an android application or a web browser in response user perform some actions which will be transmitted to server through internet, then server send specified command to microcontroller and finally actuators perform action.

1. Main Modules

The best way for the user to monitor the garden would be through a mobile application. For this we are going to develop an android application because of its86.8% global market share[9]. Following are some key modules of the system.

1.1. Intelligent Guide

This module is an intelligent agent which will be provided with data, then it will gets real time values from sensors implanted in your garden to predicts which plants can be grown, which fertilizer to be use, when to trim, estimated time to harvest, is the season is appropriate to germinate desired plant and appropriate schedules for irrigation. The system will also get the feedback from a user against suggested guidelines to improve performance in future.

.

1.2. Remote monitoring:

Monitor and interact with your plants in real time right from your smart phone .This module collect the data from sensors and saves it on the server so that it will be available online to make it ready for user to monitor and control garden from anywhere.

1.3 Controlling:

After collecting the data from sensor, system will analyze the data to generate useful information which will help to take effective decision about generating watering schedule and turn ON the water pump on specific time. Optionally can be connected to garden's lighting circuit.

2. Expected Outcome

The major focus of developing this system is to make our ecosystem healthy through grabbing the intention of people towards gardening by making it smarter as well as time and cost effective.

Following are some major expected out comes.

2.1. Reduce cost & power consumption

The proposed system will be able to plan the proper watering schedule intelligently. As the system utilizes the electricity only when required, to reduce power consumption it will also suggest fertilizer usage & other required maintenance on the basis of analyzed data so it will ultimately reduce cost.

2.2. Increase garden productivity

As system is providing the most essentials of plants meanwhile such as when to water them and when fertilizer to be used, so it will eventually increase the yield of garden. To get the maximum plant productivity, Smart vegetable gardening is suitable solution.

2.3. Provide healthy vegetables at home

Smart vegetable gardening also has a potential for healthy food. The obvious advantage is pesticide free production and availability at door step.

Code

Alexa Power ControllerJSON
To Control Water pump remotely Alexa Power component can be used.
//Send Request

{
  "directive": {
    "header": {
      "namespace": "Alexa.PowerController",
      "name": "TurnOn",//OR "name": "TurnOff"
      "payloadVersion": "3",
      "messageId": "**************************",
      "correlationToken": "*******************************"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "access-token-from-skill"
      },
      "endpointId": "appliance-011",
      "cookie": {}
    },
    "payload": {}
  }
  
  // Read Responce
  
{
  "context": {
    "properties": [ {
      "namespace": "Alexa.PowerController",
      "name": "powerState",
      "value": "ON", //"value": "OFF" to read off responce
      
      "uncertaintyInMilliseconds": 500
    } ]
  },
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "payloadVersion": "3",
      "messageId": "*******************************",
      "correlationToken": "*******************************"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "access-token-from-Amazon"
      },
      "endpointId": "appliance-011"
    },
    "payload": {}
  }
}
Ardiouno Uno R3 code to send data from esp-8266 to web server.Arduino
#include "SoftwareSerial.h"
#include <DHT22.h>
String ssid ="your ssid here";

String password="your wifi password here";

SoftwareSerial esp(2, 3);// RX, TX

String data;

String server = " www.example.com"; //url to access hosting server

String uri = "/home/read?";// path to MVC controller

#define DHT22_PIN 7
DHT22 myDHT22(DHT22_PIN);
String temp="0" ,hum="0";

void setup() {

//pinMode (DHpin, OUTPUT);

esp.begin(115200);

Serial.begin(115200);

reset();

connectWifi();

}

//reset the esp8266 module

void reset() {

esp.println("AT+RST");

delay(1000);

if(esp.find("OK") ) Serial.println("Module Reset");

}

//connect to your wifi network

void connectWifi() {

String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";

esp.println(cmd);

delay(4000);

if(esp.find("OK")) {

Serial.println("Connected!");

}

else {



Serial.println("Cannot connect to wifi"); }

}



void loop () {

DHT22_ERROR_t errorCode;
   // The sensor can only be read from every 1-2s, and requires a minimum
   // 2s warm-up after power-on.
delay(2000);
int Moist= analogRead(A0);
int Light= analogRead(A1);
errorCode = myDHT22.readData();
   switch(errorCode)
   {
    case DHT_ERROR_NONE:
   temp =(String)myDHT22.getTemperatureC();
    hum=(String)myDHT22.getHumidity();
    data = "temp="+temp+"&hum="+hum+"&light="+Light+"&moist="+Moist;// data sent must be under this form //name1=value1&name2=value2.

  httppost();
   }

}

void httppost () {

esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.

if( esp.find("OK")) {

Serial.println("TCP connection ready");

} delay(1000);

String postRequest =

"POST " + uri + " HTTP/1.0\r\n" +

"Host: " + server + "\r\n" +

"Accept: *" + "/" + "*\r\n" +

"Content-Length: " + data.length() + "\r\n" +

"Content-Type: application/x-www-form-urlencoded\r\n" +

"\r\n" + data;

String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.

esp.print(sendCmd);

esp.println(postRequest.length() );

delay(500);

if(esp.find(">")) { Serial.println("Sending.."); esp.print(postRequest);

if( esp.find("SEND OK")) { Serial.println("Packet sent");

// close the connection

esp.println("AT+CIPCLOSE");
//delay(1000000);

}
else
{
   Serial.println("Packet Not sent");

// close the connection

esp.println("AT+CIPCLOSE");
  }

}}
Esp8266_with-MVC_.Net_CoreC/C++
Its about connecting esp-8266 wifi along Ardiouno Uno R3 with MVC5 a nd .net core 2.The file contain the arduino uno code which allow you to send data from sensors to web server by calling .net core api
#include "SoftwareSerial.h"
#include <DHT22.h>
String ssid ="your ssid here";

String password="your wifi password here";

SoftwareSerial esp(2, 3);// RX, TX

String data;

String server = " www.example.com"; //url to access hosting server

String uri = "/home/read?";// path to MVC controller

#define DHT22_PIN 7
DHT22 myDHT22(DHT22_PIN);
String temp="0" ,hum="0";

void setup() {

//pinMode (DHpin, OUTPUT);

esp.begin(115200);

Serial.begin(115200);

reset();

connectWifi();

}

//reset the esp8266 module

void reset() {

esp.println("AT+RST");

delay(1000);

if(esp.find("OK") ) Serial.println("Module Reset");

}

//connect to your wifi network

void connectWifi() {

String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";

esp.println(cmd);

delay(4000);

if(esp.find("OK")) {

Serial.println("Connected!");

}

else {



Serial.println("Cannot connect to wifi"); }

}



void loop () {

DHT22_ERROR_t errorCode;
   // The sensor can only be read from every 1-2s, and requires a minimum
   // 2s warm-up after power-on.
delay(2000);
int Moist= analogRead(A0);
int Light= analogRead(A1);
errorCode = myDHT22.readData();
   switch(errorCode)
   {
    case DHT_ERROR_NONE:
   temp =(String)myDHT22.getTemperatureC();
    hum=(String)myDHT22.getHumidity();
    data = "temp="+temp+"&hum="+hum+"&light="+Light+"&moist="+Moist;// data sent must be under this form //name1=value1&name2=value2.

  httppost();
   }

}

void httppost () {

esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.

if( esp.find("OK")) {

Serial.println("TCP connection ready");

} delay(1000);

String postRequest =

"POST " + uri + " HTTP/1.0\r\n" +

"Host: " + server + "\r\n" +

"Accept: *" + "/" + "*\r\n" +

"Content-Length: " + data.length() + "\r\n" +

"Content-Type: application/x-www-form-urlencoded\r\n" +

"\r\n" + data;

String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.

esp.print(sendCmd);

esp.println(postRequest.length() );

delay(500);

if(esp.find(">")) { Serial.println("Sending.."); esp.print(postRequest);

if( esp.find("SEND OK")) { Serial.println("Packet sent");

// close the connection

esp.println("AT+CIPCLOSE");
//delay(1000000);

}
else
{
   Serial.println("Packet Not sent");

// close the connection

esp.println("AT+CIPCLOSE");
  }

}}

Schematics

Esp8266 conectivity
Picture vdsphuwhrb
Appratus
Hardware SetUp
Whatsapp image 2018 06 03 at 12 43 16 pm(1) 4jo0ysuihh

Comments

Add projectSign up / Login