Sie sind auf Seite 1von 16

Automatic Irrigation System using Soil Moisture and Temperature Sensor with Shading

Abstract: Automatic irrigation system is a system which has been used in the land of crop’s to give the
water on that time of the year rainfall is not occurred. This Automatic Irrigation System has done the
work in the absence of human. We will explain about circuit design, equipment, Coding, working
procedure of Automatic Irrigation System.
Keyword: Irrigation System, Arduino Uno R3,DC power adaptor,Relay,DS18B20 temperature
sensor,Shading.
Introduction
Automatic Irrigation System is invented or made for the development of the agriculture. The moisture and
temperature of the soil is significant aspect for the growth of the crops. This Automatic Irrigation System
consist of Moisture and Temperature sensor.Basic operation of the Automatic Irrigation System is given
below:
1. The moisture and temperature sensor take the data from soil and give these data to the Arduino.
2. Arduino take the next steps according to the data of moisture and temperature sensor. These steps
are like :
 When the value of water is not enough for the soil then Arduino starts the water
pumping motor which irrigate the soil.
 When temperature is so high for crops to survive then Arduino helps in shading.
On the basis of farming Automatic Irrigation System has many advantages.This System can be used in
irrigation and shading without the help of human. This System preserves time and water. This system also
saves the crops from the high temperature. This System maintain Soil structure and Nutrients. In this
paper, we are explaining the system architecture, design,coding, algorithm and flowchart and other
objects.
Equipment of Automatic Irrigation System
1. Arduino Uno R3 and Arduino IDE
2. Moisture sensor(FC-28)
3. Temperature sensor(DS18B20)
4. 16×2 LCD display
5. Breadboard
6. 4.7kΩ resister
7. IC(L293D)
8. 4V DC motor
9. 6V-12V DC pumping motor
10. 5V one channel relay (jqc-3ff-s-z)
11. Power adaptor(9V,350mA)
12. Power adaptor(5V,2A)
We used Power adaptor (9V, 350mA) for supplying the power in Arduino and Power adaptor (5V, 2A)
for supplying the power in 4V DC motor and 6V-12V DC pumping motor.
We used 4.7kΩ resister to determine the exact value of value of temperature sensor. And we also used IC
(L293D) to operate the 4V DC motor.
Arduino Uno R3and Arduino ide
Arduino Uno R3 is a microcontroller board based on the ATmega328p (datasheet). It has 14 digital I/O
pins(of which 6 can be used as PWM outputs) 6 analog inputs, a 16MHz quartz crystal, a USB
connection, a power jack, an ICSP header and a reset button. Arduino has everything needed to support
the microcontroller .Any one can program it by connecting it with the computer by a USB cable. It
accepts or supports 9V to 20V DC. It controls the whole System actions.

Fig: Arduino Uno R3


Arduino IDE is used for the writing a code for the Arduino which controls the whole operations.

Fig: Arduino IDE

Soil Moisture Sensor


We are chosen Soil moisture sensor (FC-28) for this automatic Irrigation System. It used for the measure
the value of soil moisture. This sensor is connected with the Arduino. This Sensor has four pins.They
are:

 VCC
 GND
 D0
 A0
It has also a potentiometer. Moisture Sensor measures the soil moisture and sends it to the Arduino in the
form of data. According to data Arduino performs the next operations.

Fig: Soil Moisture Sensor


Temperature Sensor (DS18B20)
We used DS18B20 temperature sensor for Automatic Irrigation System. This sensor is Waterproof. The
Temperature sensor(DS18B20) gives 9 to 12 bits (configurable) temperature readings over a 1-wire
interface, so that only one wire (and ground) needs to be connected from a central microprocessor. This
sensor has three wires.

 VCC
 GND
 SIG
SIG is known as a data wire. This sensor connected with the Arduino and it provides the data to the
Arduino from the soil.
Fig: Temperature Sensor (DS18B20)

16×2 LCD display


We used LCD display in this system to show the output of the sensors. This 16×2 LCD display has 16
columns and 2 rows. This LCD has 16 pins. In these pins 8 pins are a data pins. These pins are given
below:
1.VSS 5. R/W 9. D2 13. D6
2.VDD 6. E 10. D3 14. D7
3.V0 7.D0 11. D4 15.LED+
4. RS 8.D1 12. D5 16.LED-
Here V0 is a contrast pin. D0 to D7 are known as data pins. This LCD can handle 4.7V to 5.3V. It is
connected with the Arduino when Arduino get some data it display the outcome.

Fig: 16×2 LCD display

5V one channel relay (jqc-3ff-s-z)


We used 5V one channel Relay to run a pumping motor in this automatic irrigation system. Arduino
operates at 5V current. It can’t control higher voltage devices directly. Arduino will be corrupted if device
of higher voltage is attached with it. Butwe can use a 5V relay to switch the higher Voltage current and
use the Arduino to control the relay. Relay has three high voltage terminals. They are: NC, COM, NO.
These terminals connect to the devise which we want to control. Relay also has three low voltage pins.
They are: GND, VCC, IN. These pins connect to the Arduino.
Fig: 5V one channel relay

DC motors
Motor is the main part of the automatic irrigation system. We used in this system 2 types of motor. One is
6V-12V DC pumping motor and the other is 4V DC motor. Here 6V-12V DC pumping motor is used for
irrigation. Moisture sensor measures the moisture of the soil .If the moisture value of the soil is low then
soil needs water. To give the water we used this DC pumping motor. In this System we also use 4V DC
motor for the shading. If the temperature is so high for crops to survive, the temperature sensor sends the
data to the Arduino and Arduino turn on the 4V DC motor and also arrange the shading.

Fig: 6V-12V DC pumping motor and 4V DC motor

Pin Connection and diagram


Equipment Device pin Arduino Pin

Pin 1 Ground
Pin 2 5V
Pin 3 D3
Pin 4 D12
Pin 5 Ground
LCD Display Pin 6 D11
Pin 11 D10
Pin 12 D9
Pin 13 D8
Pin 14 D7
Pin 15 5V
Pin 16 Ground

Moisture Sensor Pin A0 A5

Temp sensor Data pin D4

Relay Input pin D6

Pin 1 A4
L293D(IC) Pin 2 A3
Pin 7 A2

Equipment Device pin Relay


Positive pin NC
Motor1
(Pumping motor) Negative pin -

Equipment Device pin L293D(IC)

Motor 2 Positive pin Pin 3

Negative pin Pin 6

Table 1: Pin Specification


Pin diagram is given below:
Fig: Pin Diagram
Source Code
Arduino has its own IDE. This IDE supports C as a programming language. Arduino IDE has its own
facility to connect the Arduino with a computer using a USB cable and passes code through it. The source
code of Automatic Irrigation System is given below:
#include <DallasTemperature.h>//header file
#include <OneWire.h>//header file
#include <LiquidCrystal.h>//header file
LiquidCrystal LCD(12,11,10,9,8,7);

#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int flag=0;
void setup()
{
Serial.begin(9600);
pinMode(A5,INPUT); //moisture
pinMode(A1,INPUT); // Temp
pinMode(3,OUTPUT);
pinMode(6,OUTPUT);
pinMode(A2,OUTPUT);
pinMode(A3,OUTPUT);
pinMode(A4,OUTPUT);
analogWrite(3,110);
//analogWrite(6,200);
LCD.begin(16,2);
}
void loop()
{
int SensorValue=analogRead(A5);
sensors.requestTemperatures();
clrtemp();
LCD.setCursor(0,1);
LCD.print("Temp: ");
LCD.print(sensors.getTempCByIndex(0));
float sv=sensors.getTempCByIndex(0);
Serial.println(sv);
if(sv>50.0 && flag==0)
{
shadeon();
}
else if(sv<50.0 && flag==1)
{
shadeoff();
}
//Serial.println(SensorValue);
if(SensorValue>=1000)
{
clrscr();
LCD.setCursor(0,0);
LCD.print("NOT IN Soil??");
}
else if(SensorValue<1000 && SensorValue>=700)
{
clrscr();
LCD.setCursor(0,0);
LCD.print("DRY!!!");
delay(7000);
giveWater();
}
else if(SensorValue<700 && SensorValue>=500)
{

clrscr();
LCD.setCursor(0,0);
LCD.print("Humid..");

}
else if(SensorValue<500)
{
clrscr();
LCD.setCursor(0,0);
LCD.print("Enough Water..");
}
delay(1000);
}
void giveWater()
{
int k=analogRead(A5);
clrscr();
LCD.setCursor(0,0);
LCD.print("Watering...");
clrtemp();
Serial.println(k);
while(analogRead(A5)>700 )
{
Serial.println(analogRead(A5));
digitalWrite(6,HIGH);
delay(10);
}
digitalWrite(6,LOW);
clrscr();
LCD.setCursor(0,0);
LCD.print("Done...");
delay(1000);
}
void clrscr()
{
LCD.setCursor (0, 0);
for (int i = 0; i < 16; ++i)
{
LCD.print(' ');
}
}
void clrtemp()
{
LCD.setCursor (0, 1);
for (int i = 0; i < 16; ++i)
{
LCD.print(' ');
}
}
void shadeon()
{
flag=1;
analogWrite(A4,200);
analogWrite(A3,255);
analogWrite(A2,0);
delay(1000);
off();
}
void shadeoff()
{
flag=0;
analogWrite(A4,200);
analogWrite(A2,255);
analogWrite(A3,0);
delay(1000);
off();
}
void off()
{
analogWrite(A4,0);
analogWrite(A3,0);
analogWrite(A2,0);
}
Algorithm
1. Declaring library
a. Dallas Temperature
b. OneWire
c. LiquidCrystal
2. Defining pins
a. LCD
b. ONE_WIRE
3. Void setup()
a. Defining pins
i. A1-INPUT
ii. A2-OUTPUT
iii. A3-OUTPUT
iv. A4-OUTPUT
v. 3-OUTPUT
vi. 6-OUTPUT
b. Defining values:
i. 3-110
ii. 6-200
iii. LCD-begin()
4. void loop()
a. Take input: A5
i. Do
1. requestTemperature
2. clrtemp();
3. setCursor(0,1)
4. Print(“Temp: “)
5. Print(getTempCByIndex(0))
ii. SET: sv= sensors.getTempCByIndex(0)
b. IF(sv>50.0 AND flag==1)
i. DO: shadeon()
ELSE IF(sv<50.0 AND flag==0)
i. DO:shadeoff()
c. IF(Sensorvalue>=1000)
i. DO
1. Clrscr()
2. Print(“NOT IN SOIL??”)
d. ELSE IF(Sensorvalue<1000 && Sensorvalue>=700)
i. DO
1. Clrscr()
2. Print(“DRY!!!”)
3. Wait-7 sec
4. giveWater()
e. ELSE IF(Sensorvalue <700 && Sensorvalue>=500)
i. DO
1. Clrscr()
2. Print(“Humid”)
f. ELSE IF(Sensorvalue<500)
i. DO
1. Clrscr()
2. Print(“Enough Water”)
g. Wait-1 sec
5. Define Function
a. void giveWater()
i. SET:k=input(A5)
ii. Clrscr()
iii. Print(“Watering…”)
iv. Clrtemp()
v. While
1.DO
a. Read: A5
b. Write:6 –HIGH
c. Wait-10 ms
vi. Write:6-HIGH
vii. Clrscr()
viii. Print(“Done..”)
ix. Wait-1 Sec.
b. Void Clrscr()
i. For i=0 to 16
ii. Print(“ “)
c. Void shadeon()
i. SET:flag=1
ii. Write:
1. A4:200
2. A3:255
3. A2:0
iii.Wait-1 sec
iv. Off()
d. Void shadeoff()
i.SET:flag=0
ii.Write:
1.A4:200
2.A2:255
3.A3:0
iii. Wait-1 sec
iv. Off()
e. Void Off()
i.Write:
1.A4:0
2.A3:0
3.A2:0
FLOWCHART

START

Calculate or measure the value of


temperature and moisture and flag=0

Temperature False False


value>50 Moisture
value>=700
And flag=0

True

True

Give water

Shading on Shading off STOP


CONCLUSION
This Automatic Irrigation System can play an important role in Agricultural countries. Through this
Automatic Irrigation System soil condition can be monitored. This System can help to keep soil structure
accurate.This System has shading arrangements which can be used to protect crops or plants from high
temperature.All crops generally slow down their growth below the soil temperature of about 90C and above
the temperature of about 500 C. Automatic Irrigation System.The irrigation system prevents the waste of water
and also saves the time.
REFFERENCE
1)https://www.google.com/search?client=firefox-b&biw=1536&bih=728&tbm=isch&sa=1&ei=P9DIW-
nAI8mdzwLPu6r4CQ&q=6V-12V+DC+pumping+motor&oq=6V-
12V+DC+pumping+motor&gs_l=img.3...2029.21641.0.21980.41.28.0.0.0.0.504.5657.3-
9j4j1.14.0....0...1c.1.64.img..27.10.3998.0..0j35i39k1j0i30k1j0i8i30k1.0.w7DcBqLGaoM
2)http://www.agriinfo.in/default.aspx?page=topic&superid=1&topicid=396

3) https://www.google.com/search?client=firefox-b&biw=1536&bih=728&tbm=isch&sa=1&ei=P9DIW-
nAI8mdzwLPu6r4CQ&q=arduino+uno+r3+&oq=arduino+uno+r3+&gs_l=img.3..35i39k1j0l2j0i67k1j0j0i67
k1j0l4.27741.28413.0.29461.3.3.0.0.0.0.390.773.3-2.2.0....0...1c.1.64.img..1.2.771....0.FIE3PAUlZWI

4)https://www.google.com/search?client=firefox-
b&biw=1536&bih=728&tbm=isch&sa=1&ei=5NDIW9KPEtDYzwLFjKrICQ&q=Arduino+uno&oq=Arduino+
uno&gs_l=img.3..35i39k1l2j0l8.178629.186996.0.187407.34.18.0.0.0.0.412.2760.3-
3j4.7.0....0...1c.1.64.img..27.6.2384.0..0i67k1.0.sFhAOLrHsCI

5) https://www.google.com/search?q=5v+one+channel+relay+(jqc-3ff-s-
z)&source=lnms&tbm=isch&sa=X&ved=0ahUKEwigjoWm0ZDeAhXErFMKHfChApQQ_AUIDigB&biw=1536
&bih=754&dpr=1.25

6)https://www.google.com/search?biw=1536&bih=754&tbm=isch&sa=1&ei=99LIW7GVMsTozgKjsIuICg
&q=16%C3%972+LCD+display&oq=16%C3%972+LCD+display&gs_l=img.3..0l2j0i24k1l2.63691.66035.0.6
6866.35.9.0.0.0.0.490.883.3-1j1.2.0....0...1c.1.64.img..33.1.393.0...0.P_mVXj5SS8Q

7)https://www.google.com/search?biw=1536&bih=754&tbm=isch&sa=1&ei=RtPIW-abAo72zgLo-
bCoCg&q=Temperature+Sensor+%28DS18B20%29&oq=Temperature+Sensor+%28DS18B20%29&gs_l=i
mg.3..0i30k1l2j0i5i30k1l2j0i8i30k1l6.51615.88435.0.89514.20.10.0.0.0.0.451.828.3-
1j1.2.0....0...1c.1.64.img..18.2.826.0..0j0i24k1.0.mR-LwWSo658

8)https://www.google.com/search?biw=1536&bih=754&tbm=isch&sa=1&ei=pNPIW8zQIYyjzwKemqmQ
Cw&q=Soil+Moisture+Sensor&oq=Soil+Moisture+Sensor&gs_l=img.3..0i67k1j0l9.25643.48833.0.50522.
31.11.0.0.0.0.393.753.3-2.2.0....0...1c.1.64.img..29.2.752.0..0i30k1j0i5i30k1j0i8i30k1.0.MgePCVKCELc

9)https://www.google.com/search?biw=1536&bih=754&tbm=isch&sa=1&ei=29PIW5XTA8jVzwKg4pnICg
&q=Arduino+IDE&oq=Arduino+IDE&gs_l=img.3..35i39k1j0l9.50693.57400.0.57913.31.18.0.0.0.0.420.27
20.3-4j3.7.0....0...1c.1.64.img..24.7.2716.0..0i67k1.0.ANOgm6Bjbkg

10)https://store.arduino.cc/usa/arduino-uno-rev3

Das könnte Ihnen auch gefallen