A deep learning and IoT-powered project that classifies and segregates household waste (plastic, metal, glass, organic) using image classification with CNNs and real-time actuation through Raspberry Pi & ESP32.
This project demonstrates a Smart Waste Bin capable of automatically sorting waste into the correct bin. It leverages:
- Deep Learning (CNN) for image-based waste classification.
- Sound analysis to aid classification.
- ESP32 for IoT control & mechanical actuation.
- PyQt6 desktop interface for real-time monitoring & visualization.
The solution addresses the global challenge of improper waste disposal by ensuring recyclables and organics are automatically separated at the point of disposal.
This project uses a Supervised Deep Learning algorithm:
- Model Type: Convolutional Neural Network (CNN)
- Learning Paradigm: Supervised Learning (images are labeled by category)
- Training Method: Backpropagation with Gradient Descent
- Optimizer: Adam (Adaptive Gradient Descent)
- Loss Function: Cross-Entropy Loss (multi-class classification)
- Data Handling: Mini-batch training with DataLoader
CNNs are chosen over traditional ML because they automatically learn features (edges, shapes, textures) from raw images.
Smart-waste-segregation/
│
├── dataset/ # Waste images dataset (plastic, glass, metal, organic)
├── train_model.py # CNN training script
├── waste_model.pt # Trained PyTorch model (saved weights)
├── ui_app.py # PyQt6 interface for live webcam classification
├── esp32_code/ # ESP32 firmware for tray & bin control
├── raspberry_pi_code/ # Pi-side integration with ML + control logic
└── README.md # This documentation- Image-based waste classification using CNN
- One-time task reminders for disposal & monitoring
- ESP32-controlled tray rotation to drop waste into the correct bin
- Real-time PyQt6 dashboard with webcam feed & classification summary
- Multi-modal classification (future: sound-based analysis)
- IoT Integration between Raspberry Pi and ESP32
- ESP32 (WiFi-enabled)
- Servo/Stepper Motor (for rotating top tray)
- 4 Waste Bins (plastic, organic, glass, metal)
- Camera Module (USB/Webcam or Pi Camera)
- Power Supply & Driver Circuitry
- Python 3.10+
- PyTorch (deep learning framework)
- OpenCV (image capture & preprocessing)
- PyQt6 (UI dashboard)
- SoundDevice + NumPy (future sound classification)
- Arduino/ESP-IDF for ESP32 firmware
Install dependencies:
pip install torch torchvision opencv-python pyqt6 sounddevice numpy tensorflow-
Place the dataset under
dataset/with subfolders for each class:dataset/ ├── plastic/ ├── glass/ ├── metal/ └── organic/
-
Run the training script:
python train_model.py
-
Model will be saved as
waste_model.pt.
-
Start the PyQt6 UI:
python ui_app.py
- Displays live webcam feed.
- Shows predicted waste type.
-
The prediction is sent to ESP32:
- ESP32 receives bin ID (1=Plastic, 2=Glass, 3=Metal, 4=Organic).
- Motor rotates the tray to drop waste into the corresponding bin.
- User drops waste item onto the tray.
- Camera captures image → sent to CNN.
- CNN predicts category (e.g., Plastic).
- Then the prediction is sent to the ESP32 for actuation of the servo.
- Tray rotates and directs waste to the correct bin.
- UI updates with classification history.
- Sound-based classification for metallic items (can detect)
- Cloud integration for data logging & monitoring (future extension)
- Mobile app to show live stats & waste analytics (future extension)
- Optimization with lightweight CNNs (MobileNet, EfficientNet) for faster inference
- Dineshkumar D,
- A big thank you to my amazing teammates, Aswin S, Aravind S, and Abdullah, for making this project a success through teamwork and dedication.
This project is licensed under the MIT License - see the LICENSE file for details.