Smart Plant Watering System

Smart Plant Watering System with Arduino

This tutorial will guide you through building a smart plant watering system using an Arduino. The system uses a soil moisture sensor to detect soil dryness and automatically turns on a water pump when necessary.

Components Required

System Overview

The smart plant watering system works by constantly monitoring the moisture level in the soil using a soil moisture sensor. If the soil is too dry, the system will activate the water pump via a relay, watering the plant automatically. Once the desired moisture level is reached, the pump turns off.

Wiring the Components

Follow these steps to set up the system:

Arduino Code

Here’s the Arduino code to monitor the soil moisture level and control the pump:


const int moisturePin = A0;        // Pin connected to the soil moisture sensor
const int relayPin = 7;            // Pin connected to the relay module
int moistureLevel = 0;             // Variable to store the moisture level
const int threshold = 500;         // Moisture level threshold to activate the pump

void setup() {
  pinMode(relayPin, OUTPUT);       // Set relay pin as output
  digitalWrite(relayPin, HIGH);    // Initially keep the pump off
  Serial.begin(9600);              // Start serial communication for monitoring
}

void loop() {
  moistureLevel = analogRead(moisturePin);  // Read moisture level from sensor
  Serial.print("Moisture Level: ");
  Serial.println(moistureLevel);            // Print the moisture level to serial monitor

  if (moistureLevel < threshold) {          // If soil is too dry
    digitalWrite(relayPin, LOW);            // Activate the pump (turn on relay)
    Serial.println("Watering the plant...");
  } else {
    digitalWrite(relayPin, HIGH);           // Deactivate the pump (turn off relay)
    Serial.println("Soil moisture is sufficient.");
  }
  delay(1000);                             // Wait for 1 second before taking the next reading
}
            

Code Explanation

Upload and Test

  1. Upload the code to your Arduino.
  2. Monitor the serial output to check the current moisture level.
  3. If the soil is dry (below the threshold), the pump will turn on automatically. It will stop once the soil reaches a sufficient moisture level.

Expansion Ideas

Here are a few ideas to expand your smart plant watering system:

Conclusion

You have successfully built a smart plant watering system! This can be expanded by adding features like a water level sensor, a display showing moisture levels, or remote control via Wi-Fi using an ESP8266. Such systems can make gardening easier and help ensure that your plants receive the proper care even when you're not around.