Fall ResetAmazon USFall reset deals: check better picks before checkoutAmazon US: today's deals, useful picks and quick comparisons.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowFall ResetAmazon USWork and home upgrades are worth comparing todayAmazon US: today's deals, useful picks and quick comparisons.See Picks×
Skip to content
Blog

Automatic Plant Watering Project Using Arduino: Smart Irrigation Build

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Build a safer Arduino smart-irrigation system that waters a potted plant only when its soil is dry. The finished project reads soil moisture, controls a low-voltage DC pump through a MOSFET or transistor, delivers water through tubing, monitors the reservoir, and locks out the pump when the tank is empty.

This guide focuses on a single indoor plant. Use low-voltage DC hardware only; never connect a mains-powered pump directly to an Arduino, breadboard, or exposed hobby wiring.

How the Arduino watering system works

The project follows a simple input–processing–output loop. A soil-moisture sensor provides the input, the Arduino compares the reading with calibrated limits, and a switching circuit controls the pump. An optional ultrasonic sensor measures the distance to the reservoir’s water surface, while an LCD or buzzer reports status.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Soil sensor ──> Arduino ──> MOSFET/transistor ──> DC pump ──> tubing ──> plant
                         └──> LCD or buzzer
Reservoir ──> ultrasonic level sensor ──> Arduino
  1. Power the moisture sensor briefly.
  2. Take several readings and average them.
  3. Compare the result with the plant’s calibrated dry threshold.
  4. If the soil is dry and the reservoir contains water, start the pump.
  5. Run the pump for a short, limited pulse.
  6. Stop the pump and wait for water to soak through the pot.
  7. Measure again, repeating only within a defined safety limit.

This is better than running a pump continuously until the sensor changes. Water needs time to move through soil, and a failed sensor, blocked tube, or empty reservoir could otherwise leave the pump running.

#1 Best Overall
GeeekPi Plant Watering Kit for Arduino UNO R4 WiFi, Tutorials for Programming
  • The Plant Watering Kit for Arduino UNO R4 WiFi, an all-in-one solution for enthusiasts and makers looking to delve into the world of smart gardening and IoT projects.
  • This kit is designed to provide a hands-on experience with a range of electronic components and sensors, enabling you to create a fully automated plant watering system.
  • With UNO R4 WiFi Board, it features WiFi capabilities for IoT integration.
  • Sensors and Modules equip your project with the ability to monitor and react to environmental conditions with soil moisture sensors, a temperature sensor, and water pumps.
  • 1.3-inch TFT Color Display visualizes data and controls interfaces with a vibrant color screen.

Parts required

Essential parts

  • Arduino Uno-compatible board
  • Soil-moisture sensor
  • Small low-voltage DC submersible or peristaltic pump
  • Tubing that fits the pump outlet
  • Logic-level N-channel MOSFET or suitable transistor driver
  • Flyback diode rated for the pump current
  • Gate/base resistor and gate pulldown where appropriate
  • Separate, correctly rated pump power supply
  • Breadboard or prototype board, jumper wires, and USB cable
  • Water reservoir and plant pot

Useful additions

  • Ultrasonic distance sensor for continuous reservoir-level estimation
  • Float switch for simple low-water protection
  • 16×2 or 20×4 I²C LCD
  • Buzzer or warning LED
  • Capacitive moisture sensor for longer-term installations
  • Enclosure, cable glands, and strain relief

A classroom version can use a resistive probe, but a capacitive sensor is generally the better choice for a system intended to operate unattended for weeks or months. Resistive probes measure conductivity rather than water content directly; salts, fertilizer, soil type, corrosion, and probe placement can change their readings. Science Buddies recommends intermittent sensor powering to reduce oxidation of resistive probes.

Electrical design and wiring

The Arduino pin controls the switching device; it does not power the pump. A motor can draw far more current than an I/O pin can safely provide, and its inductive voltage spike can reset or damage the controller.

External pump supply positive ──> pump positive
Pump negative ──> MOSFET drain/collector
MOSFET source/emitter ──> pump-supply ground
Arduino output ──> MOSFET gate/base through resistor
Flyback diode ──> across pump terminals
Arduino ground ──> pump-supply ground

Install the diode reverse-biased during normal operation: its cathode goes toward the pump’s positive terminal and its anode toward the switched negative terminal. Confirm the MOSFET’s voltage and current ratings, the pump’s rated voltage, and the supply’s current capacity before connecting power.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
AEDIKO Upgrade Automatic Irrigation DIY Kit Self Watering System with Capacitive Soil Moisture Sensor 5V Relay Module and Water Pump + 50cm Silicone Tubing for Garden Plant Flower Watering DIY
  • Automatic Irrigation DIY Kit: LM393 Soil Moisture Detect Sensor,Mini Water Pump, Tubing, Battery Case,One Channel 5V Relay Module and Jumper Wires in One Plant Watering System, It Can Water Plants and Flowers Automatically ,According to Monitor the Soil Moisture
  • LM393 Soil Moisture Detect Sensor: Used LM393 Chip and Stabilizes. Operating Voltage: 3.3V to 5V; PCB Size: 32mm x 14mm/ 1.26 inch x 0.55 inch; Equipped with a Fixed Bolt Hole that is Easy to Install
  • 1 Channel 5V Relay Module: Maximum Load: AC 250V/10A, DC 30V/10A; Operating Voltage 12V; Power Indicator (Green), Relay Status Indicator (Red)
  • Mini Water Pump: Rated Voltage: DC 3V or 4.5V; No Load of Water Discharge Capacity: 100L / H ; Load Rated Current: 0.18A; Use: Diving Type
  • Wide Application: This Submersible Pump Can be Used for Small Size Aquarium, Fish Tank, Pond, Tabletop Fountains, Water Gardens and Hydroponic Systems

A relay module can switch a separately powered load and may be useful where isolation is important, but a correctly selected MOSFET is usually quieter and more efficient for a small DC pump. Science Buddies uses a MOSFET, while the referenced Hackster design lists a transistor or optional relay.

Suggested Arduino pin allocation

Function Example connection
Moisture sensor analog output A0
Pump driver control D7
Ultrasonic trigger D9
Ultrasonic echo D10
I²C LCD Board-specific SDA and SCL pins
Optional sensor power Digital output
Optional buzzer Unused digital output

These are example assignments, not fixed requirements. The Hackster sample uses A0 for moisture, D7 for the pump, and pins 9 and 10 for the ultrasonic sensor. Its sample threshold of 600 is specific to that setup and must not be treated as a universal value.

Calibrate the moisture sensor before watering

Calibration matters more than copying a threshold from someone else’s sketch. The raw analog value depends on the sensor, Arduino board, soil composition, fertilizer concentration, probe depth, temperature, and sensor age.

Rank #3
LK COKOINO Educational Kit for Arduino UNO, Timed Plant Watering System with Timer Alarm & Multiple Sensors, Arduino Coding,STEM Learning DIY Electronics Project Kit for 15+ Teens and Adults
  • 1. All-in-One Arduino Integrated Kit, Combining Education and Practicality: Based on Arduino development, it integrates learning and daily use. It is not only a professional educational learning kit but also a practical daily tool, meeting dual needs of learning and use, suitable for users aged 15 and above to operate.
  • 2. Abundant Educational Resources, Easy for Beginners: Equipped with sufficient supporting courses and code resources, users can master the theory of electronic modules, improve practical operation skills, exercise logical thinking and enhance programming proficiency through hands-on practice, without the need to find additional learning materials.
  • 3. Dual-Function in One, High Practicality: It can be used as an ordinary alarm clock for daily use, or you can build an automatic watering system according to the tutorials to realize regular watering of plants, solving the trouble of plants lacking water when you are busy or away from home, making it more worry-free with one item for two uses.
  • 4. Complete Full Set of Accessories, Ready to Install and Use: Standard configuration includes a 5-meter black hose, 3 sprinkler drippers and a high-flow water pump, supporting watering up to 3 plants at the same time; equipped with a dedicated power adapter, no need to purchase additional accessories, ensuring long-term power supply.
  • 5. Stable and Durable, Worry-Free for Long-Term Use: The whole kit operates stably, with reliable performance, durable material and long service life. Whether it is used for learning and practical operation or daily plant watering, it can play a stable role for a long time.
  1. Place the sensor at the depth and position where it will remain.
  2. Record several readings in dry soil.
  3. Remove, clean, and reposition the sensor consistently, then repeat the dry readings at least three times.
  4. Water the soil gradually until it is thoroughly wet, without leaving the sensor submerged.
  5. Repeat the measurements in wet soil.
  6. Average the dry and wet readings.
  7. Choose a watering-start threshold between those measured limits.
  8. Observe the plant for several days and adjust the threshold according to the plant and soil.

Use two thresholds rather than one. This hysteresis prevents the pump from rapidly switching when the reading fluctuates near the boundary:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
if (!pumpRunning && moisture < dryThreshold) {
  startPump();
}

if (pumpRunning && moisture > wetThreshold) {
  stopPump();
}

Do not label an uncalibrated raw value as a moisture percentage. A reading such as 600 only has meaning for the particular sensor, soil, wiring, and calibration used.

Example Arduino control sketch

This example uses averaged readings, intermittent sensor power, hysteresis, timed pump pulses, a soak delay, and a maximum runtime. Replace the calibration values after measuring your own soil. The code assumes that a higher analog value represents drier soil; reverse the comparisons if your sensor behaves differently.

Rank #4
WayinTop Upgrade Automatic Irrigation DIY Kit Self Watering System for Garden Plant, Development Board + 4pcs Soil Moisture Sensor + 4 Channel Relay + 4pcs Water Pump + 5M Vinyl Tubing + Jumper Wire
  • 【Upgraded Automatic Watering System】Combine development board with USB download cable, water pump, tubing, soil moisture sensor, 4 channel 5V relay module and jumper wires in one plant watering system, including all component for a whole for Arduino DIY drip irrigating system.
  • 【Take Care of Your 4 Plants Anytime】You can have the system to water your 4 plant automatically. Whenever your soil becomes too dry, the pump is set into motion and water flows up the tube and into the pot. You don’t have to worry about your plants while going for vacations.
  • 【Development Board】The board comes preprogrammed with a bootloader that allows you to upload new code to it without the use of an external hardware programmer.
  • 【Capacitive Sensor】Insert it in to the soil around your plants and With a screen and a motherboard, you can talk to your plants. To see if your plants is thirsty, do they need more water to moisten it?
  • 【Reliable Support】We have prepared detailed automatic self watering tutorial, includes: guidance manual, demo code, burning tools, necessary class libraries.(All of these are in E-format. You can contact us on Amazon, we will send PDF Document to you at any time.)
const byte MOISTURE_PIN = A0;
const byte SENSOR_POWER_PIN = 6;
const byte PUMP_PIN = 7;
const byte LOW_WATER_PIN = 8; // LOW means tank empty in this example

const int DRY_THRESHOLD = 650;  // Calibrate for your soil
const int WET_THRESHOLD = 520;  // Must be different from dry threshold
const unsigned long PUMP_PULSE_MS = 1200;
const unsigned long SOAK_DELAY_MS = 30000;
const unsigned long MAX_RUNTIME_MS = 6000;

void setup() {
  Serial.begin(9600);
  pinMode(SENSOR_POWER_PIN, OUTPUT);
  pinMode(PUMP_PIN, OUTPUT);
  pinMode(LOW_WATER_PIN, INPUT_PULLUP);
  digitalWrite(PUMP_PIN, LOW);
}

int readMoisture() {
  digitalWrite(SENSOR_POWER_PIN, HIGH);
  delay(50);

  long total = 0;
  for (byte i = 0; i < 8; i++) {
    total += analogRead(MOISTURE_PIN);
    delay(5);
  }

  digitalWrite(SENSOR_POWER_PIN, LOW);
  return total / 8;
}

bool reservoirHasWater() {
  return digitalRead(LOW_WATER_PIN) == HIGH;
}

void runPumpPulse() {
  unsigned long start = millis();
  digitalWrite(PUMP_PIN, HIGH);

  while (millis() - start < PUMP_PULSE_MS &&
         millis() - start < MAX_RUNTIME_MS) {
    if (!reservoirHasWater()) break;
  }

  digitalWrite(PUMP_PIN, LOW);
}

void loop() {
  int moisture = readMoisture();
  Serial.print("Moisture raw: ");
  Serial.println(moisture);

  if (moisture > DRY_THRESHOLD) {
    if (!reservoirHasWater()) {
      Serial.println("Low water: pump locked out");
    } else {
      Serial.println("Dry soil: watering pulse");
      runPumpPulse();
      delay(SOAK_DELAY_MS);
    }
  } else if (moisture < WET_THRESHOLD) {
    Serial.println("Soil is adequately wet");
  } else {
    Serial.println("Soil is in the hysteresis band");
  }

  delay(5000);
}

For a production installation, replace blocking delays with a non-blocking state machine, add a maximum number of pulses per hour or day, and include an explicit sensor-disconnection test. A disconnected analog sensor can otherwise produce a misleading value.

Build and test sequence

  1. Read the sensor first. Upload a small sketch that prints raw A0 readings. Confirm that the value changes when the sensor moves between dry and wet soil.
  2. Test the driver without water. Check that the MOSFET or transistor switches correctly and that the Arduino remains stable.
  3. Connect the pump supply. Keep the pump on its external supply, connect grounds as shown, and verify the flyback diode orientation.
  4. Test water delivery manually. Check that the tubing is not kinked, the pump is primed if required, and the outlet reaches the soil securely.
  5. Add the low-water lockout. Test the empty-tank condition before allowing automatic operation.
  6. Add the ultrasonic sensor and display. Mount the ultrasonic sensor above the reservoir, facing downward and away from splash.
  7. Run a dry-plant test. Confirm that one pulse starts, the pump stops, and the system waits before reading again.
  8. Observe the plant for several days. Check the soil at multiple depths and adjust pulse duration, soak delay, and thresholds.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Monitoring the reservoir

An ultrasonic sensor measures distance to the water surface, not water volume directly. Mount it above the reservoir, measure the distance when the tank is full and empty, and convert the measured distance to a percentage only after accounting for the reservoir’s shape.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the sensor away from pump splash, tubing, condensation, and angled surfaces. Add averaging or median filtering if the reading jumps. A float switch is simpler and often more dependable when the only requirement is “stop the pump before the tank is empty.” The target project combines an ultrasonic sensor with an LCD for reservoir information; an optional buzzer can warn when the tank is low. See the referenced smart-irrigation project.

Best Value
ALMOCN Automatic Irrigation DIY Kit, 4Pcs Capacitive Soil Moisture Sensor+4Pcs 1Channel 5V Relay Module + 4Pcs Water Pump + 4Pcs 1M Vinyl Tubing for Arduino Moisture Detection Garden Watering
  • Automatic Watering System:Combine Pump, Tubing, Soil Moisture Sensor and 1 Channel 5V Relay Module in one plant watering system, it automatically waters your plants and flowers according to monitor the soil moisture in a very efficient way.
  • 4Pcs Capacitive Sensor:Operating voltage: 3.3 ~ 5.5 VDC; Output voltage: 0 ~ 3.0 VDC; Interface: PH2.54-3P; Pin: Analog signal output, GND, VCC.
  • 4Pcs 1 Channel 5V Relay Module:Maximum load: AC 250V/10A, DC 30V/10A;Operating voltage 12V;the power indicator (green), the relay status indicator (red).
  • 4Pcs Mini Water Pump: Rated voltage: DC3V or 4.5V; No load of water discharge capacity: 100L / H ; Load rated current: 0.18A, Use: diving type
  • 4Pcs 1M Vinyl Tubing: Material: PVC ; ID Size: 0.22"/5.54mm; ODSize: 0.32"/8.20mm ; Length:1M

A useful display might show:

Soil: DRY   Pump: ON
Tank: 72%   Pulses: 1

Also consider showing the raw sensor value, pump state, low-water warning, last watering time, and an implausible-reading or sensor-fault message.

Troubleshooting

Symptom Likely cause Fix
Pump never starts Wrong threshold, driver wiring error, or missing common ground Print raw readings and check the complete driver circuit
Pump always runs Disconnected sensor, reversed comparison, or incorrect active level Test the sensor separately and verify the threshold direction
Arduino resets when pumping Supply sag or motor noise Use a separate correctly rated pump supply, common ground, diode, and appropriate decoupling
Soil remains dry Kinked tube, weak pump, excessive height, or misplaced sensor Test flow into a container and reposition the outlet and sensor
Soil becomes too wet Pulse too long, no soak delay, or threshold incorrectly chosen Shorten pulses, increase the soak delay, and recalibrate
Ultrasonic reading is unstable Splash, angled surface, or poor mounting Improve mounting and filtering, or use a float switch
Sensor readings drift Resistive corrosion, salt buildup, or changed probe position Power intermittently, clean or replace the probe, or use a capacitive sensor

Improvements for a more reliable installation

  • Use capacitive sensors for long-term operation.
  • Give each plant or irrigation zone its own calibrated thresholds.
  • Add a float switch even when an ultrasonic sensor provides the display.
  • Add a flow sensor to detect a blocked tube or failed pump.
  • Record watering events with an RTC module.
  • Use an ESP32 for Wi-Fi notifications, understanding that this becomes an IoT version rather than a basic Uno project.
  • Enclose the electronics and provide waterproof cable entry, drainage, and strain relief.
  • Use a regulated supply and keep water physically separated from the controller.

Important limitations

This system reduces the risk of unnecessary watering compared with a fixed timer when it is calibrated correctly; it does not guarantee water savings or prevent overwatering in every situation. A sensor can be misplaced, a tube can clog, soil can drain poorly, or a pump can fail.

Different plants require different moisture ranges. Cacti, succulents, tropical plants, herbs, and seedlings should not automatically share one threshold. Light, temperature, season, airflow, pot size, soil composition, and fertilizer concentration also affect watering needs. The controller does not diagnose plant health or measure exact water consumption unless a flow sensor is added.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a component checklist, the Robocraze project page lists a board, sensor, pump, power source, display, reservoir, and pot. Product stock and prices vary by region and date; choose a pump and supply by verified voltage and current ratings rather than by a diagram alone.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.