Robotics & DIY Projects
Smart Agriculture: Automated Soil Irrigation System with Arduino
June 4, 2026
15 min read

Prevent under-watering or over-watering of plants. In this guide, we will assemble a fully automated soil watering system using an Arduino microcontroller, a moisture detector probe, and a 5V relay module to trigger a mini submersible water pump.
Introduction & Concept
The resistance of soil changes depending on moisture density. A resistive soil moisture sensor measures this change as an analog voltage level. The Arduino continuously reads the voltage. If the reading rises above a set dry threshold, indicating dry soil, the microcontroller switches a 5V relay module to turn on the water pump. Once the soil becomes moist again, the pump is shut down.
Required Electronic Components
| Component Name | Purpose | Store Link |
|---|---|---|
| Arduino Uno R3 | Microcontroller processor to track sensor values. | Buy Arduino Uno |
| Soil Moisture Sensor Module | Probes to detect volumetric water content in soil. | Buy Soil Sensor |
| 4-Channel 5V Relay Module | Acts as an electronic switch to safely power the water pump. | Buy 5V Relay Module |
Wiring Connections Diagram
+-------------+ +-------------------+
| Arduino Uno | | Soil Moist Probe |
| 5V |---------->| VCC |
| GND |---------->| GND |
| A0 |<----------| Analog Out (AO) |
| | +-------------------+
| | +-------------------+
| Pin 7 |---------->| Relay IN1 |
| 5V |---------->| Relay VCC |
| GND |---------->| Relay GND |
+-------------+ +---------+---------+
|
v
[Relay Switch Loop]
External 6V (+) ---> COM | NO ---> Pump (+)
External 6V (-) -----------------> Pump (-)
Step-by-Step Installation
- Sensor Setup: Connect the soil moisture probe to the amplifier breakout board. Insert the probe pins directly into plant soil.
- Relay Integration: Route the digital signal from Arduino Pin 7 to the Relay input. Connect the pump positive line to the Normally Open (NO) terminal and the power positive line to the Common (COM) terminal.
- Arduino Code Configuration: Upload the code below, and adjust the threshold limit according to your soil texture.
Control Code
const int sensorPin = A0;
const int relayPin = 7;
const int dryThreshold = 700; // Trigger threshold (0 is wet, 1023 is bone dry)
void setup() {
Serial.begin(9600);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Turn off pump (Active Low relay)
}
void loop() {
int sensorValue = analogRead(sensorPin);
Serial.print("Soil Moisture Value: ");
Serial.println(sensorValue);
if (sensorValue > dryThreshold) {
digitalWrite(relayPin, LOW); // Turn on water pump
} else {
digitalWrite(relayPin, HIGH); // Turn off water pump
}
delay(2000);
}