Automatic Plant Irrigation using Arduino UNO. How to DIY?

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
dondon pramis
Inventor
Inventor
Contact:
Location: Philippines
Posts: 44
Joined: Sun Feb 12, 2017 8:28 am

Automatic Plant Irrigation using Arduino UNO. How to DIY?

Thu Oct 18, 2018 7:31 pm

Whenever we go out of town for Holiday, we sometimes worry about our plants as they need water to nourish. In this Automatic Plant Irrigation System using Arduino, we can automatically provides water to our small garden and keep us updated by sending message to our phone.

The Circuit Diagram:
arduino-based-automatic-plant-irrigation-system-circuit-Diagram.png
This Plant Watering System. The sensor check the moisture level in soil and if the moisture level is low the Arduino switch On water pump to provide water to plant. Water pump gets automatically off when system finds enough moisture in the soil. Whenever the system switched On or off the pump, a message is sent to the users phone via GSM module, updating the status of water pump and soil moisture. This system is very useful in Farms, gardens, home etc. This system is completely automated and there is no need for any human involvement.

Required Parts:
Arduino Uno
GSM Module
Transistor BC547 (2)
Connecting wires
16x2 LCD (optional)
Power supply 12v 1A
Relay 12v
Water cooler pump
Soil Moisture Sensor
Resistors (1k, 10k)
Variable Resistor (10k, 100k)
Terminal connector
Voltage Regulator IC LM317

GSM Module:
Here we have used TTL SIM800 GSM module. The SIM800L is a complete Quad-band GSM/GPRS Module which can be embedded easily by customer or hobbyist. SIM900 GSM Module provides an industry-standard interface; the SIM800 delivers GSM/GPRS 850/900/1800/1900MHz performance for voice, SMS, Data with low power consumption. The design of this SIM800 GSM Module is slim and compact. It is easily available in the market or online from eBay or Aliexpress.

Quad - band GSM/GPRS module in small size.
GPRS Enabled
TTL Output
SIM800L.jpg
SIM800L.jpg (51.33 KiB) Viewed 612 times
In this Plant Irrigation System, we have used Soil Moisture Sensor Probe to sense the soil moisture level.
Soil-Moisture-Probe.jpg
Soil-Moisture-Probe.jpg (13.45 KiB) Viewed 612 times
One side of the probe is directly connected to Vcc and other probe terminal goes to the base of BC547 transistor. A potentiometer is connected to the base of the transistor to adjust the sensitivity of the sensor. (* you can make homemade sensor if you wanted)

The output of soil sensor circuit is directly connected to digital pin D7 of Arduino. A LED is used at the sensor circuit, this LED’s ON state indicates the presence of moisture in the soil and OFF state indicates the absence of moisture in the soil.

GSM module is used for sending SMS to the user. Here we have used TTL SIM800 GSM module, which gives and takes TTL logic directly (user may use any GSM module). A LM317 Voltage regulator is used to power the SIM800 GSM module. LM317 is very sensitive to voltage rating and it is recommended to read its data sheet before use. Its operating voltage rating is 3.8v to 4.2v (please prefer 3.8v to operate it). Below is the Circuit Diagram of Power Supply given to the TTL sim800 GSM Module:
SIM800L-GSM-module-power-supply-circuit.gif
SIM800L-GSM-module-power-supply-circuit.gif (6.94 KiB) Viewed 612 times
If you want to use SIM900 TTL Module use 5V and if the you wants to use SIM900 Module supply 12v in the DC Jack of the board.

A 12V Relay is used to control the 220VAC small water pump. The relay is driven by a BC547 Transistor which is further connected to digital pin 11 of Arduino.

An optional LCD is also used for displaying status and messages. Control pins of LCD, RS and EN are connected to pin 14 and 15 of Arduino and data pins of LCD D4-D7 are directly connected at pin 16, 17, 18 and 19 of Arduino. LCD is used in 4-bit mode and driven by Arduino’s inbuilt LCD library.(Refer to the Circuit Diagram above).

Working of this Automatic Plant Irrigation System is quite simple. It is a Completely Automated and there is no need manpower to control the system. Arduino is used for controlling the whole process and GSM module is used for sending alert messages to the user phone.

If moisture is present in soil the conduction between the two probes of Soil Moisture sensor,.. transistor Q2 remains in triggered/on state and Arduino Pin D7 remains Low. When Arduino reads LOW signal at D7, then it sends SMS to user about “Soil Moisture is Normal. Motor turned OFF” and water pump remains in Off state.

If there is no Moisture present in soil the Transistor Q2 become Off state and Pin D7 becomes High. The Arduino reads the Pin D7 and turns On the water motor and send message to user about “Low Soil Moisture detected. Motor turned ON”. Motor will automatically turn off when there is sufficient moisture in the soil.

Below is the complete CODE. It can be further enhanced to be operated and monitored over the internet.

Code: Select all

#include<SoftwareSerial.h>
SoftwareSerial Serial1(2,3);

#include<LiquidCrystal.h>
LiquidCrystal lcd(14,15,16,17,18,19);
int led=13;
int flag=0;
String str="";

#define motor 11
#define sensor 7

void setup()
{
  lcd.begin(16,2);
  Serial1.begin(9600);
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(motor, OUTPUT);
  pinMode(sensor, INPUT_PULLUP);
  lcd.print("Water Irrigation");
  lcd.setCursor(4,1);
  delay(2000);
  lcd.clear();
  lcd.print("Dohangout");
  lcd.setCursor(0,1);
  lcd.print("Hello...");
  delay(2000);
  gsmInit();
  lcd.clear();
  lcd.print("System Ready");
}

void loop()
{
    lcd.setCursor(0,0);
    lcd.print("Automatic Mode    ");
    if(digitalRead(sensor)==1 && flag==0)
    {
      delay(1000);
      if(digitalRead(sensor)==1)
      {
        digitalWrite(led, HIGH);
        sendSMS("Low Soil Moisture detected. Motor turned ON");
        lcd.begin(16,2);
        lcd.setCursor(0,1);
        lcd.print("Motor ON    ");
        digitalWrite(motor, HIGH);
        delay(2000);
        flag=1;
      }
    }

    else if(digitalRead(sensor)==0 && flag==1)
    {
      delay(1000);
      if(digitalRead(sensor)==0)
      {
        digitalWrite(led, LOW);
        sendSMS("Soil Moisture is Normal. Motor turned OFF");
        digitalWrite(motor, LOW);
        lcd.begin(16,2);
        lcd.print("Motor OFF");
        lcd.setCursor(0,1);
        lcd.print("Motor OFF");
        delay(2000);
        flag=0;
      }
    }
}
 
void sendSMS(String msg)
{
  lcd.clear();
  lcd.print("Sending SMS");
  Serial1.println("AT+CMGF=1");
  delay(500);
  Serial1.print("AT+CMGS=");
  Serial1.print('"');
  Serial1.print("+63918*******");    // number
  Serial1.print('"');
  Serial1.println();
  delay(500);
  Serial1.println(msg);
  delay(500);
  Serial1.write(26);
  delay(1000);
  lcd.clear();
  lcd.print("SMS Sent");
  delay(1000);
  lcd.begin(16,2);
}

void gsmInit()
{
  lcd.clear();
  lcd.print("Finding Module..");
  boolean at_flag=1;
  while(at_flag)
  {
    Serial1.println("AT");
    while(Serial1.available()>0)
    {
      if(Serial1.find("OK"))
      at_flag=0;
    }
    delay(1000);
  }
  Serial1.println("ATE0");
  lcd.clear();
  lcd.print("Finding Network..");
  boolean net_flag=1;
  while(net_flag)
  {
    Serial1.println("AT+CPIN?");
    while(Serial1.available()>0)
    {
      if(Serial1.find("READY"))
      net_flag=0;
      break;
    }
    delay(1000);
  }
   Serial1.println("AT+CNMI=2,2,0,0,0");
   delay(1000);
   Serial1.println("AT+CMGF=1");
   delay(1000);
   Serial1.println("AT+CSMP=17,167,0,0");
   lcd.clear();
   Serial1.flush();
}



Return to “ARDUINO AND RASPBERRY PI”

Links

In total there are 5 users online :: 1 registered, 0 hidden and 4 guests
Registered users: Bing [Bot]
Most users ever online was 156 on Sun Jun 17, 2018 7:42 am
Total posts 449
Total topics 328
Total members 62
Our newest member anonymous-kali
No birthdays today