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

SMART_BIN.jpeg
BIN1.jpeg
BIN2.jpeg
BIN3.jpeg
BIN5.jpeg
BIN6.jpeg

Team Members

This was a group project developed collaboratively by:

  1. Abbas Mustafa
  2. Aina Zainab
  3. 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:

  1. Ultrasonic sensors to measure the distance and determine how full each bin is
  2. LDR to detect reflective light (helps differentiate materials)
  3. 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

  1. Prepare the plastic bucket:
  2. Cut a hole at the top to fit the recycled funnel
  3. Secure three inner bins evenly spaced inside the bucket
  4. Attach ultrasonic sensors:
  5. One for each bin, placed on top lid measure distance.
  6. Mount the LDR and IR sensor inside the funnel to detect material type
  7. Install the continuous servo motor:
  8. Attach the 3D printed washer to the servo motor shaft
  9. Connect the laser-cut gears to the funnel base
  10. Use laser-cut axles to support gear rotation
  11. Wire all components to Arduino UNO R4 WiFi:
  12. Follow basic sensor and servo pin mapping
  13. Use jumper wires and a soldered PCB




Arduino Code

The Arduino code:

  1. Reads data from ultrasonic, IR, and LDR sensors
  2. Classifies the type of material
  3. Rotates servo accordingly
  4. Sends JSON data to FastAPI endpoint every second

Downloads

Web Dashboard

BIN7.jpeg
BIN8.jpeg

We built a web dashboard using FastAPI in Python.

It fetches live data from Arduino every 60 seconds and displays:

  1. Distance (in cm) for each bin
  2. IR and LDR sensor readings
  3. 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

  1. Drop waste into the funnel
  2. Watch the servo rotate and open the correct bin
  3. Check the dashboard to see real-time sensor data

Materials used: Mostly recycled

  1. Funnel, bucket, bins: all reused from home
  2. Gears and axles: laser-cut from scrap wood
  3. Washer: 3D printed

Result:

  1. Fully automatic
  2. Eco-friendly
  3. Easy to monitor and maintain


Files & Downloads

  1. Arduino Code: smart_bin.ino
  2. FastAPI Server Code: main.py
  3. 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!