Day 01

Begineer

Day 19 :- Automatic Plant Watering System

Aug 27, 2026

Completed

Wiring Schematic

Arduino Code

ARDUINO / C++

Day 19 Core Training Documentation

Project Overview

The Automatic Plant Watering System project teaches you one of the most practical applications of embedded systems: creating an automated solution for plant care using sensor-based intelligence.

In this project, a soil moisture sensor continuously monitors the moisture level in plant soil. When the soil becomes dry, the Arduino automatically activates a water pump to water the plant. Once moisture reaches acceptable levels, the pump stops automatically, preventing overwatering.

When the soil is sufficiently moist, the pump remains off, conserving water. As the soil dries out, the moisture sensor reading drops below the threshold. The Arduino instantly detects this and activates the pump, providing water until the soil reaches optimal moisture again.

This project teaches Soil Moisture Sensing, Analog Sensor Calibration, Automated Pump Control, Threshold-Based Decision Making, and Smart Resource Management.

By finishing this project, you’ll understand how automated watering systems work in smart gardens, agricultural automation, and intelligent plant care applications.

Components Required

To build this circuit, collect these specific items from your kit:

Arduino Uno × 1, Breadboard × 1, Soil Moisture Sensor × 1, Water Pump Module × 1, Relay Module × 1, 10kΩ Resistor × 1, Jumper Wires × 6, USB Cable × 1, Water Container × 1

Circuit Connections

Step 1: Connect Ground Rail

Connect the Arduino GND pin to the negative rail of the breadboard. This creates a shared ground connection for all components.

Step 2: Connect Soil Moisture Sensor VCC

Connect the VCC (power) pin of the soil moisture sensor to Arduino 5V. This provides power to the soil moisture detection module.

Step 3: Connect Soil Moisture Sensor GND

Connect the GND (ground) pin of the soil moisture sensor to the breadboard GND rail. This completes the power circuit for the sensor.

Step 4: Connect Soil Moisture Sensor Output

Connect the AO (analog output) pin of the soil moisture sensor to Arduino Pin A0. This analog pin receives the moisture level readings.

Step 5: Connect Moisture Sensor Pull-Up Resistor

Connect one end of the 10kΩ resistor to Arduino Pin A0 and the other end to Arduino 5V. This pull-up resistor stabilizes the analog signal from the sensor.

Step 6: Connect Relay Module VCC

Connect the VCC pin of the Relay Module to Arduino 5V. This provides power to activate the relay electromagnet.

Step 7: Connect Relay Module GND

Connect the GND pin of the Relay Module to the breadboard GND rail. This completes the relay power circuit.

Step 8: Connect Relay Module Input

Connect the IN (input signal) pin of the Relay Module to Arduino Pin 9. This pin controls when the relay activates or deactivates.

Step 9: Connect Pump to Relay Output

Connect the pump module to the relay’s normally open (NO) and common (COM) terminals. The relay will control power to the pump.

Step 10: Verify All Connections

Check all sensor, relay, and pump connections before uploading your code. Ensure the water container is filled and the pump tube is positioned correctly in the soil.

Important: The HC-SR04 sensor measures distance using ultrasonic sound waves. The TRIG pin sends the pulse and the ECHO pin receives it back, allowing Arduino to calculate distance accurately.

How the Arduino Code Works

Initialize System

In setup(), Arduino sets Pin 9 as OUTPUT to control the relay. Pin A0 is configured for analog input to read moisture levels. The Serial Monitor starts at 9600 baud for debugging and monitoring.

Read Moisture Level

Arduino continuously reads the analog moisture sensor using analogRead(A0). The reading ranges from 0 to 1023, where higher values indicate wetter soil and lower values indicate drier soil.

Compare Against Threshold

The moisture reading is compared against a predefined threshold value. If the reading falls below the threshold, the soil is considered dry and watering is needed. If above the threshold, soil moisture is adequate.

Control Relay and Pump

When moisture is below threshold, Arduino sets Pin 9 HIGH, activating the relay and turning on the pump. When moisture rises above threshold, Pin 9 goes LOW, deactivating the relay and stopping the pump.
 

Display System Status

The current moisture level and pump status are printed to the Serial Monitor. This allows users to monitor the system operation and adjust the moisture threshold if needed.

Expected Output

After uploading your code, here is what happens.

The Serial Monitor displays the current soil moisture reading. When soil is moist, the reading shows high values and the pump remains off. As soil dries out, the reading decreases. When the reading drops below your set threshold, the relay clicks and the pump activates. Water flows from the pump into the soil. As soil becomes moist again, the moisture reading increases. When the reading rises above the threshold, the relay clicks again and the pump stops. The system continuously monitors and adjusts, maintaining optimal soil moisture automatically.

Operational Troubleshooting

Pump Does Not Turn On :- Verify that Pin 9 connects correctly to the relay IN pin. Check that the Relay Module receives proper 5V power. Confirm the soil moisture reading is below your threshold value in the Serial Monitor.

Pump Runs Continuously :- Adjust the moisture threshold value in your code to a higher value. Ensure the soil moisture sensor is properly inserted into the soil and making good contact.

Moisture Readings Do Not Change :- Check that the sensor is making direct contact with soil. Ensure the sensor is not blocked or disconnected. Verify the A0 pin connection is secure.

Relay Clicks But Pump Does Not Work :- Check the pump power connections at the relay terminals. Verify the pump is receiving proper voltage from the relay output. Inspect the pump for blockages or mechanical damage.

Water Overflows From Container :- Reduce the moisture threshold to stop watering sooner. Check that the pump tube is properly positioned and not causing water overflow.

What You Learned

By finishing this project, you now know :-

How soil moisture sensors work and provide analog readings, how to use relays to control high-power devices safely, how to create threshold-based automation systems, how to design smart resource management applications, and how to build practical systems that solve real-world problems.

Next Lesson

In Day 20, you’ll learn how to create an Automatic Light Control System using an LDR sensor to turn lights on at night and off during the day automatically.