Wet! a Simple Automated Garden Watering System With Arduino UNO

by Saeed Kassim in Circuits > Arduino

1825 Views, 13 Favorites, 0 Comments

Wet! a Simple Automated Garden Watering System With Arduino UNO

Generated Image August 30, 2025 - 2_54PM.jpeg
img_5088_a0VBa29jWL.png

Water is essential for maintaining a healthy garden, and efficient watering is crucial for nurturing plants while conserving resources. This guide outlines how to create an automated garden watering system designed to optimize water usage for your plants. By incorporating sensors and pumps, this system ensures that your garden receives the perfect amount of water at the right intervals.

With this automated setup, soil moisture levels are continuously monitored, allowing you to water only when necessary. This not only fosters healthier plant growth but also significantly reduces water waste. Additionally, the system can be programmed to adjust watering schedules based on weather conditions, ensuring that your garden thrives regardless of external factors. Enjoy a flourishing garden while saving time and resources with this innovative watering solution!


Here's a breakdown of the system's core components and their functions:

1. Soil Moisture Sensor:

  1. Location: Placed in the center of the open farmland.
  2. Function: Continuously measures the water content in the soil. This data is the primary input for determining irrigation needs.

2. Watering Tank and Pump:

  1. Location: Contains water for direct irrigation of the farmland.
  2. Function: A water pump connected to this tank is activated based on predefined soil moisture thresholds. When the soil moisture level drops below a certain threshold, the pump activates to irrigate the crops.

3. Reservoir Tank and Pump:

  1. Location: A larger tank connected to the watering tank.
  2. Function: Serves as a refill source for the watering tank, ensuring a continuous supply of water.

4. Ultrasonic Sensor:

  1. Location: Inside the watering tank.
  2. Function: Monitors the water level in the watering tank. When the water level falls below a set threshold, it triggers a pump in the reservoir tank to refill the watering tank.

This system creates a closed-loop irrigation process, making farm management more efficient and sustainable. Let's get started on building it!

Supplies

Modulo Relay Rele 2 Canales Optoacoplado 24v Arduino Hobb.jpg
Soil Moisture Detection Sensor for Arduino.jpg
Arduino Uno.jpg

WIRE IT!

schematics_for_irrigation_system_JYDkaj7U2a.png

Start by carefully reviewing the schematics that have been provided. Ensure you have a comprehensive understanding of the layout and connections needed for each component.

  1. Gather all essential parts as shown in the schematics.
  2. Start wiring the components by first placing them on your breadboard or PCB layout according to the schematic. Ensure each part is in its proper spot.
  3. Use suitable wire lengths to connect each component as indicated in the schematics. Pay attention to polarity for parts like diodes and electrolytic capacitors, making sure positive and negative leads are connected correctly.
  4. Securely solder or attach wires where needed. Double-check all connections to verify they match the schematic exactly, avoiding any wiring mistakes that could cause circuit failure.
  5. As you finish each part, perform a visual check to catch potential issues early.
  6. Once all parts are wired properly, proceed to test the connections before powering the circuit to confirm everything works as expected.

BUILD IT!

img_5087_kAscVOH2pP.png

Please ensure that the components are secured according to the guidelines provided in the image shared earlier. While it's important to reference our method as a starting point, you are not required to replicate it exactly. The primary focus should be on the proper placement and securing of each component to ensure stability and functionality. Feel free to use your creativity and problem-solving skills to achieve this, as long as the end result meets the criteria of being well-organized and secure. Remember, a tidy and secure setup is vital for the overall performance, so take your time to assess the best approach before finalizing the arrangement.

PROGRAM IT!

screenshot_2022-11-05_at_12_36_03_jKhfWsV6L1.png
int moist_pin = A0; // Defines the analog pin A0 for the moisture sensor
int relay1 = 11; // Defines digital pin 11 for controlling relay1
int relay2 = 10; // Defines digital pin 10 for controlling relay2
int trigpin = 13; // Defines digital pin 13 for the trigger pin of an ultrasonic sensor
int echopin = 12; // Defines digital pin 12 for the echo pin of an ultrasonic sensor
int led1 = 9; // Defines digital pin 9 for controlling an LED
long distance, duration; // Declares two long variables to store distance and duration for ultrasonic sensor calculations

void setup() { // Setup function runs once when the Arduino starts
// put your setup code here, to run once:
Serial.begin(9600); // Initializes serial communication at 9600 baud rate for debugging/output
pinMode(led1, OUTPUT); // Sets the LED pin (9) as an output
pinMode(relay1, OUTPUT); // Sets relay1 pin (11) as an output
pinMode(relay2, OUTPUT); // Sets relay2 pin (10) as an output
pinMode(moist_pin, INPUT); // Sets the moisture sensor pin (A0) as an input
pinMode(trigpin, OUTPUT); // Sets the ultrasonic sensor trigger pin (13) as an output
pinMode(echopin, INPUT); // Sets the ultrasonic sensor echo pin (12) as an input
}

void loop() { // Loop function runs repeatedly after setup
// put your main code here, to run repeatedly:
digitalWrite(trigpin, LOW); // Sets the trigger pin LOW to ensure a clean pulse
delayMicroseconds(10); // Waits 10 microseconds to stabilize the LOW state
digitalWrite(trigpin, HIGH); // Sets the trigger pin HIGH to send an ultrasonic pulse
delayMicroseconds(12); // Waits 12 microseconds to maintain the HIGH pulse
digitalWrite(trigpin, LOW); // Sets the trigger pin LOW to end the pulse
delayMicroseconds(10); // Waits 10 microseconds before reading the echo

duration = pulseIn(echopin, HIGH); // Measures the time (in microseconds) the echo pin is HIGH
distance = ((duration / 2) * 0.034); // Calculates distance in cm (duration/2 * speed of sound in cm/µs)

int moist = analogRead(moist_pin); // Reads the analog value from the moisture sensor (0-1023)

Serial.print("water level is "); // Prints "water level is " to the Serial Monitor
Serial.print(distance); // Prints the calculated distance value
Serial.print(" "); // Prints a space for formatting
Serial.print("moisture is "); // Prints "moisture is " to the Serial Monitor
Serial.println(moist); // Prints the moisture value and moves to a new line
delay(200); // Waits 200 milliseconds before the next loop iteration

if (moist >= 0 && moist <= 300) { // Checks if moisture value is between 0 and 300 (likely indicating low moisture)
digitalWrite(relay1, HIGH); // Turns relay1 ON (e.g., to activate a pump or device)
} else { // If moisture is outside the 0-300 range
digitalWrite(relay1, LOW); // Turns relay1 OFF
}

if (distance >= 5 && distance <= 11) { // Checks if distance is between 5 and 11 cm (specific water level range)
digitalWrite(relay2, LOW); // Turns relay2 OFF
digitalWrite(led1, HIGH); // Turns the LED ON (indicating water level condition met)
} else { // If distance is outside the 5-11 cm range
digitalWrite(relay2, HIGH); // Turns relay2 ON
digitalWrite(led1, LOW); // Turns the LED OFF
}
}

SCALE IT AND USE IT!

F84FJMPMEU9ZLFD.png
FPBZNCYMEU9ZLFV.png

After successfully constructing the project and confirming that it operates effectively, you are ready to embark on exciting small-scale home agriculture endeavors. This innovative system will enhance your gardening experience, allowing you to cultivate a variety of plants with ease and efficiency.