// EcoAqua - Smart Soil Moisture & Automated Irrigation Alert
const int SOIL_SENSOR_PIN = A0; // Simulated moisture sensor pin
const int PUMP_LED_PIN = 13; // Simulated irrigation pump indicator
const int MOISTURE_THRESHOLD = 400; // Threshold for dry soil
void setup() {
Serial.begin(9600);
pinMode(PUMP_LED_PIN, OUTPUT);
Serial.println("--- EcoAqua Smart Irrigation System Active ---");
}
void loop() {
// Read simulated moisture value (0 - 1023)
int moistureLevel = analogRead(SOIL_SENSOR_PIN);
// Convert value to a readable percentage
int moisturePercent = map(moistureLevel, 0, 1023, 0, 100);
Serial.print("Soil Moisture Level: ");
Serial.print(moisturePercent);
Serial.println("%");
// Automated decision loop
if (moistureLevel < MOISTURE_THRESHOLD) {
digitalWrite(PUMP_LED_PIN, HIGH); // Turn on pump LED
Serial.println("ALERT: Soil moisture LOW! Automated pump ENABLED.");
} else {
digitalWrite(PUMP_LED_PIN, LOW); // Turn off pump LED
Serial.println("STATUS: Soil moisture OPTIMAL. Pump OFF.");
}
delay(2000); // Poll every 2 seconds
}