Detection of Pesticides in Organic Fruits and Vegetables Using IOT and ML

DOI : 10.17577/IJERTV13IS020022
Download Full-Text PDF Cite this Publication

Text Only Version


Detection of Pesticides in Organic Fruits and Vegetables Using IOT and ML

S. Saran, P. Pravallika, K. Gopichand, U. Sudheer, G.V. Vinod

Electronics and Communication Engineering Godavari Institute of Engineering and Technology (A)


The abstract describes an extensive technique that uses gas sensing, pH sensing, and triad spectroscopy to detect pesticides. Triad spectroscopy sensor measures the presence of pesticides by examining light intensity at different wavelengths. pH levels and gas concentrations are simultaneously measured by pH and gas sensors. A Python-based system that processes the gathered data using machine learning methods receives it. A buzzer sounds to inform users if pesticides are found; if not, an LCD screen shows that the sample is pesticide-free. An adaptable and efficient pesticide monitoring system is provided by this integrated method.


LCD, Triad spectroscopy sensor, pH sensor, Gas sensor, Buzzer.

  1. INTRODUCTIONSince technology is always changing these days, individuals are currently adopting instantaneous equipment to save time and increase efficiency. As is generally known, technological devices also alter the lives of men. The generator is one of the devices.

    An innovative method for guaranteeing the safety of organic produce is the combination of Python-embedded machine learning (ML) with the Internet of Things (IoT). By detecting pesticides, this cutting-edge device provides a preventative measure to preserve the quality of organic goods. The approach offers a sophisticated way to detect and warn about the presence of pesticides in organic fruits and vegetables by utilizing IOT for real-time data collection and ML algorithms developed in Python for intelligent analysis. This creative combination of technology not only solves the increasing worry about pesticide contamination but also represents a significant advancement in guaranteeing the genuineness and calibre of agricultural products that are certified organic.

    One type of computer system that is primarily made to do several jobs, such as accessing, processing, storing, and controlling data in various electronics-based systems, is called an embedded system. Hardware and software are combined to create embedded systems; the software is typically referred to as firmware and is embedded inside the hardware. One of these systems’ most crucial features is that it provides the output within the allotted time. Embedded systems help to improve the efficiency and convenience of work. Thus, embedded systems are widely used in both basic and complicated devices. In our daily lives, embedded systems are mostly used for a variety of gadgets, such as calculators, TV remote controls,

    traffic control systems for our neighbourhood, home security systems, and microwaves.

    Fig1: Overview of Embedded System


Shalini Gnanavel [1] in 2017 proposed a method in which fresh fruits and vegetables of every kind are readily available in India due to the country’s varied environment. After China, it comes in second place in the world for fruit output. According to the National Horticulture Board’s National Horticulture Database,

90.2 million metric tons of fruits were produced in India in 2018

  1. India leads the world in the production of bananas (25.7%), papayas (43.6%), and mangoes (40.4%) among other fruits. Fruit quality affects shelf life because post-harvest handling and supply chain management place a premium on fresh goods. Unfortunately, as more and more are consumed, mangoes and bananas are artificially ripened. Pesticides used in the production of these fruits have the potential to cause significant harm to humans.R Chandramma [2] in 2020 has proposed a model in which in the modern agricultural sector, exporting large amounts of fruit to foreign nations is a challenging undertaking. Farmers in this field require manual examination. By recognizing diseases in fruits and vegetables and helping farmers pack their produce as quickly as possible, our method saves them time and enables them to deliver fresh produce as soon as feasible. For the detection of diseases and fruits and vegetables, we employ the CNN algorithm. The image is first segmented using a neural network, and then certain attributes are extracted. Lastly, the image of fruits and vegetables is detected and named.

    Chang-Chi Lee [3] in 2015 has proposed a study which builds a pesticide residue testing system for fruits and vegetables using color identification technology, which can lower testing costs and expedite testing. The suggested system involves using a network camera and Raspberry Pi 3B to perform color identification processing on the rate at which the color of the pesticide test solution changes chemically under the QT Creator compiler, citing the Acetylcholinesterase (AChe) pesticide testing method, and then converting the pesticide concentration. The RGB color values for every pixel in the camera photos were transformed.

    Xia Sun [4] in 2010 proposed a paper in order to quickly identify pesticide residues in fruits and vegetables, a pesticide detection system based on an amperometric acetylcholinesterase biosensor is devised in this work. In order to detect pesticide residues, this device used the electrochemical property of the acetylcholinesterase biosensor’s catalytic substrate. The prepared biosensor’s cyclic voltammogram (CV) behavior is examined, and the data acquisition and processing circuit for the biosensor’s weak current signalswhich includes I/V conversion, differential amplification, low-pass filtering, A/D conversion, and other functionsis designed based on this characteristic of the CV. In the end, a voltage signal of around 0.5V is acquired, which is proportional to the modest current coming from the enzyme biosensor. Using the detection technology, four different types of standard pesticides were tested at various concentrations.

    Archana B S [5] in 2021 proposed a paper in human’s daily life fruits and vegetables are indispensable. So there arise an extensive need for them. In order to increase the production and to extend the life of fruits and vegetables, there require various types of toxicants. Constant use of these pesticides is hazardous to our environment and also have adverse effect on human health. Main purpose of this paper is to document and examine the different techniques used to detect the pesticides in fruits and vegetables. These techniques help to increase the efficiency and ensures the quality of fruits and vegetables.

    Wang Changlong [6] in 2009 has proposed a paper based on a mini-colorimeter, this research describes a quick approach for detecting pesticide residues in vegetable or water samples. Integrated circuit amplifiers, photodiode receivers, and emitting diodes make up the mini- colorimeter’s condition circuit and response signal. The system’s central CPU is a single chip. Four nixie tubes show the pesticide concentration (PPM). A mathematical model based on neural networks is developed to determine the pesticides’ residual concentration. 0~\6 PPM omethoate and Chlo salicylamide supervised samples are used to train the neural network weigh matrixes. Samples of green groceries have pesticide residues found in them. Measuring the levels of organophosphate pesticide residues in a greengrocery sample or Chlo salicylamide in a water sample takes one minute using this meter.

    1. EXISTING SYSTEMHistorically, time-consuming and labour-intensive techniques have been used to identify pesticies in organic fruits and vegetables. Conventional methods often start with sample extraction and then use mass spectrometry in conjunction with chromatographic methods like liquid or gas chromatography. These techniques can be costly and call for specialist staff and equipment. Furthermore, there could be a delay in the turnaround time for the results. Real-time monitoring may not be possible if chemical analysis is the only method used, and large-scale testing may be hampered by the necessity for careful sample preparation. With its combination of several methodologies for improved accuracy and speed, the suggested systemwhich combines triad spectroscopy, pH sensing, and gas sensing technologiespresents a more creative and effective approach to pesticide detection. The procedure is further streamlined by the incorporation of machine learning algorithms, which allows instantaneous detection of pesticides and real-time analysis, offering a flexible and efficient approach to pesticide monitoring in organic products.

The combination of gas sensing, pH sensing, and triad spectroscopy technologies is the suggested approach for pesticide detection in organic fruits and vegetables. While gas sensors find gas concentrations and pH sensors measure pH, triad spectroscopy uses light intensity at various wavelengths to identify pesticides. A Python-based system receives the gathered data and uses machine learning methods to process it. In this suggested approach, a buzzer is activated for instant alerting in the event that the algorithms identify pesticides. On the other hand, a good result verifying the safety of the produce is shown on an LCD screen if no pesticides are found. By improving pesticide monitoring, this all-inclusive and automated method seeks to protect organic agricultural products.

Fig 2 : Block diagram of Proposed model

    1. Arduino Mega 2560: A microcontroller board based on the ATmega2560 is the Arduino Mega 2560 (datasheet). It contains 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator,54 digital input/output pins (14 of which can be utilized as PWM outputs), a USB connector, a power jack, an ICSP header, and a reset button. It comes with everything needed to support the microcontroller; all you need to do is power it with a battery or an AC-to- DC adapter or connect it to a computer via a USB cable to get going.
    2. Triad Spectroscopy Sensor: Spectroscopy sensors are instruments that study the interaction of materials and electromagnetic radiation using spectroscopic methods. They are extensively employed to ascertain the composition of substances in a variety of domains, such as chemistry, biology, environmental science, and food analysis. A group or collection of three linked parts or components is referred to as a “triad” frequently. This could refer to a system or sensor in scientific instruments that makes use of three distinct approaches, wavelengths, or detecting strategies for improved analysis or accuracy.
    3. Ph Sensor: The pH sensor is a type of sensor that measures the concentration of hydrogen ions in a solution and produces an output signal that can be employed. Typically, it consists of a signal transmission component and a chemical component. The digital representation spans the measurement range of 0 to 14. Neutrality is indicated by the number
      1. The alkalinity increases with a greater number, and the acidity increases with a lower value. The pH sensor is frequently employed in industry to measure materials like water and solutions.
    4. MQ135 Sensor: In the modern technological environment, it is crucial to monitor the gasses generated. Gas monitoring is essential for everything from electric chimneys and safety systems in companies to air conditioners in homes. Gas sensors are a crucial component of these kinds of systems. Gas sensors are tiny, similar to a nose, and they respond spontaneously to the gas in the environment, informing the system of any changes in the concentration of molecules in the gaseous state.
    5. Buzzer: An auditory signalling device, such as a buzzer or beeper, can be piezoelectric, electromechanical, or mechanical. Buzzers and beepers are commonly used in alarm systems, timers, and to confirm user input, such as mouse clicks and keystrokes. In computers, printers, copiers, alarms, electronic toys, automobile electronics, telephones, timers, and other electronic products for sound devices, buzzers are an integrated structure of electronic transducers and DC power supply. This section’s specialized sensor expansion module and the board, when combined, can finish a straightforward circuit design that is “plug and play.” An active buzzer with a 5V rated power can be immediately attached to a continuous sound.
    6. LCD (16X2) Display: Scratch pad displays and other smaller PCs use LCD (Liquid Crystal Display) technology. Similar to gas-plasma and light-producing diode (LED) innovations, LCDs enable presentations that are far slimmer than those made using cathode beam tubes (CRT). Since LCDs operate by blocking light rather than emitting it, they use a great deal less electricity than gas and LED displays.
    1. Arduino IDE: The official software offered by, the Arduino IDE (Integrated Development Environment) is primarily used for creating, compiling, and uploading code to the Arduino device. This is an open- source program that you can easily install and begin compiling code on the fly, and it works with almost all Arduino modules.
    2. Python IDLE: An integrated development environment (IDE) for Python is called DLE (Integrated Development and Learning Environment). By default, the Python installer for Windows includes the IDLE module. Python distributions for Linux do not come with IDLE by default. Installing it requires the use of the appropriate package managers.

Random Forest Algorithm: In machine learning, it’s a well-liked ensemble learning technique. It is a classification and regression task-specific extension of decision tree methods. In essence, a Random Forest is a grouping of decision trees, each of which is trained using a different subset of the data and generates its own predictions. The results from each tree are then combined to get the final prediction.

Fig 3: Random Forest Algorithm

    1. IMPLEMENTATIONA fruit is first placed in front of the triad spectroscopic sensor. The sensor then looks over the fruit. We utilize a pH sensor to measure the pH and a MQ135 sensor to detect any gas produced by the fruit. In machine learning, we generate a dataset of high-quality fruit using the Random Forest algorithm. It is possible to compare the triad spectroscopy sensor’s values with the previously established dataset. The fruit will be shown on the LCD when the ML determines it is good; if not, a buzzer will sound.
    2. RESULTS AND DISCUSSIONSFig 4: Python dataset creation

      Fig 5: ML predicts good fruit in LCD

      Fig 10: ML predicts bad fruit in LCD and Buzzer alerts

    3. CONCLUSION & FUTURE SCOPEIn summary, a strong option for the identification of pesticides in organic fruits and vegetables is the combination of IOT and ML embedded in Python. A reliable and effective system is produced by combining the technologies of triad spectroscopy, pH sensing, and gas sensing with sophisticated data processing via machine learning algorithms. This method guarantees accurate and timely detection in addition to enabling real-time monitoring of environmental parameters influencing pesticide residues. The practical implementation of this technology is demonstrated by the buzzer that activates when pesticides are present and the LCD screen that displays an affirmative message for pesticide-free fruit. The suggested approach hs the potential to significantly improve organic farming’s food safety protocols by offering a cutting-edge way to protect the legitimacy and Caliber of organic agricultural products.

      The potential for continuous improvement and expansion is what makes this pesticide detection system potentially useful in the future. Research and development efforts could be directed toward improving the sensitivity and specificity of the machine learning algorithms, which would enable the system to detect a wider range of pesticides with even greater accuracy. Moreover, the integration of sophisticated sensors and technologies might expand the system’s capacity to identify specific classes or types of pesticides. Finally, partnerships with agricultural experts and stakeholders might make it possible to incorporate real-time environmental data, like weather and soil composition, which would allow for a more comprehensive approach to pesticide monitoring.

[1]. Shalini Gnanavel, Saranya Manobar, Kanmani Erakuty Sridhar, Sumathi Sokkanarayanan, Mithleysh Sathiyanarayanan, Quality Detection of Fresh Fruits and Vegetables to Improve Horticulture and Agro- industries IEEE Xplore2017.

[2]. R Chandramma, Ramya C, S Vintha, Shivani P R, Vidya MS, Automatic Fruit and Vegetable Detection and Disease Identification system, NCAIT-2020 conference Proceedings.

[3]. Chang-Chi Lee, Yu-Sung liu, Chun-Hsiang Tseng, Jeng-Yue Chen, Fuh-Shyang Juang, Yung-Ying Chang, Hung-Chih Hsu, Pesticide Residue Testing System for Fruits and Vegetables by Color Identification Technology 2019 IEEE International Conference on Consumer Electronics Taiwan (ICCE-TW).x4)Lohumi, S.; Lee, S.; Lee, H.; Cho, B.-K. A Review of Vibrational Spectroscopic Techniques for the Detection of Food Authenticity and Adulteration. Trends Food Sci. Technol. 2015.

[4].Xia Sun, Xiangyou Wang, Organophosphorus pesticides detection

system based on amperometric enzyme biosensor2010 IEEE.

[5]. Archana B S, Athira S Kumar, Pooja M, Thaneema N, Indu V Nair, Different Methods to Determine Pesticides in Fruits and Vegetables: A Review, International Research Journal of Engineering and Technology (IRJET) Volume: 08 Issue: 04, Apr 2021.

[6]. Wang Changlong, Zhang Shengwei, Yuan Ting, Shen Maosong, Rapid detection of pesticide residues in vegetables with mini-colorimeter The Ninth International Conference on Electronic Measurement & Instruments, ICEMI2009.