KSCSTE Project- IOT based Automated Intelligent Irrigation System with Disease Analysis & Nutrient Detection using Image Processing

Hi everyone! This is our project which we implemented for making irrigation smarter. We implemented in 2 phases:

  1. A timer based drip model
  2. An IOT based model
Proposed Initial Model
IOT based Model


In a world trying to automate almost everything , the thought arose , why not automate the irrigation system , thereby boosting the yield and playing a pivotal role in water conservation . The project we worked on, uses a microcontroller inorder to control the water flow , according to the water requirement of the plant species.Initially we decided to implement a timer based drip system where we can irrigate according to a particular time so that we can save water. Here we interfaced a RTC Timer, Soil moisture sensor and a solenoid Valve with the Arduino Microcontroller board. The soil moisture sensor detects the amount of moisture present in the soil based on which we will set a threshold value for both wet and dry soil. This process is done only between a particular time so that we can save power and water. The irrigation is done through solenoid valve.

Get more about arduino here

Sensor Testing

Block Diagram

Block Diagram

Basic Working

The plant species are unique , each with a different water requirement . Based on their requirement , the flow is controlled .

For this , there is a moisture sensor , which determines the amount of moisture in the soil based on the soil resistance , which varies from soil to soil.Suppose a plant , say cabbage , requires X litres of water for optimum functioning . At a prescribed time , say 7am to 8am and 5pm to 6pm , the timer is activated , and the moisture sensor scans the resistance of the soil.If the resistance is found to be greater than a prescribed value , the field needs to be irrigated . The water is allowed to flow through a current controlled solenoid valve , until the soil resistance comes down to the preset value . The water requirement of the plants will be stored as a database in the arduino , and the resistance comparison will be made with respect to these values.

This concept can be used for N number of plants , and the watering can be done based on their individual moisture requirement . Suppose there are two plant species . Two moisture sensors will be used in this case , which control two solenoid valves.

Along with irrigation , another concept which is being introduced , is that of fertigation , which basically means irrigation plus fertilizer supply.

Circuit Diagram

Step by Step Circuit Break up

  1. Sensor
Moisture sensor Interface

Get more about soil moisture sensor here.

2) Timer

RTC Timer Interface

Get more about RTC Timer here.

3) Solenoid Valve

Solenoid Valve Interfacing

Get more about Solenoid Valve here.

4) Combined

Complete Circuit

Get the final program code here

PCB Implementation of the project

The whole circuit was made into a module using a PCB. The design is shown below:

PCB Layout


We visited the Kerala rice station on 11th February 2016 to conduct a literature survey for the project.

Agenda of the Visit:

-To study the wetness requirements of different plants and soil

-To study the frequency of wetting needed for the soil

-To study drip irrigation system

-To study nutrient requirements of plants and detection of nutrient content in plants

Field Visit:

We were taken to the field to observe drip irrigation. We were accompanied by the resource persons along with one of the research students.

We observed various vegetable cultivation like chilli, tomatoes and cauliflower. The cauliflower was irrigated using drip irrigation system. There we came across a new technique called “FERTIGATION” wherein fertiliser will be added along with water using a tube called “VENTURI”


· Better understanding about wetness requirements of the plants

· Implementation of fertigation technique

· Frequency of wetting of plants

· Clear understanding about drip system

Drip & Venturi System

Final Prototype

The working prototype of the project is given in the video below:

We referred to many research papers for the project. Get them here

Project Poster

We participated in several project exhibitions. The poster for the same can be seen below


This project was completed over a span of 4 months. The drip system was automated. Now we thought of making the project smarter. Also the concept of IOT was trending and everything was becoming digital. Hence we thought of introducing the concept of IOT into this project so that everything can be controlled by hand held devices

Phase 2- IOT based irrigation system

In phase 2 we implemented a weather based smart irrigation system using the concept of internet of things. Here the irrigation is based on the values of temperature and humidity. We used a raspberry Pi to obtain the temperature and humidity readings which is obtained on a webpage by initiating the inbuilt raspberry pi web server. In the phase we also made a prototype of an android application using which the irrigation becomes even smarter. Basically using the application, we are giving a manual plus automation option for the irrigation system. The threshold for temperature and humidity was set based on which the solenoid valve was operated.The readings will be obtained in an android application where the user can see the readings dynamically and operate the valve using the application.

Setting up the Raspberry PI

The OS for the PI board was installed and the PI terminal can be accessed in the laptop using PUTTY. This can be done once the IP address for the raspberry pi can be obtained. The OS used by PI board is called the Raspbian OS. It is installed in memory card which is then plugged on to the PI board. We used a PI 2B version of Raspberry Pi for our project.

Get more about Raspberry pi here

How to install Raspbian?

The Putty Terminal

Each Raspberry Pi has a unique IP address with which we can communicate with the board using a suitable terminal. For windows we use the putty terminal which can otherwise be accessed using Linux.


Once the IP address has been set up we can login using a username and password. The programming in raspbian is done using python language.This is how a raspberry pi terminal looks like!

PI Terminal

Interfacing DHT11 temperature-humidity sensor with raspberry PI


The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data.

Get more about DHT11 here

How to interface DHT11 with Raspberry PI?

Next we obtained the sensor readings on to a webpage. Raspberry PI has an inbuilt Apache Webserver using which we can obtain the readings on to a webpage.The webpage which we made looks like this;

Our Webpage

Now we need to access this webpage anywhere. As of now the raspberry pi is connected to the local host.Hence to access it elsewhere we need Wifi. To help the cause we interfaced USB Wifi dongle to the raspberry pi which can be configured to any Wifi connection by changing username and password.

WIFI connected to Raspberry PI

The webserver inside Raspberry Pi cannot be used for data processing. So we need a cloud server to push the date to the cloud. This is done using socket programming.So we purchased a cloud server and created a socket to the server.

Get more about socket programming here

A client and server code is done inside raspberry pi. Client program pushes sensor data to the server where it is compared with the threshold value. Depending on the threshold value the solenoid valve is opened or closed.

Data processing in the server and feedback sent to the raspberry pi

Now the entire processing is done in the cloud and the raspberry pi is just used a device to connect sensor to the cloud. The IOT concept has taken effect now. The final step is to obtain this on an application on a hand held device. For this we need to build a database.

Database has been created

Once the database is created an android application can be made. We have made a prototype of the android application. Each user has a unique ID with which the user can login. Once logged in the user can see the sensor readings on the application and we give a manual touch to it by providing a provision to control the solenoid valve through the application.

IOT APP.apk (prototype)

The Final prototype can be seen below;

Final Prototype

The Web application looks like this:

Data pushed to server which is obtained in the webapp
1) Before Log in 2)Farm Dashboard 3)Farm Object
4) Farm Database 5)Log out

Each Farmer gets unique login and password with which the farmer can login to see his farm dashboard. The dashboard has the temperature and humidity details . An override button is also given which when set to 1 switches off the solenoid valve manually. The valve will be on according to threshold conditions of temperature and humidity.

Now the irrigation has become smart and everything is connected across the internet. Hence we have made a prototype of our proposed project “IOT based smart irrigation system”.

The main objectives of this project is that it conserves:

1) Time : The time of the person , who controls the irrigation system , is saved. People do not have to water plants from now on. It is automated

2) Money : The cost of water required for irrigation is reduced , in areas where there is a shortage of water .

3) Water : Conservation of water is the major objective of this project . Irrigation can be skipped in case of monsoon , and it ensures that plants aren’t excessively watered as well .

4) Man power : There needn’t be a person taking care of the irrigation system , as it will be fully automatic.

Future Scope

As an add-on to this project we are planning to implement the concept of “Fertigation” where the water soluble fertilizers for the plants will be given along with the irrigation. Basically speaking it is Fertilizer + Irrigation. We are planning to determine the defects in the plant by image processing techniques using Fractal Algorithm and the required amount of fertilizer is fed through irrigation.

Image Processing

The image processing was done in MATLAB.Here we have divided the project into 2 aspects:

1.Rice Disease Detection

2.Nutrient Detection based on LCC

We chose rice as it is the staple crop of Kerala. We implemented the project for detecting the two most commonly occurring diseases in rice namely:

  1. Bacterial Blight
  2. Brown Leaf spot

Farmers were not able to detect these disease at an early stage.That is when we decided to implement this using image processing techniques as it helps identify even the minute details that are not visible to the naked eye.The basic flow for disease detection is given below:

Flowchart for disease detection

Here we have used K means clustering technique to segment image and extract various properties which form the basis for the classification of the disease using an SVM classifier. The algorithm for K means clustering is shown below:

K-Means Algorithm

We used 10 properties obtained by K-means segmentation for classification of the diseases. The 10 properties are listed below:






6.Standard deviation




10. Smoothness

The two diseases correspond to different values of the above said 10 properties. These values are fed to a support vector machine which classifies the disease based on a hyperplane separating the different sets of values corresponding to a disease.The sequence of steps are given below:

SVM — supervised learning models with associated learning algorithms that analyse data used for classification.

2.Defined by a separating hyper plane

3.Builds a model that assigns new examples to one of the categories.

4.Points in space — separated by gaps, as wide as possible

5.New examples mapped into same space — predicted to which category it belongs

However in this process the user has to manually select the cluster that has the disease. We are working on automating this process currently.

We successfully identified Bacterial Blight in rice!

Now moving on to Nutrient detection aspect.Nitrogen is the most important nutrient for rice.However farmers found it difficult to know when to feed the crops with nutrients. On research at Kerala Agriculture University, we came to know that there is a standard leaf colour chart for nitrogen detection for rice.We decided to take real time image of rice leaves and compare with the colour chart to provide a feedback to farmers on when to feed nutrients to the crops.But the amount of nutrient to be fed requires more research.

Leaf Colour chart for rice

The flowchart for nitrogen detection is given in the flowchart below:

Nutrient Detection Flowchart
Nutrient supply detected

LCC 2 indicates deficient nitrogen

LCC 3 and 4 indicates nitrogen supply is optimum

LCC 5 indicates excess

Here we take average of 4 and 5 to be excess

Advantages of this project

1 this work allows easy disease detection at an earlier stage and hence allows the farmer to take necessary steps to avoid loss

2 facilitates nutrient deficiency (nitrogen) and allows farmer to add sufficient nitrogen to enhance the produce

3 Reduce water wastage

4 Significantly reduces manual labour

5 It can be completely automated in future and can be used to identify variety of diseases

After successful completion of the project, wrote a paper on the same and got it published during IEEE Region 10 Symposium APAC coneference in July 2017.

That sums it up!

Thanks for reading folks.

Like what you read? Give Jairam Sankar a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.