A CNN-Based Smart Waste Management System Using TensorFlow Lite and LoRa-GPS Shield in Internet of Things Environment

Urban areas are facing challenges in waste management systems due to the rapid growth of population in cities, causing huge amount of waste generation. As traditional waste management system is highly inefficient and costly, the waste of resources can be utilized efficiently with the integration of the internet of things (IoT) and deep learning model. The main purpose of this research is to develop a smart waste management system using the deep learning model that improves the waste segregation process and enables monitoring of bin status in an IoT environment. The SSD MobileNetV2 Quantized is used and trained with the dataset that consists of paper, cardboard, glass, metal, and plastic for waste classification and categorization. By integrating the trained model on TensorFlow Lite and Raspberry Pi 4, the camera module detects the waste and the servo motor, connected to a plastic board, categorizes the waste into the respective waste compartment. The ultrasonic sensor monitors the waste fill percentage, and a GPS module obtains the real-time latitude and longitude. The LoRa module on the smart bin sends the status of the bin to the LoRa receiver at 915 MHz. The electronic components of the smart bin are protected with RFID based locker, where only the registered RFID tag can be used to unlock for maintenance or upgrading purposes.


I. INTRODUCTION
As the population living in urban areas increases rapidly throughout the years, there are a lot of challenges taken place in cities, especially in the waste management system. The World Bank stated that approximately 2.01 billion tons of waste were generated in 2016 due to the population and economic growth in the urban areas, which is estimated to increase to 3.40 billion tons in 2050 [1]. As per EUROSTAT, the European Union recycled 423 million tons of waste, which are 56% of locally produced waste in 2016 [2]. Moreover, 24% of the locally produced waste of 179 million tons was landfilled in the European Union. The European Union is among the world's largest landfills, which are Laogang in Shanghai, Bordo Poniente in Mexico City, Jardin Gramacho The associate editor coordinating the review of this manuscript and approving it for publication was Zhouyang Ren .
in Rio de Janeiro, and Sudokwon in Seoul demonstrated that this is often a worldwide issue [3]- [5]. Waste management, also considered as a waste collection system, requires several steps and actions to manage waste disposal, including the collection, transport, monitoring and regulation of the whole process. The methods to manage waste among urban and rural areas are different. Generally, the best solution to manage collected waste is to reuse and recycle them. However, the cost of effective waste management is high, which requires cooperation from authorities and users.
A lot of efforts have been made by the government or authorities to improve the waste management system; nevertheless, this is still a big problem in every country, especially in urban cities. Two kinds of situations happen if the waste is collected based on schedule; either the bins are not fully filled, or it is overflowed. The waste that is collected before the bins are full would lead to waste of manpower resources.
Otherwise, the overflow of the waste would cause environmental pollution, including air pollution and infectious diseases. Another effort to reduce waste production and mitigate the environment is recycling the waste. However, this method does not show positive results due to the ignorance of the users who do not categorize the waste correctly. The rapid development of the digital world brings a massive impact on technical developments, especially by allowing intelligence to be integrated into the existing technologies [6]- [8], which is also called the Internet of Things (IoT). The technologies combined with IoT lead the further development of various fields, such as engineering, to an entirely new perspective [9]. There are roughly 127 devices connected to the internet every second, which is equivalent to 328 million devices connected per month [5], [10]. The expected IoT market in 2023 will achieve 1.1 trillion [11]. Such statistics have shown the imperative role of IoT in the modern world. IoT enables the control of things in the real world and informs things by unifying everything in the real world under a common infrastructure [8], [12]. With the help of IoT, the current waste management system can be improved in many aspects such as cost of resources, user-friendly, easy to be managed, reduce the waste to be disposed of by recycling them. Hence, the waste management system integrated with IoT has developed in the last decade.
Apart from IoT, another technology that has developed and brought a huge impact is ''machine learning''. Machine learning enables machines or computers to learn unsupervised from data that is labelled or unlabelled. Machine learning involves certain models and algorithms that are predictive of scientific study. The trend of machine learning has achieved the highest peak due to offering the most impressive computing features. By referring to Tractica's recent statistics [10], the market size of machine learning and AI-based technology was 1.4 billion dollars in 2016, and by 2025, growth will increase by 59.8 billion dollars. These statistics prove the effectiveness of machine learning-based applications. Deep neural network results showed improved accuracy in a series of relevant benchmark competitions in machine learning and pattern recognition [13]. Deep learning is a form of machine learning that allows the learning of computers from experience [14]. Deep learning enables multiple layers of processing in computational models to understand a data presentation with multiple layers of abstraction. These technologies help us to build cutting-edge technology in fields such as voice recognition, visual objects, drug discovery and genomics in numerous different fields. There is a class of deep learning called convolutional neural network (CNN) which is applied mainly for image processing, object recognition and so on. The integration of CNN in a smart waste management system can highly improve the performance of waste classification and categorize them correctly, saving resources and reducing the waste generated in the world. This paper presents a smart waste management system that detects and categorize the different types of waste and places them into a specific compartment. The SSD MobileNetV2 has been applied to the system for detection purposes. Moreover, the system is integrated into the IoT based sensors and LoRa-GPS module that effectively identify the bin location and transfer the bin status over a long distance.

II. RELATED WORK
The status of the bin, especially the fill percentage of the waste inside, should have less power consumption. Different methods used to monitor the level of waste in the dustbin are proposed by several authors, including an infrared sensor to measure the distance by reflecting light waves and ultrasonic sensor measures with the principle of reflected sound waves. Navghane et al. proposed a method to reduce the cost and increase the efficiency of waste applications [15]. A dustbin is interfaced with a microcontroller-based system with IR wireless systems and a central system displaying current garbage status. Therefore, the HTML page that updates the status can reduce human resources and efforts. Another GSM electronic monitoring system is proposed by Aasim et al., which sends SMS to the authority that the dustbin is fully filled to send the truck for trash collection [16]. Ultrasonic sensors were used to detect the amount of trash in the dustbin, and the GSM module was to provide information on the dustbin status. However, this system is only able to detect the top of the garbage level and cannot realize the space left in the dustbin.
To monitor the status of the bin, an energy-efficient telecommunication protocol that can travel far distances is important to be integrated in the smart waste management system. There are various kinds of telecommunication protocols available and each of them has its own strength and weakness in different situations. Smart garbage bins [17] enable approved persons to obtain information regarding the filling level via ultrasonic sensors and a GSM-equipped microcontroller that sends data to a control station. Another similar study [18] involves several sensors such as ultrasonic sensor, moisture sensor and gas sensor in its system to monitor the waste and condition of the bin. The ultrasonic sensor is used to monitor the garbage level. The wet waste can be detected by moisture sensors, and toxic gases can be detected through gas sensors. The microcontroller obtains the data from sensors and transmits them through the ZigBee transmitter at a long distance. Besides, the microcontroller also sends the SMS message to the mobile device through GSM. Apart from that, a sensor node for monitoring the waste bin filling level equipped with RFID technology is proposed in 2016, which could be a feasible solution due to its robustness and low cost [19]. However, 2G is not a long-term solution because it has a high running cost and will be eliminated in the future [20], causing the 2G telecommunication to stop servicing. This will lead to the disability to use IoT that communicates through GSM protocols. Table 1 shows the transmission range, spectrum used, bandwidth and maximum data rate of various Low Power Wide Area Network (LPWAN) technologies. LoRa provides a free spectrum under 1 GHz; meanwhile, it can transmit up to 15km. A system to monitor the overall condition of the dustbins plays an important role  [5], [22]- [24].
in a smart waste management system, where the authorities can monitor the overall situation of all dustbins in an easier method. Misra et al. proposed a waste management system that is monitored by the cloud [21]. From their experiment, ultrasonic sensors are used to sense the level of waste in the dustbin due to the longer range provided compared to IR sensors. Apart from that, IR sensors are also found to be affected by sunlight, object colour and object hardness. Their system is capable of sensing the amount of waste and the strength of biogas generated in the municipal area. The information gathered by sensors is sent to a server, where it is stored and processed over the internet. This data is then used to track the waste bins, and the correct choice is made by selecting the correct waste bin to be collected. The main features of this system are that it is designed to learn from experience and to draw conclusions not only on the status of the daily waste level. Apart from that, based on the experience, the system will predict the future situation, such as the availability of vehicles near the site and other factors involved. The overall cost and power consumption of this system is controlled very well, but it cannot recognize and separate the various types of waste in the dustbin.
Apart from that, Bhor et al. proposed a method for Smart Garbage Management in Smart Cities using IoT which can monitor the system through GUI [25]. The bins are integrated with ultrasonic sensors to detect the amount of garbage inside and a GSM system to communicate to the authorized control room. To have better control over the disposal of garbage, a GUI is built to track the desired details relevant to the garbage for various selected locations. This system ensures that waste in the dustbins are collected shortly after the amount of garbage reaches its limit. Apart from that, this system also eliminates corruption in the overall waste management system by detecting false reports. The vehicle garbage collection trips have been reduced and thereby reduces the overall waste collection budget. A smart waste management system requires automation to alert the authorities on the condition of the dustbins when the level of waste is almost or already full. A smart garbage alert system was proposed by Norfadzlia et al., which is an integrated system consisting of Arduino Uno, GSM Module, Ultrasonic sensor and LED light [26]. The ultrasonic sensors are used to detect two threshold levels which are 70% and 90% of the bin height. When the first threshold level is reached, the green LEDs will be switched on to alert the residents on that floor, and a first warning message is sent to the municipality. If the garbage level is then reached the second threshold level, the second warning message is sent to the municipality and red LEDs will be turned on to alert the residents. However, this system is limited and user friendly to users in flat residential areas or condominiums.
Another smart garbage alert system presented by Kumar et al. involves a microcontroller and IoT to alert the administrator. The system will alert a web server using a microcontroller and telecommunication module [27]. The microcontroller, Arduino UNO R3 is used to read data from an ultrasonic sensor. After the garbage crosses a certain level, it is configured to send a warning to the Thing Speak web server. For the verification process, an RFID reader is interconnected to the Arduino. Whenever the RFID reader is interrupted by an RFID tag (ID card of the cleaner), the ultrasonic sensor checks the dustbin's status and sends it to the webserver. An android application is created to view the notification and status at the server end. The limitation of this system is the status of the bin can only be seen when the RFID tag is detected manually by the RFID reader, which is not user-friendly [28]. Due to the number of dustbins allocated in the urban areas is in a huge number, the power consumed by the dustbins and the system need to be handle properly to prevent overconsumption of resources. An article with title 'A Low Power IoT Sensor Node Architecture for Waste Management Within Smart Cities Context' focuses on the development of an Internet of Things (IoT) system to improve power-saving waste management in the context of Smart Cities [29]. An innovative typology of sensor nodes based on the use of low-cost and low-power components is defined. This node is integrated with a single-chip microcontroller, a sensor capable of measuring the filling level of the trash bins using ultrasound and a LoRa LPWAN (Low Power Large Area Network) technology-based data transmission module [22]. A minimal network architecture, based on a LoRa gateway, was built along with the node to test the performance of the IoT node. In particular, the paper analyses the node architecture in-depth, focusing on energy-saving technologies and policies, with the goal of extending battery life by reducing power consumption through optimization of hardware and software. Apart from that, the author also analyses the effectiveness of the sensor and radio module in the system. However, the proposed system does not categorize the waste automatically that leads to the biodegradable and non-biodegradable waste being mixed up in the bin.
The smart waste management system integrated with IoT only is not sufficient to achieve good management of waste. This is due to the waste not being categorized and separated in order to decide whether it can be recycled. An intelligent waste management system with a smart bin is necessary to manage a variety of waste materials. In artificial intelligence systems, object detection has been widely used. Recently, more studies have focused on improving the object detection techniques using deep machine learning, such as vehicle detection [30], face detection [31], and document image classification [32]. The most widely used technique is Convolutional Neural Network (CNN). Bobulski et al. created a waste classification system using image processing and CNN to classify various kinds of plastic garbage [33]. This plastic waste segregation system improves the efficiency of recycling by automating the sorting of materials, thus reducing the cost and simplifying the process. They developed a simpler and hence faster 15-layer network compared to AlexNet. This network has a shorter learning time, and in their research, this system categorized the waste into four main categories with very high accuracy. However, the proposed 15-layer network and AlexNet have less depth than other existing models, leading to difficulties learning features from image sets. Nowakowski et al. proposed an idea to identify and classify waste electrical and electronic equipment from photos by using an image recognition system [34]. The system involves users to improve the classification of the system by capturing their e-waste objects and upload them to the waste collection company server. The system will study the waste and enhance the waste collection preparation. This image recognition system can run on a server or via a mobile app. The authors proposed various methods for a different types of images. A convolutional neural network (CNN) based model is used to identify the type of e-waste; meanwhile, the category and size of waste are detected by a faster regionbased convolutional neural network (Faster R-CNN). CNN is good in image classification, while R-CNN is mainly for object detection. Yet, R-CNN must feed 2000 regions and apply CNN for each region, which consumes a lot of time to train for a large dataset and affect the speed of detection.
A deep neural network model, WasteNet, is proposed to improve waste classification accuracy [35]. This model is implemented on a Jetson Nano edge device which allows convenient deployment at the edge to permit smart bins to identify waste. On the TrashNet dataset, the WasteNet model has enhanced the accuracy of the system to 97%. This is a significant improvement on the original SVM method, which achieved 63% accuracy and an accuracy of 22% for CNN. Transfer learning is used on the WasteNet model to improve the baseline performance, speed up overall model development and training time. On the ImageNet dataset, the models which are trained for general image classification are used for transfer learning in this WasteNet model. A paper with title ''Classification of Trash for Recyclability Status'' is proposed [36]. A dataset named TrashNet is created and consists of 6 classes which are glass, paper, metal, plastic, cardboard, and trash. Each of the class has around 400-500 images and this dataset is released by them to the public. In this research, support vector machines (SVM) and convolutional neural networks (CNN) are used to test for this dataset on their performance. Based on the result of the research, CNN performs better than SVM. SVM has lower accuracy and limitation on the type of waste detectable. This is due to the simpler algorithm in SVM compared to the neural network, where a longer time is required to train the model to achieve optimal performance. Apart from that, Adedeji et al. proposed an intelligent waste classification system by combination of ResNet and SVM [37]. They used a 50-layer residual net pre-train (ResNet-50) CNN model to serve as the extractor of the system and Support Vector Machine (SVM) to categorize the waste into various groups such as glass, metal, paper, and plastic etc. A dataset of images of trash which was developed by Gary et al. is used to test the accuracy of this system, and an accuracy of 87% is achieved in this research. Wei-Lung et al. proposed an interesting idea in order to improve the accuracy of the classification of recycling waste [38]. TrashNet, a dataset consisting of six types of waste categories and contains up to 2527 waste pictures, was used in this research to test the CNNs' performance. Data augmentation is applied to the dataset in order to significantly increase the diversity of data available for the training model and yet without collecting new data. Apart from that, a genetic algorithm (GA) is utilized in this research on the fully connected layer of DenseNet121. This can improve the accuracy of DenseNet121 on classification, and this optimized DenseNet121 achieved 99.6%, the highest accuracy in their research. From the papers reviewed, the proposed waste management systems are insufficient to solve the major challenges faced in cities. Most of the system proposed only has a single function, such as the system is only able to monitor the level of waste without method to alert the administrator. Apart from that, some systems only able to transmit the data of the bin in a short distance such as Wi-Fi protocol. The lack of classification and categorization of waste in the proposed system by many authors is also unable to solve the recycling problem existing.

III. SMART WASTE MANAEMENT SYSTEM A. SYSTEM MODEL DESIGN
The design and dimensions of the bin are shown in Figure 1. The top compartment, also known as the electronic component compartment, stores most of the electronic components. The remaining compartments are used to store different types of waste. The waste thrown onto temporary waste placement  will be detected by Raspberry Pi and then moved into the respective compartment by using servo motors. Figure 2 shows the overview of the smart waste management system. The development of a smart waste management system focuses on waste classification, categorization and bin status monitoring. There will be five major steps in developing the CNN-based object detection: choosing Ten-sorFlow Lite over TensorFlow, the model and architecture of object detection, method of obtaining dataset, and method to export the trained model into hardware application. The waste classification and categorization system include CNN based object detection model and hardware such as Raspberry Pi, camera module, ultrasonic sensor and servo motors. Apart from that, the monitoring system of the bin is built on Arduino with ultrasonic sensors, GPS module and LoRa communication module with a written Arduino IDE sketch algorithm to obtain the real-time information of the bin from a further position. Besides, RFID based locker system is also integrated with the Arduino to protect the electronic components of the bin.

B. OBJECT DETECTION MODEL
TensorFlow Lite is chosen over TensorFlow to be used on a low power mobile platform. This is due to most of the models trained on TensorFlow required a decent GPU to perform object detection. However, the requirement of a decent GPU is not applicable to the development of a smart bin. Tensor-Flow Lite allows the object detection models to be used on low power mobile devices such as Raspberry Pi. There are several pre-trained detection models on the COCO dataset provided by Tensorflow [39]. Several requirements need to be considered in choosing the suitable and optimum object detection model. The object detection model chosen is SSD MobileNetV2 Quantized 300×300, which is a COCO-trained model available in TensorFlow. Single Shot MultiBox Detector, also known as SSD, is specially designed for real-time object detection, which performs much faster and is lighter in terms of CPU usage. Figure 3 shows the architecture of the SSD MobileNet model, where the layers are simplified to improve the performance meanwhile maintain accuracy. The SSD removes the region proposal network to increase the frame rate of object detection and implements several improvements such as multi-scale features and default boxes in order to improve the accuracy of the model. By using images with low resolution, such as 300 × 300 pixels, the time required to detect an object is hugely reduced. From the comparison in Table 2, SSD has the optimum mean  average precision (mAP) and high frame rate among different detection models. Apart from the detection model, the CNN architecture of MobileNetV2 is designed to have decent classification performance on low power mobile devices. MobileNet architecture substantially lowers the network's complex structure and model size. MobileNetV2 has a small architectural model size and low computing power compared to other networks shown in Table 3. The chosen model in the proposed system is quantized. Common neural networks consist of numerical values with high precision, which leads to tens or hundred of million of weights. The extremely large weights require a decent CPU, GPU or TPU to compute, which consume huge computing power and large memory. Quantization decreases the number of bits of image pixels without affecting the accuracy by replacing the high-precision numerical values with low-precision numerical values such as int and float. In this model, the 32-bit parameters is quantized to 8-bit, where the size and performance of the model are improved when performing detection. Two methods will be used to obtain the dataset, which is download from free sources and capture by phone with 12 megapixels camera module. The images will be obtained from free resources on Google Images. Due to the SSD MobileNetV2 Quantized 300 × 300, all the images in the waste dataset shall be 300 × 300 pixels. However, the resolution of images obtained are all in different sizes and format, thus an open-source software, Batch Image Resize is used to resize all the images to 300 × 300 pixels and output in JPEG image format. The training of the waste detection model is based on supervised learning, where the class of waste needs to be known by the network. In machine learning, the process is called labelling, which gives informative labels on the image to understand and learn from it. An open-source software, LabelImg is used to label the images into five categories, which are paper, cardboard, glass, plastic, and metal as shown in Figure 4 and Figure 5. Data augmentation is a method that uses existing training data to create new training data by applying several changes on the image. As CNN cannot verify the similarities of images with different conditions like rotated image, shifted image, flipped image and so on, data augmentation is useful in improving the accuracy of CNN model. A neural network library named Keras provides API (Application Programming Interface) to use data augmentation when training a model. There will be  five main data augmentation techniques to be used which are image shifts, image flips, image brightness, image zoom and image rotations.
The training process of the object detection model required a decent GPU in order to have a better mean average precision result (mAP) and faster loss convergence. The higher computing power of GPU can increase the speed of training, and large memory of GPU can include more images to be trained at a time. Google Colab is chosen to train the CNN object detection model over a laptop because the GPUs available on Google Colab are the workstation cards, which are better than notebook GPUs in many aspects such as performance and memory size and bandwidth. The interface of Google Colab is shown in Figure 6. To improve the performance of waste detection model, hyperparameter tuning can be done with an optimizer. Adam optimizer will be used to tune the hyperparameters throughout the training process. Besides, the cosine decay learning rate, in which the learning rate will decay with the cosine function, is implemented in the training process to optimize the converging of the loss. Due to the limitation of the GPU memory, the optimum batch size of 16 is used. The hyperparameters that can be tuned with suitable settings are shown in Table 4, and the training configuration file is shown in Figure 7. In TensorFlow, the trained model can be exported as an inference graph which can be used to run object detection with python script. However, the inference graph cannot be implemented directly in the TensorFlow Lite interpreter due to the different format of the model. It must VOLUME 9, 2021   be converted by using TensorFlow Lite Optimizing Converter (TOCO). The usage of TOCO is required to build TensorFlow from the computer source.

C. WASTE CLASSIFICATION AND CATEGORIZATION SYSTEM
The development of waste classification and categorization required the integration of hardware with the CNN object detection trained model. The electronic components to be integrated into this system is listed in Table 5, and the diagram of the electronic component connection is shown in Figure 8. The type of waste will be categorized for respective compartments, shown in Table 6. Raspberry Pi 4 acts as the main processing centre for the waste classification and categorization system. The trained CNN waste detection model will be imported into Raspberry Pi 4 and integrated with the algorithms written in Python language to detect and control   the movement of the waste. Pi Camera is used to work with the trained model to detect the waste that appeared in the range of the camera module with 8 megapixels. Pi Camera V2 is connected to Raspberry Pi 4 CSI camera port through the 15-pin connector, which required 3.3V to work. Apart from that, an ultrasonic sensor, HC-SR04, is used to detect the non-detectable waste within the waste placement area; therefore, the waste will be moved into Waste Compartment 4.
On the categorization part of the system, servo driver HAT and servo motors are used to move the waste into the waste compartment. The gear horn of the SG-90 servo motor is connected to a plastic board, act as a door to allow the waste to fall into the respective waste compartment. The SG-90 servo motor has a torque of 2.5kg/cm, which is sufficient to withstand most of the waste thrown on the plastic board and able to rotate clockwise and anticlockwise between 0 • and 180 • to move the waste in the desired direction. 4 servo motors are used to control the plastic board and one servo motor acts as the lock for the highest door of the bin. As each servo motor requires 5V to operate, Raspberry Pi 4 lacks sufficient 5V pins and pulse width modulation (PWM) pin. Therefore, an expansion board, servo driver HAT is a solution to the limitation of Raspberry Pi 4. Raspberry Pi 4 uses Pin 3 (SDA) and Pin 4 (SCL) to connect to servo driver HAT through I2C and is able to control five servo motors with the available 16 PWM outputs channel. Apart from that, the HAT is powered from an 11.1V Li-Po battery through the VIN terminal, which is also able to power on Raspberry Pi 4 through HAT.

D. BIN STATUS MONITORING AND LOCKER SYSTEM
The smart waste management system is not limited on classifying and categorizing the waste; meanwhile, it is able to monitor and track the condition of the bin from a long distance. Apart from that, electronics components stored in the top compartment of the bin are protected by installing RFID based locker system. There are two parts of the bin status monitoring process, where the bin acts as the client and the server is connected to the computer. The system on the bin monitors the status and location of the bin through sensors, send the information through LoRa communication and protect the electronic components compartment with RFID based locker. The server connected to the computer receives the information from the bin, allowing the administrator to monitor the bin. The list and connection of electronic components used are shown in Table 7 and Figure 9, respectively. Arduino Uno R3 acts as the central processing microcontroller for the ultrasonic sensors, GPS module, LoRa module, RFID reader and solenoid lock. Arduino Uno has 14 digital input/output (I/O) pins and six analogue pins, which can perform like digital pins with certain commands in the Arduino IDE script. With the pins available on Arduino Uno, it can read from the sensors and modules to perform the bin monitoring and locker functions. A 12V DC Li-Ion battery is used to supply power to Arduino Uno through the DC power jack, which will be then regulated down to 5 volts and it is sufficient to supply current to the ultrasonic sensor, LoRa/GPS shield, RFID reader and a 5V relay breakout board. The fill level of waste in the bin needed to be monitored in real-time to improve the waste collection schedule, which prevents waste overflows or early collection. For this purpose, HC-SR04 ultrasonic sensors, Dragino Lora/GPS Shield and Dragino LoRa Bee (915 MHz) are connected to Arduino Uno. Four ultrasonic sensors are installed in each waste compartment respectively to monitor the waste fill level in real-time. The ultrasonic sensor is able to read a distance from 2cm to 400cm with an accuracy of 0.3cm, which is sufficient to read the fill level of waste in each waste compartment. The ultrasonic sensor uses sonar to determine the object distance. Firstly, the trigger pin of the ultrasonic sensor is set to high to emits a40 kHz high-frequency sound. The emitted sound wave travels through the air and bounces back when it meets an object. After 10 microseconds, the trigger pin is set to low and set echo pin to high using 'PulseIn' function of Arduino to measure the duration of reflected sound waves. The distance of the object can be calculated by using the measured duration and speed of sound in the air, which is 343m/s or 0.0343cm/µs at 20 • . The formula is shown in Equation 1. An expansion board integrated with the LoRa module and GPS module is installed on Arduino Uno to track the GPS and transmit data through LoRa communication. L80 GPS, which is based on MTK MT3339, is used to calculate and predict the latitude and longitude of the bin by tracking at least three satellites for positioning. The GPS module can fix the location in a short amount of time even inside with low battery consumption due to automatically computed orbits that are saved for up to 3 days in internal flash. The serial interface UART is set to 9600 baud rate in the coding and initialized through Software Serial. The LoRa Bee connected on the shield is based on an SX1276 transceiver, which can transmit and receive at 915 MHz with high interference immunity whilst minimizing current consumption.

Distance to the object
The electronic components in the smart bin are protected by integrating an RFID-based locker. Therefore, an RC522 VOLUME 9, 2021 RFID reader with a registered RFID tag acts as the requirement to unlock the solenoid locker installed on the door of the electronic component compartment. The RC522 RFID reader communicates with the RFID tags with a maximum range of 5cm by creating a 13.56 MHz electromagnetic field. Arduino Uno communicates with the reader through Serial Peripheral Interface (SPI), involving four pins. The 12V solenoid locker is used with a 5V relay breakout board, which can control the locker to unlock only when there is an input signal to relay the breakout board. The input pin (IN) of relay breakout board acts as a switch to activate the relay with the connection of battery and solenoid locker to relay common pin (COM) and normally open pin (NO). The high output signal from Arduino Uno to relay breakout board enables the current flow into the solenoid locker to unlock it. To reduce the usage of current, the VCC of the relay breakout board is connected to an analog pin to disable it when the solenoid locker without needs to be unlocked. To monitor the status of the bin from a long distance, a Dragino LoRa shield with LoRa Bee is used to receive the information transmitted from the bin through Arduino IDE in the laptop. The LoRa transceiver at both smart bin and computer operate at 915 MHz to communicate. An Arduino Uno is required for the installation of a LoRa shield with a connection to the computer through USB cable type A to enable the computer to read the information received from the bin. The computer communicates with Arduino through Serial communication protocol and Arduino IDE software, where the baud rate of both computer and Arduino has to be the same. The baud rate chosen is 9600, which is fixed in the sketch coding in Arduino and Serial Monitor of Arduino IDE software.

A. SMART BIN PROTOTYPE
The bin prototype is made of acrylic plastic with dimensions of 0.50 m (length) × 0.50 m (width) × 1.20 m (height). Figure 10(a) and Figure 10(b) are the front view and top view of the smart bin, respectively labelled with each compartment, temporary waste placement and electronic components involved. Figure 10(c) depicts the electronic components used in waste classification and categorization system. The waste will be thrown on temporary waste placement for further action. The camera module from Raspberry Pi will detect the type of waste using the trained CNN model. The servo motor will control the plastic board to categorize the waste into the respective compartment. Table 8 represents the overall function of the electronic components that have been used in developing the system.

B. CNN BASED WASTE CLASSIFICATION AND CATEGORIZATION
The training of the object detection model, SSD MobileNetV2 Quantized 300 × 300, is performed on the TensorFlow framework by using Google Colab. The optimal configuration of the training is shown in Figure 11(a).  The model is trained until the classification loss of the graph is converged and the step of training is almost 22000, which is shown in Figure 11(b). The GPU used on Google Colab to train the model is Nvidia Tesla T4. The training process took 4 hours to converge the loss from 30 to 3.5 exponentially.
The loss of the model cannot go lower than three due to the characteristic of the SSD MobileNet model. The model has a trade-off inaccuracy for better performance on low-power computing devices such as Raspberry Pi 4.
There are several losses and mean average precision (mAP) that have been tracked and visualized through the available toolkit from TensorBoard. There are two losses that can be tracked in TensorBoard during the training process, which is classification loss and total loss. The definition of classification loss is that the correct category score should be larger by specified safety margins than all erroneous categories total scores. The graph of classification loss and the total loss graph are shown in Figure 12(a-b). The x-axis is referring to a number of steps of training, and the y-axis refers to a different type of loss. As the training steps increases over time, the loss converges to a small range of value, which is around 3.5 in this model. When the loss cannot go lower, the training is stopped and then exported to be used for detection later. This is to prevent the model the has been overfitted with the training data, causing unable to detect well on an object other than training images. The average of AP (average precision) at all classes with different IoU (Intersection over union) is the mean average precision (mAP) in Tensorboard. The graph of mAP shown in Figure 12(c) does not have high accuracy of  up to 80%. This is due to the SSD object detection model's characteristic, which has lower accuracy than the R-CNN object detection model. Another reason that leads to the low mAP is the small size of the dataset, where each class of the dataset consists of 600 images, including augmented images, as shown in Figure 13.
During the process of training, the model will be saved every 10 minutes. Figure 14  converted and exported through TOCO into FlatBuffer format with the extension '.tflite' to be used in object detection later, as shown in Figure 14(b). A standard text format labelmap file is created, which consists of the classes name of the waste, as shown in Figure 15. The labelmap file and exported model file are required by Raspberry Pi to run detection on the TensorFlow Lite framework. The screenshot of each class detection is shown in Figure 16. The detection's accuracy and speed in terms of FPS (frames per second) can be seen in the detector windows.
The average accuracy for each class is calculated in Table 9, where each test is done with the different waste objects to obtain the average accuracy. Inference time is the time taken for the trained model to detect the type of waste that occurred in the camera. The smaller the value of inference time, the faster the Raspberry Pi is able to detect the type of waste in real-world applications. The average inference time of the trained model integrated with Raspberry Pi is shown in Table 10. From the average result of precision, it is notable that the trained model can detect the most common   waste with average accuracy higher than 80%. The speed of detection of SSD MobileNetV2 Quantized model in Tensor-Flow Lite framework performs faster with similar accuracy compared to SSD MobileNetV2 in TensorFlow framework on Raspberry Pi. This can improve the user experience on throwing waste into the bin and the speed to detect and categorize the waste.

C. BIN STATUS MONITORING AND LOCKER SYSTEM
The bin status monitoring part of the system consists of obtaining the latitude and longitude of the bin, waste fill percentage and send this information to the receiver through the LoRa module. The GPS module on Dragino LoRa/GPS shield requires tracking three satellites for positioning. In real-world   application, the GPS module takes 5 to 20 minutes to fix the position indoor and 1 minute for outdoor. However, the time needed to fix the position will be improved later with the help of internal memory flash, which can store up to 3 days of computed orbits, which are latitude and longitude. The green LED on the shield will start blinking when the GPS location is fixed, as shown in Figure 17(a). The integration of hardware, LoRa/GPS shield and ultrasonic sensors and algorithm written in Arduino IDE sketch can send the GPS location and waste fill percentage through LoRa transceiver. However, there are several conditions implemented to save energy and  ensure the message is sent to the receiver successfully. Firstly, the data will not be sent when the GPS position is not yet fixed, as shown in Figure 17(b). This is to reduce the energy consumption of the LoRa module. Next, the algorithm in smart bin's Arduino waits for the reply from the receiver to ensure the message is received successfully for 10 seconds, as shown in Figure 17(c). By using Arduino IDE software, the information received by the LoRa receiver connected to the computer can be monitored through Serial Monitor in the software at a baud rate of 9600. Figure 18 shows the screenshot for Arduino on smart bin, where the GPS location and waste fill percentage are captured successfully by the sensors. The information is successfully sent with a reply from the LoRa receiver. On the LoRa receiver connected to the computer, Figures 19(a-b) shows that the message is successfully received and displayed in Serial Monitor. The latitude and longitude received on the computer are inserted into Google Maps, and the location tracking is precise, as shown in Figure 19(c). The integration of the RFID reader and solenoid locker on Arduino is installed on the smart bin, as shown in Figure 20(a). The RFID will be functioning for 30 seconds and then switched off for the process to monitor and send the information of the bin. This process will be loop continuously until the RFID reader reads a registered RFID tag, then it will break the loop and unlock the solenoid locker for 5 seconds. The unlocking process is displayed in Serial Monitor, as shown in Figure 20(b). Table 11 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 existing system 1 to 6 is only capable of monitoring the condition of the bin, such as waste fill percentage, gas pollution level and GPS location. Most of the communication protocols used are not suitable for implementation in smart waste management systems due to the short distance of transmission, and protocols such as GSM are terminating soon in many countries. The existing system 7 to 10 involves machine learning to classify the type of waste. Only one system has a mechanism to categorize the waste; however, it can only detect plastic waste. Based on the comparison, the existing waste management system cannot cover most of the significant challenges faced in urban areas.

VI. CONCLUSION
The first problem faced by the current waste management system in cities is inappropriate use of recycle bins, causing high waste generation. This problem can be reduced through the automation process of waste classification and categorization in the bin. With the integration of the CNN model, SSD MobileNetV2 Quantized 300 × 300 and Pi Camera on Raspberry Pi, the bin is able to classify five types of waste, including paper, cardboard, plastic, glass and metal, with acceptable precision and low interference time. The servo motors connected to the plastic board in the smart bin categorize the waste from temporary waste placement into the respective waste compartment. The process to classify and categorize the waste took 4 seconds and can be improved in future. The second challenge faced is the waste of resources such as manpower due to the fixed schedule-based waste collection. This challenge can be reduced by implementing a system able to monitor the status of the bin from a far distance. The bin status monitoring system in the smart bin is able to improve the waste of resources due to schedule based waste collection. The ultrasonic sensors connected to Arduino Uno can detect the waste fill percentage with precise reading. The GPS module on LoRa/GPS shield can detect the latitude and longitude accurately and quickly. With the LoRa module, both waste fill percentage and GPS location can be sent to the LoRa receiver connected to the laptop with a distance of up to 5 km. This can help the waste management system administrator monitor the status of the bin from a far distance and decide the time to collect waste from the bin. In order to protect the electronic components in the smart bin, an RFID reader and solenoid locker are installed on the top compartment and connected to Arduino Uno. Only the registered RFID tag can unlock the solenoid locker to allow further maintenance and upgrade of the system in future.
Several limitations exist in the proposed system. Firstly, the small dataset can hardly improve the CNN-based object detection model to detect more waste precisely but only five types of common waste. Apart from that, the object detection model with higher precision is not able to be implemented on Raspberry Pi without GPU. Lastly, the usage of batteries in the system requires the renewal of batteries after a period. The proposed system can be improved by increasing the size of the dataset by adding more variants of waste images in each class and increase the types of waste to expand the coverage of waste detectable. Apart from that, implementing an object detection model with higher precision and speed on a microcontroller with higher processing power can improve waste detection and categorization performance. The system's power source can be changed to renewable energy sources such as solar panels to improve the lifetime of the system.