An Internet of Things Based Smart Waste Management System Using LoRa and Tensorflow Deep Learning Model

Traditional waste management system operates based on daily schedule which is highly inefficient and costly. The existing recycle bin has also proved its ineffectiveness in the public as people do not recycle their waste properly. With the development of Internet of Things (IoT) and Artificial Intelligence (AI), the traditional waste management system can be replaced with smart sensors embedded into the system to perform real time monitoring and allow for better waste management. The aim of this research is to develop a smart waste management system using LoRa communication protocol and TensorFlow based deep learning model. LoRa sends the sensor data and Tensorflow performs real time object detection and classification. The bin consists of several compartments to segregate the waste including metal, plastic, paper, and general waste compartment which are controlled by the servo motors. Object detection and waste classification is done in TensorFlow framework with pre-trained object detection model. This object detection model is trained with images of waste to generate a frozen inference graph used for object detection which is done through a camera connected to the Raspberry Pi 3 Model B+ as the main processing unit. Ultrasonic sensor is embedded into each waste compartment to monitor the filling level of the waste. GPS module is integrated to monitor the location and real time of the bin. LoRa communication protocol is used to transmit data about the location, real time and filling level of the bin. RFID module is embedded for the purpose of waste management personnel identification.


I. INTRODUCTION
Internet of things (IoT) is a communication paradigm that envisions a future paradigm where everyday life objects will be equipped with a microcontroller and some form of communication protocol [1]. One well-known product of IoT is the smart city, which can be defined as a city with The associate editor coordinating the review of this manuscript and approving it for publication was Arun Prakash . smart technology, smart people, and smart collaboration [2]. IoT shall transparently and seamlessly incorporate a large number of heterogeneous end systems while providing open access to select subsets of data for the development of a plethora of digital services [3]. One major topic within the smart city is smart waste management. When it comes to waste management systems, the communication distance between the waste collection center and the waste collection point is a major factor in determining the system's VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ effectiveness. However, available communication technology such as LoRa and SigFox, which operate on a low power, wide-area network (LPWAN) are able to cater to the longdistance communication needed by the waste management system while sacrificing on the rate of data transmission. Studies [4]- [8] in the field of wireless communication in IoT have also been accelerating. Conversely, communication technology such as Bluetooth, Wi-Fi, and Zigbee offer better data transmission rates, but these are limited by their data transmission ranges. Waste management is a costly operation as it takes up a great deal of resources and labor. Efforts have been taken by the authorities to improve waste management systems by setting up the recyclable bin and launching the 3Rs campaign (recycle, reuse and reduce). A study on public awareness of recycling activities in Kota Bharu, Kelantan Malaysia shows that only 31.8% of the total of 384 participants were involved in recycling [9]. This shows both that the initiatives taken previously were not effective and that a smart waste management system needs to be developed to replace the existing infrastructures.
Advances in the field of IoT have made it possible to improve the existing waste management system. Sensors implementation in the waste bin together with IoT connectivity allow for real-time monitoring, which is absent in the existing waste management system. Data such as filling level, temperature, humidity, and any necessary data can be collected from the sensors. These data can then be transferred to the cloud for storage and processing. The processed data can then be used to study and access the limitation of the existing waste management system and therefore improve the system's efficiency as a whole. IoT application in the waste bin is one step towards a smart city.
In addition, deep learning has provided state-of-the-art solutions for comprehensively understanding human behaviors [10]. With the development of deep learning and image processing algorithms, the classification of waste can be carried out with higher accuracy and in a shorter time. Classification of waste is a crucial step before the separation of waste can be performed. A deep learning method such as a convolutional neural network allows for the extraction of unique features from the image and then classifies them into each class with high accuracy [11]. Tensorflow is an open-source, deep-learning library used for machine learning applications. It is capable of speech recognition [12], image classification [13], object detection [14], text classification [15], etc. With the intelligence gained from deep learning and an IoT, which integrates millions of smart devices together, the existing infrastructure for waste management systems can be improved.
Challenges in achieving sustainable waste management have been summarized in [16]. Insufficient technologies and facilities due to the increasing rate of waste generation have resulted in the failure to cope with landfilling [17], [18]. The lack of a recycling market has also hindered the effectiveness of waste recycling implementation [19]. Waste minimization is a costly operation, the lack of funds among industry practitioners has resulted in a reluctance to apply proper waste management techniques [17], [19]. Besides that, insufficient regulations imposed by authorities have allowed the practitioners to apply their way of waste management [19], [20]. Industry practitioners do not have an awareness of the importance of implementing a regulated waste management system based on the predefined waste management hierarchy [19], [20]. The present methods and infrastructures used are discussed in [21]. The existing infrastructures are carry high operating costs and offer only limited accuracy [22].

II. RELATED WORK
For an IoT-based solution to be implemented, it should be energy efficient, able to communicate, and share information across extended coverage [23]. An IoT-based embedded system is proposed in [24]. GSM communication technology is used as the platform to perform data transmission to the server. Web-based Android applications are developed to interface with a web server to provide information from sensors monitoring bin status, amount of waste in the bin, and time of waste collection. The data are processed by a graph theory optimization algorithm to obtain the shortest path for reaching the bin to efficiently manage the waste collection strategies. Graph theory optimization provides a very cost-efficient procedure to reduce the operation costs of a waste management system.
A second IoT-based smart bin is proposed in [25]. It comes with three compartments, each with its own functionality: The first compartment consists of an infrared IR sensor and metal detector. The second compartment consists of an IR sensor and moisture sensor to detect dry and wet waste. The last compartment is subdivided into three bins for the collection of segregated waste respectively. The system connects to WiFi for data transmission to a specific server. The storage compartment consists of a rotating table with three bins, namely dry, wet, and metal. It rotates according to the type of waste detected in the previous compartment. The use of Wi-Fi as a communication medium limits its transmission range,which is a crucial element of a smart bin that might be situated in a remote location.
A third IoT-based solid waste management system is proposed in [26]. In this system, a DHT22 temperature sensor, MQ-135 gas sensor, IR sensor, passive infrared, PIR sensor, and load cell are used to monitor the temperature and humidity, presence of harmful gas, amount of garbage, presence of user, and weight of garbage respectively. LoRa communication is used to transmit data to a gateway, and the data are sent to a cloud for cloud monitoring. The system uses a total of five waste bins to handle five different types of wastes, with each bin having its own set of sensors, which ultimately increases the overall cost of the system.
A fourth IoT-based system is proposed in [27]. This system relies on an ultrasonic sensor to monitor the amount of waste in the bin. The monitored data are also transmitted through LoRa communication. The proposed system only monitors the amount of waste in the bin. However, the author highlighted it power management with such components as a counter and switching regulator to manage the power consumption.
An automated approach to segregate recyclable material is proposed in [28]. The recycling bin is equipped with four types of sensors, namely inductive sensors to detect plastic, a capacitive sensor to detect metal, a photoelectric sensor to detect paper, and a proximity sensor to detect motor position. When waste is inserted into the recycle bin, three types of sensors connected to Arduino Uno operate to detect the type of material. Once the detection is completed, the circular plate holding the waste will be rotated by the direct current motor to the respective material's compartment. A pusher then pushes the recyclable material to the separation bin. The proposed system relies on several sensors that can add up to the maintenance and manufacturing cost of the recycling bin.
A smart recycling bin is proposed in [29]. The system uses Raspberry Pi 3 and Xilinx PYNQ-Z1 FPGA board together with pretrained ResNet-34, a convolution neural network containing 34 pretrained layers to perform waste classification. The data collected from the bin are transmitted using a LoRa communication network from a sensor node to the gateway. The system obtained a detection accuracy of 92.1% with an average processing time of 1.82 seconds. However, the system does not perform any form of waste segregation after waste classification.
An intelligent waste classification system is proposed in [30]. It uses a 50-layer residual net pre-train (ResNet-50) model, which served as an extractor and Support Vector Machine (SVM) to classify waste into different classes such as glass, metal, paper, and plastic. The top classification layer of the model is removed, and features are extracted from the network. The feature extracted is then classified using multi-class SVM [31], [32]. The proposed system obtains an accuracy of 87%. The proposed system provided an in-depth approach in optimizing the ResNet-50 model for waste identification by providing a set of defined parameters for the SVM optimization. However, ResNet-50 requires a higher processing power that is not suitable for mobile platform implementation.
An intelligent waste separator is proposed in [33]. The system classifies waste based on the first two Hu's Invariant Moments (HIM) [34] with the k-Nearest Neighbors (k-NN) [35] algorithm by using Euclidean distance. The proposed system is able to achieve an efficiency of 98.33% using the k-NN algorithm with k = 3. The proposed system is able to identify different types of waste with high accuracy, but if deformed waste is disposed of, the system is unable to identify it due to the fact that the system's waste detection relies on the shape of the waste.
Research on waste sorting using deep neural networks is performed in [36]. Several deep convolutional neural network architectures such as ResNet, MobileNet, Inception-v4, DenseNet, and Xception are used to perform training and testing. A total of 2527 waste images consisting of paper, glass, plastic, metal, cardboard, and trash are used as the training dataset. The two different optimization approaches used are Adam [37] and Adadelta [38]. Based on the results, Inception-v4 shows exceptional results over the other architectures, with 90% test accuracy when trained without any pre-trained weights, whereas DenseNet-121 yields 95% test accuracy when done using transfer learning with defined weight. However, this research also proposes a new model, namely RecycleNet, which is optimized for classification of select recyclable object classes. This model can reduce the number of parameters in a 121-layered network from 7 million to about 3 million, and it is able to obtain 81% test accuracy with a limited dataset.
In [11], a smart bin system based on machine learning, image processing, and IoT is proposed. This system uses a convolutional neural network (CNN) to identify and segregate waste into different classes, such as metal, glass, paper, and plastic. A total of 400 to 500 images containing the four different classes are used to train the network. The CNN used is implemented in TensorFlow using Keras. The network is constructed of eight layers. The train/validation split used is 350-400/50-100 per class, and 50 epochs are used. With image processing running on the Raspberry Pi micro-controller, the system is able to identify and classify waste with an accuracy of around 84%.
A smart bin using LoRa technology is proposed in [39]. Wireless communication is achieved by using WiFi, Bluetooth, and cellular networks, but these bands include major problems such as noise, interference, network lag, interruption, and inefficiency. LoRa technology is proposed to solve these problems by having a separate network. LoRa enables long-range transmission of more than 10km with low power consumption. It is able to handle high capacity, that is, millions of messages per base station, which is ideal for public network operators serving many customers. The proposed system consists of LoRa gateway, a remote diagnostic system, sensors for monitoring garbage quantity, and a cloud platform. The process is done by interfacing various modules such as GPS, camera, motors, and sensors. Sensors keep track of garbage levels and detect overflows. LoRa gateway transmits information about the garbage bin to a nearby vehicle, which is a smart dustbin, by recording the information in the cloud platform. The smart dustbin that receives information will move to the bin for replacement. The communication is done using LoRa.
Research presented in [40] examine LoRa as a low power wide area network (LPWAN) protocol. LoRa utilizes star topology to broadcast signals between the node and gateway. It allows for the usage of scalable bandwidths of 125 kHz, 250 kHz, or 500 kHz [41]. Chirp spread spectrum allows for good sensitivity, robustness, and doppler shift resistance. Its low power capability also allows for an average lifespan of five to ten years of deployment. Several applications of LoRa can be found in fields such as smart environment, smart home, smart city, and smart metering. Table 1 represents the comparison between different communication protocols.  [40], [43].
A similar approach is done in [42]; however, the communication protocol used is Zigbee and GPRS.
Nonetheless, the existing waste management systems presented throughout the literature do not combine both a complete waste segregation system together with a robust communication network. Instead, they only have one of those in their system. In this article, we present a smart waste management system using integrated sensors, LoRa communication protocol, which has been used for the data transmission to the server, and a TensorFlow framework to train a deep learning model that performs real-time object detection and classification.

III. HARDWARE MODELING OF SMART BIN
Conventional bins are usually categorized in terms of the type of waste, for example, recyclable and non-recyclable waste. The recyclable bin is further categorized into different types, such as paper, metal, and plastic waste. This convention has resulted in as many as 4 different types of bin situated at a garbage collection point. This eventually increases the overall cost of operation for the maintenance of the bin. Even if the designated bins are well prepared for public usage, often the public will not utilize it properly and simply throw waste in any of the bins regardless of designation. Hence, conventional bins have proved their ineffectiveness in the public eyes. This article offers a solution to this issue by having separated waste compartments account for different types of waste, such as paper, plastic, metal, and general waste. In order to effectively identify and segregate different types of waste, an object detection model is trained using a Tensorflow framework and exported to a Raspberry Pi mobile microprocessor to perform waste detection. Ultrasonic sensor monitors the filling level of the bin, while a GPS module monitors its location. The status of the bin's filling level and location is then sent to the server through a LoRa module for the purpose of monitoring.
An RFID module is also implemented into the system to provide access for authorized personnel to the bin for maintenance purposes. Figure 1(a) represents a 3D model of the bin using the modeling tool, Blender3D. The electronic compartment holds the electronic components. The waste detection compartment has a retractable platform that holds the waste temporarily. At the same time, waste identification is being performed by capturing the image of the waste and processing it with the Raspberry Pi. The bin is designed with four different compartments to hold metal waste, plastic waste, paper waste, and general waste. Each waste compartment comes with a retractable lid that opens and closes to allow the waste to enter. Figure 1(b) represents the dimensions of the bin. Figure 2 represents the overall block diagram, where the development process of the smart bin is given. Arduino Uno and Raspberry Pi operate independently and do not communicate with each other. The camera module is connected to Raspberry Pi to capture the waste image for the purpose of object detection and identification. After the waste is identified, servo motors controlled by the Raspberry Pi will actuate the opening and closing of the lid of the waste compartment. The opening of the lid allows waste to fall from the waste detection compartment into its respective waste compartment, which is shown in Figure 15. An RFID module is connected to the Raspberry Pi to identify authorized personnel possessing access cards. Once authorized personnel are identified, RFID module will trigger Arduino Uno to unlock the electronic compartment. Communication of the RFID module consists of two parts, an RFID reader that has an antenna responsible for transmitting and receiving a signal through radio waves [44], and a passive RFID tag that contains an antenna and integrated circuit that stores the identification code and other information. Since the purpose of the RFID module is to only allow authorized personnel to access the bin through the use of RFID tags, a list of identification codes that come with the RFID tags are encoded into the system so that the system will only respond when it encounters registered RFID tags. The system responds by unlocking the electronic compartment. Since the RFID module is based on a backscattered system, the power transmitted between the RFID reader and tag might vary with its position [45], which ultimately affects the performance of the RFID module. In order to solve this issue, we have situated the RFID so that it is easily reachable and has no obstacles over the surface of the RFID reader. The latter ensures good transmission of power between both the RFID reader and tag.

IV. SENSORS AND LoRa IMPLEMENTATION
The ultrasonic sensor is connected to Arduino Uno to monitor the filling level of each of the bin's waste compartment, including a plastic, metal, paper, and general waste compartment. The ultrasonic sensor uses sonar to measure the time taken for the signal to travel from the transmitter end to the receiver end, and the time difference is used to calculate the filling level of waste inside the bin. A GPS module provides information on the location (latitude, longitude) as well as the real-time of the bin from the satellite. The filling level, location, and real-time bin are collected and transferred via a LoRa module from the bin to the Waspmote gateway, which is connected to the computer. Figure 3 represents the sensor and modules used in the system. Table 2 represents the model of the sensors and modules used in the system.   LoRa is suitable to be implemented in this system because bins are usually placed between a few meters to a few kilometers apart, and LoRa is able to transmit data from a long distance while consuming low power. Figure 4 shows the multiprotocol radio shield connected with the LoRa module and Arduino Uno, which acts as a node, and Waspmote, which acts as a gateway. Table 3 represents the specification of LoRa used in the system. The LoRa module is connected to Arduino through a multiprotocol radio shield, which acts as the interconnection shield for Arduino and is designed to connect two communication modules at the same time. The module uses star topology as the nodes (end device/sensor node) to establish point-to-point connections with gateway through the use of parameters such as the node address. Figure 5 represents the star topology deployed by the LoRa module. It comes with two frequency bands, 868 MHz and   915 MHz ISM bands, which include several channels in each frequency band. Three options of bandwidth are available, 125 kHz, 250 kHz, or 500 kHz. Higher bandwidth is chosen for faster transmission, while lower bandwidth is chosen for longer reach. At the gateway end, a hyper-terminal called RealTerm is used for receiving and decoding the data stream sent from the LoRa node.

V. OBJECT DETECTION MODEL
A predictive system was proposed in [46], where the system evaluates the condition of equipment using predictive maintenance techniques. Raspberry Pi is used to preprocess the data collected from the sensors, and the data is uploaded to the database through WiFi connectivity for cloud analysis. A Statistical Analysis System is proposed to analyze and process the data, which requires high computational power. A similar approach is proposed in [47], where data are sent to the cloud to perform analysis and predict the waste generation habits in the region. In our proposed system, we have decided to utilize the mobility of Raspberry Pi, a mobile CPU together with MobileNetV2, a lightweight model and a mobile architecture to perform waste classification on the board itself instead of uploading it to the database for cloud analysis. This allows us to reduce the latency in waste classification. Moreover, the bin itself is scattered around the city where connectivity to the database might not be feasible. For example, a 5MP image has a typical file size of 15.0MB. If we were to reduce the latency of waste classification, Wi-Fi connectivity would be chosen to upload the image at a higher data rate. However, Wi-Fi connectivity is limited by its transmission range of around 50m. This would imply that the bin must be within that range in order to classify waste, which is not ideal. Hence, the system would perform better by performing waste classification on the board itself to reduce the latency of waste classification.
Edge learning has been deployed in many IoT platforms [48]- [50] due to the limitations, such as limited computing power and battery life, faced by current IoT technologies. With edge learning, the huge amount of data and computations that were previously processed in the device and cloud can now be offloaded to the edge. This results in lower latency and a better response time in the system. For the proposed system, LoRa communication is used as a medium for data transmission, which has a desirable long-range characteristic suitable to be implemented in the bin, that will be scattered around the city. However, LoRa has a limited data rate of 50 kbps per channel [51]. As mentioned previously, a typical 5MP image of waste has a file size of 15.0MB. Hence, performing edge learning by sending images of waste to the edge is also not suitable for the proposed system.
Waste identification is performed using the TensorFlow object detection API running on the Raspberry Pi. This object detection API runs on a pre-trained object detection model, SSD MobileNetV2, which is lightweight and suitable to run on low-computing power devices such as Raspberry Pi. The architecture of MobileNetV2 [52] is based on linear bottlenecks depth-separable convolution with inverted residuals and it is an improvement over the previous version, MobileNetV1 [53]. Depth-separable convolution requires less computation by splitting convolution into two separate layers, depthwise convolution and pointwise convolution. Figure 6 represents the operation of depthwise convolution and pointwise convolution. Depthwise convolution is performed by extracting spatial features of each input feature separately, thereby reducing the number of parameters and computational cost. On the other hand, pointwise convolution is a 1×1 convolution used to build new features through linear combination from the output of depthwise convolution. Figure 7 represents the conventional residual block and inverted residual block. The conventional residual block will first pass the input through a 1 × 1 convolution to reduce the dimension. This is followed by standard convolution and finally 1 × 1 convolution to increase the dimension. Alternatively, the inverted residual block will first pass the input through 1 × 1 convolution to increase the dimension. This is followed by depthwise convolution and then pointwise convolution to reduce the dimension.
As mentioned previously, pointwise convolution in an inverted residual block will result in a reduction of dimension. Together with a non-linear activation function, it will result in loss of information. Hence, the linear bottleneck layer in  MobilenetV2 is used to replace ReLU to prevent non-linearity from destroying too much information in low-dimensional space. Table 4 represents the bottleneck residual block architecture used to transform features for a block size of H × W, where H represents height and W represents weight with an expansion factor t and stride s transforming from input feature K to output feature K'. The residual block has 3 layers where the first layer uses 1 × 1 convolution with a rectified linear activation unit capped at 6 (ReLU6). This is followed by 3 × 3 depthwise convolution with ReLU6 and then linear 1 × 1 convolution to match the initial number of features. ReLU6 is used as the non-linearity due to its robustness in low precision computation [53], and the replacement of ReLU6 with a linear transformation layer at the output of the bottleneck has shown improvement in terms of accuracy of object detection. Figure 8 represents the impact of ReLU6 in bottleneck. It is observed that linear bottleneck outperforms ReLU6 in bottleneck at the output layer.  Figure 9 represents the stride block of MobileNetV2. Stride = 1 block represents the bottleneck residual block, while Stride = 2 block represents the block used for downsizing the input feature. The first layer of the bottleneck residual block is used to expand the number of features of the input data based on the expansion factor before outputting it to the second layer. The second layer will then perform depthwise convolution to filter the feature. The filtered feature will then be reduced to a smaller number in the third layer. Residual connection is used to help the flow of gradients through the network. Figure 10 represents the comparison between different types of residual configuration. It is observed that a shortcut between bottlenecks outperforms another shortcut configuration. The addition of shortcut con-  nections between bottleneck layers, which is lacking in the previous MobileNetV1, allows for improvement in performance. Table 5 represents the body architecture of MobileNetV2, which is used to perform feature extraction with standard convolution (conv2d), average pooling (avgpool), expansion factor (t), number of output feature (c), block repetition (n), and stride (s). The network has 19 residual bottleneck layers, and its architecture is described in Table 4. Depthwise convolution and spatial convolution are performed using 3 × 3 kernels, while pointwise convolution is performed using a 1 × 1 kernel. The spatial dimensions of the tensors reduce over time and the use of low-dimension tensors allows MobileNetV2 to reduce the number of computations, which ultimately improves its performance. However, features extracted from low-dimensional tensors are limited. Hence, MobileNetV2 solves this issue by first expanding the number of features based on the expansion factor to restore the data before reducing the number of features at the final layer. Single-shot multibox detector (SSD) is an object detector that is used to detect multiple objects within a single image. The detection model is based on a feed-forward convolutional network that predicts the bounding boxes and confidence scores for each object. SSD implementation is independent of the base network, which is responsible for feature extraction. It uses multiple feature layers of different sizes to predict the bounding box and confidence of different objects in an image. In our proposed system, we have used SSD as the object detector and MobileNetV2 as our feature extractor with the final fully connected classification layer removed. Figure 11 represents the architecture of SSD with MobileNetV2, which is used as the base network responsible for feature extraction. The progressive reduction in the size of feature layers allows the prediction of objects at multiple scales. In order to detect objects in an image, SSD uses multiple default boxes (anchors) of different sizes, scales, and aspect ratios with grid cells to detect multiple objects within the grid cell region. In the case of SSD, an object is considered to be detected if it is able to predict the class and location of the object. Otherwise, it is considered background and ignored. The default box with the highest degree of overlap with the ground truth bounding box containing the object is responsible for detecting the class and location of the object. The degree of overlapping is measured by the intersection over union (IoU) evaluation metric between the default box and the ground truth bounding box containing the object. The ground truth bounding box in our case is the labeled waste images that are used as the training and testing dataset. Another evaluation metric used is the loss function, which describes the confidence loss and the localization loss. Confidence loss describes the confidence of the object's prediction, while localization loss describes the offset of the default box from the center of the bounding box. Generally, high IoU score implies that there is a high degree of overlapping between the default box and the bounding box and can be considered as a good prediction. On the other hand, low loss function implies that the confidence loss and localization loss is low and can also be considered as a good prediction. In order to correctly predict the object, 8732 default boxes of different scales, aspect ratio, and sizes are used to match the bounding box and perform prediction. The default box with a confidence score lower than a threshold of 0.2 will be filtered out, and the default box categorized as the background will also be filtered out. Before outputting predicted default boxes, nonmaximum suppression is used to filter out the repeated default boxes. The pre-trained object detection model is trained using images of waste as a training dataset. This method of training is known as transfer learning. Figure 12 represents the sample image used as a dataset to train the model, and 365 images of waste with a different orientation, background, and lighting condition are collected. Before the training, images of waste are labeled by class to perform supervised learning where we feed in training data with known classes for the model to perform training. Image labeling is done using software LabelImg as shown in Figure 13. Figure 14 represents the process of obtaining the object detection model. After waste images are collected and labeled, they are used to train the object detection model until the model consistently achieves an error of less than 1.0000. A frozen inference graph is generated and exported to Raspberry Pi to perform object detection. The threshold for the accuracy of the model is determined based on the mean average precision (mAP) score of the model obtained from evaluating test images as well as test results obtained during real-time waste detection. The mAP score of the model obtained from evaluating test images is 86.2%. Whereas for real-time waste detection, the average precision of metal, plastic, and paper are 86.7%, 96.3%, and 82.3% respectively. Since the lowest average precision is 82.3%, the threshold accuracy value is defined at 80% by adding some tolerance to the lowest average precision value so that the model has more flexibility in terms of waste detection performance. Once the inference graph is obtained, it is exported to Raspberry Pi to perform waste detection and identification. Figure 15 represents the operation of the bin after the identification of waste. Waste will be first dropped into the retractable platform to perform waste detection using the inference graph generated previously. After the class of the waste is identified, the retractable lid of the specific waste compartment will be actuated and opened by a servo motor. Then, the retractable platform will be lowered to allow the waste with the help of gravity to fall into the specific waste compartment. Algorithm 1 describes the working mechanism of the bin. The ultrasonic sensor is used to detect the  presence of waste inside the waste detection compartment by comparing the distance before and after the presence of waste. For example, the total distance traveled by the ultrasonic sound wave is 0.50m when the compartment is empty (measured according to the length of the waste detection compartment). If there is a presence of waste in the waste detection compartment, the total distance traveled by the ultrasonic sound wave would be shortened as it is reflected by the surface of the waste. At the same time, the Pi camera is constantly capturing images of waste and sending them to Raspberry Pi to perform waste classification. If the type of waste is not in one of the classes (metal, plastic, or paper), then the waste is unidentified and the system will classify it as general waste based on the data obtained from the ultrasonic sensor that senses the presence of waste. These steps are taken to reduce the amount of training dataset required to train the waste detection model by eliminating the need to prepare the training dataset of general waste and by reducing the computational cost. The system is designed and trained to classify and segregate waste based on the image of the waste. The waste image dataset is prepared with different capturing angles, lighting conditions, and backgrounds. Hence, the system is able to classify the waste thrown at different orientations and positions. However, if the waste is covered with a foreign item such as a garbage bag, it will be identified as general waste.

VI. SMART BIN PROTOTYPE
The bin is built with a dimension of (0.37m width × 0.44m depth × 0.56m height). Figure 16 (a), (b) and (c) presents its front view, top view, and back view. The waste detection platform allows the waste to be detected and classified by the waste detection model before being thrown into the designated waste compartment. Figure 16(d) shows the electronic compartment, and the functionality of each electronic component is shown in Table 6. Figure 16(e) shows one of the waste compartments where the entrance of waste is controlled by the servo motor-controlled lid, which opens according to the type of waste detected.   Table 7 represents the overall system cost of the proposed system. LoRa works on an unlicensed spectrum. Hence, it comes with no spectrum costs. The gateway cost is only incurred once per base station. The overall system cost per bin amounts to $180. The overall system cost is justifiable as it aims to reduce the amount of manual labor work at the recycling plant, which ultimately reduces the cost of waste management. Table 8 represents the system's nominal power consumption. The higher power consumption of Raspberry Pi 3 Model B+ is due to the high computation power required during waste detection and classification. The nominal power consumption of the ultrasonic sensor accounts for five ultrasonic sensors operating simultaneously. Servo motors controlling the platform and lid contribute a nominal power consumption of 1.5W each, which add up to 3.0W. The total nominal power In designing the power module to power the entire system, we have come up with two options as illustrated in Table 9. We have decided to use a power bank with a capacity of 20000mAh as the main power source, which supplies up to 5V and 2.1A, coupled with a solar panel that generates up to 13W/5V. The portability of this option allows the bin to be placed on the sidewalk of the street where a power outlet might not be readily available. Since the bin will be placed in an open public area, there will be direct sunlight for the solar panel to generate electricity during the day and to charge up the power bank. During the night when there is no sunlight,  the system will utilize the energy reserved in the power bank that was charged up during the day. On the other hand, power from a universal power supply module is restricted by the availability of power outlets, and it is charged by the utility company as per electricity usage, which increases the annual operating cost of the system in comparison with the power bank with a solar panel option, which has a minimal annual operating cost. A power bank has a typical lifespan of three to five years, whereas a solar panel has a typical lifespan of 25 to 30 years. Table 10 represents the annual operating cost of different power module options. It is observed that the first option (assuming the power bank and solar panel each has a service life of 3 years and 25 years, respectively) is cheaper compared to the second option (assuming an average electricity cost of $0.12/kWh). Hence, the implementation of a power bank with a solar panel is deemed more environmentally friendly and sustainable in the long run.

VII. RESULTS AND DISCUSSION OF OBJECT DETECTION MODEL
Training of the waste detection model is done using Anaconda Distribution, a general-purpose Python notebook used to perform tasks such as machine learning, training the neural VOLUME 8, 2020 network, data visualization, predictive analytics, and bias mitigation. Transfer learning is performed on a pre-trained model, SSDMobileNetV2 by retraining the model with our own sets of waste images. The training is performed until the error is around 1.0000, which took around 20000 epochs. The error is around 1.0000 because this is a lightweight object detection model suitable for portable devices like mobile phones and Raspberry Pi with limited computing power, but, on the contrary, it is able to perform detection at a relatively high speed of 31ms. Figure17 (a), (b) and (c) presents the classification error, localization error, and total error of the model during training. Classification error is responsible for predicting the confidence score of all the classes and backgrounds. Localization error is responsible for fine adjustments in the position of the box generated during object detection. The total error is the summation of the classification error and localization error. After training the model for 20000 epochs, performance validation is performed by allowing the model to classify 200 random images of waste to obtain the mAP score of the model. Figure 17(d) represents the mAP score obtained during the training and evaluation phase of the model. The model is able to achieve a mAP score of 86.23%. Whereas for real-time waste detection, the average precision of metal, plastic, and paper are 86.7%, 96.3% and 82.3%, respectively. To ensure the model is not overfitted, we evaluate the training error and validation error. Figure 17 (e) and (f) represents the validation error and training error obtained during the training phase. Based on the graph, it is observed that both graphs have a downtrend pattern, which implies that the model is improving its accuracy in prediction and reducing its error. Both of the graphs are downtrending towards the value of 1.000, which signifies a good fit for the model. At 20000 epochs, the model obtained a training error of 1.023 and a validation error of 1.310. Figure 18 represents the data obtained from training the waste detection model. Checkpoint is saved every few minutes during training. This folder contains the GraphDef that defines the dataflow, annotations for variables, input pipelines, and values of each variable such as weight, bias, placeholders, gradients, hyper-parameters, and metadata. After the training has reached an error of around 1.0000, a frozen inference graph will be generated as shown in Figure 19. This frozen inference graph is a serialized GraphDef protocol buffer written to a disk that removes unnecessary metadata, gradients, and training variables. It is then exported to Raspberry Pi to perform waste detection.    Table 11 represents the performance and precision of the waste detection model. Based on the table, the waste detection model that was generated obtained an average precision of 88.4%. The precision for each type of waste detection is to be improved by increasing the number of sample data images. Waste detection running on the Raspberry Pi with camera module captures at a rate of around 0.75 frames per second. Table 12 represents the inference time of the waste detection model obtained during real-time waste detection on Raspberry Pi 3 Model B+. In reality, the operation of waste detection takes around one second, and the operation to drop the waste into the waste compartment takes another second. Hence, the total time taken from start to finish takes around  two seconds. The system's mechanism is designed to handle only one type of waste at a time. If there happens to be two consecutive wastes thrown before the identification of the waste that was thrown first, it will evaluate whether both the wastes are of the same type. If both of the waste items are of the same type, for example plastic, both of the waste items will then be thrown into the plastic waste compartment. However, if the two are each of a different type, for example plastic and paper, both will be thrown into the general waste compartment.  Figure 21 presents the access code obtained from the RFID scan to identify the authorized personnel. Only an access card with this particular access code can open the locking mechanism of the electronic compartment. The fill volume, GPS coordinates, and real-time of the bin collected from the ultrasonic sensors and GPS module, respectively, are presented in Figure 22. These data are collected and serialised before being sent. A LoRa module is set up at the node end, another LoRa module is set up at the gateway, and data is received at the gateway through a RealTerm hyperterminal. Serialized data are sent from the LoRa node to the LoRa gateway and are decoded using a RealTerm HyperTerminal, which is presented in Figure 23. The serialized data consist of the bin's location, the date, the bin's real-time, followed by the bin's filling level. LoRa module is transmitting data that is collected from the bin to the gateway at a data rate of 1180bps with a spreading factor, SF = 12, bandwidth, BW = 500kHz, and coding rate, CR = 4/5. Figure 24 represents the distance range covered by LoRa in the proposed system. The test was conducted with the gateway placed at an elevated position within the faculty of engineering, UKM to ensure there is a good line of sight, LoS with the node. One the other hand, the LoRa node at the bin is placed near a residential area, which is 2.6km away. It was found that the packet is correctly received at the gateway, which implies that the bin is still within the range of LoRa communication. The range is extended further down to the city center of Bangi, Selangor. It was found that the LoRa node is still within range and that the packet is correctly received at the gateway within a range of 5km from the gateway. This data transmission range is achievable due to facts that the city center of Bangi is of moderate density and that not a lot of high-rise structures are present. Therefore, these conditions allow for better LoS between the LoRa node and gateway. However,  packets are received at the gateway with a success rate of 96% and a mean received signal strength indicator, RSSI of −127.3dBm are observed after the bin is placed at a range of more than 5km. Packet losses are apparent because LoS of LoRa communication is reduced by the building structures over time as the bin is moved further away from the gateway. Table 13 presents the comparison among different waste management systems in terms of the type of waste, sensors, communication protocol, micro-controller, and machine learning architecture. Based on the comparison, it is observed  that the proposed system is more compact and flexible as it runs waste detection on a mobile micro-controller platform and because at the same time it is able to transfer data at a longer range and with lower power consumption. Based on Table 1, LoRa has proved to be more suitable for application in the bin system due to the fact that bins are usually placed and scattered around a city and could be few kilometers apart. The long-range and low power capability of LoRa is able to overcome this issue. Besides, the implementation of SSDMobileNetV2, a lightweight machine learning architecture allows for the mobile application required by a smart bin.

X. CONCLUSION
This article presented a smart waste management system by implementing sensors to monitor the status of the bin, LoRa communication protocol for low power and long-range data transmission, and TensorFlow-based object detection to perform waste identification and classification. The pre-trained object detection model, SSDMobilnetV2 is able to perform well in Raspberry Pi 3 Model B+ due to its lightweight nature. The model was able to detect and classify waste according to classes such as metal, plastic, and paper. However, the accuracy of the model can be improved by increasing the number of training data-in this case, the number of waste images-and by increasing the training time. The segregation of waste is interfaced and coordinated well between the object detection performed by Raspberry Pi and the servo motor controlling the lid of the individual waste compartment. An RFID module controls the locking mechanism of the bin. Ultrasonic sensors monitor the filling level, while the GPS module monitors the location and real-time of the bin. LoRa operating at a frequency band of 915MHz transmits data regarding the status of the bin regarding filling level, location, and real-time from the bin to the LoRa gateway. The data received at the gateway is decoded by a terminal program, RealTerm. This automated segregation and monitoring system implementation in the bin aims to reduce the operating cost and improve the waste management system. At the same time, we are eager to develop the city into a smart city. In the future, the waste detection model is to be improved by increasing the number of waste images in the dataset to increase the flexibility of the system in identifying waste. Moreover, an automated routing system can be developed to identify and pinpoint the shortest path to the bin for the purpose of maintenance. With this in mind, the existing waste management system can be improved and bring society towards a greener and healthier life. He has a patent and published around 60 peer-reviewed journal articles, conference papers, and two book chapters. His current research interests include biomedical instrumentation, signal processing, wearable sensors, medical image analysis, machine learning, embedded system design, and simultaneous EEG/fMRI. He is also running several NPRP and UREP grants from QNRF and internal grants from Qatar University along with academic and government projects. He has been involved in EPSRC, ISIF, and EPSRC-ACC grants along with different national and international projects. He has worked as a Consultant for the projects entitled Driver Distraction Management Using Sensor Data Cloud (2013-14, Information Society Innovation Fund (ISIF) Asia His research interest includes applied electromagnetic applications involving antennas, metamaterials, and metasurfaces. His main targeted applications are reconfigurable antennas for multi-standard wireless communications systems, security of chipless RFID systems with fractal tags, terahertz photoconductive antennas for infra-red energy harvesting, UWB nano rectennas for collection of solar energy, phase shifters for low-cost 5G communication systems, and microwave absorbing materials for stealth technologies.
MOHAMMAD TARIQUL ISLAM (Senior Member, IEEE) is currently a Professor with the Department of Electrical, Electronic and Systems Engineering, Universiti Kebangsaan Malaysia (UKM), and a Visiting Professor with the Kyushu Institute of Technology, Japan. He is the author and a coauthor of about 500 research journal articles, nearly 175 conference papers, and a few book chapters on various topics related to antennas, metamaterials, and microwave imaging with 20 inventory patents filed. Thus far, his publications have been cited 5641 times and his H-index is 38 (Source: Scopus). His Google scholar citation is 8200 and H-index is 42. His research interests include communication antenna design, metamaterial, satellite antennas, and microwave imaging. He has been serving as an Executive Committee member of the IEEE AP/MTT/EMC Malaysia Chapter, since 2018, the Chartered Professional Engineer (C.Eng.), a member of IET, U.K., and a Senior Member of IEICE, Japan. He was a recipient of more than 40 research grants from the Malaysian Ministry of Science, Technology and Innovation, the Ministry of Education, UKM research grant, and international research grants from Japan and Saudi Arabia. He received several international gold medal awards, the Best Invention in Telecommunication Award for his research and innovation, and the best researcher awards at UKM He has supervised about 30 Ph.D. theses, 20 M.Sc. theses, and has mentored more than ten postdoctorals and visiting scholars. He was an Associate Editor of IET Electronics Letters. He also serves as a Guest Editor for Sensors journal and an Associate Editor for IEEE ACCESS. VOLUME 8, 2020