## 4 Holistic Trash Collection System Architecture
### System Components
#### 4.1.2 QR-Based Trash Bin  
The QR-based trash bins will be crafted to be reliable, efficient, and simple to operate. The trash bin will include a QR code that can be read by a mobile device running our mobile app, as shown in Figure 4.  
QR codes will serve as tools for monitoring trash bin usage and fill levels. When users scan the QR code using the mobile app, they can inspect the current trash level  
Figure 4: QR-based Trash Bin. Figure 3: The flow of the Mobile App. and verify the accuracy of the information provided by the previous user. Additionally, as a fail-safe measure in case the QR code is damaged, each bin comes equipped with a unique ID number already stored in the collection team's database. This ID number serves as an additional means of identification, enabling users to access and modify the bin's information, even if the QR code is unreadable or compromised. Users can adjust the recorded garbage fill level information if they find discrepancies with the previously saved data. Furthermore, the application allows users to update the garbage level after disposing of their waste. Utilizing the QR code for monitoring trash bin fill levels can significantly enhance route management in several ways. For instance, it enables the provision of real-time updates on those bins in need of immediate attention, facilitating the optimization of collection routes and bolstering waste management efficiency. By directing collection trucks to locations where they are most needed, this approach reduces travel time and minimizes fuel consumption. Moreover, monitoring trash bin fill levels serves as a preventive measure against garbage overflow. When bins reach capacity, individuals tend to leave their waste around the bins, which adversely impacts the environment and contributes to littering. Therefore, this comprehensive and immediate trash collection system has the potential to enhance waste management efficiency, leading to a cleaner and more sustainable environment. QR-Coded Bin Route Optimization Algorithm  
For route optimization, Algorithm 1 takes a set of QR-coded bins and a set of routes as the input, outputting an optimized route based on the shortest distance and weight of each route. It first calculates the total distance and weight of each route and then sorts the routes in increasing order of distance. It sets the initial route to be the shortest route, and then iteratively adds bins to the route if the distance and weight constraints are met. Finally, it returns the optimized route. ```
Input: A set of QR-coded bins \(B\), a set of routes \(R\) Output: An optimized route \(r^{*}\) foreach route \(r\in R\)do  Calculate the total distance \(d_{r}\) of route \(r\);  Calculate the total weight \(w_{r}\) of route \(r\);  end fore Sort the routes in increasing order of \(d_{r}\); Set the initial route \(r^{*}=R_{1}\); whilethere exists a route \(r\) that has not been added to \(r^{*}\)do foreach bin \(b\in B\)do ifbin \(b\) is not in \(r^{*}\)then  Calculate the distance \(d_{new}\) from the end of \(r^{*}\) to \(b\); Calculate the weight \(w_{new}\) of \(r^{*}\) plus \(b\); if\(d_{new}\leq\) maximum route distance and \(w_{new}\leq\) maximum route weight then  Add bin \(b\) to the end of \(r^{*}\);  end if  end foreach return Optimized route \(r^{*}\);
```  
**Algorithm 1** QR-Coded Bin Route Optimization Algorithm  
Unreadable QR Code Resolution Algorithm  
In order to address issues related to the QR codes affixed to the bins, Algorithm 2 concentrates on rectifying the problems stemming from unreadable or unscannable QR codes. It systematically attempts to read each QR code, and if any issues are detected, it prompts the user for the bin's ID and any details of the encountered problems. The algorithm then assesses whether the problem is recurring or unique. If the problem is found to be recurring, the specific bin may be removed from the list. However, if the problem is identified as unique, it will be added to the list of problematic bins requiring manual inspection or retagging.