The
automatic watering system helps you to water plants at your home, garden
or farm in your absence. It uses technology to detect
the moisture level of the soil and automatically water
the plant when there is no moisture detected in the soil.
required components
Arduinouno
Soil moisture sensor
Relay for Arduino
Dc motor pump
Breadboard
Jumper wires
int ACWATERPUMP = 13; //You can remove this line, it has no use in the program.
int sensor = 8; //You can remove this line, it has no use in the program.
int val; //This variable stores the value received from Soil moisture sensor.
void setup() {
pinMode(13,OUTPUT); //Set pin 13 as OUTPUT pin, to send signal to relay
pinMode(8,INPUT); //Set pin 8 as input pin, to receive data from Soil moisture sensor.
}
void loop() {
val = digitalRead(8); //Read data from soil moisture sensor
if(val == LOW)
{
digitalWrite(13,LOW); //if soil moisture sensor provides LOW value send LOW value to relay
}
else
{
digitalWrite(13,HIGH); //if soil moisture sensor provides HIGH value send HIGH value to relay
}
delay(400); //Wait for few second and then continue the loop.
}
Comments
Post a Comment