Smart Enose Food Waste Management System
Smart Enose Food Waste Management System
Journal of Sensors
Volume 2021, Article ID 9931228, 13 pages
https://doi.org/10.1155/2021/9931228
Research Article
Smart eNose Food Waste Management System
Shazmina Gull , Imran Sarwar Bajwa , Waheed Anwar , and Rubina Rashid
Department of Computer Science, The Islamia University of Bahawalpur, Bahawalpur, Pakistan
Copyright © 2021 Shazmina Gull et al. This is an open access article distributed under the Creative Commons Attribution License,
which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
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.
eNose system
MQ135
User
MQ4
Cloud/data server
Weight sensor
detecting, and measuring the gas compounds, micro- and Decision tree is used as the machine algorithm in this system.
macromolecules, ion species, and volatile particles in samples The control unit analyzes and stores sensor values sent by the
and data processing and analysis systems. Arduino. The user can check the food wastage statistics
A lot of food researches have been came in the IoT era for through the system.
different FSC states, i.e., for production monitoring, quality The rest of the paper discusses the proposed system in
monitoring, waste management using RFID, temperature, more detail. “State of the Art” is all about the related research
humidity, camera, and many other sensors and modules. work. “Architecture of IoT-Based Food Waste Management”
Not any single research brings forward the idea of detecting tells about the architecture of the proposed system. “System
food items using low-cost sensors and detecting the food Implementation” contains the specifications of hardware
items while measuring food wastage. For this context, this used in this research. It contains the calibration of sensors,
research is new in its architecture and methodology. implementation of machine algorithm, and the smart eNose
This research helped in detecting, monitoring, and man- food waste management system. “Results and Discussion”
aging the food wastage in context of eNose and weight sensor contains the results of this research after the experiments
along with the Wi-Fi and Arduino modules. This research and implementation. “Conclusion” and “Future Work” con-
using gas sensors, i.e., MQ135 and MQ4, and a load cell tain the conclusion and future work of this research work,
enables the restaurants and households to monitor their food respectively.
wastage and upon statistics to reduce the amount of wastage
using some useful initiatives. Wastage of food can reduce if 2. State of the Art
monitored properly, analyzed on daily basis, and reported
to user. Detecting food items would help in attaining the This chapter discusses the related work in food department
amount of wastage of each food item and, after that, prepar- using the IoT technology. The work that is related to manag-
ing specific food item as earlier as needed by comparing the ing the food waste or casual wastage of any area using IoT
analysis report. The main objectives of this research are as technology, what researches have done on food quality in
follows: any phase of FSC (food supply chain), and IoT-based kitchen
systems that used to manage buckets and stove system in
(i) A system for real-time monitoring must have to be kitchens are describe here in detail.
ensured for food wastage reduction
2.1. Food Waste Management. Jagtap and Rahimifard [5]
(ii) A system must be capable of detecting food items reduces the wastage of meat 60.7% at the Chicken Tikka
(i.e., milk, meat, fruit, vegetable, or bread) to reduce Masala restaurant within eight months. A bin carried the
food waste wastage where a load cell weighs the wasted meat and that
(iii) A smart system is mandatory for restaurants to figures are sent to the mobile app using a Bluetooth sensor.
The data is then sent to the cloud server for analysis and stor-
detect and monitor food waste regularly to monitor
age purposes.
how much amount is being wasted and which item
Hong et al. [6–10] designed a smart garbage system that
is being wasted the most
collects food from houses, and users pay regularly according
(iv) A smart cost-effective system is needed to assist in to their waste materials. They used RFID to track the garbage
kitchen management against food wastage. collectors and weight sensors to weight the waste material.
The garbage collectors are synchronized with cloud.
The proposed system is composed of three layers/nodes: The IoT-based smart garbage and waste collection bin
sensor node, machine algorithm, and control unit. Sensor [11] used IR for level detection, weight sensor, and Wi-Fi.
node worked with the eNose system (MQ4, MQ135) and Whenever IR detects the overweight, it alarmed the system
weight sensor (HX711 and strain gauge load cell) to detect and user to free up the smart bin.
the food items and measure the weight of food waste. The A very efficient and smart restaurant waste management
machine algorithm is used here to analyze the food items. system monitored the generation (using RFID and weight
Journal of Sensors 3
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 struc-
tured 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.
Start
Sensors
Control unit
Data cleansing/
Normalization
Generate dataset
Split data
Training Testing
dataset dataset
Apply decision
Tree
Apply model
Check accuracy
& performance
Final result
Visualization
Graphs/plots
End
MQ–4
10
Rs/Ro
1
0.1
100 1000 10000
LPG Al cohol
CH4 Smoke
H2 Air
C0
MQ–135
10
Rs/Ro
0.1
10 100 1000
ppm
Air NH4
CO2 1/4⁎
CO +
3/4 AE
3. Architecture of IoT-Based Food the weight of the wasted food item. The record is then saved
Waste Management into the database for further precautionary measures to
reduce the food wastage. Architecture of smart eNose food
This smart system consists of combination of different sen- waste management is shown in Figure 1, in which we
sors and modules. The user has to put wasted food item on depicted all components, their interaction, and working
the acrylic disc of the weight sensor. The weight sensor mea- strategy.
sures 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 3.1. Used Algorithm. We designed the detailed working algo-
sensed values using Arduino. Arduino IDE is used to inter- rithm of IoT-based smart eNose food waste management
pret the sensed information. The control unit analyzes the based on entropy and information from decision tree. The
sensor information through the machine algorithm and proposed algorithm steps are described in Algorithm 1, and
comes up to a result which food item is being wasted and flow chart is given in Figure 2.
6 Journal of Sensors
Class Polynominal 0 Rice&Meat (70) Bread (70) Bread (70), Meat (70), ...[2 more]
Table 1: Information gain of full dataset. Table 3: Gain ratio of training dataset.
Table 2: Gain ratio of full dataset. used for detecting the NH3 and CO2 in food waste. MQ135
gas sensor is shown in Figure 3.
Attribute Weight
The MQ4 sensor is used to detect CH4, cigarette smoke,
CH4 0.815 natural gas LNG, cooking fumes, and alcohol. It is highly sen-
NH3 0.864 sitive to CH4 and LNG yet low sensitive to smoke and alco-
CO2 0.881 hol. In our system, it is used to detect CH4 in food waste.
The MQ4 gas sensor is shown in Figure 4.
Weight sensor consists of HX711 (A/D converter) and 5
3.2. Machine Algorithm for Smart eNose Food Waste kg load cell (weight gauge) sensor that is used to measure the
Management. After sensing, retrieving, and constructing weight of food wasted. HX711 is a high-precision 24-bit
the dataset, classification and regression are done using the analog-to-digital converter. HX711 is specially designed for
decision tree. We use RapidMiner for applying machine industries and weighing scales. It can be directly interfaced
learning algorithm: decision tree. with the bridge sensor. It supports two analog-input chan-
The decision tree algorithm is a supervised learning algo- nels. Weight sensor is shown in Figure 5.
rithm that is used for classification and regression. The deci-
sion tree algorithm generates a training model (trained 4.2. Sensor Calibration. In this proposed model, MQ135,
decision tree and rule set) to predict the desired attribute’s MQ4, and load cell sensors are mainly used for detection
(class in our dataset) values. We used the C4.5 decision tree and measurement purposes. These sensors are used in a pro-
algorithm model (advanced ID3) in this project. totype model after calibration. Before their actual usage, the
We used the information gain and gain ratio. We gas sensors (MQ135, MQ4) are put to preheat for 24 hours
calculate the information gain and gain ratio using the for each gas detection and were made sure to use 10 kΩ or
RapidMiner tool before splitting the dataset. The highest above with gas sensors (MQ135, MQ4) for RL . For calibra-
information gain is chosen by the decision tree algorithm to tion, RO has to be calculated firstly in fresh air, and after that,
construct/split the decision tree. We used the gain ratio for it never changes in fresh air. The calculated value of RO is
splitting our dataset to construct the decision tree. Gain ratio used to calculate the RS that is changeable with the gas con-
is used to remove the biasness over attributes. centration or presence in specific gas.
The general formula to calculate PPM of a gas is
4. System Implementation PPM = 10∧½flog ðratioÞ − b/mg: ð1Þ
4.1. Used Hardware. We designed the sensor node of the
smart eNose food waste management by using multiple sen- The measurement gas concentration graph for MQ4 and
sors MQ135, MQ4, and weight sensor. A microcontroller MQ135 is given in Figures 6 and 7, respectively.
Arduino UNO is used for embedding these sensors. Detail The gas concentration graph is on log-log scale/linear
of hardware components used in data collection is as follows: scale. So, the line formula is used to find the log-log scale
MQ135 is an air-quality highly sensitive sensor/module. gas concentration ratio.
This sensor used to detect the smoke, NH3, alcohol, NOx,
benzene, and CO2. In our proposed system, this sensor is y = mx + b: ð2Þ
Journal of Sensors 7
CO2
Rice
NH3
CH4 CH4
Here, y is the X value, x is X value, m is the slope of line, PLX-DAQ. In this current system, four classes are used to
and b is y intercept. discriminate between food items based on gas emission (see
For log-log scale, convert (2) into following: Figure 8).
The information gain for our dataset is given in Table 1.
log ðyÞ = m × log ðxÞ + b: ð3Þ As shown in Table 1, information gain for all of the attri-
butes and the number of instances used for each class item
Here, the log base is 10. are of equal size.
The value of RO found by the MQ4 and MQ135 sensors The calculated gain ratio for our dataset is given in
in our system is 4.78. Table 2.
The weight sensor contains a strain gauge load cell and a We also calculate the gain ratio of the training dataset for
HX711 A/D converter. For its calibration, the known weight accuracy (see Table 3).
has to be placed on the load cell, and the calibration factor to The both calculated gain ratios give the highest ratio of
set the scale was found. After that, that calibration factor was CO2, so we choose the CO2 attribute as root or construc-
used to measure the weight of an unknown object. In this tion/split in the decision tree.
research, the method used for calibration is taken from the The rule model for this current system is as follows:
HX711_ADC library. The calibration value of weight sensor If CO2 > 542:425, NH3 > 5:030, and CH4 > 3:770, then
found using our load cell is 456.0. rice and meat is (52/0/0/0).
If CO2 > 542:425, NH3 > 5:030, and CH4 ≤ 3:770, then
4.3. Implementation of Decision Tree Algorithm. The dataset meat is (0/49/0/0).
is collected by two sensors, MQ4 (CH4 detection) and If CO2 > 542:425, NH3 ≤ 5:030, and CH4 > 3:175, then
MQ135 (CO2 and NH3 detection), using Arduino IDE and bread is (1/0/1/53).
8 Journal of Sensors
112.202
100
89.125
79.433
70.795
63.096
56.234
50.119
Food_Class
CH4 CH4
NH3 CO2
(a) (b)
CO2 NH3
NH3 CO2
(c) (d)
NH3
CH4
(e)
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.
10 Journal of Sensors
4.00
3.75
3.50
3.25
3.00
2.75
2.50
Frequency
2.25
2.00
1.75
1.50
1.25
1.00
0.75
0.50
0.25
0.00
2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00
CH4
4.00
3.75
3.50
3.25
3.00
2.75
2.50
Frequency
2.25
2.00
1.75
1.50
1.25
1.00
0.75
0.50
0.25
0.00
300 350 400 450 500 550 600 650 700 750 800 850 900 950 1,000
CO2
Rice and Meat Rice
Meat Bread
(b)
4.00
3.75
3.50
3.25
3.00
2.75
2.50
Frequency
2.25
2.00
1.75
1.50
1.25
1.00
0.75
0.50
0.25
0.00
3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50
NH3
Rice and Meat Rice
Meat Bread
(c)
Figure 13: Color-histogram frequency graphs. (a) CH4 frequency over class. (b) CO2 frequency over class. (c) NH3 frequency over class.
True rice and meat True meat True rice True bread Class precision
Pred. rice and meat 14 0 0 1 93.33%
Pred. meat 0 17 0 0 100.00%
Pred. rice 1 0 17 1 89.47%
Pred. bread 2 0 0 15 88.24%
Class recall 82.35% 100.00% 100.00% 88.24%
.
6. Conclusion lect data, 70 instances of each, of four food items, i.e.,
meat, rice, rice and meat, and bread. We use 5 kg strain
Food wastage becomes a renowned issue of these days. In this gauge load cell and HX711 as the weight sensor to mea-
modern computer age, there is a need to control human sure the weight of food wastage.
chores using computers. To fulfill this purpose of IoT and For ensuring the accuracy and performance of our sys-
to reduce the amount of food wastage, we designed a system tem, we calibrate the sensors as per recommendations. We
that is suitable in this situation and do not need human col- use the decision tree algorithm with contrast to the informa-
laboration to control and monitor it manually. tion gain and gain ratio to make this system an intelligent and
We proposed a smart eNose food waste management smart system. The generated rule model is applied in actual
system that is capable of describing a food item and in implementation of the current system software. We imple-
which amount is wasted in a day. For this accomplish- ment our system in home and find out the food wastage in
ment, we use sensors and microcontroller collaboration one day. The current system is accurate, efficient, cost-effec-
with the great contribution of decision tree. We detect tive, and durable in its performance. This system appeals
food items through their gas emission. The smart eNose high accuracy of 92.65%. There is a least classification error
system helps us to detect food items which contain MQ4 found, 7.35%.
and MQ135 sensors. MQ4 is used to detect CH4 (emitted The proposed system is new in its technology and fills the
from rice). MQ135 is used to detect CO2 (emitted from gap in the food waste management industry with its high
bread and meat) and NH3 (emitted from meat). We col- accuracy and cost-efficiency.
12 Journal of Sensors