# Smart eNose Food Waste Management System

Authors: Shazmina Gull; Imran Sarwar Bajwa; Waheed Anwar; Rubina Rashid
Journal: Journal of Sensors
 (2021)

---

## Abstract

The modern age is an era of fast-growing technology, all thanks to the Internet of Things. The IoT becomes a prime factor of human life. As in this running world, no one cares about the wastage of food. However, this causes environment pollution as well as loss of many lives. A lot of researchers help in this era by introducing some great and beneficial projects. Our work is introducing a new approach by utilizing some low-cost sensors. In this work, Arduino UNO is used as a microcontroller. We use the eNose system that comprises MQ4 and MQ135 to detect gas emission from different food items, i.e., meat, rice, rice and meat, and bread. We collect our data from these food items. The MQ4 sensor detects the CH4 gas while the MQ135 sensor detects CO2 and NH3 in this system. We use a 5 kg strain gauge load cell sensor and HX711 A/D converter as a weight sensor to measure the weight of food being wasted. To ensure the accuracy and efficiency of our system, we first calibrate our sensors as per recommendations to run in the environment with the flow. We collect our data using cooked, uncooked, and rotten food items. To make this system a smart system, we use a machine learning algorithm to predict the food items on the basis of gas emission. The decision tree algorithm was used for training and testing purposes. We use 70 instances of each food item in the dataset. On the rule set, we implement this system working to measure the weight of food wastage and to predict the food item. The Arduino UNO board fetches the sensor data and sends it to the computer system for interpretation and analysis. Then, the machine learning algorithm works to predict the food item. At the end, we get our data of which food item is wasted in what amount in one day. We found 92.65% accuracy in our system. This system helps in reducing the amount of food wastage at home and restaurants as well by the daily report of food wastage in their computer system.


---

## Body

## 1. Introduction

The IoT encompasses all fields of life and turns the world into a smart world. It works in hospitals, supermarkets, security areas, banks, business, offices, laboratories, restaurants, educational institutions, and home making the world smart and intellectual. As household and restaurant automation is discussed, the main unit of both areas is the kitchen where food is produced, cooked, and served to people to feed them and make them healthy. But the main problem is the wastage of food. Food wastage becomes a threatening problem nowadays. Around 1.3 billion tons of food is wasted each year that is enough to feed 3 billion hungry people each year at a cost of $990 billion [1]. Just in Pakistan, around 36 million tons of food is wasted each year [2].Greenhouse gases are emitted at food production time (which makes the 14.1% of emission) while methane gas is produced at the time of food decay [1]. Food production consumes water as one apple growth consumes 125 litres of water and one-kilogram beef needs to consume 15,400 litres [3]. And a huge amount of food waste contributes to water waste. According to [3], 3.3 billion tons of CO2 wasted each year, and 1 tons of food waste reduction can save approximately 4.2 tons of CO2 [4].To overcome this problem, IoT can help in monitoring and reducing the waste of food. There is a noteworthy requirement to control, monitor, and management of food wastage. A system is a desideratum to cover the above-mentioned measures. This problem can be handled to IoT, as it bordered every field of life, by using some sensors, actuators, and modules. This research helps the chef as well as the home and restaurants to reduce the food wastage using IoT sensors and modules.Electronic nose (eNose) concept comprises several heterogeneous electrochemical gas sensors that work according to the mechanism of human nose. eNose consists of sensing, detecting, and measuring the gas compounds, micro- and macromolecules, ion species, and volatile particles in samples and data processing and analysis systems.A lot of food researches have been came in the IoT era for different FSC states, i.e., for production monitoring, quality monitoring, waste management using RFID, temperature, humidity, camera, and many other sensors and modules. Not any single research brings forward the idea of detecting food items using low-cost sensors and detecting the food items while measuring food wastage. For this context, this research is new in its architecture and methodology.This research helped in detecting, monitoring, and managing the food wastage in context of eNose and weight sensor along with the Wi-Fi and Arduino modules. This research using gas sensors, i.e., MQ135 and MQ4, and a load cell enables the restaurants and households to monitor their food wastage and upon statistics to reduce the amount of wastage using some useful initiatives. Wastage of food can reduce if monitored properly, analyzed on daily basis, and reported to user. Detecting food items would help in attaining the amount of wastage of each food item and, after that, preparing specific food item as earlier as needed by comparing the analysis report. The main objectives of this research are as follows:(i)
A system for real-time monitoring must have to be ensured for food wastage reduction(ii)
A system must be capable of detecting food items (i.e., milk, meat, fruit, vegetable, or bread) to reduce food waste(iii)
A smart system is mandatory for restaurants to detect and monitor food waste regularly to monitor how much amount is being wasted and which item is being wasted the most(iv)
A smart cost-effective system is needed to assist in kitchen management against food wastage.The proposed system is composed of three layers/nodes: sensor node, machine algorithm, and control unit. Sensor node worked with the eNose system (MQ4, MQ135) and weight sensor (HX711 and strain gauge load cell) to detect the food items and measure the weight of food waste. The machine algorithm is used here to analyze the food items. Decision tree is used as the machine algorithm in this system. The control unit analyzes and stores sensor values sent by the Arduino. The user can check the food wastage statistics through the system.The rest of the paper discusses the proposed system in more detail. “State of the Art” is all about the related research work. “Architecture of IoT-Based Food Waste Management” tells about the architecture of the proposed system. “System Implementation” contains the specifications of hardware used in this research. It contains the calibration of sensors, implementation of machine algorithm, and the smart eNose food waste management system. “Results and Discussion” contains the results of this research after the experiments and implementation. “Conclusion” and “Future Work” contain the conclusion and future work of this research work, respectively.


## 2. State of the Art

This chapter discusses the related work in food department using the IoT technology. The work that is related to managing the food waste or casual wastage of any area using IoT technology, what researches have done on food quality in any phase of FSC (food supply chain), and IoT-based kitchen systems that used to manage buckets and stove system in kitchens are describe here in detail.


### 2.1. Food Waste Management

Jagtap and Rahimifard [5] reduces the wastage of meat 60.7% at the Chicken Tikka Masala restaurant within eight months. A bin carried the wastage where a load cell weighs the wasted meat and that figures are sent to the mobile app using a Bluetooth sensor. The data is then sent to the cloud server for analysis and storage purposes.Hong et al. [6–10] designed a smart garbage system that collects food from houses, and users pay regularly according to their waste materials. They used RFID to track the garbage collectors and weight sensors to weight the waste material. The garbage collectors are synchronized with cloud.The IoT-based smart garbage and waste collection bin [11] used IR for level detection, weight sensor, and Wi-Fi. Whenever IR detects the overweight, it alarmed the system and user to free up the smart bin.A very efficient and smart restaurant waste management system monitored the generation (using RFID and weight sensor bin at each restaurant), collection (through smart wastage collection truck enabled with RFID, weight, video surveillance cameras, and GPS/GIS monitoring), transportation (using truck with real-time video monitoring), and disposal (by measuring the weight of wastage using RFID) of food waste at restaurants. This system worked well, efficiently, and with low error rate. [12]Ostojić et al. [13, 14] measured the temperature and humidity of supplied food items and alert the user when the parameter values increased. RFID tag is used to detect each food item. They used Wi-Fi to sync with the server and cloud.The food waste management system [15] for a university mess is designed using a sharp IR sensor to count people, using the mess-meal-cards in a box, weighting sensor, and Hx711-IC to measure the weight of wastage of the food. The sensed value is displayed on LED, and the LED sends data to IC every 3 seconds. The resultant data is also uploaded to web portal to monitor the food wastage.Elhassan et al. [16] proposed a smart garbage bin for massive areas that contains five sections for different waste materials (paper, plastic, metal, glass, and food, respectively). The authors used a capacitive proximity sensor for detecting paper and plastic, metal sensor for metal detection, infrared sensor for glass detection, humidity sensor to validate whether the trash is wet or not, ultrasonic sensor to detect the trash bin level, and servomotor and solar cell for power consumption. The sensed values are sent to the control unit using radio frequency signals. As bin is filled with wastage or the humidity level increased, the system alerts the user.Sofia et al. detect and analyze the presence of mycotoxins in different food items using UV, spectrometer, biosensors, and electrical nose and proved that the mycotoxins destroy food in any stage of food production, preservation, and harvesting [17].A food waste management-recycling system [18] used RFID and weight and level sensor to detect the bin tag and location and to measure the waste weight and the level detection (3 levels) of trash in trash bin. The trash bin is collected by a smart truck, and all the collected food wastage is recycled in fertilizer for planting using FWDM (designed using motor vehicle parts and IOT modules). The overall result and data capture through sensors can be seen on LCDs.A smart bin system is created for recycling and managing the wastage. The RFID and Wi-Fi module is used in this project. A user via a web service calls for a smart bin and places the wastage in to the bin by specifying the waste type. If the waste is recyclable, this wastage is sent to the company (waste-collector-vendor) for recycling; otherwise, it would be wasted/discarded. Each type of wastage is weighted by the wastage-based billing system. The user has to pay the bill using RFID [19].


### 2.2. IoT-Based Kitchen

Chatterjee et al. [20–22] worked on kitchen air quality by measuring temperature, humidity, gas leakage, and water flow using respective sensors. Whenever these parameters crossed the threshold, the system alerts the user.Minaam et al. [23] designed a system that used a led indicator and AVR burning tool, for indicating the cooking time of a meal. The chef can set a timer for different cooking food items at the same time using a 4×4 keypad.An AI system for smart refrigerator worked with image processing to detect food items and their freshness status; after that, the NLP analysis helped to analyze which food is going to rot, and an alarming message is sent to the user via a mobile phone to prevent food spoilage and to manage the food wastage [24].Chopade and Nighot [25–27] worked on kitchen pantry systems that detect the level of food stored on shelves and alert the user whenever it reduced and suggest the nearby stores from where the user can purchase that food item.


## 2.1. Food Waste Management

Jagtap and Rahimifard [5] reduces the wastage of meat 60.7% at the Chicken Tikka Masala restaurant within eight months. A bin carried the wastage where a load cell weighs the wasted meat and that figures are sent to the mobile app using a Bluetooth sensor. The data is then sent to the cloud server for analysis and storage purposes.Hong et al. [6–10] designed a smart garbage system that collects food from houses, and users pay regularly according to their waste materials. They used RFID to track the garbage collectors and weight sensors to weight the waste material. The garbage collectors are synchronized with cloud.The IoT-based smart garbage and waste collection bin [11] used IR for level detection, weight sensor, and Wi-Fi. Whenever IR detects the overweight, it alarmed the system and user to free up the smart bin.A very efficient and smart restaurant waste management system monitored the generation (using RFID and weight sensor bin at each restaurant), collection (through smart wastage collection truck enabled with RFID, weight, video surveillance cameras, and GPS/GIS monitoring), transportation (using truck with real-time video monitoring), and disposal (by measuring the weight of wastage using RFID) of food waste at restaurants. This system worked well, efficiently, and with low error rate. [12]Ostojić et al. [13, 14] measured the temperature and humidity of supplied food items and alert the user when the parameter values increased. RFID tag is used to detect each food item. They used Wi-Fi to sync with the server and cloud.The food waste management system [15] for a university mess is designed using a sharp IR sensor to count people, using the mess-meal-cards in a box, weighting sensor, and Hx711-IC to measure the weight of wastage of the food. The sensed value is displayed on LED, and the LED sends data to IC every 3 seconds. The resultant data is also uploaded to web portal to monitor the food wastage.Elhassan et al. [16] proposed a smart garbage bin for massive areas that contains five sections for different waste materials (paper, plastic, metal, glass, and food, respectively). The authors used a capacitive proximity sensor for detecting paper and plastic, metal sensor for metal detection, infrared sensor for glass detection, humidity sensor to validate whether the trash is wet or not, ultrasonic sensor to detect the trash bin level, and servomotor and solar cell for power consumption. The sensed values are sent to the control unit using radio frequency signals. As bin is filled with wastage or the humidity level increased, the system alerts the user.Sofia et al. detect and analyze the presence of mycotoxins in different food items using UV, spectrometer, biosensors, and electrical nose and proved that the mycotoxins destroy food in any stage of food production, preservation, and harvesting [17].A food waste management-recycling system [18] used RFID and weight and level sensor to detect the bin tag and location and to measure the waste weight and the level detection (3 levels) of trash in trash bin. The trash bin is collected by a smart truck, and all the collected food wastage is recycled in fertilizer for planting using FWDM (designed using motor vehicle parts and IOT modules). The overall result and data capture through sensors can be seen on LCDs.A smart bin system is created for recycling and managing the wastage. The RFID and Wi-Fi module is used in this project. A user via a web service calls for a smart bin and places the wastage in to the bin by specifying the waste type. If the waste is recyclable, this wastage is sent to the company (waste-collector-vendor) for recycling; otherwise, it would be wasted/discarded. Each type of wastage is weighted by the wastage-based billing system. The user has to pay the bill using RFID [19].


## 2.2. IoT-Based Kitchen

Chatterjee et al. [20–22] worked on kitchen air quality by measuring temperature, humidity, gas leakage, and water flow using respective sensors. Whenever these parameters crossed the threshold, the system alerts the user.Minaam et al. [23] designed a system that used a led indicator and AVR burning tool, for indicating the cooking time of a meal. The chef can set a timer for different cooking food items at the same time using a 4×4 keypad.An AI system for smart refrigerator worked with image processing to detect food items and their freshness status; after that, the NLP analysis helped to analyze which food is going to rot, and an alarming message is sent to the user via a mobile phone to prevent food spoilage and to manage the food wastage [24].Chopade and Nighot [25–27] worked on kitchen pantry systems that detect the level of food stored on shelves and alert the user whenever it reduced and suggest the nearby stores from where the user can purchase that food item.


## 3. Architecture of IoT-Based Food Waste Management

This smart system consists of combination of different sensors and modules. The user has to put wasted food item on the acrylic disc of the weight sensor. The weight sensor measures the weight of the wasted food, and the eNose system detects the gas emission from food items. The sensed values are then sent to the control unit by digitizing the analog sensed values using Arduino. Arduino IDE is used to interpret the sensed information. The control unit analyzes the sensor information through the machine algorithm and comes up to a result which food item is being wasted and the weight of the wasted food item. The record is then saved into the database for further precautionary measures to reduce the food wastage. Architecture of smart eNose food waste management is shown in Figure1, in which we depicted all components, their interaction, and working strategy.Figure 1
System architecture of smart eNose food waste management.


### 3.1. Used Algorithm

We designed the detailed working algorithm of IoT-based smart eNose food waste management based on entropy and information from decision tree. The proposed algorithm steps are described in Algorithm1, and flow chart is given in Figure 2.Algorithm 1: Working algorithm of IoT-based food waste management.
Step 1: Data collection is the first step of proposed system that is used to collect the data from connected sensors.Step 2: After data collection, the next step is data processing to organize the attribute values into a spreadsheet file for making the structured dataset.Step 3: After data processing, the next step is data cleansing in which the data normalize each attribute value by handling the duplicate, incomplete, and faulty values.Step 4: In this step, we apply some validation methods for data analysis by using decision tree. Information gain and gain ratio are used for decision tree classifier.Step 5: In the second last step, data prediction is performed by detecting the food item either meat or any other food item (rice, rice and meat, or bread).Step 6: In the last step, predicted results are displayed and visualized.Figure 2
Flowchart of smart eNose food waste management system.


### 3.2. Machine Algorithm for Smart eNose Food Waste Management

After sensing, retrieving, and constructing the dataset, classification and regression are done using the decision tree. We use RapidMiner for applying machine learning algorithm: decision tree.The decision tree algorithm is a supervised learning algorithm that is used for classification and regression. The decision tree algorithm generates a training model (trained decision tree and rule set) to predict the desired attribute’s (class in our dataset) values. We used the C4.5 decision tree algorithm model (advanced ID3) in this project.We used the information gain and gain ratio. We calculate the information gain and gain ratio using the RapidMiner tool before splitting the dataset. The highest information gain is chosen by the decision tree algorithm to construct/split the decision tree. We used the gain ratio for splitting our dataset to construct the decision tree. Gain ratio is used to remove the biasness over attributes.


## 3.1. Used Algorithm

We designed the detailed working algorithm of IoT-based smart eNose food waste management based on entropy and information from decision tree. The proposed algorithm steps are described in Algorithm1, and flow chart is given in Figure 2.Algorithm 1: Working algorithm of IoT-based food waste management.
Step 1: Data collection is the first step of proposed system that is used to collect the data from connected sensors.Step 2: After data collection, the next step is data processing to organize the attribute values into a spreadsheet file for making the structured dataset.Step 3: After data processing, the next step is data cleansing in which the data normalize each attribute value by handling the duplicate, incomplete, and faulty values.Step 4: In this step, we apply some validation methods for data analysis by using decision tree. Information gain and gain ratio are used for decision tree classifier.Step 5: In the second last step, data prediction is performed by detecting the food item either meat or any other food item (rice, rice and meat, or bread).Step 6: In the last step, predicted results are displayed and visualized.Figure 2
Flowchart of smart eNose food waste management system.


## 3.2. Machine Algorithm for Smart eNose Food Waste Management

After sensing, retrieving, and constructing the dataset, classification and regression are done using the decision tree. We use RapidMiner for applying machine learning algorithm: decision tree.The decision tree algorithm is a supervised learning algorithm that is used for classification and regression. The decision tree algorithm generates a training model (trained decision tree and rule set) to predict the desired attribute’s (class in our dataset) values. We used the C4.5 decision tree algorithm model (advanced ID3) in this project.We used the information gain and gain ratio. We calculate the information gain and gain ratio using the RapidMiner tool before splitting the dataset. The highest information gain is chosen by the decision tree algorithm to construct/split the decision tree. We used the gain ratio for splitting our dataset to construct the decision tree. Gain ratio is used to remove the biasness over attributes.


## 4. System Implementation

### 4.1. Used Hardware

We designed the sensor node of the smart eNose food waste management by using multiple sensors MQ135, MQ4, and weight sensor. A microcontroller Arduino UNO is used for embedding these sensors. Detail of hardware components used in data collection is as follows:MQ135 is an air-quality highly sensitive sensor/module. This sensor used to detect the smoke, NH3, alcohol, NOx, benzene, and CO2. In our proposed system, this sensor is used for detecting the NH3 and CO2 in food waste. MQ135 gas sensor is shown in Figure 3.Figure 3
MQ135 sensor.The MQ4 sensor is used to detect CH4, cigarette smoke, natural gas LNG, cooking fumes, and alcohol. It is highly sensitive to CH4 and LNG yet low sensitive to smoke and alcohol. In our system, it is used to detect CH4 in food waste. The MQ4 gas sensor is shown in Figure 4.Figure 4
MQ4 sensor.Weight sensor consists of HX711 (A/D converter) and 5 kg load cell (weight gauge) sensor that is used to measure the weight of food wasted. HX711 is a high-precision 24-bit analog-to-digital converter. HX711 is specially designed for industries and weighing scales. It can be directly interfaced with the bridge sensor. It supports two analog-input channels. Weight sensor is shown in Figure5.Figure 5
Weight sensor: HX711 and 5 kg load cell.


### 4.2. Sensor Calibration

In this proposed model, MQ135, MQ4, and load cell sensors are mainly used for detection and measurement purposes. These sensors are used in a prototype model after calibration. Before their actual usage, the gas sensors (MQ135, MQ4) are put to preheat for 24 hours for each gas detection and were made sure to use 10 kΩ or above with gas sensors (MQ135, MQ4) for RL. For calibration, RO has to be calculated firstly in fresh air, and after that, it never changes in fresh air. The calculated value of RO is used to calculate the RS that is changeable with the gas concentration or presence in specific gas.The general formula to calculate PPM of a gas is(1)PPM=10∧logratio−b/m.The measurement gas concentration graph for MQ4 and MQ135 is given in Figures6 and 7, respectively.Figure 6
MQ4-CH4 measurement-circuit gas concentration graph.Figure 7
MQ135-CO2+NH4 measurement-circuit gas concentration graph.The gas concentration graph is on log-log scale/linear scale. So, the line formula is used to find the log-log scale gas concentration ratio.(2)y=mx+b.Here,y is the X value, x is X value, m is the slope of line, and b is y intercept.For log-log scale, convert (2) into following:
(3)logy=m×logx+b.Here, the log base is 10.The value ofRO found by the MQ4 and MQ135 sensors in our system is 4.78.The weight sensor contains a strain gauge load cell and a HX711 A/D converter. For its calibration, the known weight has to be placed on the load cell, and the calibration factor to set the scale was found. After that, that calibration factor was used to measure the weight of an unknown object. In this research, the method used for calibration is taken from the HX711_ADC library. The calibration value of weight sensor found using our load cell is 456.0.


### 4.3. Implementation of Decision Tree Algorithm

The dataset is collected by two sensors, MQ4 (CH4 detection) and MQ135 (CO2 and NH3 detection), using Arduino IDE and PLX-DAQ. In this current system, four classes are used to discriminate between food items based on gas emission (see Figure 8).Figure 8
Statistics of full dataset.The information gain for our dataset is given in Table1.Table 1
Information gain of full dataset.
AttributeWeightNH30.813CO20.813CH40.813As shown in Table1, information gain for all of the attributes and the number of instances used for each class item are of equal size.The calculated gain ratio for our dataset is given in Table2.Table 2
Gain ratio of full dataset.
AttributeWeightCH40.815NH30.864CO20.881We also calculate the gain ratio of the training dataset for accuracy (see Table3).Table 3
Gain ratio of training dataset.
AttributeWeightNH30.886CH40.908CO20.917The both calculated gain ratios give the highest ratio of CO2, so we choose the CO2 attribute as root or construction/split in the decision tree.The rule model for this current system is as follows:IfCO2>542.425, NH3>5.030, and CH4>3.770, then rice and meat is (52/0/0/0).IfCO2>542.425, NH3>5.030, and CH4≤3.770, then meat is (0/49/0/0).IfCO2>542.425, NH3≤5.030, and CH4>3.175, then bread is (1/0/1/53).IfCO2>542.425, NH3≤5.030, and CH4≤3.175, then meat is (0/3/0/0).IfCO2≤542.425, then rice is (0/1/52/0).The trained decision tree for this proposed system is given in Figure9, and the implementation of proposed system is given in Figure 10.Figure 9
Trained decision tree.Figure 10
Implementation of smart eNose food waste management system.


## 4.1. Used Hardware

We designed the sensor node of the smart eNose food waste management by using multiple sensors MQ135, MQ4, and weight sensor. A microcontroller Arduino UNO is used for embedding these sensors. Detail of hardware components used in data collection is as follows:MQ135 is an air-quality highly sensitive sensor/module. This sensor used to detect the smoke, NH3, alcohol, NOx, benzene, and CO2. In our proposed system, this sensor is used for detecting the NH3 and CO2 in food waste. MQ135 gas sensor is shown in Figure 3.Figure 3
MQ135 sensor.The MQ4 sensor is used to detect CH4, cigarette smoke, natural gas LNG, cooking fumes, and alcohol. It is highly sensitive to CH4 and LNG yet low sensitive to smoke and alcohol. In our system, it is used to detect CH4 in food waste. The MQ4 gas sensor is shown in Figure 4.Figure 4
MQ4 sensor.Weight sensor consists of HX711 (A/D converter) and 5 kg load cell (weight gauge) sensor that is used to measure the weight of food wasted. HX711 is a high-precision 24-bit analog-to-digital converter. HX711 is specially designed for industries and weighing scales. It can be directly interfaced with the bridge sensor. It supports two analog-input channels. Weight sensor is shown in Figure5.Figure 5
Weight sensor: HX711 and 5 kg load cell.


## 4.2. Sensor Calibration

In this proposed model, MQ135, MQ4, and load cell sensors are mainly used for detection and measurement purposes. These sensors are used in a prototype model after calibration. Before their actual usage, the gas sensors (MQ135, MQ4) are put to preheat for 24 hours for each gas detection and were made sure to use 10 kΩ or above with gas sensors (MQ135, MQ4) for RL. For calibration, RO has to be calculated firstly in fresh air, and after that, it never changes in fresh air. The calculated value of RO is used to calculate the RS that is changeable with the gas concentration or presence in specific gas.The general formula to calculate PPM of a gas is(1)PPM=10∧logratio−b/m.The measurement gas concentration graph for MQ4 and MQ135 is given in Figures6 and 7, respectively.Figure 6
MQ4-CH4 measurement-circuit gas concentration graph.Figure 7
MQ135-CO2+NH4 measurement-circuit gas concentration graph.The gas concentration graph is on log-log scale/linear scale. So, the line formula is used to find the log-log scale gas concentration ratio.(2)y=mx+b.Here,y is the X value, x is X value, m is the slope of line, and b is y intercept.For log-log scale, convert (2) into following:
(3)logy=m×logx+b.Here, the log base is 10.The value ofRO found by the MQ4 and MQ135 sensors in our system is 4.78.The weight sensor contains a strain gauge load cell and a HX711 A/D converter. For its calibration, the known weight has to be placed on the load cell, and the calibration factor to set the scale was found. After that, that calibration factor was used to measure the weight of an unknown object. In this research, the method used for calibration is taken from the HX711_ADC library. The calibration value of weight sensor found using our load cell is 456.0.


## 4.3. Implementation of Decision Tree Algorithm

The dataset is collected by two sensors, MQ4 (CH4 detection) and MQ135 (CO2 and NH3 detection), using Arduino IDE and PLX-DAQ. In this current system, four classes are used to discriminate between food items based on gas emission (see Figure 8).Figure 8
Statistics of full dataset.The information gain for our dataset is given in Table1.Table 1
Information gain of full dataset.
AttributeWeightNH30.813CO20.813CH40.813As shown in Table1, information gain for all of the attributes and the number of instances used for each class item are of equal size.The calculated gain ratio for our dataset is given in Table2.Table 2
Gain ratio of full dataset.
AttributeWeightCH40.815NH30.864CO20.881We also calculate the gain ratio of the training dataset for accuracy (see Table3).Table 3
Gain ratio of training dataset.
AttributeWeightNH30.886CH40.908CO20.917The both calculated gain ratios give the highest ratio of CO2, so we choose the CO2 attribute as root or construction/split in the decision tree.The rule model for this current system is as follows:IfCO2>542.425, NH3>5.030, and CH4>3.770, then rice and meat is (52/0/0/0).IfCO2>542.425, NH3>5.030, and CH4≤3.770, then meat is (0/49/0/0).IfCO2>542.425, NH3≤5.030, and CH4>3.175, then bread is (1/0/1/53).IfCO2>542.425, NH3≤5.030, and CH4≤3.175, then meat is (0/3/0/0).IfCO2≤542.425, then rice is (0/1/52/0).The trained decision tree for this proposed system is given in Figure9, and the implementation of proposed system is given in Figure 10.Figure 9
Trained decision tree.Figure 10
Implementation of smart eNose food waste management system.


## 5. Results and Discussion

The smart eNose food waste management System is operable in homes and restaurants as well. This proposed system is efficient, real-time, accurate, and cost-effective. The proposed system detects the food items with the collaboration of sensors and actuators and measures the weight of waste food. The sensed information is then analyzed using the decision tree. This system helps to reduce the food wastage by checking the previous records. A chef can also cook according to the need and likes of consumers. This system requires no human interception as the literature research work needs human to enter the food type or weight of food wastage.We implement our system at home. The food wastage in one day at home can be found easily using graphs. These graphs are made by using RapidMiner. One of these graph records is given in Figure11.Figure 11
Food wastage in one day at home.In Figure11, the weight is measured in grams.


### 5.1. System Accuracy and Efficiency

The smart eNose food waste management system is accurate, efficient, and highly performed. These features are achieved after training and testing the dataset on different food items. The proposed system offers a class precision for meat, rice, rice and meat, and bread of 100%, 89.47%, 93.33%, and 88.24%, respectively; the class recall of meat, rice, rice and meat, and bread is 100%, 100%, 82.35%, and 88.24%, respectively, and 92.65% accuracy and weighted-mean recall. The accuracy and performance vectors description are given in Table4:Table 4
Performance vector of algorithm.
Accuracy: 92.65%Confusion matrix:TrueRice and meatMeatRiceBreadRice and meat14001Meat01700Rice10171Bread20015The scatter plots, retrieved after making the decision tree of given dataset, are given in Figure12.Figure 12
(a–e) Scatter plots of multiple attributes where blue denotes rice and meat, red denotes bread, sea-green denotes meat, and light-green denotes rice.
(a)(b)(c)(d)(e)To describe the frequency of different attributes over food items, color-histogram graph is used in this proposed system (see Figure13).Figure 13
Color-histogram frequency graphs. (a) CH4 frequency over class. (b) CO2 frequency over class. (c) NH3 frequency over class.
(a)(b)(c)The proposed system has also some negative points as there is a 7.35% classification error in implementing the decision tree using the dataset generated from the sensors (Table5; classification error: 7.35%).Table 5
Classification error.
True rice and meatTrue meatTrue riceTrue breadClass precisionPred. rice and meat1400193.33%Pred. meat01700100.00%Pred. rice1017189.47%Pred. bread2001588.24%Class recall82.35%100.00%100.00%88.24%.


## 5.1. System Accuracy and Efficiency

The smart eNose food waste management system is accurate, efficient, and highly performed. These features are achieved after training and testing the dataset on different food items. The proposed system offers a class precision for meat, rice, rice and meat, and bread of 100%, 89.47%, 93.33%, and 88.24%, respectively; the class recall of meat, rice, rice and meat, and bread is 100%, 100%, 82.35%, and 88.24%, respectively, and 92.65% accuracy and weighted-mean recall. The accuracy and performance vectors description are given in Table4:Table 4
Performance vector of algorithm.
Accuracy: 92.65%Confusion matrix:TrueRice and meatMeatRiceBreadRice and meat14001Meat01700Rice10171Bread20015The scatter plots, retrieved after making the decision tree of given dataset, are given in Figure12.Figure 12
(a–e) Scatter plots of multiple attributes where blue denotes rice and meat, red denotes bread, sea-green denotes meat, and light-green denotes rice.
(a)(b)(c)(d)(e)To describe the frequency of different attributes over food items, color-histogram graph is used in this proposed system (see Figure13).Figure 13
Color-histogram frequency graphs. (a) CH4 frequency over class. (b) CO2 frequency over class. (c) NH3 frequency over class.
(a)(b)(c)The proposed system has also some negative points as there is a 7.35% classification error in implementing the decision tree using the dataset generated from the sensors (Table5; classification error: 7.35%).Table 5
Classification error.
True rice and meatTrue meatTrue riceTrue breadClass precisionPred. rice and meat1400193.33%Pred. meat01700100.00%Pred. rice1017189.47%Pred. bread2001588.24%Class recall82.35%100.00%100.00%88.24%.


## 6. Conclusion

Food wastage becomes a renowned issue of these days. In this modern computer age, there is a need to control human chores using computers. To fulfill this purpose of IoT and to reduce the amount of food wastage, we designed a system that is suitable in this situation and do not need human collaboration to control and monitor it manually.We proposed a smart eNose food waste management system that is capable of describing a food item and in which amount is wasted in a day. For this accomplishment, we use sensors and microcontroller collaboration with the great contribution of decision tree. We detect food items through their gas emission. The smart eNose system helps us to detect food items which contain MQ4 and MQ135 sensors. MQ4 is used to detect CH4 (emitted from rice). MQ135 is used to detect CO2 (emitted from bread and meat) and NH3 (emitted from meat). We collect data, 70 instances of each, of four food items, i.e., meat, rice, rice and meat, and bread. We use 5 kg strain gauge load cell and HX711 as the weight sensor to measure the weight of food wastage.For ensuring the accuracy and performance of our system, we calibrate the sensors as per recommendations. We use the decision tree algorithm with contrast to the information gain and gain ratio to make this system an intelligent and smart system. The generated rule model is applied in actual implementation of the current system software. We implement our system in home and find out the food wastage in one day. The current system is accurate, efficient, cost-effective, and durable in its performance. This system appeals high accuracy of 92.65%. There is a least classification error found, 7.35%.The proposed system is new in its technology and fills the gap in the food waste management industry with its high accuracy and cost-efficiency.


## 7. Future Work

In the future, we want to increase our accuracy and performance using more sensors, i.e., pH sensor for food items and ethylene sensor to work with fruits and vegetables. As this, the today world is incomplete without smart phones. So, we want to make our system mobilize for every user to interact with the system using their mobile phones at any place at any time. This would help in increasing the accuracy, durability, reliability, and efficiency of the proposed system.



---

*Source: 9931228-2021-07-22.xml*