Introduction

Having plants in your home or office can brighten up the space and improve air quality. However, remembering to water all your plants regularly can be a chore. An automated plant watering system takes care of watering your plants for you, ensuring they get just the right amount of water on schedule.

In this guide, I will show you how to build a simple automated plant watering system using an Arduino microcontroller, a water pump, soil moisture sensors, and other inexpensive electronic components. This system can be built for well under $100, making it an affordable option compared to commercial systems.

Benefits of an Automated Plant Watering System

There are several benefits to using an automated system rather than watering your plants manually:

Parts Needed

The main components I used for this project are:

Optional components include a real time clock module or shield to keep the time and a relay module for controlling a higher voltage pump.

How the System Works

The automated plant watering system uses soil moisture sensors placed in the pots of each plant to detect when the soil becomes dry. The sensors communicate this data to the Arduino.

Based on the moisture threshold set in the Arduino code, the Arduino will turn on the water pump when the soil becomes dry enough. Water flows from the reservoir through tubing to the plant pot, hydrating the soil.

Once the sensors detect the soil has reached the desired moisture level, the water pump will turn off again. This cycle repeats each time the soil dries out.

The system can be programmed to water on a schedule by using a real time clock module. For example, the Arduino could be set to check the sensors and water if needed every 12 hours.

Assembly Step-by-Step

Follow these steps to assemble your own automated plant watering system:

1. Install Arduino libraries

The Arduino will need the following libraries to interact with the system's components:

Install these through the Arduino IDE Library Manager.

2. Connect moisture sensors

I used 2 moisture sensors in my system, one for each plant. The sensors have 3 pins: 5V power, ground, and data.

Connect the power pins to Arduino 5V and ground pins. Connect the data pins to any analog input pins on the Arduino.

3. Connect water pump

I powered the small 5V water pump directly from the Arduino's 5V power and ground pins.

Use male-to-female jumper wires to connect the pump's red wire to 5V and black wire to ground.

Caution: If using a larger pump, power it from an external power supply and use a relay module to control it with the Arduino.

4. Assemble components on breadboard

Place the Arduino, moisture sensors, and any other components on a breadboard to connect them.

Use jumper wires to connect the sensors, pump, Arduino power, and any other components as needed.

5. Program the Arduino

Upload the program code to the Arduino through the Arduino IDE. I have provided code samples below to use as a starting point.

The code will continually check soil moisture levels and activate the pump when needed. Adjust moisture thresholds and timing as needed.

6. Add water tubing and reservoir

Cut plastic tubing to length and connect one end to the water pump discharge using fittings. Place the opposite end in the plant pot.

Fill reservoir with water supply and submerge the pump intake. The system is now ready for operation!

Arduino Code Examples

Here are some code examples for controlling the system with Arduino:

This simple example turns the pump on for 5 seconds if the moisture level drops below a threshold:

```c
const int sensorPin = A0; // Soil sensor connected to analog pin A0
const int pumpPin = 8; // Water pump connected to pin 8

void setup() {

pinMode(pumpPin, OUTPUT); // Set pump pin as output

}

void loop() {

int moisture = analogRead(sensorPin); // Read moisture sensor

if(moisture < 350) { // If dryer than threshold

digitalWrite(pumpPin, HIGH); // Turn pump on
delay(5000); // Wait 5 seconds
digitalWrite(pumpPin, LOW); // Turn pump off

}

delay(1000); // Wait 1 second between checks

}
```

For a system with multiple plants, use an array to store multiple sensor values:

```c
const int sensorPins[] = {A0, A1}; // Sensors on pins A0 and A1

void loop() {

for(int i=0; i < 2; i++) { // Loop through sensor array

int moisture = analogRead(sensorPins[i]);

if(moisture < 350) {
  // Turn pump on
  // Wait
  // Turn pump off 
}

}

}
```

Conclusion

Building an automated Arduino-based system is an easy and affordable way to ensure your plants get the water they need while you are away. Customize the sensors, timing, and components to fit your home and plants' needs. This is just one example of the many useful IoT and automation projects that can be created using Arduino!