Automatic Watering System To Plants By Using Arduino Mega 2560

In this article I will explain about the Automatic Watering System to Plants using Arduino Mega 2560.

In my last article I explained about controlling Light/Fan using Arduino Mega 2560. Now I will explain about Automatic Watering System on plants using Arduino Mega 2560.
 
Introduction:
  • In this article I will explain about the Automatic Watering System to plants using Arduino Mega 2560.
  • It can be very useful for maintaining the plants.
  • It will monitor the plants at the correct time and give the status of the plants. 
Parts Of List:
  • Arduino Mega 2560
  • Soil moisture sensor
  • Bluetooth
  • Motor
  • Led 
  • GSM-Module
  • Bread Board
  • Hook up wires 
GSM-Module
  • GSM means Global System For Mobile and it can be used to send and receive message in critical area.
  • It can also act as GSM modem.
  • It can have a PIN configuration and MIC is also attached. 

                    Figure 1: GSM-Module
Soil Moisture sensor
  • Soil moisture sensor is used to measure the volumetric water in soil.
  • It measures the free soil moisture requiring removing, drying, and weight of a sample.
  • It consists of two pins only.

      
    Figure2: Soil moisture sensor
Bluetooth Module
  • It can be used to design the transparent wireless serial connection setup.
  • HC-05 module is easy to use Bluetooth SSP.
     
          Figure 3: Bluetooth Module
Connection:

Step 1:Connection from GSM To Arduino Mega 2560
  • Connect the RX pin of the GSM board to the RX1 of the Arduino Mega 2560.
  • Connect the TX pin of the GSM board to the TX1 of the Arduino Mega 2560.
  • Connect the 5V power supply to the Arduino Mega 2560.
  • At last connect the GND to the GSM board.
Step 2:Connection From Soil Moisture To Arduino Mega 2560
  • Vcc pin to the 5v
  • Gnd to Gnd
  • Data pin to the Analog A0
Step 3: Connection From Bluetooth TO Arduino Mega 2560
  • RX to TX
  • TX to RX
  • Vcc to Arduino 5v
  • Gnd to Gnd 
Step 4:LED To Arduino Mega 2560
  • Connect the positive pin in digital pin 5 in Arduino Mega 2560
  • Connect the negative pin in the GND to Arduino Mega 2560. 
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. }       
Explanation:
  • I have explained about Automatic Watering System on plants using Arduino Mega 2560.
  • It can be used to measure the  level of plants in the soil.
  • When the plants are in a dry condition it can be used to send the following message to the user, "Hey there! I NEED SOME WATER" . 
  • So it can be used to send  water to the plant automatically by Android App.
Output:

  
                                          
                                                      Figure 4:Output
 
Read more articles on Internet of Things: