Smart Bin: a Recycled Waste Sorting System With Arduino and FastAPI
by asmasaif in Circuits > Arduino
27 Views, 0 Favorites, 0 Comments
Smart Bin: a Recycled Waste Sorting System With Arduino and FastAPI






Team Members
This was a group project developed collaboratively by:
- Abbas Mustafa
- Aina Zainab
- Asma Saif
Introduction
Our Smart Bin project is designed to automatically sort waste into Metal, Glass, and Organic categories.
It uses sensors and servo motors, and all parts are controlled by an Arduino UNO R4 WiFi.
The system also connects to a web dashboard using FastAPI and Python, and it’s built using mostly recycled materials.
Supplies
Electronics:
- 3 × Ultrasonic sensors (HC-SR04)
- 1 × IR sensor
- 1 × LDR
- 1 × Continuous rotation servo motor
- 1 × Arduino UNO R4 WiFi
- Jumper wires
- soldered PCB
- Power supply ( battery)
Recycled Components:
- 1 × Plastic bucket (outer body)
- 3 × Small Bottles (used as internal bins)
- 1 × Recycled funnel (top)
- 2 × Laser-cut axles (wood or acrylic)
- 2 × Laser-cut gears
- 1 × 3D printed washer (custom part)
Software:
- Arduino IDE
- FastAPI (Python)
- HTML + Jinja2 (for dashboard)
How It Works
When waste is dropped into the funnel, the system uses:
- Ultrasonic sensors to measure the distance and determine how full each bin is
- LDR to detect reflective light (helps differentiate materials)
- IR sensor to detect the presence of objects
The Arduino uses this data to classify the type of waste. It then controls a continuous rotation servo motor to rotate the funnel toward the correct bin.
The Arduino is WiFi-enabled and sends real-time sensor data to a FastAPI backend. This backend updates a dashboard every 60 seconds to show current readings and bin statuses: Full, Half, or Empty.
Building the Hardware
- Prepare the plastic bucket:
- Cut a hole at the top to fit the recycled funnel
- Secure three inner bins evenly spaced inside the bucket
- Attach ultrasonic sensors:
- One for each bin, placed on top lid measure distance.
- Mount the LDR and IR sensor inside the funnel to detect material type
- Install the continuous servo motor:
- Attach the 3D printed washer to the servo motor shaft
- Connect the laser-cut gears to the funnel base
- Use laser-cut axles to support gear rotation
- Wire all components to Arduino UNO R4 WiFi:
- Follow basic sensor and servo pin mapping
- Use jumper wires and a soldered PCB
Arduino Code
The Arduino code:
- Reads data from ultrasonic, IR, and LDR sensors
- Classifies the type of material
- Rotates servo accordingly
- Sends JSON data to FastAPI endpoint every second
Downloads
Web Dashboard


We built a web dashboard using FastAPI in Python.
It fetches live data from Arduino every 60 seconds and displays:
- Distance (in cm) for each bin
- IR and LDR sensor readings
- Bin status: Full, Half, or Empty
The dashboard uses HTML and Jinja2 templates and can be viewed on any device on the same network.
Final Demo
- Drop waste into the funnel
- Watch the servo rotate and open the correct bin
- Check the dashboard to see real-time sensor data
Materials used: Mostly recycled
- Funnel, bucket, bins: all reused from home
- Gears and axles: laser-cut from scrap wood
- Washer: 3D printed
Result:
- Fully automatic
- Eco-friendly
- Easy to monitor and maintain
Files & Downloads
- Arduino Code: smart_bin.ino
- FastAPI Server Code: main.py
- Dashboard Template: index.html
Conclusion
This project helped us learn about hardware-software integration, recycling engineering, and IoT dashboards. It’s ideal for schools, homes, or public places to promote smart waste management.
Thanks for reading!