Sortify: AI-Powered Smart Sorting Bin 🤖
A live demonstration of the Sortify system in action.
#📝 Project Description
Sortify is an intelligent, real-time waste sorting system that combines the power of computer vision with embedded systems. This project, developed by Rosey, automates the process of separating common recyclable items—plastic bottles, aluminum cans, and nylon bags—into their respective bins.
It uses a custom-trained YOLO (You Only Look Once) model to identify objects from a live webcam feed and controls a servo motor via an Arduino to physically direct the waste into the correct container. This project serves as a practical and impressive demonstration of applying modern deep learning models to solve real-world automation and environmental challenges.
#✨ Key Features
Real-Time Detection: Employs a YOLOv8 model for fast and accurate object identification.
Custom-Trained Model: Trained on a custom dataset of bottles, cans, and nylons for high-precision sorting.
Physical Sorting Mechanism: Integrates with an Arduino and servo motor to physically actuate a sorting flap.
Robust Communication: Uses reliable serial communication to bridge the Python-based vision script and the Arduino controller.
Intelligent Cooldown: Prevents hardware strain by implementing a cooldown period between sorting actions.
#🛠️ Tech Stack & Hardware
Computer Vision: Python, OpenCV, Ultralytics YOLO
Hardware Control: Arduino, C++, PySerial
Hardware Components:
A computer with Python installed
Arduino UNO (or a compatible microcontroller)
A standard servo motor (e.g., SG90)
A webcam
Jumper wires
The physical structure for the bin and sorting mechanism
#📂 Dataset
The model was trained on a custom dataset containing approximately 200 images of plastic bottles, aluminum cans, and nylon bags. The images were collected, annotated, and labeled specifically for this project.
You can access the full dataset via the link below. Please ensure you have the necessary permissions to view it.
Download the Sortify Dataset from Google Drive https://drive.google.com/drive/folders/1KAMCklkbJRYuBIlKmLi7ELV77DJ30og-?usp=sharing
#🚀 Setup and Installation
Follow these steps to get the Sortify system up and running on your own machine.
- Clone the Repository
git clone [https://github.com/your-username/Sortify.git](https://github.com/Rosemar4/Sortify.git)
cd Sortify
- Set Up the Python Environment
It is highly recommended to use a virtual environment.
# Create a virtual environment
python -m venv venv
# Activate it (Windows)
venv\Scripts\activate
# Activate it (macOS/Linux)
source venv/bin/activate
# Install the required packages
pip install ultralytics opencv-python pyserial
- Configure the Arduino
Open the sorter_controller.ino sketch in the Arduino IDE.
Ensure you have the <Servo.h> library (it is typically included by default).
Connect your Arduino, select the correct Board and Port from the Tools menu, and click Upload.
Note the port your Arduino is connected to (e.g., COM10 on Windows or /dev/tty/ACM0 on Linux).
- Final Configuration
Open the sortify_main.py script.
Locate the following line and change 'COM10' to the port you noted in the previous step:
ARDUINO_PORT = 'COM10'
Make sure your custom-trained model file, best.pt, is in the same folder as the script.
#
With the hardware assembled and the software configured, you are ready to start sorting!
Run the main Python script from your terminal:
python sortify_main.py
A window will appear showing the live feed from your webcam.
Hold an item (a can, bottle, or nylon) in front of the camera.
Once detected, the script will send a command to the Arduino, and the servo will move the sorting flap to the correct position.
Press the 'q' key on your keyboard to close the application.
This project was created by Rosey. Feel free to connect and share your feedback!