Final-year projects / Smart city

Smart dustbin with fill level and route report

Municipal bins overflow while trucks visit half-empty ones on a fixed schedule. Bins that report how full they are let the truck visit only those that need it, in line with Swachh Bharat goals.

ESP32Mini projectECE, CSE, Diploma
ESP32IR71°131 cmFeatured
Parts
₹1,375
Build
8 weeks
Board
ESP32
Objectives
5

Block diagram

Inputs
  • Ultrasonic sensor in the lidMeasures how full the bin is
  • IR
    IR sensorOpens the lid when a hand comes near
Controller
  • ESP32
    ESP32Reports the fill level
Outputs
  • 71°
    ServoLifts the lid
  • CLOUD
    Cloud dashboardStores readings, plots trends and sends alerts+

Objectives

  1. To measure the fill level in percent.
  2. To open the lid hands-free and close it after three seconds.
  3. To report fill level to a dashboard.
  4. To plan a collection order from the reported levels of several bins.
  5. To publish readings over MQTT and show them on a live dashboard with threshold alerts.

Parts and specifications

  • ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)
    ₹450Buy
  • HC-SR04 ultrasonic sensor2 cm to 4 m, 15° beam, 40 kHz, 10 µs trigger, echo pulse 58 µs per cm, 5 V
    ₹80Buy
  • IR obstacle sensor moduleReflective IR pair with LM393, 2 to 30 cm set by trimmer, digital out, sunlight can false-trigger
    ₹40Buy
  • MG996R metal gear servo9.4 kg·cm at 4.8 V, 0 to 180°, stall up to 2.5 A so give it its own 5 to 6 V supply
    ₹350Buy
  • DUSTBI
    Dustbin with hinged lid
    ₹250
  • KΩ
    1 kΩ and 2 kΩ resistors (echo divider)
    ₹5
  • USB
    5 V 2 A USB adapter and wires
    ₹200

Total about ₹1,375 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Fill level

Bin depth 40 cm, sensor 2 cm below the lid. Fill % = (40 − (d − 2)) / 40 × 100. d = 12 cm gives 75%.

Echo divider

Vout = 5 × 2 / (1 + 2) = 3.33 V, safe for the ESP32 input.

Route order

With fill levels from several bins, visit only bins above 70%, ordered by nearest-next from the depot, and compare distance with a fixed route.

Pin map

SignalPin or connection
HC-SR04 TRIGGPIO 5
HC-SR04 ECHOGPIO 18 through 1 kΩ / 2 kΩ divider (5 V → 3.3 V)
IR sensor OUTGPIO 27
Servo signalGPIO 13 (servo on 5 V, common ground)

Firmware outline

  1. When the IR sensor sees a hand, open the lid to 90°, wait 3 s after it leaves, close.
  2. Measure fill only with the lid closed, as a median of 5.
  3. Every 10 minutes post bin ID and fill % to the dashboard.
  4. Flag 'Full' above 85% on an LED.

Test plan

TestExpected result
Empty, half and full binFill within ±5%
Hand near the lidOpens within 0.5 s
Paper vs crumpled bagsNote how uneven waste affects the reading
Five bins with set levelsRoute skips nearly empty bins

These rows start your results table when you plan the project.

Viva practice

Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.

1. Why the divider on the echo pin?
2. Why measure with the lid closed?
3. Why does uneven waste affect the reading?
4. Why an MG996R and not SG90?
5. How would bins report from the street?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

Datasheets and sources to cite

  • HC-SR04 user guide
  • Swachh Bharat Mission (Urban) solid waste guidelines
  • Solid Waste Management Rules 2016

About this project

How much does the smart dustbin with fill level and route report project cost?

About ₹1,375 for the parts in the base list: ESP32 DevKit V1, HC-SR04 ultrasonic sensor, IR obstacle sensor module, MG996R metal gear servo, Dustbin with hinged lid, 1 kΩ and 2 kΩ resistors (echo divider), 5 V 2 A USB adapter and wires.

How long does it take?

About 6 weeks for the base project, built on an ESP32. Each upgrade adds time.

Which branches is it suitable for?

Electronics and Communication, Computer Science / IT (IoT, AI), Diploma (any electronics branch), as a mini project.

Which pins and design calculations does it use?

HC-SR04 TRIG on GPIO 5; HC-SR04 ECHO on GPIO 18 through 1 kΩ / 2 kΩ divider (5 V → 3.3 V); IR sensor OUT on GPIO 27. Worked calculations on this page: fill level, echo divider, route order.

How do I test it?

Empty, half and full bin: Fill within ±5%. Hand near the lid: Opens within 0.5 s. Paper vs crumpled bags: Note how uneven waste affects the reading. Five bins with set levels: Route skips nearly empty bins.

What are the objectives?

To measure the fill level in percent. To open the lid hands-free and close it after three seconds. To report fill level to a dashboard. To plan a collection order from the reported levels of several bins.