Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Based Smart Irrigation System with Soil Moisture Sensing and Automatic Water Pump Control

Image of Arduino UNO Based Smart Irrigation System with Soil Moisture Sensing and Automatic Water Pump Control

Smart Irrigation System Documentation

Summary

The Smart Irrigation System is designed to monitor soil moisture levels and automatically irrigate when the soil becomes too dry. The system uses an Arduino UNO microcontroller to read the soil moisture level from a Soil Moisture Sensor through a Soil Moisture Module. If the moisture level falls below a predefined threshold, the Arduino activates a 12V Single Channel Relay, which in turn powers a water pump to irrigate the soil. The system is powered by a 9V battery.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

12V Single Channel Relay

  • An electrically operated switch that allows you to control a high power circuit with a low power signal.
  • It has a normally closed (NC) and normally open (NO) contact, a common (COM) terminal, an input (IN) terminal, and a power supply (VCC) and ground (GND).

Soil Moisture Module

  • An interface board for the Soil Moisture Sensor.
  • It provides an analog output corresponding to the amount of moisture in the soil and a digital output that can be calibrated with an onboard potentiometer.

9V Battery

  • A standard 9V battery used to power the relay and the water pump.

Water Pump

  • An electric pump that moves water when powered.
  • It has two terminals: positive and negative.

Soil Moisture Sensor

  • A sensor that measures the volumetric content of water in the soil.
  • It has a power (VCC), ground (GND), and signal (SIG) terminal.

Wiring Details

Arduino UNO

  • A0 connected to Soil Moisture Module (Analog)
  • GND connected to Soil Moisture Module (Ground)
  • 3.3V connected to Soil Moisture Module (VCC)
  • 5V connected to 12V Single Channel Relay (VCC)
  • GND connected to 12V Single Channel Relay (GND)
  • D3 connected to 12V Single Channel Relay (IN)

12V Single Channel Relay

  • VCC connected to Arduino UNO (5V)
  • GND connected to Arduino UNO (GND)
  • IN connected to Arduino UNO (D3)
  • COM connected to 9V Battery (+)
  • NO connected to Water Pump (positive)

Soil Moisture Module

  • Analog connected to Arduino UNO (A0)
  • Ground connected to Arduino UNO (GND)
  • VCC connected to Arduino UNO (3.3V)
  • positive connected to Soil Moisture Sensor (VCC)
  • negative connected to Soil Moisture Sensor (GND)

9V Battery

  • (+) connected to 12V Single Channel Relay (COM)
  • (-) connected to Water Pump (negative)

Water Pump

  • positive connected to 12V Single Channel Relay (NO)
  • negative connected to 9V Battery (-)

Soil Moisture Sensor

  • VCC connected to Soil Moisture Module (positive)
  • GND connected to Soil Moisture Module (negative)
  • SIG is not connected in this configuration.

Documented Code

/*
 * Smart Irrigation System
 * This Arduino sketch reads soil moisture levels using a soil moisture sensor.
 * If the soil is too dry, it activates a relay to turn on a water pump.
 */

const int soilMoisturePin = A0; // Analog pin connected to soil moisture sensor
const int relayPin = 3;         // Digital pin connected to relay module
const int threshold = 500;      // Threshold value for soil moisture

void setup() {
  pinMode(relayPin, OUTPUT);    // Set relay pin as output
  digitalWrite(relayPin, LOW);  // Ensure relay is off initially
  Serial.begin(9600);           // Initialize serial communication
}

void loop() {
  int soilMoistureValue = analogRead(soilMoisturePin); // Read soil moisture
  Serial.print("Soil Moisture: ");
  Serial.println(soilMoistureValue); // Print soil moisture value

  if (soilMoistureValue < threshold) {
    digitalWrite(relayPin, HIGH); // Turn on water pump
  } else {
    digitalWrite(relayPin, LOW);  // Turn off water pump
  }

  delay(1000); // Wait for 1 second before next reading
}

The code is written for the Arduino UNO and is responsible for reading the soil moisture level from the sensor connected to analog pin A0. Depending on the moisture level, it controls the relay connected to digital pin D3, which in turn controls the water pump. The serial communication is used for debugging purposes to monitor the soil moisture readings.