Automatic Plant Watering/Irrigation System Using Arduino Uno

Automatic Plant Watering/Irrigation System Using Arduino Uno


This project monitors the moisture of soil and waters it by AC pump.

Components required 

Hardware

  • Arduino UNO

  • Soil Moisture Sensor 

  • 5 V 1 channel Relay Module
  • AC-Pump-240-Volts


  • Jumper/Connecting Wires

  • 5 V DC Adapter

Software
  • Arduino IDE

Warning: - AC is very risky and accidental shock could be fetal, so be sure to pursue appropriate safety precautions.  Predictable Designs assumes no accountability for any injury that may happen by following this tutorial.


Circuit and Working

The circuit is built using Arduino Uno, Soil Moisture sensor and a 1-channel relay or as per the requirements.

The step-wise working is as follows:

      Step1: Upload the sketch in Arduino Uno. A Sample sketch is shown below: 

#define PUMP_ON 13
#define SEN_IN 2
void setup() {
   pinMode(PUMP_ON, OUTPUT);
  pinMode(SEN_IN, INPUT);
}
void loop() {
  if(digitalRead(SEN_IN) == HIGH){
    digitalWrite(PUMP_ON, LOW);
  } else {
    digitalWrite(PUMP_ON, HIGH);
    delay(1000);
  }
}

Step 2: Connect Relay with Arduino Uno
Relay      Adruino Uno
IN1      >   Pin 13
GND   >    GND
VCC   >     5V

Step 3: Connect Soil Moisture with Arduino Uno 
Soil Moisture Sensor                Adruino Uno
DO                                   >        Pin 2
GND                                >        GND
VCC                                >         3.3V

Step 4: Connect Relay and AC Pump as shown below
Step 5: Power the AC Pump and Adruino Uno (use 5V Adapter)

Measuring soil moisture Percentage 


The analog output of soil moisture sensor is processed using ADC. The output of the soil moisture sensor varies in the range of ADC value from 0 to 1023.
We can represent the moisture value (in percentage) using the given formula :
Moisture (in percentage) = 100 – (Analog output * 100)

Use the given sketch to control the pump  on Moisture Percentage

/*Sketch using Moisture Percentage*/

#define PUMP_ON 13
#define SEN_IN A1

void setup() {
  Serial.begin(9600);
}
void loop() {
  float MOISTURE_PER;
  int SENSOR_IN;
  SENSOR_IN = analogRead(SEN_IN);
  MOISTURE_PER = (100 - ( (SENSOR_IN/1023.00) * 100 ) );
  if (MOISTURE_PER > 50){
    digitalWrite(PUMP_ON, HIGH);
  } else {
    digitalWrite(PUMP_ON, LOW);
    delay(1000);
  }
}

Comments

Post a Comment

Popular posts from this blog

PIR Motion Sensor Using Arduino Uno