2. Introduction
This system is built using Arduino UNO.
In this system, soil moisture sensor senses the moisture level
of the soil.
If soil will get dry then sensor senses low moisture level and
automatically switches on the water pump to supply water to
the plant.
As plant get sufficient water and soil get wet then sensor
senses enough moisture in soil. After which the water pump
will automatically get stopped.
3. Components used
Arduino UNO
5V Relay
Soil moisture sensor
Watering tube
Jumper wires
5V DC Motor pump
9V DC power supply
4. Working of Soil moisture Sensor
The soil moisture sensor consists of two probes which are
used to measure the volumetric content of water.
The two probes allow the current to pass through the soil and
then it gets the resistance value to measure the moisture value.
When there is more water, the soil will conduct more
electricity which means that there will be less resistance.
Dry soil conducts electricity poorly, so when there will be less
water, then the soil will conduct less electricity which means
that there will be more resistance.
This sensor can be connected in two modes; Analog mode and
digital mode.
6. Working
Now the system has to supply water to soil in which plant is
located
For this to happen we have to write and compile a program
code and transfer it to Arduino.
Connect the Arduino to the PC and open the ARDUINO IDE
and write the code.
Use the analogRead function to read the values for the sensor.
7. Code
const int Pin=0;
const int limit=480;
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(3,OUTPUT);
// put your setup code here, to run once:
}
void loop() {
int value;
value=analogRead(Pin);
Serial.println("analog value:");
Serial.println(value);
delay(1000);
if (value<limit)
{
digitalWrite(3,HIGH);
}
else
{
digitalWrite(3,LOW);
}
// put your main code here, to run repeatedly:
}