Rain Water Harvesting project, “Rainwater Harvesting,” employs raindrop and soil moisture sensors along with two motor pumps controlled by Arduino. When rain is detected, one pump activates to collect water from the roof. Simultaneously, another pump starts when the soil moisture sensor indicates plants require watering, delivering stored rainwater to them. This automated system ensures efficient use of rainwater for plant care, contributing to sustainability by reducing dependency on external water sources for gardening needs.
Components:
- Arduino Board
- Raindrop Sensor
- Soil Moisture Sensor
- DC Motor Pumps (2 pieces, one for rainwater collection and one for plant watering)
- External Power Supply for Pumps (e.g., 12V power adapter)
- Connecting Wires (male-to-male, male-to-female, and female-to-female)
- Breadboard (Mini 1 piece)
Connections:
- Raindrop Sensor:
- Signal Pin: Connect to digital pin 2 (raindropSensorPin)
- VCC: Connect to 5V pin on Arduino
- GND: Connect to GND pin on Arduino
- Soil Moisture Sensor:
- Signal Pin: Connect to analog pin A0 (soilMoistureSensorPin)
- VCC: Connect to 5V pin on Arduino
- GND: Connect to GND pin on Arduino
- Pump 1 (for rainwater collection):
- Positive (VCC/+): Connect to a separate external power source (e.g., 12V power supply)
- Negative (GND/-): Connect to GND pin on Arduino
- Signal Pin: Connect to digital pin 3 (pump1Pin)
- Pump 2 (for watering plants):
- Positive (VCC/+): Connect to a separate external power source (e.g., 12V power supply)
- Negative (GND/-): Connect to GND pin on Arduino
- Signal Pin: Connect to digital pin 4 (pump2Pin)
// Define pin numbers for raindrop sensor, soil moisture sensor, and motor pumps
const int raindropSensorPin = 2; // Connect raindrop sensor to digital pin 2
const int soilMoistureSensorPin = A0; // Connect soil moisture sensor to analog pin A0
const int pump1Pin = 3; // Connect pump 1 to digital pin 3
const int pump2Pin = 4; // Connect pump 2 to digital pin 4
// Threshold values for sensors
const int raindropThreshold = 500; // Adjust this value according to your raindrop sensor's sensitivity
const int moistureThreshold = 500; // Adjust this value according to your soil moisture sensor's reading
void setup() {
pinMode(raindropSensorPin, INPUT);
pinMode(soilMoistureSensorPin, INPUT);
pinMode(pump1Pin, OUTPUT);
pinMode(pump2Pin, OUTPUT);
// Initially turn off pumps
digitalWrite(pump1Pin, LOW);
digitalWrite(pump2Pin, LOW);
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
// Read sensor values
int raindropValue = analogRead(raindropSensorPin);
int moistureValue = analogRead(soilMoistureSensorPin);
// Check if raindrop sensor detects rain
if (raindropValue < raindropThreshold) {
// Start pump 1 to collect rainwater
digitalWrite(pump1Pin, HIGH);
Serial.println("Rain detected. Pump 1 started.");
delay(1000); // Delay for stability
} else {
// Stop pump 1 if no rain detected
digitalWrite(pump1Pin, LOW);
Serial.println("No rain detected. Pump 1 stopped.");
}
// Check if soil moisture is below threshold, indicating plant needs water
if (moistureValue < moistureThreshold) {
// Start pump 2 to water plants
digitalWrite(pump2Pin, HIGH);
Serial.println("Soil moisture low. Pump 2 started.");
delay(1000); // Delay for stability
} else {
// Stop pump 2 if soil moisture is sufficient
digitalWrite(pump2Pin, LOW);
Serial.println("Soil moisture ok. Pump 2 stopped.");
}
delay(500); // Adjust delay as needed for sensor stability and responsiveness
}