Plant watering system

 Plant watering system




To create a simple plant watering system using Arduino, you'll need a few components, including a moisture sensor to detect the soil's moisture level, a water pump to supply water, and an Arduino to control the system.

Components:

  • Arduino Uno (or any other compatible board)
  • Soil moisture sensor
  • Relay module (for controlling the water pump)
  • 5V submersible water pump
  • Jumper wires
  • External power supply for the pump
  • Breadboard
  • Optional: LED for indicating system status

Circuit Diagram:

       +-------------------+
       |    Arduino Uno    |
       +-------------------+
           |     |     | 
           |     |     |
         VCC    GND   A0 (Analog Pin)
           |     |      |
           |     |      |
  +--------------------------+
  |  Soil Moisture Sensor    |
  |    (Analog Output)       |
  +--------------------------+
             |
           VCC
             |
           GND
             |
        +------------+
        | Relay Module|
        +------------+
             | 
             |
       +-------------+  
       | Water Pump  |  
       | (5V Submersible) |
       +-------------+

Steps:

  1. Soil Moisture Sensor: It detects the moisture in the soil. It sends an analog signal to the Arduino. The sensor has two main parts: a probe that goes into the soil and a module that connects to the Arduino.
  2. Relay Module: It acts as a switch. When the moisture level is low, the Arduino will trigger the relay, turning on the water pump.
  3. Water Pump: The pump supplies water when triggered by the relay.
Arduino Code:

// Pin assignments
int moisturePin = A0;  // Moisture sensor connected to analog pin A0
int relayPin = 7;      // Relay connected to digital pin 7
int moistureLevel;     // Variable to store moisture sensor reading
int moistureThreshold = 400;  // Threshold below which watering is needed

void setup() {
  pinMode(relayPin, OUTPUT);  // Set relay pin as output
  Serial.begin(9600);         // Start serial communication
}

void loop() {
  // Read moisture level from the sensor
  moistureLevel = analogRead(moisturePin);

  // Print moisture level to the Serial Monitor
  Serial.print("Soil Moisture Level: ");
  Serial.println(moistureLevel);

  // Check if moisture level is below the threshold
  if (moistureLevel < moistureThreshold) {
    // If moisture level is low, activate the water pump
    digitalWrite(relayPin, HIGH);  // Turn on the pump (relay on)
    Serial.println("Watering the plant...");
  } else {
    // If moisture level is sufficient, turn off the water pump
    digitalWrite(relayPin, LOW);   // Turn off the pump (relay off)
    Serial.println("Soil Moisture is Adequate");
  }

  // Wait for 1 second before checking again
  delay(1000);
}


Explanation of Code:

  1. moisturePin reads the value from the moisture sensor.
  2. moistureThreshold is the moisture level below which the pump will turn on (you can adjust this value based on the type of soil and plant).
  3. The digitalWrite(relayPin, HIGH) turns on the relay, which then activates the pump to water the plant.
  4. The program continuously checks the moisture level every second (you can adjust this timing).

Post a Comment

0 Comments