How to Build a DIY Automatic Plant Watering System With Arduino


An automatic plant watering system can help keep your plants healthy and thriving when you are away from home. In this guide, I will walk you through how to build a simple DIY automatic plant watering system using an Arduino microcontroller. This project is perfect for beginners looking to get started with Arduino and electronics projects.

Overview of the System

The automatic plant watering system consists of a few key components:

The system works by continuously checking the moisture level of the soil using the sensor. When the soil gets too dry, the Arduino turns on the water pump to pump water into the soil until the desired moisture level is reached again.

Step-by-Step Building Instructions

Supplies Needed

1. Set up the Soil Moisture Sensor

The soil moisture sensor has two exposed probes that detect moisture. Insert the probes into the soil of your plant. Try to bury it a few inches down.

Connect the sensor to your Arduino using the breadboard and jumper wires. Connect the power to 5V and ground to GND. Connect the signal pin to Analog 0.

2. Connect the Water Pump

Using more jumper wires, connect the 9V water pump to the Arduino. Power the pump from the 9V battery by connecting the red wire to the positive side and black wire to ground.

Connect the pump control pin to Digital Pin 8 on the Arduino. This will allow us to turn the pump on and off in the code.

3. Add Tubing to Pump Water

Cut a length of plastic tubing and attach one end to the water pump outlet. Place the other end of the tubing into your plant's soil near the moisture sensor. The pump will push water through the tube when activated.

You can place the pump in a water reservoir like a bucket or plant saucer to pull water from. The end of the tube should be fully submerged.

4. Upload the Arduino Code

With all the hardware connected, it's time to load the code onto the Arduino. This code continually reads the moisture sensor and turns the pump on when needed.

const int sensorPin = A0; // Soil Sensor pin
const int pumpPin = 8; // Water Pump pin
const int threshold = 850; // Moisture threshold for the soil

void setup() {

pinMode(pumpPin, OUTPUT);


void loop() {

int moisture = analogRead(sensorPin);

Serial.print("Moisture: ");

if(moisture < threshold){
digitalWrite(pumpPin, HIGH);
digitalWrite(pumpPin, LOW);



Upload this code to your Arduino IDE. You may need to adjust the threshold variable depending on your soil and sensor. Lower values make the pump turn on more frequently.

5. Run and Test the System

Once uploaded, your automatic plant watering system should be ready! The Arduino will read the moisture sensor and print the values to the Serial Monitor in the IDE.

Monitor the moisture values and make sure the pump turns on when the soil gets dry. You can adjust the threshold as needed to better control the moisture range.

Add more tubing splitters to water multiple plants at once. Just make sure the water pump can handle the extra load.

Tips for Improving the System

Here are some ways to take this project to the next level:


Building your own automatic plant watering system is a fun electronics project that also solves a practical problem. This Arduino-based design provides a simple way to keep plants watered on a schedule with minimal effort.

With the basics down, there are many ways to upgrade and expand the system to perfectly fit your needs. Automatic plant watering is also a great way to get introduced to IoT and smart gardening concepts.

Let me know if you have any other questions! I'm happy to help explain any part of this DIY Arduino project in more detail.