A smart, automated waste management system that uses Computer Vision and IoT to segregate waste into Biodegradable and Non-Biodegradable categories. Powered by a Raspberry Pi 4 and a custom TensorFlow Lite model.
This project solves the problem of improper waste disposal at the source. The bin operates autonomously using a "Sense-Think-Act" pipeline:
- Sense: An ultrasonic sensor detects when waste is thrown.
- Think: A camera captures an image, and a TFLite model classifies it (Bio vs. Non-Bio).
- Act: A servo motor tilts a flap to direct the waste into the correct compartment.
- Raspberry Pi 4 (4GB or 8GB RAM recommended)
- Raspberry Pi Camera Module/USB Webcam
- HC-SR04 Ultrasonic Sensor
- SG90 Micro Servo Motor
- External Power Supply for the Servo
- Jumper wires & Breadboard
- Cardboard/Acrylic chassis for the bin
The servo motor is powered externally to prevent voltage drops on the Raspberry Pi.
Wiring Pinout:
| Component | Pin | Raspberry Pi Pin |
|---|---|---|
| Ultrasonic Trig | Trig |
GPIO 23 |
| Ultrasonic Echo | Echo |
GPIO 24 |
| Servo Signal | Signal |
GPIO 18 |
| USB Camera | USB | Any USB Port |
Note: The Servo VCC/GND are connected to the external battery pack, sharing a common ground with the Pi.
The project runs on Raspberry Pi OS (RasPiOS).
- Python 3.7+
- TensorFlow Lite Runtime
- OpenCV
- GPIO Zero
-
SSH into your Raspberry Pi:
ssh pi@<YOUR_PI_IP_ADDRESS>
-
Navigate to the project directory:
cd Smart-Waste-Bin -
Add the scripts:
# Transfer the Python script scp testing.py pi@<YOUR_PI_IP>:/home/pi/Smart-Waste-Bin/ # Transfer the Model file scp waste_classifier_model_quantized.tflite pi@<YOUR_PI_IP>:/home/pi/Smart-Waste-Bin/
-
Run the script:
python3 testing.py
Once the script is running, the system follows this autonomous workflow:
- Initialization: The script initializes the camera and moves the servo motor to the Neutral (Center) position.
- Waiting for Input: The Ultrasonic Sensor continuously monitors for objects. The terminal will display "Waiting...".
- Detection: When you bring an object (waste) close to the sensor (within 20cm), the system triggers.
- Capture & Classification: The camera wakes up, captures a single frame, and sends it to the TFLite model. The prediction (Bio/Non-Bio) is printed in the terminal.
- Actuation:
- If Biodegradable: The servo tilts the flap to the Left.
- If Non-Biodegradable: The servo tilts the flap to the Right.
- Reset: The system holds the position for 3 seconds to allow the waste to fall, then resets the flap to Neutral and waits 5 seconds before scanning again.
The model was trained using a custom dataset of household waste.
- Classes: Biodegradable, Non-Biodegradable
- Algorithm: SSD MobileNet V2 / YOLO (Specify which one you used)
- Format: Converted to
.tflitefor edge optimization.
- Shubham Gupta
- Vikas Prajapati
- Sangeet Sangwan
- Prabhkirat Kaur

