# Project export: SmartBin

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: After seeing staff members sorting through waste containers during Cal Hacks, our team was inspired to create SmartBin, an automatic system that divides landfill/recycling/compost waste at the source.
- Devpost: https://devpost.com/software/smartbin-1izmh5
- GitHub: https://github.com/jdsantelicesl/SmartBin
- Video: https://www.youtube.com/embed/DUQ2zHv1NQs?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 3 GitHub contributor(s) — Edward (16 commits), Juan Santelices (16 commits), Bill Susanto (5 commits)

## Devpost submission (written by the team)

### Inspiration

Throughout the hackathon, our team was intrigued by staff members sorting through trash bins in order to ensure recycling, compost and landfill waste was separated. After further investigation and a quick staff member interview, we learned about San Francisco's "zero-waste" program. This program requires event hosts within city limits to sort their waste into the three specified categories to reduce landfill use, with penalties or bans for events that fail to meet the waste sorting criteria. The demand for waste sorting has grown so much that private companies, such as Green Mary, have entered the sector. Our team came up with an innovative solution, Smart Bin. Smart Bin automates waste sorting, reducing manual labor costs and reducing pollution.

### What it does

Smart Bin is a smart, standalone trash disposal system. It scans incoming waste and sorts it as it goes through our system.

### How we built it

Our system is built on top of a Raspberry Pi. The Raspberry Pi hosts a Yolo11 object detection system that scans incoming waste and makes an inference as to what section it should be directed to (landfill, compost, recycling). The output from out model is then sent to an Arduino board that controls a servo motor using PMW. Our motor directs the trash to its corresponding bin, effectively sorting it.

### Challenges we ran into

One challenge we ran into was the internet connection at the venue. We wanted to download open-source data sets from Roboflow Universe to train our Object Detection model to segregate different types of waste. We also dealt with hardware difficulties during the event, running the servo motors took a lot of juice from the batteries so we had to prepare a lot beforehand. We also modeled designs of our props to be 3d printed during the event, which took a long time to print where we had to optimize different slicing methods to improve from 7 hours of printing to sub 5 hours of print time. We also had limitations when it comes to computing power of the raspberry pi, where all of our detection model, and functions are all ran on this mini-computer.

### Accomplishments we're proud of

We are extremely proud of what we built. We were able to build Smart Bin as a standalone system, one that is only dependent on a Raspberry Pi, an Arduino Board, and a servo motor. The total cost of our unit comes out to less than $50, making it highly accessible and likely to make an impact on the environment.

### What we learned

Through this project, we gained a deeper understanding of the complexities involved in waste management and automation. We learned about the real-world implications of waste diversion requirements for events and how crucial it is to accurately sort trash. Additionally, we improved our skills in hardware integration, machine learning, and rapid prototyping, which were crucial to successfully building a working product in a limited time frame.

### What's next

Our next steps involve expanding the scalability of the system across urban environments by integrating even more advanced real-time data analytics and optimizing waste collection routes through machine learning algorithms. We aim to enhance the mobile experience by allowing users to locate and interact with SmartBins seamlessly. Additionally, we plan to collaborate with municipalities and large organizations to implement SmartBin on a larger scale, helping cities reduce waste inefficiencies and environmental impact.

## README (from the GitHub repository)

# SmartBin - [![Link to Demo](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=DUQ2zHv1NQs)
![logo banner](assets/logo.png)

## Intro
Introducing SmartBin—an automated hardware solution that sorts trash automatically into the correct bins for compost, landfill, and recycling. Using a combination of a Servo Motor, Arduino Uno, custom-designed and 3D-printed funnels, and a computer vision YOLO-trained model, we’ve developed a system that makes waste sorting more accurate and efficient, reducing the need for manual labor.

## How does it work?
Just three simple steps. Throw your trash in the chute, SmartBin scans, and the pipe motor directs.
SmartBin uses a camera to capture images of waste as it’s placed into the system. These images are then processed using a YOLO model running on a Raspberry Pi, which is trained to identify whether an item is compostable, recyclable, or destined for the landfill. YOLO’s real-time image recognition helps classify items quickly and accurately.

![build](assets/build.jpg)

## Trash Detection Model
We grabbed datasets from Roboflow and uploaded them onto Ultralytics Hub to train our model on Google Colab for over 100 Epochs and classified 10 main classes that revolve around daily urban trash.

### Workflow
![workflow](assets/workflow.png)

### ML Training
![workflow](assets/google-colab.png)
P.S. We trained the model at the hotel nearby to get better wifi power.

### Pitch Deck
[Figma Pitch Deck Presentation Slides](https://www.figma.com/proto/fPMhEasDlWZEEhfg6660DM/SmartBin?node-id=50-180&node-type=canvas&t=3vaZL3ahZxr8h3Yb-1&scaling=contain&content-scaling=fixed&page-id=0%3A1)

[Figma Design Workflow](https://www.figma.com/design/0ZV7e0JJXtjuXRCYjlXEfv/SmartBin-Template?node-id=0-1&t=e87UqHIZ6ZarGZek-1)

## Conclusion
With SmartBin, we’re offering a practical and sustainable solution to a widespread issue, making waste management at large events simpler, more efficient, and compliant with regulations. Join us in working toward a cleaner tomorrow.
Thank you!


## Detected evidence (automated analysis)

Indexed codebase: 93 recognized source files, 4478 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Python (language) — detected in the code
- Next.js (technology) — claimed on Devpost, not found in the code
- PyTorch (technology) — claimed on Devpost, not found in the code
- React (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (100 of 100)

```
.DS_Store
.gitignore
actuator.py
classification.py
detection_test.py
firmata_arduino/firmata_arduino.ino
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/67223204
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_behaviors_ajax-error_ts-app_assets_modules_github_behaviors_include-d0d0a6-aa0f176b5b12.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-c89801ebbe15.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_behaviors_task-list_ts-app_assets_modules_github_sso_ts-ui_packages-900dde-18d1c91a7872.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_blob-anchor_ts-ui_packages_code-nav_code-nav_ts-ui_packages_filter--8253c1-87c39cb5708f.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_ref-selector_ts-a14af0a18402.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_github_sticky-scroll-into-view_ts-7cbef09a422c.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_react-code-view_components_blob-edit_BlobEditor_tsx-ui_packages_web-commit-fb78e1.5dab79890ecfec70a7cd.module.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/behaviors-93a5d7e13186.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/code-59de543ca292.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/code-menu-2b308c1236c2.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/codespaces-00f8bdb5a024.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/dark_high_contrast-2494e44ccdc5.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/editor-2d49f4af0cc1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/element-registry-35c81adeb5a5.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/environment-b7c8196d9516.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/github-73db358cd913.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/github-elements-aeb1b578f60b.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-create-menu-b35e64a90b34.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-dfacc4e45ec5.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-user-nav-drawer-656ee88982f5.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-user-nav-drawer.830d6c10c9fea7fc134e.module.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/keyboard-shortcuts-dialog-a549d5821edb.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/notifications-global-54f34167118d.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/notifications-subscriptions-menu-5d446132baea.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/notifications-subscriptions-menu.1bcff9205c241e99cff2.module.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/octicons-react-45c3a19dd792.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/primer-fefb1a332c28.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/primer-primitives-4cf0d59ab51a.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/primer-react-65b92279806c.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/primer-react.ed72bee494c072c5b54c.module.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-1a79343258bd.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-code-view-4ce384d578c1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-code-view.48bd266d84e39961d591.module.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-core-0819e0281150.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-lib-7b7b5264f6c1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/repositories-e391e0092c62.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/repository-0f7cf89e325a.css
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_aria-live_aria-live_ts-ui_packages_promise-with-resolvers-polyfill_promise-with-r-014121-ce989b6c1293.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_code-view-shared_hooks_shortcuts_ts-ui_packages_code-view-shared_utilities_web-wo-4a6509-1064a2d07db4.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_code-view-shared_hooks_use-canonical-object_ts-ui_packages_code-view-shared_hooks-2170c0-a950e6dae777.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_document-metadata_document-metadata_ts-ui_packages_repos-file-tree-view_repos-fil-5db355-996f3bf82132.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_failbot_failbot_ts-314bc7883729.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_hydro-analytics_hydro-analytics_ts-ui_packages_ref-selector_RefSelector_tsx-a26f6bcc1e3a.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_paths_index_ts-dce6cc95a312.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_promise-with-resolvers-polyfill_promise-with-resolvers-polyfill_ts-ui_packages_re-8d43b0-692b2026dda4.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_ui-commands_ui-commands_ts-d25fac54a6bc.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_updatable-content_updatable-content_ts-69467ce2cf45.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/ui_packages_verified-fetch_verified-fetch_ts-ui_packages_code-view-shared_components_SharedMa-058d4a-af37e21c9cbd.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_braintree_browser-detection_dist_browser-detection_js-node_modules_githu-bb80ec-634de60bacfa.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_codemirror_lib_codemirror_js-7ab4c207ef51.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_color-convert_index_js-0e07cc183eed.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-bf7e5a3732fd.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-f4b251-f7c3b6081b19.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_dompurify_dist_purify_js-b73fdff77a4e.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_emotion_is-prop-valid_dist_emotion-is-prop-valid_esm_js-node_modules_emo-41da55-1851acd376ff.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_focus-visible_dist_focus-visible_js-node_modules_fzy_js_index_js-node_mo-8edd88-99bd6dce30b5.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_arianotify-polyfill_ariaNotify-polyfill_js-node_modules_github_mi-247092-76666ec8c39f.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_auto-complete-element_dist_index_js-a164c5ea9f62.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_catalyst_lib_index_js-node_modules_github_hotkey_dist_index_js-no-d67c7f-bd7d077cdcb1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_catalyst_lib_index_js-node_modules_github_hydro-analytics-client_-3af2330-931c29f6883f.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_catalyst_lib_index_js-node_modules_primer_live-region-element_dis-037ad60-8582b70cd5a9.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_combobox-nav_dist_index_js-node_modules_github_g-emoji-element_di-6ce195-53781cbc550f.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_remote--b0e14d-a57a4c842e6f.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-21f158-7d460d5f7704.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-cdab1b-03eba6ef6933.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-d1a841-8f251a0656e7.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_hydro-analytics-client_dist_analytics-client_js-node_modules_gith-f3aee1-e6893db9c19e.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_mini-throttle_dist_decorators_js-node_modules_delegated-events_di-e161aa-a6774a3bb897.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_codemirror_addon_comment-488acd-b35cbcd1070a.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_catalyst_lib_inde-dbbea9-e73b311a14f1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_morphdom_dist_morphdom-e-7c534c-f8a5485c982a.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_stacktrace-parser_dist_s-1f651a-0cff18664748.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_quote-selection_dist_index_js-node_modules_github_session-resume_-9a8cd2-373766bf71f1.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_relative-time-element_dist_index_js-6d3967acd51c.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-893f9f-6cf3320416b8.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-e53a3f-96e856171702.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_selector-observer_dist_index_esm_js-f690fd9ae3d5.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_text-expander-element_dist_index_js-f5498b8d4e5d.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_github_turbo_dist_turbo_es2017-esm_js-858e043fcf76.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_lit-html_lit-html_js-ce7225a304c5.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_oddbird_popover-polyfill_dist_popover_js-aff936e590ed.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_oddbird_popover-polyfill_dist_popover-fn_js-4896ddd4b7bb.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_primer_behaviors_dist_esm_index_mjs-4aa4b0e95669.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_scroll-anchoring_dist_scroll-anchoring_esm_js-node_modules_stacktrace-pa-a71630-67856ad29bae.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_template-parts_lib_index_js-96453a51f920.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/wp-runtime-e711cecaa174.js
inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin.html
inference/garbage_classification.pt
inference/trash-detection.pt
INSTRUCTIONS.md
README.md
requirements.txt
test.py
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Update README.md
- Update README.md - Updated Pitch Deck
- Update README.md - Updated Pitch Deck
- Update README.md - Updated Pitch Deck
- Update README.md - Added Pitch Deck
- Rename google-colab to google-colab.png
- Update README.md
- Rename Screenshot 2024-10-20 at 10.32.49 AM.png to google-colab
- uploade Screenshot 2024-10-20 at 10.32.49 AM.png
- added workflow.png
- Update README.md
- added logo
- renamed image
- added assets for README
- Update README.md
- Raspberry Pi Model Tuning
- feat(detect): added detection
- feat(cls): added classification
- fixed prev
- centered servo

## Key source files (fetched from GitHub, selected and truncated for size)

### INSTRUCTIONS.md

```markdown
## To run py firmata.

1. Open the firmata_arduino folder with arduino ide and run\
2. Create virtual env for python: **python3.12** -m venv venv
3. install requirements.txt. ```pip install -r requirements.txt```
4. go to myenv/Lib/site-packages/pyfirmata/pyfirmata.py and change line 185 to ```len_args = len(inspect.getfullargspec(func)[0])```
5. create .env in root and add ```PORT = "<your_arduino_port>"```
```

### requirements.txt

```
��b l i n k e r = = 1 . 8 . 2  
 c e r t i f i = = 2 0 2 4 . 8 . 3 0  
 c h a r s e t - n o r m a l i z e r = = 3 . 4 . 0  
 c l i c k = = 8 . 1 . 7  
 c o l o r a m a = = 0 . 4 . 6  
 c o n t o u r p y = = 1 . 3 . 0  
 c y c l e r = = 0 . 1 2 . 1  
 f i l e l o c k = = 3 . 1 6 . 1  
 F l a s k = = 3 . 0 . 3  
 f o n t t o o l s = = 4 . 5 4 . 1  
 f s s p e c = = 2 0 2 4 . 9 . 0  
 h u b - s d k = = 0 . 0 . 1 3  
 i d n a = = 3 . 1 0  
 i t s d a n g e r o u s = = 2 . 2 . 0  
 J i n j a 2 = = 3 . 1 . 4  
 k i w i s o l v e r = = 1 . 4 . 7  
 M a r k u p S a f e = = 3 . 0 . 2  
 m a t p l o t l i b = = 3 . 9 . 2  
 m p m a t h = = 1 . 3 . 0  
 n e t w o r k x = = 3 . 4 . 1  
 n u m p y = = 2 . 1 . 2  
 o p e n c v - p y t h o n = = 4 . 1 0 . 0 . 8 4  
 p a c k a g i n g = = 2 4 . 1  
 p a n d a s = = 2 . 2 . 3  
 p i l l o w = = 1 1 . 0 . 0  
 p s u t i l = = 6 . 1 . 0  
 p y - c p u i n f o = = 9 . 0 . 0  
 p y F i r m a t a = = 1 . 1 . 0  
 p y p a r s i n g = = 3 . 2 . 0  
 p y s e r i a l = = 3 . 5  
 p y t h o n - d a t e u t i l = = 2 . 9 . 0 . p o s t 0  
 p y t h o n - d o t e n v = = 1 . 0 . 1  
 p y t z = = 2 0 2 4 . 2  
 P y Y A M L = = 6 . 0 . 2  
 r e q u e s t s = = 2 . 3 2 . 3  
 s c i p y = = 1 . 1 4 . 1  
 s e a b o r n = = 0 . 1 3 . 2  
 s e t u p t o o l s = = 7 5 . 2 . 0  
 s i x = = 1 . 1 6 . 0  
 s y m p y = = 1 . 1 3 . 1  
 t o r c h = = 2 . 5 . 0  
 t o r c h v i s i o n = = 0 . 2 0 . 0  
 t q d m = = 4 . 6 6 . 5  
 t y p i n g _ e x t e n s i o n s = = 4 . 1 2 . 2  
 t z d a t a = = 2 0 2 4 . 2  
 u l t r a l y t i c s = = 8 . 3 . 1 7  
 u l t r a l y t i c s - t h o p = = 2 . 0 . 9  
 u r l l i b 3 = = 2 . 2 . 3  
 W e r k z e u g = = 3 . 0 . 4  
 
```

### actuator.py

```python
import pyfirmata
import time
import os
from dotenv import load_dotenv

load_dotenv()

# Define the port where Arduino is connected
# Example: 'COM3' for Windows or '/dev/ttyUSB0' for Linux/Mac
port = os.getenv('PORT')
# Establish connection with the Arduino board
board = pyfirmata.Arduino(port)
# Start an iterator to read input values continuously
it = pyfirmata.util.Iterator(board)
it.start()

servo_pin = board.get_pin("d:9:s")


# Pass integer as pos. Recycle = 1, Landfill = 2, Compost = 3
def set_servo_angle(pos):
    # Three positions of bins. Angles subject to change depending on orientatio
    if pos == 1:
        servo_pin.write(101)
    if pos == 2:
        servo_pin.write(67)
    if pos == 3:
        servo_pin.write(33)
    time.sleep(2) # can move down to 0.015, set to 0.05 as standard
    
set_servo_angle(1)
set_servo_angle(2)



```

### classification.py

```python
from ultralytics import YOLO
import cv2

# Load the YOLOv11 classification model
model = YOLO('inference/garbage_classification.pt')

# Open the webcam
cap = cv2.VideoCapture(0)
frame_count = 0

while True:
    # Read a frame from the webcam
    ret, frame = cap.read()
    if not ret:
        break

    # Perform classification
    frame_count += 1
    
    if frame_count % 30:
        results = model(frame)

    # Get the top predicted class and its confidence
    top_prediction = results[0].probs.top1
    confidence = results[0].probs.top1conf.item()

    # Get the class name
    class_name = model.names[top_prediction]

    # Display the result on the frame
    cv2.putText(frame, f"{class_name}: {confidence:.2f}", (10, 30),
                cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)

    # Show the frame
    cv2.imshow('YOLOv11 Classification', frame)

    # Break the loop if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release the webcam and close windows
cap.release()
cv2.destroyAllWindows()

```

### detection_test.py

```python
import cv2
from ultralytics import YOLO
import time
import os
from dotenv import load_dotenv

from actuator import set_servo_angle

load_dotenv()

# Load your custom YOLO model, replace with Trash Detection Model
model = YOLO('inference/trash-detection.pt') 

# Access the webcam
cap = cv2.VideoCapture(0)

if not cap.isOpened():
    print("Error: Webcam not detected.")
    exit()

while True:
    ret, frame = cap.read()

    if not ret:
        print("Failed to grab frame")
        break

    # Perform object detection on the frame using your custom model
    results = model(frame)

    # Check if results are not empty
    if results:
        for result in results[0].boxes:
            class_id = int(result.cls)
            confidence = result.conf.item()  # Confidence score

            if confidence > 0.1:

                # Separate if statements for each class and control the corresponding Arduino pin
                if class_id == 1:  # Can
                    print(f"🥫Detected CAN with confidence {confidence:.2f}")
                    set_servo_angle(1)

                if class_id == 7:
                    print(f"🥤Detected PLASTIC BOTTLE with confidence {confidence:.2f}")
                    set_servo_angle(1)

                if class_id == 8:
                    print(f"🥤Detected PLASTIC BOTTLE CAP with confidence {confidence:.2f}")
                    set_servo_angle(1)

                if class_id == 9:
                    print(f"🍾Detected POP TAB with confidence {confidence:.2f}")
                    set_servo_angle(1)

                # if class_id == 3:
                #     print(f"🧃Detected DRINK CARTON with confidence {confidence:.2f}")
                #     set_servo_angle(1)

                if class_id == 4:
                    print(f"🥂Detected GLASS with confidence {confidence:.2f}")
                    set_servo_angle(2)

                if class_id == 5:  # Paper
                    print(f"📜Detected PAPER with confidence {confidence:.2f}")
                    set_servo_angle(3)

                if class_id == 2:
                    print(f"📦Detected CARDBOARD with confidence {confidence:.2f}")
                    set_servo_angle(3)

                if class_id == 6:
                    print(f"🛍️Detected PLASTIC BAG with confidence {confidence:.2f}")
                    set_servo_angle(2)

            else:
                pass

    # Display the frame (optional, can be removed if no display needed)
    #cv2.imshow('Custom YOLO Object Detection', frame)

    # Press 'q' to break the loop and stop the program
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release the webcam and close all OpenCV windows
cap.release()
cv2.destroyAllWindows()

```

### test.py

```python
import cv2
from ultralytics import YOLO
from pyfirmata import Arduino, util
import time
import os
from dotenv import load_dotenv

load_dotenv()

# Initialize Arduino and specify the COM port (replace with your port)
# board = Arduino(os.getenv("PORT"))

# Define pins for each action
# pin_can = board.get_pin('d:9:o')  # Digital pin 9, output mode (e.g., LED for 'Can')
# pin_paper = board.get_pin('d:10:o')  # Digital pin 10, output mode (e.g., LED for 'Paper')
# pin_cap = board.get_pin('d:11:o')  # Digital pin 11, output mode (e.g., LED for 'Plastic Bottle Cap')

# Load your custom YOLO model, replace with Trash Detection Model
model = YOLO('inference/trash-detection.pt') 

# Access the webcam
cap = cv2.VideoCapture(0)

if not cap.isOpened():
    print("Error: Webcam not detected.")
    exit()

colors = {
    1: (0, 255, 0),    # Green for Can
    5: (255, 0, 0),    # Blue for Paper
    7: (0, 0, 255)     # Red for Plastic Bottle Cap
}

while True:
    ret, frame = cap.read()

    if not ret:
        print("Failed to grab frame")
        break

    # Perform object detection on the frame using your custom model
    results = model(frame)

    # Check if results are not empty
    if results:
        for result in results[0].boxes:
            class_id = int(result.cls)
            confidence = result.conf.item()  # Confidence score
            box = result.xyxy[0].tolist() # Grab XY dimensions to draw box
            
            x1, y1, x2, y2 = map(int, box)
            color = colors.get(class_id, (255, 255, 255))
            cv2.rectangle(frame, (x1, y1), (x2, y2), color, 2)
            label = f"{model.names[class_id]}: {confidence:.2f}"
            cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
            
            # Separate if statements for each class and control the corresponding Arduino pin
            if class_id==0: # Battery
                print(f"Battery")
            if class_id == 1:  # Can
                print(f"✅🥫 Detected CAN with confidence {confidence:.2f}")
                # pin_can.write(1)  # Turn on the pin (e.g., LED on)
                # time.sleep(2)     # Wait for 2 seconds
                # pin_can.write(0)  # Turn off the pin

            if class_id == 5:  # Paper
                print(f"✅📄 Detected PAPER with confidence {confidence:.2f}")
                # pin_paper.write(1)  # Turn on the pin (e.g., LED on)
                # time.sleep(2)       # Wait for 2 seconds
                # pin_paper.write(0)  # Turn off the pin

            if class_id == 7:  # Plastic bottle cap
                print(f"✅🥤 Detected PLASTIC BOTTLE CAP with confidence {confidence:.2f}")
                # pin_cap.write(1)  # Turn on the pin (e.g., LED on)
                # time.sleep(2)     # Wait for 2 seconds
                # pin_cap.write(0)  # Turn off the pin

            else:
                print("❌ No Detection")
    # Display the frame (optional, can be removed if no display needed)
    cv2.imshow('Custom YOLO Object Detection', frame)

    # Press 'q' to break the loop and stop the program
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release the webcam and close all OpenCV windows
cap.release()
cv2.destroyAllWindows()

# Close the connection to the Arduino board
# board.exit()
```

### inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-user-nav-drawer.830d6c10c9fea7fc134e.module.css

```css
.styles-module__emojiContainer--yBvrp img,.styles-module__emojiIcon--AXyd_{font-size:14px;height:14px;margin-top:1px;vertical-align:-2px;width:14px}
/*# sourceMappingURL=global-user-nav-drawer-e40acce7cd68.js.map*/
```

### inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/react-1a79343258bd.css

```css
.react-app{display:block;min-height:calc(100vh - 64px)}@supports(height: 100dvh){.react-app{min-height:calc(100dvh - 64px)}}
/*# sourceMappingURL=index.scss.map */

/*# sourceMappingURL=react-4706fb18d862.css.map*/
```

### inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/app_assets_modules_react-code-view_components_blob-edit_BlobEditor_tsx-ui_packages_web-commit-fb78e1.5dab79890ecfec70a7cd.module.css

```css
.WebCommitDialog-module__commitFileIcon--sHZ5I{margin-right:var(--base-size-8)}
/*# sourceMappingURL=app_assets_modules_react-code-view_components_blob-edit_BlobEditor_tsx-ui_packages_web-commit-fb78e1-f6b676b17323.js.map*/
```

### inference/Editing SmartBin_README.md at main · jdsantelicesl_SmartBin_files/global-create-menu-b35e64a90b34.js

```javascript
"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["global-create-menu"],{12786:(e,o,s)=>{var _=s(72245),i=s(22629);(0,_.k)("global-create-menu",{Component:i.r})}},e=>{var o=o=>e(e.s=o);e.O(0,["primer-react","react-core","react-lib","octicons-react","vendors-node_modules_primer_behaviors_dist_esm_index_mjs","vendors-node_modules_emotion_is-prop-valid_dist_emotion-is-prop-valid_esm_js-node_modules_emo-41da55","vendors-node_modules_oddbird_popover-polyfill_dist_popover-fn_js","vendors-node_modules_github_catalyst_lib_index_js-node_modules_github_hydro-analytics-client_-3af2330","ui_packages_failbot_failbot_ts","ui_packages_promise-with-resolvers-polyfill_promise-with-resolvers-polyfill_ts-ui_packages_re-8d43b0"],()=>o(12786)),e.O()}]);
//# sourceMappingURL=global-create-menu-032661045801.js.map
```

[63 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]