As students, we noticed a growing problem in our university cafeteria. People would often have trouble with recycling and picking the right bin to throw their trash into. Nowadays those bins aren't available to us, we have to leave all of the trash in one general bin which then gets sorted by other workers.
That's what motivated us to create AutoSort. A bin that can automate the process of sorting rubbish for you. It does so by utilizing machine vision and a garbage classification machine learning model.
We're using a RaspberryPi 4 B to run our scripts. That part is located in our 3d-printed bin. You can see our initial design down below.
To take pictures of the trash that falls in the bin we're currently using a regular webcam. We're planning to upgrade it to a picamera in the future.
To open and close the individual doors we use servos.
Models of proposed bin design can be found in the SolidWorks folder. The STL files directory contains .stl exports that can be opened without SolidWorks. The Parts directory contains all of the individual parts as .SLDPRT files. The Assembly/Parts directory contains a final assembly and the referenced parts which are all dupilcates of what's in the Parts directory.
Exporting from solidworks can be inconsistent, if you are unable to view the parts please see the YouTube video under AutoSort in action along with the .stl files.
Every time something is thrown into the bin, we take a picture of it. We then send that image to a garbage classification model which tells us the packaging information. Then the bin opens one of its compartments for the rubbish to fall into. In addition to that we also send the information to discord, and firebase for data analysis and visualization.
Here's a flow-chart ilustrating that process:
- Clone the repository.
- Make sure that you have some kind of a camera/webcam connected to your device.
- Install all the necessary packages:
os
time
threading
colorama
inflect
reqests
json
opencv-python
gradio
gpiozero
firebase_admin
python-dotenv
- Create a
.env
file. - Add an
API_KEY = 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
line to it (in case it fails, you can generate a new prototyping API key from the link provided here). - You can now run the
main_testing.py
file.
With that you won't be able to use our discord webhook/firebase features. If you wish to experience the live webhook feature follow the next few steps:
- Create a discord server.
- Add a webhook in one of your discord channels.
- Copy the webhook key and paste a
WEBHOOK_URL = your webhook url goes here add it here
line to the.env
file.
Now you can see live updates from AutoSort in discord!
Down below you can see some images of our system.
- yangy50, for the garbage classification model, you can check it out here: https://huggingface.co/yangy50/garbage-classification.
- marloft, our IoT teacher for keeping us motivated and helping us with the issues we encountered along the way.