void setup() {
Serial.begin(9600);
pinMode(A0,INPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
int val=analogRead(A0);
Serial.println(val);
if(val<350){
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
delay(500);
}
if(val>1000)
{
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}
}
EXPANDED TECHNICAL DETAILS
Automated Agricultural Hydration
The Smart Irrigation system optimizes water usage by sensing soil moisture levels and automating the delivery of water only when necessary.
- Moisture Thresholding: Integrates a Soil Moisture Sensor (analog). The Arduino samples the moisture level (0-1023) and compares it against a pre-set "Dryness threshold."
- High-Power Actuation: When the soil reaches the critical dry-point, the Arduino triggers a 5V/12V Relay, which in turn activates a water pump.
Safety and Logic
- Rain-Delay Override: (Advanced version) Includes a guide on adding a "Rain Sensor." If the Arduino detects active rain, it overrides the irrigation cycle to prevent over-watering and save water resources.