
Arduino Project - Irrigation system
Arduino irrigation system
Operation
The Soil Moisture Sensor measures soil moisture grace to the changes in electrical conductivity of the earth ( soil resistance increases with drought ).
The electrical resistance is measured between the two electrodes of the sensor.
A comparator activates a digital output when an adjustable threshold is exceeded
int sensor = A1;
int pump = 13;
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
lcd.print("System Run Start!");
lcd.noDisplay();
delay(1000);
lcd.display();
delay(500);
pinMode(sensor, INPUT);
pinMode(pump,OUTPUT);
Serial.begin(9600);
}
void loop() {
lcd.setCursor(0, 1);
int sensorValue = analogRead(sensor);
Serial.println(sensorValue);
lcd.print("sen.val = ");
lcd.print(sensorValue);
while (analogRead(sensor) < 200 );
{
digitalWrite(pump, HIGH);
delay(1500);
Serial.println(sensorValue);
lcd.setCursor(0, 1);
lcd.print("Pump ON ");
}
digitalWrite(pump, LOW);
delay(1000);
}
Project - Tharindu Nishantha
No comments: