Smart Farming and Plant Disease Detection using IoT and ML

Download Full-Text PDF Cite this Publication

Text Only Version

Smart Farming and Plant Disease Detection using IoT and ML

Arathi Nair

Dept. of Electronics and Communication Engineering College of Engineering Kidangoor

Kottayam, India

Merry James

Dept. of Electronics and Communication Engineering College of Engineering Kidangoor

Kottayam, India

Gouripriya J

Dept. of Electronics and Communication Engineering College of Engineering Kidangoor

Kottayam, India

Sumi Mary Shibu

Dept. of Electronics and Communication Engineering College of Engineering Kidangoor

Kottayam, India

Shihabudeen H

Dept. of Electronics and Communication Engineering College of Engineering Kidangoor

Kottayam, India

Abstract The goal of the concept is to reduce the human involvement and thus to increase farmer procurement in agricultural sector. The majority of the time, farmers are unable to get a good yield, resulting in a decrease in income. This occurs due to a variety of significant reasons such as a lack of minerals, soil humidity, temperature changes, and so on. Furthermore, the high prevalence of illnesses in the crop has an impact on the harvest's quality and quantity. IoT sensors can provide information about agricultural areas and can be easily monitored, making smart agriculture a novel concept. The goal of this article is to create a Smart Agriculture System that utilizes cutting-edge technologies including Node MCU, IoT, Android, Wireless Sensor Networks, and Machine Learning. Monitoring climatic conditions and early diagnosis of plant diseases are two critical components of increasing crop output. A feature of the proposed system is the ability of a system to monitor temperature, humidity, and wetness through sensors using NodeMCU and send SMS warnings and a notification on the application intended for the same on the farmer's smartphone using Wi-Fi/3G/4G. A duplex communication link based on a cellular Internet interface is used by the system. Farmers can gain greater benefits from this reliable, non- destructive technology by detecting plant diseases earlier. By utilizing three classes of tomato plants (two infected and one healthy), system for smart farming and plant disease detection using IoT and ML was developed.

Keywords Smart Farming; Internet of Things (IoT); Soil Moisture sensor; Temperature and Humidity sensor; MachineLearning; VGG16.


    The art and science of cultivating the soil, growing crops, and raising livestock is known as agriculture. It is more than just an industry; it is the foundation of human society, as the purpose is not merely to cultivate food, but to

    achieve human perfection. The foundation for a happy and healthy society can be found in a thriving and wealthy agriculture industry. Because of the shrinking agricultural workforce in recent decades, the adoption of internet connectivity solutions in farming techniques has been sparked to lessen the demand for physical labor.

    The Internet of Things (IoT) is a technology that allows any device to send or receive data over the Internet to a server. IoT solutions are aimed at assisting farmers in closing the supply-demand gap by ensuring high yields, profitability, and environmental preservation. The method of utilizing IoT technology to assure the most efficient use of resources in order to generate high crop yields while lowering operating costs. Sensors connected to the internet of things can provide data on agricultural lands. Farmers can use this technology to check the actual state of their crops without having to be present in the field.

    They surveyed various common uses of Agriculture IoT Sensor Monitoring Network technologies employing Cloud computing as the backbone in their study [1]. This survey will be used to better understand the various technologies and to develop sustainable and intelligent agriculture. Equipment for indicating, observing, and controlling moisture levels as well as creature detection is available. The soil dampness sensor detects and measures the amount of moisture in the soil. The critters are detected by the PIR sensor, and a high recurrence sound flag is set. The pH sensor and the water stream sensor are used to speed up the composting process.

    This data is prepared, and the ideal water level will be sent to the field by spontaneously switching on the water pump's power supply. Address for the supplied

    microcontroller, which is configured to deliver the sensor's data to the client via a website page displaying the field's current condition. They have designed a smartphone app for farmers and VA officers as part of the intended effort. The farmer and the VA officer can both use the app to receive information on the land [2].

    The review presented in the publication [3] provides informational expertise in the realm of agriculture that researchers might utilize to detect diseases early. Plant diseases are caused by biotic and abiotic factors that impair crop yield. Plant illnesses are diagnosed by extracting and categorizing information from plant photos, which aids in determining whether a plant is healthy or unhealthy. Crop productivity is increased when diseases are detected early. This work [3] discusses numerous image processing approaches for feature extraction, segmentation, and classification that have been used by various agricultural researchers. The effects of various image processing technologies on various plants are discussed. For the identification of plant leaf diseases, there are a variety of image processing approaches that include image capture, image pre-processing, image segmentation, feature extraction, and image classification. Because noise makes disease detection difficult, many types of filtering techniques can be employed to de-noise the image so that diseases can be detected efficiently and clearly.

    Plant disease recognition using digital and cell phone camera photos is proving to be difficult. The application of several machine learning algorithms for plant disease categorization has recently become popular, with encouraging results in a few diseases and crops. The development of deep Convolutional Neural Network (CNN) based architectures has considerably improved classification accuracy. In this research, we present a method to monitor farmland using IoT technology, and we employed a VGG16 pre-trained deep learning model to identify two different diseases and a healthy class of tomato crop from an image dataset. Various sensors can send data over the Internet using this approach. Farmers can use a smartphone to remotely monitor their field from their home. This system creates an intelligent solution for monitoring numerous elements that affect agricultural cultivation as well as increasing crop productivity by detecting plant illnesses early. A soil moisture sensor, a humidity and a temperature sensor (DHT11) are all part of the IoT system. It is responsible for connecting these sensors to the NodeMCU (ESP8266). The following is a flow diagram of our planned IoT system:

    Fig. 1. Flow Diagram of IoT System

    Agriculturists in provincial areas may believe it is difficult to distinguish between the diseases that may be present in their harvests. It is not reasonable for them to visit an agri-business office to determine the nature of the infection. Our goal is to use image processing and machine learning to distinguish the illness in a plant by looking at its morphology. Overall, employing machine learning to train big publicly available

    data sets provides a clear technique to identify illness in plants on a massive scale.


    Th goal of this study is to create a smart system for monitoring agricultural land and detecting plant diseases. The following are expected outcomes in order to meet the objectives:

    • To identify the various diseases that impact plants at various stages of development.

    • To keep track of variables such as soil moisture, temperature, humidity, and dew point.

    • Using a mobile application, provide farmers with real- time alerts and notifications.

    • To make farming easier for farmers by allowing them to manage their operations from the comfort of their own homes.


    Farmers can use an IoT-based system and a mobile application as part of the Smart Agriculture System. On the hardware side, we have an Internet of Things-based system that measures numerous metrics such as soil moisture, temperature, and humidity. An android app for farmers is included in the software section. We created an Android app that is connected to the hardware system via IoT and alerts the farmer so that he or she may monitor the live status of temperature, humidity, and other field factors at any time using the app.

    1. IoT System

      Temperature-Humidity (DHT11), Soil moisture, and other parameters are monitored using an IoT-based system (soil moisture sensor). The IoT system's circuit diagram is shown in the diagram below.

      Fig. 2. Circuit Diagram of the IoT System

    2. Components

      1. Temperature and Humidity sensor (DHT11)

        The DHT11 is a basic digital temperature and humidity sensor with a modest price tag. It measures the ambient air with a capacitive humidity sensor and a thermistor and outputs a digital signal on the data pin. It is simple to use, but data collection takes careful scheduling.

        To find dew point, dew point=(C-(100-H)/5) Where, C=temperature value in degree Celsius

        H=Humidity value

        Fig. 3. Temperature and Humidity Sensor

      2. Soil Moisture Sensor

        A soil moisture sensor is a device used to determine the volumetric water content of soil. The sensor uses other soil indirectly detect volumetric water content without removing moisture. Because environmental factors like as soil type, temperature, and conductivity might affect the outcome, it must be calibrated. properties like as electrical resistance or conductance, dielectric constant, and interaction with other neutrons to indirectly detect volumetric water content without removing moisture. Because environmental factors like as soil type, temperature, and conductivity might affect the outcome, it must be calibrated.

        Fig. 4. Soil Moisture Sensor

      3. NodeMCU

    NodeMCU is an open-source firmware. The firmware as well as the prototyping board designs are both free sources [10]. The firmware was created using the Espressif Non-OS SDK for ESP8266 and is based on the eLua project. It makes use of a number of open-source projects, including lua-cjson and SPIFFS. Users must select the components important to their project and construct a firmware tailored to their needs due to resource limits.

    A circuit board that functions as a dual in-line package (DIP) that merges a USB controller with a smaller surface-mounted board housing the MCU and antenna is commonly used as prototype hardware. The design was based on the ESP8266s ESP-12 module, which is a Wi-Fi SoC with a Tensilica Xtensa LX106 core that is frequently used in IoT applications.

    Fig. 5. NodeMCU

    These sensors collect data such as temperature, humidity, and moisture level from the farms and send it to the Node MCU, where the data is stored (ESP8266). Node MCU is a Lua- based open-source firmware and development board designed specifically for IoT applications. It consists of firmware that runs on Espressif Systems' ESP8266 Wi-Fi SoC and hardware that is based on the ESP-12 module. The values from the sensors are kept in the Node MCU's connection to the IoT analytics platform service ThingSpeak. The following is the hardware section of the smart agriculture system:

    Fig. 6. Hardware System


    In the realm of machine vision, plant disease detection is a very important research topic. By acquiring photographs of the same, machine vision equipment is used to determine whether there is illness in the gathered plant images [4]. Plant disease detection equipment based on machine vision is currently used in agriculture, and it has mostly supplanted the conventional naked eye identification approach. For traditional machine vision-based plant disease diagnosis methods, traditional image processing algorithms or human feature design with classifiers are frequently utilized [5]. This method builds the imaging scheme and determines a suitable light source and shooting angle based on the diverse features of plant diseases, which helps to generate images with uniform illumination. While correctly developed imaging schemes can substantially reduce the difficulty of designing traditional algorithms, they also

    increase the cost of implementation. Plant disease identification in a genuine complicated natural environment presents multiple problems, including a modest difference between the lesion region and the backdrop, low contrast, substantial fluctuations in the scale of the lesion area and different types, and a lot of noise in the lesion image. Furthermore, when taking plant disease photos under natural light circumstances, several disruptions arise. Traditional classical approaches typically appear powerless at this time, and better detection results are difficult to get.

    Traditional plant disease detection technologies have a number of drawbacks. To solve this, we used a dataset from Kaggle [9] in our disease identification technique. The dataset contains approximately 895 pictures and is divided into three classes: Bacterial spot, Healthy, and Early Blight. We use the VGG16[6] pre-trained model, which is a convolutional neural network model (CNN) [7] for training. We use this model to load our dataset, resize the photos, and divide it into test and training data. From each class, 716 images are utilized to train and 179 images are used for testing. After that, the model is set up to perform the training.

    The model has a validation loss of 0.4 and a validation accuracy of 0.6, with an output train loss of 0.22 and a train accuracy of 0.78. The model is saved to the current directory after it has been trained. After that, the model is imported into the main code for disease detection. The primary code is hosted on Amazon Web Services' (AWS) free tier. The http protocols are used by the android application to communicate with it. The program accepts an image, converts it to base64 format, and sends it to the AWS server via a post request with URL encoding. The plant's illness will be the answer. If no sickness is found, a response of "healthy" will be given. If an illness is identified by its class name, we can offer important advice on how to resolve the problem.

    Fig. 7. Flow Diagram of Machine Learning

    CNN has a lot of advantages when it comes to picture feature extraction. CNN, like a biological neural network, minimizes the complexity of the network model and the number of weights by using a weight-sharing network topology. VGG16 has a deeper structure than LeNet, AlexNet, and ZFNet, and can extract features more effectively. The maximum pooling layer follows each of the five convolutions in the VGG structure [8].

    Fig. 8. Example of output showing the readings of the Temperature sensor.

    The value of temperature was estimated as 30 Degree Celsius.

    Fig. 9. Example of output showing the readings of the Humidity sensor. The humidity was estimated to be 77 percentage

    Fig. 10. Example of output shows the readings of the Soil Moisture Sensor.The soil moisture reading was estimated to be 42.33 percentage.


    The mobile application calcuates and displays several metrics such as temperature, humidity, and moisture level. The following figures explain how to measure temperature, humidity, and soil moisture in this study. The graphs were examined using ThingSpeak, an IoT analytics tool that allows users to gather, visualize, and analyze live data streams in the cloud.

    The experimental analysis' dewpoint was estimated to be

    25.4 degrees Celsius.

    The second important aspect of our study is determining if the crop is infected or healthy, as depicted in the diagram.


This paper explores IoT-based Smart Farming technology, as well as Machine Learning-based plant disease detection. This technology decreases farmers and growers physical labor, increasing output in every way conceivable. Wireless sensors, cloud computing, communication technologies and various machine learning algorithms are all discussed in depth for this purpose. Tomato crop disease classification was performed using photos from the Kaggle dataset and the VGG16 pre-trained deep learning architecture.

Fig.11. Output of classifier showing Healthy leaf of Tomato

Fig. 12. Output of classifier showing Disease-Early Blight

Fig. 13. Output of classifier showing disease-Bacterial Spot

For disease identification, three groups were used: healthy, bacterial spot, and early blight.


  1. Mahammad Shareef Mekala, Dr.P. Viswanathan, A Survey: Smart Agriculture IoT with Cloud Computing, VIT University,978-1- 5386-1716-8/17/, Aug 2017, IEEE.

  2. K.T. E Keerthana, S. Karpagavalli, A. Mary Posonia, Smart System Monitoring Agricultural Land using IoT, International Conference on Emerging Trends and Innovation in Engineering and Technological Research (ICETIETR), 2018

  3. Gaganpreet Kaur, Sarvjeet Kaur, Amandeep Kaur, Plant Disease Detection: A Review of Current Trends, Sri Guru Granth Sahib World University, International Journal of Engineering and Technology, 7(3.34) ,874-881, 2018.

  4. Lee SH, Chan CS, Mayo SJ, Remagnino P. How deep learning extracts and learns leaf features for plant classification. Pattern Recognition. 2017,71:113.

  5. Tsaftaris SA, Minervini M, Scharr H. Machine learning for plant phenotyping needs image processing

  6. Aravind Krishnaswamy Rangarajan, Raja Purushothaman, Anirudh Ramesh, Tomato Crop Disease Classification using Pre-Trained Deep Learning Algorithm, International Conference on Robotics and Smart Manufacturing,2018

  7. Ms. Nilam Bhise, Ms. Shreya Kathet, Mast. Sagar Jaiswar, Prof. Amarja Adgaonkar, Plant Disease Detection using Machine Learning, International Research Journal of Engineering and Technology (IRJET), Volume: 07 Issue: 07July 2020

  8. Chenglin Wang, Tianhong Luo, Lijun Zhao, Yunchao Tang and Xiangjun Zou, Window Zooming-Based Localization Algorithm of Fruit and Vegetable for Harvesting Robot, Digital Object Identifier 10.1109/ACCESS.2019.2925812

  9. Hardikkumar S. Jayswal and Jitendra P. Chaudhari, Plant LeafDisease Detection and Classification using Conventional Machine Learning and Deep Learning, International Journal on Emerging Technologies, 2020

  10. Yogendra Singh Parihar, Internet of Things and Nodemcu – A Review of Use of Nodemcu ESP8266 in IoT Products,JETIR,Volume6, Issue6,June2019

Leave a Reply

Your email address will not be published. Required fields are marked *