Automatic Plant Watering System Using Arduino

Introduction

 
In this article, I'll show you how to create an automatic plant watering system using Arduino Mega interfacing with Android mobile. This project is fully based on soil moisture irrigation.
 
Requirements
  • Arduino Mega
  • Soil Moisture Sensor
  • Motor
  • HC-05 Bluetooth Module
  • Bread Board
  • GSM900 Module
  • Led
  • Some Wires 
Connections
 
GSM
  • RX to RX1
  • TX to TX 1
  • Gnd to Gnd  
Bluetooth
  • RX to TX
  • TX to RX
  • Vcc to Arduino 5v
  • Gnd to Gnd  
Led
  • Anode to the digital pin 5
  • Cathode pin to the Gnd  
Soil Moisture 
  •  Vcc pin to the 5v
  • Gnd to Gnd
  • Data pin to the Analog A0  
Programming
  1. #include<SoftwareSerial.h>        
  2. SoftwareSerial firstSerial(15,16);      
  3. int led = 5;      
  4. int pin=A0;    
  5. int moisture=0;    
  6. String readString;      
  7. void setup()      
  8. {      
  9.     Serial.begin(9600);     
  10.     firstSerial.begin(9600);        
  11.     Serial.begin(9600);        
  12.     pinMode(led, OUTPUT);    
  13.       delay(100); // Baud Rate        
  14. }      
  15.       
  16. void loop()       
  17. {      
  18.     while (Serial.available()) //Send data only when you receive data      
  19.     {      
  20.         delay(4); //delay time      
  21.         char c = Serial.read();      
  22.         readString += c;      
  23.     }      
  24.     if (readString.length() > 0)      
  25.     {      
  26.         Serial.println(readString);      
  27.         if (readString == "ON")       
  28.         {      
  29.             digitalWrite(led, HIGH); // LED ON      
  30.         }      
  31.         if (readString == "OFF")       
  32.         {      
  33.             digitalWrite(led, LOW); //LED OFF      
  34.         }      
  35.         readString = "";      
  36.     }      
  37.     int soilmoisture=analogRead(pin);     
  38.     if(soilmoisture>=100){        
  39.   digitalWrite(led,HIGH);    
  40.   firstSerial.println("AT+CMGF=1");        
  41.   delay(1000);        
  42.   firstSerial.println("AT+CMGS=\"+xxxxxxxxxx\"\r");  //Enter Your Mobile Number instead XXXX while Testing      
  43.   delay(1000);        
  44.   firstSerial.println("Hai there I need some water");        
  45.   delay(100);        
  46.   firstSerial.println((char)23);        
  47.   delay(1000);        
  48. }        
  49. else{        
  50.   digitalWrite(led,LOW);        
  51. }        
  52.   Serial.println(soilmoisture);        
  53.   Serial.print("%");        
  54.   delay(20);        
  55. }      
Android App
  • The Android App is developed using MIT App inventor. 
  • The Android coding is attached in the zip you can download and install it to your mobile and you can modify it with your own method. 
Explanation
 
The Automatic plant watering system is based upon soil irrigation. In the program first, we want to set the header file to the GSM Module and set the RX and TX Pin to the GSM Module. In the setup function, we want to set the baud rate for GSM and the Arduino Board as  9600 and here we are using the HC-05 Bluetooth device for pairing between Android mobile and the Arduino when it is paired,  which means completely controlled through the Android device. Here's the procedure:
 
Working Procedure
  • Step 1: Connect the device using the BT Communication method and pair it to Android Mobile.
  • Step 2: It shows the status every 60 seconds.
  • Step 3: When the temperature is greater than 100 the water will pump through the plant. This is based on soil irrigation.  
Output 
 
 
Read more articles on Arduino: