Automatic Drip-Irrigation System with Arduino (Arduino every - ATMEGA 4809)

Published  December 15, 2023   0
Drip-Irrigation System

Here using ATMEGA 4809 Arduino nano board and Capacitive Soil Moisture Sensor V2, I am trying to make an Automatic drip-irrigation system.

Arduino Nano Board with Water Pump

Below is my code which is being used in the project. 

/* code for Automatic irrigation system using moisture sensor
*/

void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT);

}

void loop() 
{
 int sensorval = analogRead(A0);

Serial.print(sensorval);
Serial.println("n");

if (sensorval < 300)
{digitalWrite(3, HIGH);
}

 if (sensorval > 500)
{digitalWrite(3, LOW);
}

delay(10);

}

I have connected water pump to Arduino via relay module which will control the pump as per Arduino’s command.

Also, I have connected the moisture sensor to Arduino, to get the information about the soil. Then I have connected a resistor in series to the motor pump as a load, since I have used USB as power input to the motor pump (refer to the below circuit diagram).

USB Power Input

Note: Arduino Nano board and Amphenol Humidity and Temperature sensor was purchased from digikey for this project. 

When we turn on the circuit, soil moisture sensor starts measuring the water level in the atmosphere in terms of water fraction by volume. When I measured sensor inside the water it was above 500 and out side in air it was about 290. So, we can consider as if the sensor reading goes below 300 means there is no water content in soil and more than 500 is more than enough water content present in soil.

Whenever the sensor detects that the water/ moisture level is below 300 relay will be triggered by Arduino and water starts flowing through the pipe. Here the end terminal of pipe is closed, and a small hole is made for a drop-by-drop flow. And the drip irrigation starts. And when the sensor detects as water/ moisture level is above 500 it means there is a lot of water content so Arduino will turn off the relay leading to turn off the pump. This turning off process is useful while raining, so that we don’t need to turn off the pump. Also, it turns on itself when water requirement is there for soil. And we can adjust this for the soil as it needed.

Circuit Soil Moisture Sensor

Code
/* code for Automatic irrigation system using moisture sensor*/

void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT);

}

void loop() 
{
 int sensorval = analogRead(A0);

Serial.print(sensorval);
Serial.println("n");

if (sensorval < 300)
{digitalWrite(3, HIGH);
}

 if (sensorval > 500)
{digitalWrite(3, LOW);
}

delay(10);

}
Video