IOT PLANT - Grow your plants from anywhere around the world.

Friday, September 22, 2017

 

Watch the video


The device and plant setup


Light sensor and Soil moister sensor

What about growing your any plants from anywhere around the world without your actual presence? Yes it is possible by this project called 'IoT Plant'. 

You can water you plant through different modes available in the android application and you will get the real time reading of moister, temperature and light that is available for the plant on your smartphone. And also you will get an email when your plant require water, manure etc..

Let's read more about it -

What is IoT (internet of things)? - simple definition

Internet of thing is the ecosystem of connected physical devices that are accessible through the internet.

Features of IoT Plant

  1. Cheap price (~4000rs)
  2. You can monitor the real time requirement of the plant.
  3. Different modes of water supply for different types of plants

What you can monitor?

  • The humidity of the soil.
  • Light available to the plant leafs and temperature of the atmosphere.

Different modes of water supply

  • Manual mode - You can manually supply the water.
  • Timer mode - Can be used to supply water in regular interval of time or at a particular time every day.
  • Automatic mode - Automatically supply water as per the requirement of the plant. Suitable for the plants which always need water.(eg: Paddy cultivation)


Technical details


This project was made using the micro controller called arduino. - It is cheap opensource board which can be used for different applications by programming using C++ language through the arduino IDE software. And an IoT board called EP8266 which revolutionized the Internet of things. For a mere dollar you can add a whole world wireless capability to your projects. That is the reason why we are choose ESP8266 for making this project. 

It is used some sensors such as soil moister sensor, temperature sensor and light sensor to monitor the real time environment of the plant. Also a water pump and relay to pump the water to the plant. 

For this project I am used an IoT application called 'Blynk'. Through this application we are controlling the water pump and see the environment or the water requirement of the plant through different types of graphs.

IOT application - 'Blynk'


Parts used

Electronic parts

Mechanical parts

  1. Arduino nano
  2. ESP8266
  3. ESP8266 programmer
  4. LCD display
  5. Relay module
  6. Plastic box (17 x 11 cm wide)
  7. Ac to DC 12 volt 2 AH regulator. 
  8. Water pump
  9. Switch

Circuit diagram



Arduino code (C++ language)

This is the program uploaded to arduino board

 const int mPin = A1;  
 const int lPin = A2;  
 const int tPin = A3;  
   
 int mValue = 0;      
 int lValue = 0;   
 int tValue = 0;   
   
 int moist = 0;  
 int light = 0;  
 int temp = 0;  
   
 //--  
 byte datas1 = 0;  
 byte datas2 = 0;  
 byte datas3 = 0;  
 //--  
   
 const int motor_in = 2;  
 const int auto_in = 4;  
 const int motor_out = 7;  
 int mstate = 0;  
 int astate = 0;  
   
 //-------LCD--------  
 #include <Wire.h>  
 #include <LCD.h>  
 #include <LiquidCrystal_I2C.h>  
 #define I2C_ADDR  0x3F // <<----- Add your address here. Find it from I2C Scanner  
 #define BACKLIGHT_PIN 3  
 #define En_pin 2  
 #define Rw_pin 1  
 #define Rs_pin 0  
 #define D4_pin 4  
 #define D5_pin 5  
 #define D6_pin 6  
 #define D7_pin 7  
 LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);  
 //-------LCD--------  
   
   
 void setup() {  
    
  Serial.begin(115200);  
    
  //-------LCD--------  
  lcd.begin (16,2); // <<----- My LCD was 16x2  
  // Switch on the backlight  
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);  
  lcd.setBacklight(HIGH);  
  lcd.home (); // go home  
  lcd.print("** IOT PLANT **");  
  delay(1000);   
  //-------LCD--------  
   
  pinMode(motor_in, INPUT);  
  pinMode(auto_in, INPUT);  
  pinMode(motor_out, OUTPUT);  
 }  
   
 void loop() {  
    
  // read the analog in value:  
  mValue = analogRead(mPin);  
  lValue = analogRead(lPin);  
  tValue = analogRead(tPin);  
    
  moist = map(mValue, 300, 1023, 100, 0);  
  light = map(lValue, 0, 1023, 100, 0);  
  temp = (5.0 * tValue * 100.0) / 1024;   
     
  mstate = digitalRead(motor_in);  
  astate = digitalRead(auto_in);  
    
 //---------- manuel mode ----  
  if (mstate == HIGH && astate == LOW)  
  {  
   digitalWrite(motor_out, HIGH);  
     
   lcd.clear();//***************  
   lcd.setCursor (0,0);    // go to start of 1nd line  
   lcd.print("Water is pumping");  
     
   lcd.setCursor (0,1);    // go to start of 2nd line  
   lcd.print("Moisture:");  
   lcd.setCursor (9,1);   
   lcd.print(moist);  
   lcd.setCursor (11,1);   
   lcd.print("%");  
   delay(1000);  
  }  
 //---------- automatic mode ----  
  else if (mstate == LOW && astate == HIGH)  
  {  
   if (moist < 25)  
   {  
   digitalWrite(motor_out, HIGH);    
   lcd.clear();//***************  
   lcd.setCursor (0,0);    // go to start of 1nd line  
   lcd.print("Water is pumping");  
   lcd.setCursor (0,1);    // go to start of 2nd line  
   lcd.print("Moisture:");  
   lcd.setCursor (9,1);   
   lcd.print(moist);  
   lcd.setCursor (11,1);   
   lcd.print("%");  
   delay(1000);  
   }  
   else  
   {  
    digitalWrite(motor_out, LOW);  
    lcd.clear();//***************  
    lcd.setCursor (0,0);    // go to start of 1nd line  
    lcd.print("Water is excess");  
    lcd.setCursor (0,1);    // go to start of 1nd line  
    lcd.print("motor turned off");  
    delay(1000);  
   }  
     
  }  
  else   
  {  
   digitalWrite(motor_out, LOW);  
     //-------------------------------------------  
   lcd.clear();//*******  
     
   lcd.setCursor (0,0);    // go to start of 1nd line  
   lcd.print("Moisture:");  
   lcd.setCursor (9,0);   
   lcd.print(moist);  
   lcd.setCursor (11,0);   
   lcd.print("%");  
     
   lcd.setCursor (0,1);    // go to start of 2nd line  
   lcd.print("Temperature:");  
   lcd.setCursor (12,1);  
   lcd.print(temp);  
   lcd.setCursor (15,1);  
   lcd.print("C");  
     
   delay(1000);  
   
   lcd.clear();//***************  
     
   lcd.setCursor (0,0);    // go to start of 1nd line  
   lcd.print("Moisture:");  
   lcd.setCursor (9,0);   
   lcd.print(moist);  
   lcd.setCursor (11,0);   
   lcd.print("%");  
     
   lcd.setCursor (0,1);    // go to start of 2nd line  
   lcd.print("Light:");  
   lcd.setCursor (6,1);  
   lcd.print(light);  
   lcd.setCursor (8,1);  
   lcd.print("%");  
     
   delay(1000);  
   //------------------------------------------------  
  }  
 //----------  
     
   datas1 = moist & 0xFF;  
   Serial.write(0x8);  
   Serial.write(datas1);  
   datas2 = light & 0xFF;  
   Serial.write(0x7);  
   Serial.write(datas2);  
   datas3 = temp & 0xFF;  
   Serial.write(0x6);  
   Serial.write(datas3);   
   delay(5);  
 }  

ESP8266 code (C++ language)

This is the program uploaded to ESP8266 board.

 #include <ESP8266WiFi.h>  
 #include <BlynkSimpleEsp8266.h>  
   
 byte ID = 0;  
 int data = 0;  
   
 // You should get Auth Token in the Blynk App.  
 // Go to the Project Settings (nut icon).  
 char auth[] = "49f8b849e38141d48366b93170b7a529";  
   
 // Your WiFi credentials.  
 // Set password to "" for open networks.  
 char ssid[] = "iotplant";  
 char pass[] = "12345678";  
   
 #define moistpin V1  
 #define lightpin V5  
 #define temppin V2  
   
 BlynkTimer timer;  
   
   
 BLYNK_CONNECTED() {  
   
  Blynk.syncAll();  
 }  
   
   
 void myTimerEvent()  
 {  
  if(Serial.available()>0)  
  {  
   ID = Serial.read();  
   data = Serial.read();  
   
   if(ID == 0x6)  
   {  
    Blynk.virtualWrite(moistpin, data);  
       
     if (data<25)  
     {  
      Blynk.email("Subject:* IOT PLANT *", "Plant need water");  
      Blynk.notify("YOUR PLANT IS THURSTY!");  
     }  
   }  
     
   if(ID == 0x7)  
   {  
    Blynk.virtualWrite(lightpin, data);  
   }  
   
   if(ID == 0x8)  
   {  
      
    Blynk.virtualWrite(temppin, data);  
   }  
     
   }  
   else  
   {  
    Blynk.virtualWrite(V1, 0);  
    Blynk.virtualWrite(V5, 0);  
    Blynk.virtualWrite(V2, 0);  
   }  
  }  
   
 void setup()  
 {  
  Serial.begin(115200);  
  Blynk.begin(auth, ssid, pass);  
  timer.setInterval(1000L, myTimerEvent);  
 }  
   
 void loop()  
 {   
  Blynk.run();  
  timer.run(); // Initiates BlynkTimer  
 }  


Future plans/updates

  1. Adding a camera to monitor the growth of the plant
  2. Adding a sensor to monitor the nitrogen content in the soil, to supply the manure for the plant.

You Might Also Like

3 comments

  1. Hi, Where can I find the LCD.h library

    ReplyDelete
    Replies
    1. You may visit here - https://github.com/nherment/Arduino-Library/blob/master/LCD/LCD.h

      Delete
  2. HI Where can I Find the LiquidCrystal_I2C.h library plzz give the link

    ReplyDelete

Click on 'Notify me' to get replies of your comment.

Popular Posts

Like us on Facebook

Contact Form

Name

Email *

Message *