Anda di halaman 1dari 40

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JnanaSangama”, Machhe, Belagavi, Karnataka-590018

A Project Report
On
“Raspberry Pi and Arduino Based Automated Irrigation System”
Sponsored by
Karnataka State Council for Science and Technology[KSCST]
Indian Institute of Science Campus, Bangalore

Submitted in partial fulfillment of the requirements for the award of the degree of

Bachelor of Engineering
in
Information Science and Engineering
Submitted by
Aishwarya T 4GW13IS001
Chaithra M 4GW13IS006
Meghana M R 4GW13IS024
Sushma R Krishnan 4GW13IS048

Under the Guidance of


Ayesha Taranum Chaya P
Assistant Professor, Assistant Professor,
GSSSIETW, Mysuru GSSSIETW, Mysuru

DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING


(Accredited by NBA, New Delhi, Validity 01.07.2017 to 30.06.2020)

GSSS INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN


K.R.S ROAD, METAGALLI, MYSURU-570016, KARNATAKA

(Affiliated to VTU, Belagavi, Approved by AICTE, New Delhi & Govt. of Karnataka)

2017
ACKNOWLEDGEMENT

We sincerely owe our gratitude to all the persons who helped and
guided us in completing this project work.

First and foremost we offer our sincere thanks to Smt. Vanaja B Pandit,
Honorable Secretary, GSSSIETW and the management of GSSSIETW, Mysuru
for providing help and support to carry out the project.

We are thankful to Dr. Sumithra Devi K.A, Principal GSSSIETW, Mysuru


without her help this project would be a dream.

We are thankful to Dr. Reshma Banu, Professor and Head of Department of


Information Science and Engineering for her suggestions for the effectiveness
of project.

We would like to sincerely thank our project guide Mrs. Ayesha Taranum
and Mrs. Chaya P , Assistant Professors, Department of Information Science
and Engineering for their valuable guidance, constant assistance and
constructive suggestions for the effectiveness of project, without which this
project would not have been possible.

We would also like to thank all our ISE staff members who have always been
with us extending their precious suggestions, guidance and encouragement
throughout the project.

Lastly, we would like to thank our parents and friends for their support,
encouragement and guidance throughout the project.

Aishwarya T (4GW13IS001)
Chaithra M (4GW13IS006)
Meghana M R (4GW13IS024)
Sushma R Krishnan (4GW13IS048)
i
ABSTRACT

Adopting an optimized irrigation system has become a necessity due to


the lack of the world water resource. The system has a soil-moisture sensor.
This project focuses on a smart irrigation system which is cost effective.
Automation allows us to control various appliances automatically. The
objective of this project is to control the water supply to each plant
automatically depending on values of soil moisture sensors. Mechanism is
done such that soil moisture sensor electrodes are inserted in soil.

Automatic irrigation scheduling consistently has shown to be valuable in water


use efficiency with respect to manual irrigation based on direct soil water
measurements. The aim of the implementation is to demonstrate that the
automatic irrigation can be used to reduce water use. The implementation is an
automated irrigation system that consists of a soil moisture sensors which
senses the soil humidity and automatically waters the field.

ii
TABLE OF CONTENTS

Acknowledgement i

Abstract ii

Contents iii

List of Figures v

List of Tables vi

1. INTRODUCTION 01-03

1.1 Overview 01

1.2 Proposed System 01

1.3 Objectives 02

1.4 Advantages 02

1.5 Organization of the project 02

2. LITERATURE SURVEY 04-07

2.1 Related Work 04

3. SOFTWARE REQUIREMENTS AND SPECIFICATION 08-10

3.1 Functional Requirements 08

3.2 Non-Functional Requirements 08

3.3Feasibility Analysis 09

3.4 Risk Analysis 09

3.5 External Interface Requirement 10

3.6 System Requirements 10

4. SYSTEM ANALYSIS AND DESIGN 11-16

4.1 System Design 11

iii
4.2 Methodology 13

4.3 Required components 14

4.5 Data Flow Diagram 16

5. IMPLEMENTATION 17-23

5.1 Software Tools 17

5.2 Code Snippets 18

6. TESTING 24-27

6.1 System Testing 24

6.2 Test Classification 25

6.3 Test Cases 26

7. RESULTS AND DISCUSSIONS 28-29

7.1 Snapshots 28

CONCLUSION AND FUTURE SCOPE 30

REFERENCES 31-32

iv
LIST OF FIGURES

FIGURE NUMBER DESCRIPTION PAGE NUMBER

Block Diagram
4.1 11

4.2 Flowchart of the system 13

4.3 GSM module 14

4.4 Soil Moisture Sensor 15


.

4.5 Block diagram of Raspberry Pi


15
system

4.6
Data flow diagram 16

7.1
The model for the proposed system 28

7.2 The Arduino hardware 28

7.3 Final Prototype 29

v
LIST OF TABLES

TABLE DESCRIPTION PAGE NUMBER

6.1 Test cases 27

vi
Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 1
INTRODUCTION

1.1 Overview of the project

At the present era, the farmers have been using irrigation technique in India through
the manual control in which the farmers irrigate the land from time to time. This process
sometimes consumes more water. Automatic irrigation scheduling consistently has shown to
be valuable in water use efficiency with respect to manual irrigation based on direct soil
water measurements. Irrigation of plants is usually a very time-consuming activity which has
to be done in a reasonable amount of time; it requires a large amount of human resources. All
the steps were executed by humans traditionally.

Nowadays, some systems use technology to reduce the number of workers and to
reduce the time required to water the plants. With such systems, the control is very limited
and many of the resources are still wasted. Water is one of these resources which is used
excessively. Mass irrigation is the method which is used to water the plant. This method
represents massive losses since the amount of water given exceeds the plants’ needs. The
excess water gets discharged by the holes of the pots, or it percolates through the soil in the
fields. In addition to the excess cost of water, labour is becoming more and more expensive.

1.2 Proposed System

The proposed irrigation system makes the efficient use of water. Water is fed to the
plant whenever there is need. There already exist irrigation systems which water plants on the
basis of soil humidity, pH value of soil, temperature and light. Wherever these parameters are
required in big agricultural fields their productivity of the crop matters.

The proposed irrigation system will be very efficient in areas like house gardens,
office premises, buildings etc. where watering plants at regular interval matters. This system
also presents an smart drip irrigation system to water plants using devices like raspberry pi,
Arduino microcontrollers. Zigbee is used to control the system wirelessly. And also the user
gets the status time to time.

GSSSIETW,Mysuru Page 1 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

1.3 Objectives

The objectives of the project is to design a smart drip irrigation system to water plants with
the use of devices like raspberry pi, Arduino microcontrollers. Zigbee is used to control the
system wirelessly while Python programming language is used for automation purpose.
This system also contributes an efficient and fairly cheap automation irrigation system.
System once installed has no maintenance cost and is easy to use. Environment parameters
monitoring system based on wireless communication technology has been developed to
control remotely, which realizes the measurement of temperature, rain fall, soil parameters.
Monitoring system based on wireless communication technology has been developed to
control remotely, which realizes the measurement of temperature, rain fall, soil parameters.

1.4 Advantages

 Moisture within the root zone can be maintained at field capacity.


 Water distribution is highly uniform.
 Labour cost is less than other irrigation methods.
 Fertilization can easily be included with minimal waste of fertilizers.
 Consumption of water as well as electricity is reduced to an significant amount.

1.5 Organization of the Project

Chapter 1: Introduction
This chapter provides the overview of the project.
Chapter 2: Literature Survey
This chapter specifies about the related work and background works of this project.
Chapter 3: Software Design
Requirement
The chapter summarizes about the system requirement specifications, functional and non-
functional requirements of this project.
Design
This module signifies the design description, system architecture and explanation of modules.
Chapter 4: Implementation
This module of the chapter consists the project implementation and the functionality.

GSSSIETW,Mysuru Page 2 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Testing
This module describes the types of testing required for this project and the test cases designed
and implemented.
Chapter 5: Results and Conclusion
This chapter includes the snapshots of the working that is developed by this project and the
conclusion.

GSSSIETW,Mysuru Page 3 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 2
LITERATURE SURVEY

Related Work

After the research in the agricultural field, researchers found that the yield of
agriculture goes on decreasing day by day. Use of technology in the field of agriculture plays
important role in increasing the production as well as in reducing the extra man power efforts,
water requirement and fertilizer requirement.

Bennis, H. Fouchal, O. Zytoune, D. Aboutajdine, “Drip Irrigation System using Wireless Sensor
Networks” The Model includes soil moisture, temperature and pressure sensors to monitor the
irrigation operations. Specifically, we take into account the case where a system malfunction
occurs, as when the pipes burst or the emitters block. Also, we differentiate two main traffic
levels for the information transmitted by the WSAN, and we use an adequate priority-based
routing protocol to achieve high QoS performance. Simulations conducted over the NS-2
simulator show promising results in terms of delay and Packet Delivery Ratio (PDR), mainly
for priority traffic [1].

Joaquín Gutiérrez, Juan Francisco Villa-Medina et al. “Automated Irrigation System Using a
Wireless Sensor Network and GPRS Module, In this paper the System has a distributed wireless
network of soil-moisture & temperature sensors placed in root zone of plants. Gateway unit
handles sensor information, triggers actuators, and transmits data to a web application. An
algorithm was developed with threshold values of sensors that was programmed into a
microcontroller-based gateway to control water quantity [2].

Sangamesh Malge, Kalyani Bhole, “Novel, Low cost Remotely operated smart Irrigation
system" In this paper a Small embedded system device (ESD) which takes care of a whole
irrigation process. The PIC18F4550 microcontroller interfaced with GSM module works as a
brain and several sensors like temperature, level and rain works as eyes of this ESD. If and
only if eyes of the ESD see all parameters are within a safe range, the PIC18F4550 starts
irrigation process by starting the irrigation pump. The farmer gets time to time feedback from
ESD through SMS about the action that has taken place by PIC18F4550 [3].

Nikhil Agrawal, Smita Singhal, “Smart Drip Irrigation System using Raspberry pi and
Arduino” The commands from the user are processed at raspberry pi using python

GSSSIETW,Mysuru Page 4 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

programming language. Arduino microcontrollers are used to receive the on/off commands
from the rasperry pi using zigbee protocol. Star zigbee topology serves as backbone for the
communication between raspberry pi and end devices. Raspberry pi acts a central coordinator
and end devices act as various routers [4].

Pravina B. Chikankar, Deepak Mehetre, Soumitra Das, “An Automatic Irrigation System using
ZigBee in Wireless Sensor Network” In the research field of wireless sensor network power
efficient time is major issue which can be overcome by using ZigBee technology. The main
idea is to understand how data travels through wireless medium transmission using WSN and
monitoring system. Design of an irrigation system which is automated by using controllable
parameter such as temperature, soil moisture and air humidity because they are the important
factors to be controlled in PA(Precision Agriculture) [5].

Sneha Angal “Raspberry pi and Arduino Based Automated Irrigation System” The paper
presents a home automation system which is based on Raspberry pi, Arduino
microcontrollers, and zigbee and relay boards to water plants. Raspberry pi acts as the control
block in the automatic irrigation system to control the flow of motor.

The commands from the Arduino are processed at raspberry pi. Zigbee module is used for
communication between the Raspberry pi and Arduino. This paper presents an efficient and
fairly cheap automation irrigation system. By using moisture sensor we will make the
irrigation system smart and automated. System once installed has no maintenance cost and is
easy to use[6].

Bhagyashree K.Chate , Prof.J.G.Rana ,”Smart irrigation system using Raspberry pi” The aim
of this paper is to develop a smart irrigation monitoring system using raspberry pi.Focus area
will be parameters such as temperature and soil moisture. This system will be a substitute to
traditional farming method .We will develop such a system that will help a farmer to know
his field status in his home or he may be residing in any part of the world. It proposes a
automatic irrigation system for the agricultural lands. Currently the automation is one of the
important role in the human life.

It not only provide comfort but also reduce energy, efficiency and time saving. Now the
industries are use automation and control machine which is high in cost and not suitable for

GSSSIETW,Mysuru Page 5 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

using in a farm field. So here it also design a smart irrigation technology in low cost which is
usable by Indian farmers. Raspberry pi is the main heart of the whole system.

An automated irrigation system was developed to optimize water use for agricultural crops.
Automation allows us to control appliances autom-atically. The objectives of this paper were
to control the water motor automatically, monitor the plant growth using webcam and we can
also watch live streaming of farm on android mobiles by using wi-fi.[7]

Suprabha Jadhav1, Shailesh Hambarde,”Android based Automated Irrigation System using


Raspberry Pi” Nowadays, adopting an optimized irrigation system has become a necessity
due to the lack of the world water resource. The system has a distributed wireless network of
soil-moisture and temperature sensors.

This project focuses on a smart irrigation system which is cost effective. As the technology is
growing and changing rapidly, Wireless sensing Network (WSN) helps to upgrade the
technology where automation is playing important role in human life. Automation allows us
to control various appliances automatically.

DC motor based vehicle is designed for irrigation purpose. The objectives of this paper were
to control the water supply to each plant automatically depending on values of temperature
and soil moisture sensors. Mechanism is done such that soil moisture sensor electrodes are
inserted in front of each soil. It also monitors the plant growth using various parameters like
height and width. Android app.[8]

Nikhil Agrawal , Smita Singhal “Smart Drip Irrigation System using Raspberry pi and Arduino” This

paper proposes a design for home automation system using ready-to-use, cost effective and
energy efficient devices including raspberry pi, arduino microcontrollers, xbee modules and
relay boards. Use of these components results in overall cost effective, scalable and robust
implementation of system.
The commands from the user are processed at raspberry pi using python programming
language. Arduino microcontrollers are used to receive the on/off commands from the
rasperry pi using zigbee protocol.Star zigbee topology serves as backbone for
thecommunication between raspberry pi and end devices.Raspberry pi acts a central
coordinator and end devices act as various routers.
Low-cost and energy efficient drip irrigation system serves as a proof of concept. The design
can be used in big agriculture fields as well as in small gardens via just sending an email to

GSSSIETW,Mysuru Page 6 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

the system to water plants. The use of ultrasound sensors and solenoid valves make a smart
drip irrigation system. The paper explains the complete installation of the system including
hardware and software aspects.[9]

Gajjala Ashok, Gogada Rajasekar, “Smart Drip Irrigation System using Raspberry Pi
and Arduino” This paper proposes a design for home automation system using ready-to-use,
cost effective and energy efficient devices including raspberry pi, arduino microcontrollers,
xbee modules and relay boards. Use of these components results in overall cost effective,
scalable and robust implementation of system.

The sensor data were uploaded in to cloud by raspberry pi using python programming
language. Arduino microcontrollers used to transmit the sensor data to the raspberry pi using
zigbee protocol. Star zigbee topology serves as backbone for the communication between
raspberry pi and end devices. Raspberry pi acts a central coordinator and end devices act as
various routers. Low-cost and energy efficient drip irrigation system serves as a proof of
concept.

The design can be used in big agriculture fields as well as in small gardens and water plants.
The use of ultrasound sensors and solenoid valves make a smart drip irrigation system. The
paper explains the complete installation of the system including hardware and software
aspects.[10]

GSSSIETW,Mysuru Page 7 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 3
SYSTEM REQUIREMENTS AND SPECIFICATION

System requirement specification gives the complete description of the behavior about the
system developed by this project. This includes specification of functional and non functional
requirements of the application. The interaction of the users with the application is
represented with the help of use cases and there analysis. This also includes the description
about feasibility, risk analysis and external interface requirements to accomplish this project.

3.1 FUNCTIONAL REQUIREMENTS


The functional requirements will describe the features and functionality of the system.
Functional requirements record the operation that must be done. Functional requirements are
based for non-functional requirements.
3.2 NON FUNCTIONAL REQUIREMENTS
The non-functional requirements define how the system will do certain operation. Non-
functional requirements are usually called as “quality attributes”. The system should also
meet the non-functional requirements along with the functional requirements.
Non-functional requirements for this project are:

● Security
It is the feature of the system which ensures that system must be protected from the
unintentional or malignant harm.
● Performance
The way in which the system meets its performance targets is for it to
be specified clearly and explicitly. The system itself might not need anything
specifically for its basic operation, but the complete system along with the
components connected may have some Performance requirements.
 User-friendly
The graphical user interface (GUI) is user-friendly.
● Usability
Usability determines how difficult it is to learn and use the system.
● Availability
It means for how long the system is available for its users and for how long the
system will be operational.

GSSSIETW,Mysuru Page 8 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

 Reliability
Reliability determines how often the software fails. The measurement is expressed in
Mean Time Between Failures (MTBF). The system is completely tested for
robustness before the deployment. The module developed thus maintains data
consistency.

3.2.1 SOFTWARE QUALITY ATTRIBUTES


A few added quality and attribute of the system is important for the developer’s alike
usability, correctness and testability. Usability can be obtained by developing the product as
user-friendly. For correctness responsibility and proper attention should be given during
design and coding. Testability and maintainability plays an important role for long life of the
product.

3.3 FEASIBILITY ANALYSIS


Feasibility analysis is the estimation of practically proposed system or project.
3.3.1 SCHEDULE FEASIBILITY
The project development was planned to reach designing phase by the end of the semester
which gives a duration of six months. This was enough time to develop a working version of
the end product and the software.

3.4 RISK ANALYSIS

3.4.1 PERFORMANCE RISK

The performance of the software may be hinder due to various causes like unresponsive GUI and
misstep to execute given commands. One of the cause can be large-sized front end, which can
be changed by building light-weight GUI. Systems are advised to design in a way that front and back-
end can communicate directly.

3.4.2 SAFETY RISK


Safety of the user data with the system is risk. The user data may be lost and/or depraved due
to inappropriate management and storage. This needs to be handled by using dependable
document in the back end to store the user data.

GSSSIETW,Mysuru Page 9 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

3.5 EXTERNAL INTERFACE REQUIREMENT

3.5.1 HARDWARE INTERFACE


Hardware interface is a physical binding which connects the people and technology. The
system will collaborate with the hardware resources. It disciplines the design which shapes
the connection between user and the technology.

3.5.2 SOFTWARE INTERFACE


All the versions of the android phone will support the application. It will have a interaction
with the care-taker and/or nurse. Access to the entire user is prohibited and allowing access to
only care-taker and/or nurse is provided. Software interfaces provide access to the resources
such as memory, storage, CPU etc. of the system.

3.6 SYSTEM REQUIREMENTS


The two major kinds of system requirements are hardware and software requirements.

HARDWARE REQUIREMENTS:
 Arduino Uno
 Raspberry Pi
 Water Pump
 Jump Wires
 Bread Board
 Motor driver
 Laptop
 Mobile phone

SOFTWARE REQUIREMENTS

 Juice SSH application


 Arduino application
 Python for programming Raspberry Pi

GSSSIETW,Mysuru Page 10 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 4
SYSTEM ANALYSIS AND DESIGN

4.1 SYSTEM DESIGN

Figure 4.1 Block Diagram.

Raspberry Pi: The Raspberry Pi is a low cost, credit-card sized computer. Its capable of
doing everything you’d expect a desktop computer to do, from browsing the internet and
playing high-definition video, making spreadsheets, and playing games. There are different
models of Raspberry Pi from Raspberry Pi 0 to Raspberry Pi 3.

Motor: A Motor is a device which converts electrical power into mechanical rotation using
the principle of electromagnetism. Electro-magnetism: A wire wound on a ferrite core
carrying electric current generates a magnetic field; this principle is called Electro-magnetism

DC motor:
DC motor in simple words is a device that converts direct current (electrical energy) into
mechanical energy.

GSSSIETW,Mysuru Page 11 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Wi-fi dongle: It makes Internet of Things devices cable free. Specifications:

IEEE 802.11n (draft), IEEE 802.11g, IEEE 802.11b

Soil moisture Sensor: Soil moisture sensor includes comparator (LM393) which converts
analog data to discrete. Two soil probes consist of two thin copper wires each of 5 cm length
which can be immersed into the soil under test. The circuit gives a voltage output
corresponding to the conductivity of soil. The soil between the probes acts as a variable
resistance whose value depends upon moisture content in soil. The resistance across soil
probes can vary from infinity (for completely dry soil) to a very little resistance (for 100%
moisture in soil).

It consist of different types of sensing units such as Soil moisture sensor to measure water
content of soil, temperature sensor to detect the temperature. DC motor based vehicle is
designed for Irrigation purpose. Webcam is interfaced to Raspberry Pi using USB port. Robot
moves forward for 5 seconds. It stops at the 1st plant. Image of that plant is taken using
webcam. Raspberry Pi performs Image Processing which gives calculates the growth of plant
using height and width parameters. If the growth of plant is improper, it will spray fertilizer
on plant. If the growth of plant is proper, the soil moisture electrode is inserted in soil. The
set point for soil moisture sensor is 4000.

If the soil moisture value is less than 4000, water will be supplied for 2 seconds. If the soil
moisture value is less than 4000, water will be supplied for 1 second. If the soil moisture
value is greater than 4000, no water supply takes place. The Raspberry Pi will send all the
Information to the server using Wi-Fi. We are designing an Android App based server. The
android app has a GUI which will show all the data to user.

GSSSIETW,Mysuru Page 12 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

4.2 METHODOLOGY
The system can be represented using algorithms and algorithms are designed using
flowcharts.

Figure 4.2 Flowchart of the system

The logics of the algorithm help to identify whether there is need of water to plant. Further,
logics and decision making conditions help soil moisture condition of the soil and it always
maintain moisture and also the user gets the status of the motor on the mobile. First the
moisture sensor senses the soil.
The output of the moisture is in the analog form. The ADC of the Arduino converts the
output of the moisture sensor into digital form. The digital value is then send to the Raspberry
pi through RF module which decides whether to soil is wet or dry and according to that water
the plant. If the soil is dry, Raspberry pi actuates the relay and water pump starts which leads
to water to flow. If the soil is wet, Raspberry pi turns the relay of as a result water pump is off
and water flow stop.

GSSSIETW,Mysuru Page 13 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

4.3 Required components


 GSM Module

Figure 4.3 GSM module


Here we have used TTL SIM800 GSM module. The SIM800 is a complete Quad-band
GSM/GPRS Module which can be embedded easily by customer or hobbyist. SIM900
GSM Module provides an industry-standard interface; the SIM800 delivers GSM/GPRS
850/900/1800/1900MHz performance for voice, SMS, Data with low power consumption.

GSSSIETW,Mysuru Page 14 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

 Soil Moisture Sensor

Figure 4.4 Soil Moisture Sensor

A Soil Moisture Sensor Probe to sense the soil moisture level. To make probe, we have
cut and etched a Copper clad Board according to the Picture shown below. One side of
the probe is directly connected to Vcc and other probe terminal goes to the base of BC547
transistor. A potentiometer is connected to the base of the transistor to adjust the
sensitivity of the sensor.
 Raspberry Pi

Figure 4.5 Block diagram of Raspberry Pi system

Raspberry pi is a pocket personal computer with Linux operating system on it. This is
great cheap to encourage young people for learning, programming, experimenting and for

GSSSIETW,Mysuru Page 15 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

making innovation. Resembling like motherboard, raspberry pi has all the components to
connect inputs, outputs and storage.

4.5 Data Flow Diagram

Figure 4.6 Data flow diagram

Data flow diagram depicts the working of Raspberry pi using various sensors. The flow of
data with the help of Wi-Fi module and mobile which informs the farmer about the soil
moisture.

GSSSIETW,Mysuru Page 16 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 5
IMPLEMENTATION
This includes the details about technologies used for the implementation of this projectand
control flow of all the modules and sub modules.

5.1 SOFTWARE TOOLS


Software tools helps in building the project as per the aim. Following are the software tools
used for the project-

ARDUINO:

The Arduino microcontroller is an easy to use yet powerful single board computer that has
gained considerable traction in the hobby and professional market. The Arduino is open-
source, which means hardware is reasonably priced and development software is free. This
guide is for students in ME 2011, or students anywhere who are confronting the Arduino for
the first time. For advanced Arduino users, prowl the web; there are lots of resources. The
Arduino project was started in Italy to develop low cost hardware for interaction design.

RASPBERRY PI PLATFORM & PYTHON PROGRAMMING:

Raspberry Pi is a low-cost computing platform. The goal of the Raspberry Pi Foundation is to


make computing available to everyone globally to help them to learn programming. Since its
initial release in 2012, the Raspberry Pi has seen several enhancements in terms of the
amount of RAM, CPU power, peripheral support, and support for networking protocols; yet,
it has managed to hold on to its original US$ 35 price tag .

The latest version, Raspberry Pi 3, was announced in February 2016. It comes with a 1.2GHz
64-bit quad-core ARMv8 CPU, 1GB RAM, built-in wireless/Bluetooth support and much to
program them using a variety of programming tools/environments. In this article, let’s get
started with programming on the Raspberry Pi using one of the most popular languages in the
world, Python.

The Raspberry Pi has been nothing short of a revolution in introducing millions of people
across the world to computing and being one of the drivers behind introducing computer

GSSSIETW,Mysuru Page 17 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

programming to everyone. It has powerful enough hardware to get started with programming
and the US$ 35 price tag is hard to beat.

The makers of Raspberry Pi have also paid special attention to ensuring that barriers to
getting started are minimal. The recommended Linux distribution for Raspberry Pi, Raspbian,
comes bundled with multiple programming languages and IDEs so that you are ready to go
from the time you power on the mini development board.

Python, on the other hand, is one of the most popular languages in the world and has been
around for more than two decades. It is heavily used in academic environments and is a
widely supported platform in modern applications, especially utilities, and desktop and Web
applications. Python is highly recommended as a language that is easy for newcomers to
program. With its easy-to-read syntax, the introduction is gentle and the overall experience
much better for a newbie.

The latest version of the Raspbian OS comes bundled with both Python 3.3 and Python 2.x
tools. Python 3.x is the latest version of the Python language and is recommended by the
Raspberry Pi Foundation too.

5.2 CODE SNIPPETS


The methods used in the code (pseudo) are as follows:

def gpio_setup() {

//setup the GPIO pins of raspberry pi


}

def check_for_pump_start()
{

// This function uses the IMAP library to check the mail


from email account with the particular subject line
}

def send_email(to, subject, body) {


//uses SMTP server of email account to send an email for

GSSSIETW,Mysuru Page 18 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

the successful run of the pump


}

main method {
//calls GPIO setup
gpio_setup() {
while (true)

//check for the email


check_for_pump_start()
if (there is desired email)
International Conference on Computing, Communication and Automation (ICCCA2015)
930

//check for the number of minutes pump will


be run

//make GPIO pin of pi as high


//wait for X minutes
//send status mail for successful run
//make GPIO pin of pi low
}

Code for aurdino

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

String ssid ="NET";

String password="dontconnect";

int old = 1;

const int VAL_PROBE = 8; // Digital pin 8

const int MOISTURE_LEVEL = 250;

String uri = "192.168.43.179:8080/";

GSSSIETW,Mysuru Page 19 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

String server = "192.168.43.179";

void connectWIFI()

String cmd = "AT+CWJAP=\"NET\",\"dontconnect\"";

Serial.println(cmd);

mySerial.println(cmd);

delay(6000);

if(mySerial.find("OK")){

Serial.println("Connected!");

else{

Serial.println("Not Connected.");

mySerial.println("AT+CIPSTAMAC?");

connectWIFI();

void getRequest(String wdata="0"){

String cmd = "AT+CIPSTART=\"TCP\",\""; //make this command:


AT+CPISTART="TCP","192.168.88.35",80

cmd += server;

cmd += "\",8080";

mySerial.println(cmd);

//wait a little while for 'Linked'

delay(300);

//This is our HTTP GET Request change to the page and server you want to load.

if (old==0)

GSSSIETW,Mysuru Page 20 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

{cmd = "GET /1 HTTP/1.0\r\n";

cmd += "Host: "+server+"\r\n\r\n";

else{cmd = "GET /0 HTTP/1.0\r\n";

cmd += "Host: "+server+"\r\n\r\n";

Serial.println(cmd);

//The ESP8266 needs to know the size of the GET request

mySerial.print("AT+CIPSEND=");

mySerial.println(cmd.length());

Serial.println("AT+CIPSEND="+cmd.length());

//Look for the > prompt from the esp8266

if(mySerial.find(">"))

//Send our http GET request

Serial.println("Sending Data Now");

mySerial.println(cmd);

else

//Something didn't work...

Serial.println("Closed Connection");

mySerial.println("AT+CIPCLOSE");

void setup() {

// Open serial communications and wait for port to open:

GSSSIETW,Mysuru Page 21 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Serial.begin(9600);

pinMode(VAL_PROBE, INPUT);

while (!Serial) {

// wait for serial port to connect. Needed for native USB port only

Serial.println("START");

// set the data rate for the SoftwareSerial port

mySerial.begin(9600);

connectWIFI();

getRequest("1");

void loop() { // run over and over

int moisture = digitalRead(VAL_PROBE);

//Serial.println(moisture);

if (moisture!=old){

old = moisture;

Serial.println(old);

getRequest(old+"");

if (mySerial.available())

Serial.write(mySerial.read())

Code for raspberry pi

from flask import Flask


import RPi.GPIO as GPIO

GSSSIETW,Mysuru Page 22 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

app = Flask(__name__)
motorPin = 3
GPIO.setmode(GPIO.BCM)
GPIO.setup(motorPin, GPIO.OUT)
@app.route('/<state>')
def hello_world(state):
if state=1:
GPIO.output(motorPin, GPIO.HIGH)
else:
GPIO.output(motorPin, GPIO.LOW)
return 'done'
if __name__ == "__main__":
app.run(host='0.0.0.0',
port=8080, debug=True)

GSSSIETW,Mysuru Page 23 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Chapter 6

TESTING

6.1 SYSTEM TESTING


Before implementing the new system operation or functionality, a test run of the system
is done for removing the bugs. It is an important phase of any successful system. After
codifying the whole programs of the system, a test plan should be developed and run on a set
of test data. The output of the test run should match the expected results. System testing is
considered as a part of implementation process.
Testing involves a variety of things, but most importantly it measures the quality of the
software we are developing. This view will find out the defects in the software waiting to be
discovered and this view is rarely disproved or even disputed. Several factors contribute to
the importance of making testing a high priority of any software development effort. These
include
 Development cost of the program is reduced.
 Assuring that the application behaves exactly as we explain to user for the majority
of programs, unpredictability is the least desirable consequences of using an
application.
 The total cost of ownership is reduced. By providing software that looks and behaves
as shown in the documentation, fewer hours of training and less support from product
experts is sufficient for customers.
 Developing customer loyalty.

System testing is the process of checking the objective and requirements. It is a very critical
element of software quality assurance (SQA) and represents the review of specification,
design and coding. Testing represents an interesting anomaly i.e deviation from what is
actually required for the software. Thus, a series of tests are performed for the proposed
system before the system is ready for customer acceptance. Some of the various test cases
used to test the system are as follows
 The test cases are written for testing against requirements of the unit being tested.
 If the unit modifies the database, test for the integrity of the database after the
operation.

GSSSIETW,Mysuru Page 24 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

 Test cases for the path or branch coverage should be done.


 Test cases for data flow coverage should be done.
 Test cases based on the experience such as testing for boundary conditions-minimum,
maximum and off by one boundary.

6.2 TEST CLASSIFICATION

6.2.1 UNIT TESTING


Unit testing, a testing technique in which individual modules are tested to determine if there
are any issues and/or bugs by the developer. It is concerned with functional correctness of the
individual modules. The main aim is to isolate each unit of the system to identify, analyze
and fix the defects.

6.2.2 INTEGRATION TESTING


Upon completion of unit testing, the units or modules are to be integrated which gives raise to
integration testing. The purpose of integration testing is to verify the functional, performance,
and reliability between the modules that are integrated.

6.2.3 FUNCTIONAL TEST


Functional Testing is a testing technique that is used to test the features/functionality of the
system or Software, should cover all the scenarios including failure paths and boundary
cases.

6.2.4 SYSTEM TEST


System Testing is usually carried out by a team that is independent of the development team
in order to measure the quality of the system unbiased. It includes both functional and Non-
Functional testing.

6.2.5 WHITE BOX TESTING


White box testing is a testing technique that examines the program structure and derives test
data from the program logic/code. The other names of glass box testing are clear box testing,
open box testing, logic driven testing or path driven testing or structural testing.

GSSSIETW,Mysuru Page 25 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

6.2.6 BLACK BOX TESTING


Black-box testing is a method of software testing that examines the functionality of an
application based on the specifications. It is also known as Specifications based testing.
Independent Testing Team usually performs this type of testing during the software testing
life cycle.

6.2.7 INTEGRATION TESTING


Software integration testing is the testing of two or more integrated software components and
to examine the failures caused after integration.

6.2.8 ACCEPTANCE TESTING


Acceptance testing, a testing technique performed to determine whether or not the software
system has met the requirement specifications. The main purpose of this test is to evaluate the
system's compliance with the business requirements and verify if it is has met the required
criteria for delivery to end users

6.3 TEST CASES


Test case ID Test cases Testcase Status Remarks
description
01 Login Check whether the Pass The users are able
user can login to to login to the
the applications applications
correctly. correctly with
verified username
and password.
02 Arduino Check whether the Pass The Arduino is
Arduino is sending sending correct
appropriate signals messages and
and messages to signals to the
the Raspberry pi Raspberry pi
03 Water pump Check whether the Pass The motor pump
motor pump correctly pumps the

GSSSIETW,Mysuru Page 26 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

correctly pumps water to the plants


water to the plants. by receiving signals
from Arduino.
04 Moisture sensor Check whether the Pass The soil moisture
soil moisture sensor senses the
sensor senses the moisture in the soil
moisture in the soil and sends correct
appropriately. messages and
signals to the
Raspberry pi and
the pump.
05 Raspberry Pi Check whether the Pass The Raspberry pi
raspberry pi receives signals
receives signals from the Arduino
from Arduino and and displays
displays the appropriate events
corresponding on both the mobile
events on the and laptop
laptop and mobile.

Table 6.1: Test Cases

GSSSIETW,Mysuru Page 27 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

CHAPTER 7
RESULTS AND DISCUSSION
The results of the system is as shown below
Hardware Part

Figure 7.1: The model for the proposed system

Figure 7.2: The Arduino hardware used.

GSSSIETW,Mysuru Page 28 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

Figure 7.3: Final Prototype

In this work, we successfully develop a system that can help in an automated irrigation
system by analyzing the moisture level of the ground. The smart irrigation system proves to
be a useful system as it automates and regulates the watering without any manual
intervention. The primary applications for this project are for farmers and gardeners who do
not have enough time to water crops/plants.

The moisture sensors and temperature sensor measure the moisture level (water content) and
temperature of the different plants. If the moisture level is found to be below the desired
level, the moisture sensor sends the signal to the Arduino board which triggers the Water
Pump to turn ON and supply the water to respective plant. The system may be further
extended for outdoor utilization.

GSSSIETW,Mysuru Page 29 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

CONCLUSION AND FUTURE SCOPE

CONCLUSION
 Using this system, one can save manpower, water to improve production and
ultimately increase profit.
 The automated irrigation system is feasible and cost effective for optimizing water
resources for agricultural production.
 The system would provide feedback control system which will monitor and control all
the activities of irrigation system efficiently.

FUTURE WORK
This Smart irrigation proves to be the system automates for irrigation system and regulates
water for irrigation is done without manual Using this system, solenoid valves and relay
board can be controlled remotely which opens the opportunities to control the water flow as
well as the electrical flow.
Irrigation system is automated with depends on sensor Report the pump is operated by the
weather condition by soil, rain and temperature conditions the water pump will work and by
wireless zigbee the data is communicate and the sensor readings are uploaded into cloud
network by Wifi technology.

GSSSIETW,Mysuru Page 30 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

REFERENCES

[1] I. Bennis, H. Fouchal, O. Zytoune, D. Aboutajdine, “Drip Irrigation System using


Wireless Sensor Networks” Proceedings of the Federated Conference on Computer Science
and Information Systems, ACSIS, Vol. 5, 2015.
[2] Joaquín Gutiérrez, Juan Francisco Villa-Medina, Alejandra Nieto-Garibay, and Miguel
Ángel Porta- Gándara, “Automated Irrigation System Using a Wireless Sensor Network and
GPRS Module,” IEEE Transactions on Instrumentation and Measurement, vol. 63, no. 1,
January 2014.
[3] Sangamesh Malge, Kalyani Bhole, “Novel, Low cost Remotely operated smart Irrigation
system" 2015 International Conference on Industrial Instrumentation and Control (ICIC)
College of Engineering Pune, India. May 28-30, 2015
[4] Nikhil Agrawal, Smita Singhal, “Smart Drip Irrigation System using Raspberry pi and
Arduino” International Conference on Computing, Communication and Automation
(ICCCA2015) .
[5] Pravina B. Chikankar, Deepak Mehetre, Soumitra Das, “An Automatic Irrigation System
using ZigBee in Wireless Sensor Network,” 2015 International Conference on Pervasive
Computing (ICPC).
[6] Sneha Angal “Raspberry pi and Arduino Based Automated Irrigation System”
International Journal of Science and Research (IJSR) Volume 5 Issue 7, July 2016
[7] Bhagyashree K.Chate , Prof.J.G.Rana , “Smart irrigation system using Raspberry pi
“International Research Journal of Engineering and Technology (IRJET), 2016,
[8] Suprabha Jadhav1, Shailesh Hambarde,” Android based Automated Irrigation System
using Raspberry Pi”, International Journal of Science and Research (IJSR), Volume 5 Issue 6,
June 2016
[9] Nikhil Agrawal , Smita Singhal “Smart Drip Irrigation System using Raspberry pi and
Arduino” International Conference on Computing, Communication and Automation (ICCCA2015)
[10] Gajjala Ashok, Gogada Rajasekar, “ Smart Drip Irrigation System using Raspberry Pi
and Arduino” International Journal of Scientific Engineering and Technology for
Technology,2016
[11] HemaN., Krishna Kant, “Local Weather Interpolation Using Remote AWSData with
Error Corrections Using Sparse WSN forAutomated Irrigation for Indian Farming”, 978-1-
4799-5173-4/14/$31.00 ©2014 IEEE.

GSSSIETW,Mysuru Page 31 Dept. of ISE


Raspberry Pi and Arduino Based Automated Irrigation System

[12] A. R. AI-Ali, Murad Qasaimeh, Mamoun AI-Mardinia, Suresh Radder and I. A.


Zualkernan, “ZigBee-Based Irrigation System for Home Gardens” Department of Computer
Science and Engineering, American University of Sharjah, UAE 978-1-4799-6532-
8/15/$31.00 ©20 15 IEEE
[13] G. Nisha , J.Megala, Velammal institute a/technology ,Chennai,India, “Wireless sensor
network based automated irrigation and crop field monitoring system”, 2014 Sixth
International Conference on Advanced Computing (ICoAC) 978-1-4 799-8159-
5114/$31.00©20 14 IEEE
[14] Zhiyong Lai, Yongli Dai, “An Irrigation Control System Based On An FPGA” 2012
Second International Conference on Instrumentation & Measurement, Computer,
Communication and Control.
[15] Mahir Dursun and Semih Ozden, “A wireless application of drip irrigation automation
supported by soil moisture sensors” Scientific Research and Essays Vol. 6(7), pp. 1573-1582,
4 April, 2011.

GSSSIETW,Mysuru Page 32 Dept. of ISE

Anda mungkin juga menyukai