Smart Garbage Bin Based on AIoT

Waste management and monitoring is a major concern in the context of the environment, and has a significant impact on human health. The concept of the Artificial Intelligence of Things (AIoT) can help people in everyday tasks in life. This study proposes a smart trash bin to help solve the problem of waste management and monitoring. Traditional methods of garbage disposal require human labor, and pose a hazard to the worker. The proposed smart garbage bin can move itself by using ultrasonic sensors and a web camera, which serves as its “eyes.” Because the smart garbage bin is designed for indoor use and mobility, we use a Bluetooth beacon for location tracking, whereby the bin transmits a constant signal that the other devices in the environment can detect. A smart garbage bin was developed in this study to be used in the E315 research room in the Electrical Engineering Department of the National Chin-Yi University of Technology. An Android application was also developed to help users monitor waste in the smart bin.


Introduction
Garbage collectors are used in a variety of settings, including businesses, offices, schools, hospitals, and streets [1]. Waste management plays a crucial role in creating a clean environment in cities across the globe [2]. In an enclosed environment, garbage becomes an obstacle and a health hazard for residents because it can affect air quality and cleanliness. The disposal of trash is the problem considered in this paper. The main challenge in the typical garbage collection procedure is inspecting dust containers without knowing the baseline information, which is the level of waste. This technique leads to fuel and time being wasted [3]. The timely collection of waste minimizes overflowing garbage and helps keep the indoor environment clean [4]. Because solid waste management is a crucial aspect of environmental hygiene, it must be incorporated into environmental planning to create a clean and comfortable living atmosphere.
According to the World Health Organization (WHO), sanitation services and workers are essential for operational support during the COVID-19 pandemic, but they also incur a high risk of contracting this and other diseases due to the nature of their work [5]. The garbage bin is a hotbed for germs, and people frequently come into contact with it. A smart garbage bin can help minimize human contact when disposing of garbage. According to Cheong et al. [6], a garbage bin that can automatically retrieve trash and move it to the local waste disposal center is the trend of the future.
The procedure of garbage collection and its operational effectiveness can be improved by enhancing its intelligence [7,8]. A smart bin is a waste management dustbin that is self-aware, and detects the level of waste in it. It sends corresponding alerts to public authorities, thus allowing them to arrange for it to be emptied. Because timely checks would not suffice in regions where the frequency of use of the bin changes, this sort of bin is very useful [9]. Such a system can identify the amount of waste in the container and can be controlled by an app, thus eliminating the need for consumers to approach it. According to research on smart garbage bins [10], they can be divided into two types: bins for biodegradable waste and those for non-biodegradable waste. This is also how the smart waste bin system works: When biodegradable trash reaches a particular level as detected by a sensor, the smart garbage bin notifies the relevant authorities via the app and automatically closes. When the threshold of the non-biodegradable bin is exceeded, it also reacts similarly. As a result [11], AIoT-based solutions are the most suitable alternative given the problems that municipalities encounter in such work. The quality and efficiency of the smart waste bin can be improved by combining the IoT and AI. Such a system uses ThingSpeak as a server; it collects, stores, analyzes, and visualizes sensor data [12]. At the beginning of this paper, we will briefly explain the motivation for making the smart trash can. Next is the literature discussion. The subsequent paper will explain the system architecture and system process. In the next chapter, this paper will explain the process and experiment of using a fuzzy algorithm. The next content will mention the operation screen of smart mobile devices. Finally, this thesis will put forward conclusions and contributions.

AIoT
According to Harry Henderson, Artificial Intelligence (AI) is a quest to create software or robotic systems that act in ways that most people would consider to require humanlike intelligence [13]. According to Wiley, the IoT encapsulates a vision of a world in which billions of objects with embedded intelligence, communication means, sensing, and actuation capabilities connect over Internet Protocol (IP) networks. The "things" in the IoT are the objects of everyday life, augmented with micro-controllers, optical radio transceivers, sensors, actuators, and protocol stacks suitable for communication in constrained environments where the target hardware has limited resources. This allows them to gather data from the environment and act upon it, thus giving them an interface with the physical world [14]. This is why we choose AI and the IoT as the basis of the technology to create a smart garbage system.
Research that combines AI and IoT technology is called the Artificial Intelligence of Things (AIoT). AI and IoT technologies are used to integrate data, knowledge, and intelligence. The IoT can provide data flows required by AI. The hope is that this smart garbage bin can map rooms independently without needing to be controlled by humans.

Edge Detection
Edges are significant local changes in a given image, and are remarkable features for analyzing images. Edges typically occur along the boundary between regions in a picture. Edge detection is frequently the first step in recovering information from images [15]. It is a technique of image segmentation that determines the presence of an edge or a line in an image, and outlines it in an appropriate way. In general, an edge is defined as the boundary pixels that connect separate regions with changing amplitude attributes of the image, such as different values of constant luminance and tristimulus in the image [16]. This paper uses the Canny edge detector, which is commonly used. It performs smoothing with a linear combination of exponential functions and then detects edges by higher-order derivative operators [17]. There are three main criteria to assess the Canny algorithm: a low error rate; good localization, which involves minimizing the distance between the detected edge pixels and actual edge pixels; and the minimal response, of only one detector response per edge [18].

Indoor Positioning System (IPS)
The localization of a device in an open space can be carried out with the global positioning system (GPS). Indeed, embedded GPS chips are used in such devices as mobile phones and tablet PCs. GPS can make it easy to locate things, but tracking the location of someone who is in an open space is difficult because of external factors. Researchers have investigated various ways to detect a person's location in an enclosed space. The most suitable method in this regard is called the indoor positioning system (IPS).
The IPS is a system for locating objects in a room by using radio waves, magnetic fields, or other sensors obtained by mobile devices [19]. There are three kinds of position estimation techniques for the IPS. The first is triangulation, in which geometric calculation is used to find a position based on angles to the object from prior positions at either end of a line of known length. The second is trilateration, which is a crucial component of GPS-based estimation. It is a process to estimate the position of a mobile device given the positions of at least three other objects as well as their distances to the device. The third technique for position estimation is multilateration, which is commonly used to accurately track aircraft at airports by using time difference of arrival (TDOA) ranging. Multilateration uses range measurements of the "difference in the distance" between two or more reference devices. Multilateration involves transmitting signals from the reference devices at specific times [20].
3 Proposed System 3.1 System Architecture Fig. 1 shows the system architecture used in this study. The architecture of the AIoT consists of three layers: a physical layer, a network layer, and an application layer.

NodeMCU
NodeMCU is an open-source firmware for the ESP8266 that uses the on-module flash-based SPIFFS file system, as show in Fig. 2. NodeMCU is implemented in C, and is layered on the SDK. It is a micro-controller like Arduino but has additional specifications, such as a Wi-Fi module, so that there is no need to add other modules to it.

Ultrasonic Sensor
The ultrasonic sensor can detect the distance between itself and an object so that the user can determine or adjust this distance, as shown in Fig. 3. This sensor operates according to the reflection of waves from the given object. An ultrasonic sensor is used to detect the distance between the smart garbage bin and objects around it to prevent it from colliding with objects.

Gas Sensor MQ4
Methane is a greenhouse gas produced by the decomposition of organic matter by anaerobic bacteria, when certain types of microorganisms decompose organic matter in the absence of air. It is also produced naturally during the decomposition of biomass. The MQ4 sensor is highly sensitive to methane, and is resistant to interference by alcohol and other gases, as shown in Fig. 4. Its range of detection is between 300 and 10000 ppm.

Beacon Bluetooth Low Energy
Bluetooth low energy focuses on short-range communication, as shown in Fig. 5. The distance between wireless devices is influenced by many factors, including the place of operation, antenna design, and tool orientation. The power of transmission (Tx power) is generally measured in units of dBm, and is configured for a certain distance (−30 to 0 dBm). A higher transmission power increases the range of the transmitted signal but uses up more battery [21].

Logitech C505
Logitech C505 is a webcam with a resolution of 720 pixels and a long-range mic that supports clear and natural conversation up to several meters, as shown in Fig. 6. We used this web camera for edge detection because it produces a clear image and reduces noise in it, making it easier for the system to detect edges. The mic can capture sound up to 3 m away. In the future, it is hoped that the smart garbage bin can be controlled by voice commands alone.    Android device. Data from the Android device, camera, and sensor are sent to the server until the smart garbage bin moves to the exact desired location, as shown in Fig. 8. We used room E315 of the Department of Electrical Engineering in the National Chin-Yi University of Technology as the mapping location for the smart garbage bin, as shown in Fig. 9.

Arduino IDE
The Arduino IDE, or the Arduino Integrated Development Environment, software contains a text editor for writing code, a message area, a text console, a toolbar with buttons for trivial functions, and a series of menus. It connects to the Arduino hardware and uploads the data to facilitate communicate between devices. We use the Arduino IDE to easily code our NodeMCU.

Blynk
Blynk is a hardware-agnostic IoT platform with white-label mobile apps, private clouds, device management, data analytics, and machine learning. It combines a cloud platform with applications that

Fuzzy Method
We used the fuzzy logic architecture based on the mathematical model of MISO (multiple input single output) to calculate and analyze the variables. Fig. 10 shows the architecture used in this research. Two parameters were used as input: the percentage of waste and methane level. The output shows an ON/OFF notification. Each input was divided into the three categories mentioned in Tab. 1. Fig. 11a shows the fuzzy inference based on past research obtained using MATLAB. The result of fuzzy inference shows that if the bin was 50% full of waste and the methane level was 650 ppm (1 ppm=1 mg/l), the smart bin sent a notification to the relevant authorities. This calculation was in accordance with the provisions set. Fig. 11b shows the surface viewer obtained using MATLAB. This graph shows the relation among all variables used in this research. The higher the percentage of waste and the methane level were, the more likely was the notification to be turned to ON.

Canny Edge
In the smart garbage bin 315 experiment, four points of view were taken from various cameras as shown in Tab. 2. The image will be captured in the second frame rate unit, and the Canny filter will be applied to make it easier for the 315 smart bin to detect edges. According to this explanation, the smart bin 315 traveled toward the user by using BLE to make it easier for it to reach its destination without colliding with items surrounding it. This was accomplished using edge detection. According to the case shown in Tab. 2 scene 1, when the smart bin was called, it began identifying the edges by using a Canny filter and followed the path with the fewest lines. The smart bin was spun once so that it would memorize the corners of the room in a process akin to indoor mapping. As shown in Tab. 2 scene 2, the smart bin moved until it found the general user. The user then disposed of their trash in the smart bin, after which it reverted to mapping and edge detection, as shown in Tab. 2 scenes 3 and 4.  Edge detection is a basic problem in image processing and computer vision. The purpose of edge detection is to identify points with obvious brightness changes in digital images. Significant changes in image attributes usually reflect important events and changes in attributes. These include (1) discontinuities in depth, (2) discontinuities in surface orientation, (3) changes in material properties, and (4) changes in scene lighting. Edge detection is a research field in image processing and computer vision, especially in feature detection. Image edge detection greatly reduces the amount of data, and eliminates information that can be considered irrelevant, retaining the important structural attributes of the image.

Mathematical Model
After field surveys and multi-stakeholder discussions, we analyzed the smart garbage bin system in terms of its ability to determine the edges and its rate of waste disposal.

Rate of Waste Disposal
We calculated the weight of each recycling bin and organics in it to compute the amount of waste: In Eq. (1), W D : weight of the disposed waste; and W A : weight of all waste.
Because the smart garbage bin system separates waste, In Eq. (2),

Edge Detection
Edge detection is a form of image segmentation used to detect the presence of an edge or line in an image and draw an appropriate outline of it. The major goal is to simplify visual data by reducing the amount of data that need to be processed.

Analyses of Experimental Results
The outcome of this research is a prototype of a smart garbage bin, called SB-315. This Android-based application can show the percentage of waste and level of methane in each garbage box. Fig. 12a shows the homepage of the smart garbage bin application. It has various features, such as a bell sound for a notification if the waste level exceeds the given threshold, a waste level button to see the level and percentage of waste, and a "Call SB-315" function for the user to call the smart garbage bin. Fig. 12b shows the page representing the level and percentage of waste in each box of the smart garbage bin. Level 1 is indicated in green, with the percentage of waste ranging from 0-20% of the total capacity of the box; level 2 is indicated in yellow, and represents a percentage ranging from 20%-50%; level 3 is indicated in red, and reflects a percentage of garbage above 50%. If the waste level reaches the red threshold, a notification appears on the home page. Level 3 notifications continue to run even if the smart garbage bin has been dispatched [22][23][24]. The SB-315 prototype was constructed with two manual waste separations: one for recyclable waste and the other for non-recyclable waste. This smart garbage bin was designed to be as small as possible in order to fit through the narrow hallway of room 315. Fig. 13a shows that SB-315 has a height of 0.68 m, side width of 0.35 m, front width of 0.6 m, and a hole for a trash box of size 0.22 m. When the trash box is lifted and removed, this box has a height of 0.51 m, with a front width of 0.16 m and a side width of 0.23 m. Fig. 13b shows that this garbage box also has an ultrasonic sensor near the lid of each recyclables' and non-recyclables' box, so that when the bin arrives at the user's location, the user simply needs to place their hand on the sensor to open the lid of the garbage box. The bin also has a camera on the front for edge detection.

Conclusions
This study developed a self-monitoring and self-moving smart trash bin for research room E315 of the Engineering Building of the National Chin-Yi University of Technology. The idea for this smart trash bin came about because of the activities of students at the lab. It uses the concept of the Artificial Intelligence of Things. The results of experiments showed that it functions well by using the fuzzy method and Canny edge detection. The main parameters of the system are the percentage of waste, obtained from the readings from an ultrasonic sensor, and the methane level, obtained from readings from an MQ4 gas sensor. This system is also connected to an Android device that can be used to call the smart trash bin through a Bluetooth beacon connection. Now due to the outbreak of COVID-19, the method studied in this paper will effectively avoid direct or indirect contact between people. This method will directly avoid people's doubts about contact with trash cans and will also prevent COVID-19 from invading people's bodies through trash or trash cans. Therefore, the use of smart trash cans can prevent people from directly touching germs.
Acknowledgement: This research was supported by the Department of Electrical Engineering at National Chin-Yi University of Technology. The authors would like to thank the National Chin-Yi University of Technology, Takming University of Science and Technology, Taiwan, for supporting this research. We thank Cwauthors (www.cwauthors.com) for its linguistic assistance during the preparation of this manuscript.
Funding Statement: The authors received no specific funding for this study.