Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗑️ SenseBin — Smart Dustbin

Industry-Oriented Embedded Systems & IoT Project

SenseBin is an ESP32-based smart waste-management system designed to automate dustbin monitoring, touchless lid operation, and waste-level detection. The system combines ultrasonic sensing, servo motor control, embedded firmware, alert mechanisms, and a real-time IoT dashboard to demonstrate an industry-oriented smart waste-management solution.

The project is developed with a hardware-ready architecture and a Wokwi virtual simulation, making it possible to develop and validate the complete embedded system without physical hardware.


🚀 Project Overview

Traditional waste bins require manual checking to determine whether they are full. This can result in unnecessary collection trips, overflowing bins, poor maintenance efficiency, and hygiene concerns.

SenseBin addresses this problem by continuously monitoring the bin and automatically responding to detected objects and waste levels.

The system provides:

  • 🤖 Touchless automatic lid operation
  • 📡 Ultrasonic-based object detection
  • 📊 Real-time waste-level estimation
  • 🚨 Full-bin alert generation
  • 💡 LED-based status indication
  • 🔊 Buzzer-based critical alert
  • ⚙️ Servo-controlled lid
  • 📟 Local status monitoring through OLED
  • 🌐 Flask-based telemetry API
  • 📈 Real-time web dashboard
  • 🧪 Wokwi virtual embedded-system simulation

🎯 Objectives

The main objectives of SenseBin are:

  1. Detect a nearby hand/object without physical contact.
  2. Automatically open and close the dustbin lid.
  3. Measure the distance between the sensor and waste.
  4. Calculate the approximate waste-fill percentage.
  5. Classify the bin as NORMAL, HIGH, or FULL.
  6. Generate visual and audible alerts when collection is required.
  7. Stream telemetry to a monitoring dashboard.
  8. Validate the embedded system using virtual simulation.

🏗️ System Architecture

                    ┌──────────────────────┐
                    │       ESP32          │
                    │   Microcontroller    │
                    └──────────┬───────────┘
                               │
             ┌─────────────────┴─────────────────┐
             │                                   │
             ▼                                   ▼
   ┌──────────────────┐               ┌──────────────────┐
   │ HC-SR04 Sensor 1 │               │ HC-SR04 Sensor 2 │
   │ Hand/Object      │               │ Waste Level      │
   │ Detection        │               │ Measurement      │
   └────────┬─────────┘               └────────┬─────────┘
            │                                  │
            ▼                                  ▼
   Object Detection                    Distance Measurement
            │                                  │
            ▼                                  ▼
     Servo Control                       Fill Calculation
            │                                  │
            ▼                                  ▼
       Lid OPEN/CLOSE                 NORMAL/HIGH/FULL
                                               │
                           ┌───────────────────┼──────────────────┐
                           │                   │                  │
                           ▼                   ▼                  ▼
                       Green LED           Red LED             Buzzer
                           │                   │                  │
                           └───────────────────┴──────────────────┘
                                               │
                                               ▼
                                    Telemetry / Monitoring
                                               │
                                               ▼
                                    Flask REST API
                                               │
                                               ▼
                                    SenseBin Dashboard

⚙️ Hardware Components

Component Purpose
ESP32 Main microcontroller
HC-SR04 #1 Hand/object detection
HC-SR04 #2 Waste-level measurement
Servo Motor Automatic lid control
Green LED Normal status
Red LED High/full status
Buzzer Critical/full-bin alert
OLED Display Local system information
Breadboard Circuit prototyping
Jumper Wires Component connections

Note: Physical hardware is optional for this implementation. The embedded circuit is validated using Wokwi simulation.


🧠 Embedded System Logic

1. Object Detection

The first ultrasonic sensor monitors the area near the dustbin.

Object Distance ≤ Detection Threshold
                ↓
        Object Detected
                ↓
          Servo Activated
                ↓
            Lid OPEN

After the configured delay:

Lid CLOSE

2. Waste-Level Detection

The second ultrasonic sensor measures the distance between the sensor and the waste surface.

Assuming a known bin height:

Fill Level = Bin Height − Measured Distance

The fill percentage is calculated as:

Fill Percentage =
((Bin Height − Measured Distance) / Bin Height) × 100

Example for a 30 cm bin:

Waste Level Sensor Distance Status
0% 30 cm NORMAL
25% 22.5 cm NORMAL
50% 15 cm NORMAL
75% 7.5 cm HIGH
90% 3 cm FULL

🚦 Status Classification

0–74%
   ↓
NORMAL
   ↓
Green LED
75–89%
   ↓
HIGH
   ↓
Warning indication
90–100%
   ↓
FULL
   ↓
Red LED + Buzzer

📡 Telemetry

SenseBin uses a lightweight telemetry structure to communicate sensor and system states.

Example:

{
  "event": "object_detected",
  "fill_percentage": 50,
  "status": "NORMAL",
  "lid": "OPEN",
  "alert": false,
  "hand_distance": 15,
  "bin_distance": 15
}

Telemetry fields:

Field Description
event Current system event
fill_percentage Calculated waste level
status NORMAL / HIGH / FULL
lid OPEN / CLOSED
alert Collection alert state
hand_distance Object detection distance
bin_distance Waste sensor distance

🌐 IoT Dashboard

The project includes a futuristic web dashboard designed specifically for SenseBin telemetry.

Dashboard Features

  • Real-time waste level
  • Bin status
  • Lid status
  • Sensor distance
  • Object detection state
  • Collection alerts
  • Waste-level trend
  • Activity/event log
  • Sensor telemetry
  • System status

The dashboard does not use unrelated metrics. All displayed values correspond to actual SenseBin sensor inputs, calculated states, actuator states, or system events.


🖥️ Backend

The project uses a lightweight Flask backend.

frontend
    │
    │ GET
    ▼
Flask Server
    │
    │ telemetry
    ▼
SenseBin Dashboard

API Endpoint

GET /api/telemetry

Used by the dashboard to retrieve the latest SenseBin telemetry.

Telemetry Input

Telemetry can also be simulated directly from the terminal using:

backend/telemetry_input.py

Example:

{"event":"bin_full","fill_percentage":90,"status":"FULL","lid":"CLOSED","alert":true,"hand_distance":100,"bin_distance":3}

🧪 Virtual Simulation

The embedded system is simulated using Wokwi.

The simulation includes:

  • ESP32
  • Two ultrasonic sensors
  • Servo motor
  • Green LED
  • Red LED
  • Buzzer
  • OLED display
  • Serial Monitor

Simulation Workflow

Sensor Input
     ↓
ESP32 Firmware
     ↓
Sensor Processing
     ↓
Decision Logic
     ↓
Servo / LED / Buzzer
     ↓
Serial Monitor

🧪 Testing Scenarios

Test 1 — Object Detection

Hand Distance : 2.9 cm
Bin Distance  : 100.9 cm
Fill Level    : 0%
Status        : NORMAL
Lid           : OPEN

Expected:

Object Detected
Servo → OPEN
Green LED → ON

Test 2 — Normal Bin

Fill Percentage : 50%
Status          : NORMAL
Lid             : CLOSED
Alert           : FALSE

Expected:

Green LED → ON
Red LED → OFF
Buzzer → OFF

Test 3 — High Fill Level

Fill Percentage : 75%
Status          : HIGH
Lid             : CLOSED
Alert           : FALSE

Expected:

Warning state activated

Test 4 — Full Bin

Fill Percentage : 90%
Status          : FULL
Lid             : CLOSED
Alert           : TRUE

Expected:

Red LED → ON
Buzzer → ON
Collection Required

📁 Project Structure

Smart-Dustbin/
│
├── backend/
│   ├── server.py
│   └── telemetry_input.py
│
├── frontend/
│   ├── index.html
│   ├── styles.css
│   ├── app.js
│   └── sb.jpeg
│
├── wokwi/
│   ├── sketch.ino
│   ├── diagram.json
│   └── libraries.txt
│
├── screenshots/
├── circuit_diagram/
├── reports/
├── docs/
│
├── requirements.txt
├── README.md
└── .gitignore

📂 Directory Description

backend/

Contains the Flask telemetry server and terminal-based telemetry simulator.

frontend/

Contains the SenseBin IoT monitoring dashboard.

wokwi/

Contains the embedded firmware and Wokwi circuit configuration.

screenshots/

Project demonstration screenshots.

circuit_diagram/

Circuit and wiring documentation.

reports/

Project reports and documentation.

docs/

Additional technical documentation.


🛠️ Software Requirements

  • Python 3.x
  • Flask
  • Flask-CORS
  • Requests
  • Arduino IDE or Wokwi
  • VS Code
  • Modern web browser

▶️ Running the Project

1. Install Backend Dependencies

pip install flask flask-cors requests

2. Start Flask Server

cd backend
python server.py

The server runs at:

http://localhost:3000

3. Start Telemetry Input

Open another terminal:

cd backend
python telemetry_input.py

Send telemetry as JSON.

Example:

{"event":"object_detected","fill_percentage":50,"status":"NORMAL","lid":"OPEN","alert":false,"hand_distance":15,"bin_distance":15}

4. Open Dashboard

Open:

frontend/index.html

using VS Code Live Server.

The dashboard retrieves telemetry from:

/api/telemetry

📊 Example Telemetry Sequence

The dashboard can be tested using a progressive waste-level sequence:

0%

{"event":"bin_monitoring","fill_percentage":0,"status":"NORMAL","lid":"CLOSED","alert":false,"hand_distance":100,"bin_distance":30}

25%

{"event":"bin_monitoring","fill_percentage":25,"status":"NORMAL","lid":"CLOSED","alert":false,"hand_distance":100,"bin_distance":22.5}

50%

{"event":"object_detected","fill_percentage":50,"status":"NORMAL","lid":"OPEN","alert":false,"hand_distance":15,"bin_distance":15}

75%

{"event":"bin_warning","fill_percentage":75,"status":"HIGH","lid":"CLOSED","alert":false,"hand_distance":100,"bin_distance":7.5}

90%

{"event":"bin_full","fill_percentage":90,"status":"FULL","lid":"CLOSED","alert":true,"hand_distance":100,"bin_distance":3}

This produces a meaningful Waste Level Trend from 0% → 25% → 50% → 75% → 90%.


🔬 Testing & Validation

The system is validated across three layers:

Embedded Layer

Ultrasonic Sensors
        ↓
ESP32
        ↓
Servo / LED / Buzzer

Backend Layer

Telemetry JSON
        ↓
Flask REST API
        ↓
HTTP 200 Response

Dashboard Layer

API Telemetry
        ↓
Real-Time Visualization
        ↓
Status / Trends / Alerts

This layered architecture allows the embedded system, communication layer, and monitoring interface to be tested independently.


🏭 Industry Relevance

Smart waste-management systems can improve operational efficiency in:

  • Smart cities
  • Hospitals
  • Airports
  • Railway stations
  • Shopping malls
  • Office buildings
  • Educational campuses
  • Industrial facilities
  • Public spaces

Potential benefits include:

  • Touchless waste disposal
  • Improved hygiene
  • Reduced manual monitoring
  • Early detection of overflowing bins
  • More efficient collection planning
  • Reduced unnecessary collection trips
  • Real-time operational visibility

🔮 Future Enhancements

The current system can be extended with:

  • ESP32 Wi-Fi telemetry
  • MQTT communication
  • Cloud-based monitoring
  • Multiple-bin management
  • GPS-based bin tracking
  • Mobile notifications
  • Predictive waste-level analytics
  • Waste collection route optimization
  • Battery and power monitoring
  • Solar-powered operation
  • Machine-learning-based collection prediction

🎓 Embedded Systems Concepts Demonstrated

This project demonstrates practical implementation of:

  • Microcontroller programming
  • GPIO
  • Digital input/output
  • Ultrasonic sensing
  • PWM
  • Servo motor control
  • Sensor interfacing
  • Threshold-based decision making
  • Actuator control
  • Embedded C / Arduino programming
  • Serial communication
  • Sensor calibration
  • Real-time telemetry
  • REST API communication
  • IoT dashboard integration
  • Virtual hardware simulation
  • System testing and validation

📸 Project Evidence

The repository contains evidence of:

  • Wokwi embedded-system simulation
  • Sensor readings
  • Servo response
  • LED and buzzer alerts
  • Flask telemetry communication
  • SenseBin dashboard
  • Waste-level trend visualization
  • Full-bin detection

👨‍💻 Project Type

Domain: Embedded Systems / IoT / Smart Infrastructure

Project Level: Industry-Oriented Student Project

Controller: ESP32

Simulation: Wokwi

Backend: Python + Flask

Frontend: HTML + CSS + JavaScript

Communication: REST API / JSON Telemetry


📌 Conclusion

SenseBin demonstrates how an embedded system can combine sensing, real-time decision-making, actuator control, telemetry, and visualization into a practical smart-infrastructure solution.

By integrating ESP32 firmware, ultrasonic sensors, servo control, alert mechanisms, virtual hardware simulation, Flask telemetry, and a real-time dashboard, the project provides a complete prototype architecture for intelligent waste-level monitoring and automated waste-bin management.


About

SenseBin — an ESP32-based smart waste management system with ultrasonic sensing, automated lid control, bin-level monitoring, alerts, and real-time IoT dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages