Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗑️ Smart Dustbin Embedded System

An ESP32-based Smart Dustbin that provides automatic lid control, hand detection, waste-level monitoring, LED status indication, and buzzer alerts.

The project is developed using C++, Arduino Framework, and PlatformIO, with the complete circuit tested and simulated using Wokwi.


📌 Project Overview

The Smart Dustbin Embedded System is designed to make waste disposal more convenient and hygienic.

The system uses two ultrasonic sensors:

  • One sensor detects a hand or object near the dustbin.
  • The second sensor monitors the waste level inside the dustbin.

When a hand is detected within the configured distance, the servo motor automatically opens the lid. After a short delay, the lid closes automatically.

The waste-level sensor continuously measures the distance between the sensor and the waste. The system calculates the approximate fill percentage and indicates the bin status using LEDs and a buzzer.


✨ Features

  • 🖐️ Contactless hand detection
  • 🚪 Automatic dustbin lid
  • 📏 Waste-level monitoring
  • 📊 Fill percentage calculation
  • 🟢 Normal-status LED
  • 🔴 Warning/full-status LED
  • 🔊 Full-bin buzzer alert
  • 📟 Serial Monitor status output
  • ⚡ ESP32-based control
  • 🧪 Wokwi simulation
  • 🔧 PlatformIO project
  • 📚 Complete project documentation

🛠️ Technologies Used

Technology Purpose
ESP32 Main microcontroller
C++ Firmware programming
Arduino Framework Embedded development
PlatformIO Build and project management
Wokwi Circuit simulation
ESP32Servo Servo motor control
HC-SR04 Ultrasonic distance measurement

🔩 Hardware Components

  • ESP32 DevKit
  • 2 × HC-SR04 Ultrasonic Sensors
  • Servo Motor
  • Green LED
  • Red LED
  • Buzzer

🔌 Pin Configuration

Component ESP32 GPIO
Servo PWM GPIO 18
Hand Sensor TRIG GPIO 23
Hand Sensor ECHO GPIO 22
Level Sensor TRIG GPIO 5
Level Sensor ECHO GPIO 19
Green LED GPIO 25
Red LED GPIO 26
Buzzer GPIO 27

⚙️ How It Works

1. Hand Detection

The first HC-SR04 sensor detects a hand or object near the dustbin.

Configured threshold:

20 cm

When the distance is 20 cm or less:

Hand Detected
      ↓
Servo Opens
      ↓
Lid Opens
      ↓
Wait 3 Seconds
      ↓
Servo Closes
      ↓
Lid Closes

2. Waste-Level Monitoring

The second HC-SR04 sensor measures the distance between the top of the bin and the waste.

Configured bin height:

30 cm

The filled height is calculated using:

Filled Height = Bin Height - Sensor Distance

The fill percentage is calculated using:

Fill Percentage =
(Filled Height / Bin Height) × 100

🚦 Waste-Level Status

Fill Level Green LED Red LED Buzzer Status
0–74% ON OFF OFF Normal
75–89% ON ON OFF Warning
90–100% OFF ON ON Full

🧠 System Architecture

                    SMART DUSTBIN
                         |
                       ESP32
                         |
          +--------------+--------------+
          |                             |
          v                             v
    Hand Detection                Waste Monitoring
      HC-SR04                       HC-SR04
          |                             |
          v                             v
   Hand Distance                  Waste Distance
          |                             |
          v                             v
    Hand Detected                  Fill Percentage
          |                             |
          v                             v
     Servo Motor                   Status Decision
          |                             |
          v                    +--------+--------+
      Automatic               |        |        |
        Lid                   v        v        v
                           Normal   Warning    Full
                             |        |         |
                             v        v         v
                           Green   Green+Red  Red+Buzzer
                            LED       LED

🔄 System Flow

START
  |
  v
Initialize ESP32
  |
  v
Read Hand Sensor
  |
  v
Hand <= 20 cm?
  |
 +---- YES ----> Open Lid
 |                  |
 |                  v
 |              Wait 3 sec
 |                  |
 |                  v
 |              Close Lid
 |
 v
Read Waste-Level Sensor
  |
  v
Calculate Fill %
  |
  v
Determine Bin Status
  |
  +---- Normal ----> Green LED
  |
  +---- Warning ---> Green + Red LED
  |
  +---- Full ------> Red LED + Buzzer
  |
  v
Repeat

📂 Project Structure

Smart-Dustbin-Embedded-System/
│
├── circuit_diagram/
│   └── README.md
│
├── docs/
│   ├── architecture.md
│   └── testing.md
│
├── include/
│   └── config.h
│
├── reports/
│   └── project_report.md
│
├── screenshots/
│   ├── 01-complete-circuit.png
│   ├── 02-hand-detection.png
│   ├── 03-lid-open.png
│   ├── 04-normal-level.png
│   ├── 05-warning-level.png
│   ├── 06-full-bin-alert.png
│   └── 07-serial-monitor.png
│
├── src/
│   └── main.cpp
│
├── test/
│   └── test_smart_dustbin.md
│
├── diagram.json
├── platformio.ini
├── wokwi.toml
├── README.md
├── LICENSE
└── .gitignore

🧪 Testing

The system was tested in stages before complete integration.

Tested Components

  • ESP32
  • Servo motor
  • Hand-detection sensor
  • Waste-level sensor
  • Green LED
  • Red LED
  • Buzzer
  • Serial Monitor

Testing Summary

Test Result
PlatformIO Build ✅ PASS
Servo Operation ✅ PASS
Hand Detection ✅ PASS
Automatic Lid ✅ PASS
Waste-Level Detection ✅ PASS
Fill Calculation ✅ PASS
Green LED ✅ PASS
Red LED ✅ PASS
Buzzer ✅ PASS
Complete Integration ✅ PASS

🧪 Wokwi Simulation

The project was successfully tested using Wokwi.

The simulation includes:

ESP32
├── Hand Detection HC-SR04
├── Waste-Level HC-SR04
├── Servo Motor
├── Green LED
├── Red LED
└── Buzzer

The circuit configuration is stored in:

diagram.json

The Wokwi configuration is stored in:

wokwi.toml

🚀 Getting Started

Requirements

Install:

  • Visual Studio Code
  • PlatformIO
  • Wokwi

Clone the Repository

git clone https://github.com/VaishnavaDevi-R/Smart-Dustbin-Embedded-System.git

Move into the project:

cd Smart-Dustbin-Embedded-System

Build the Project

pio run

A successful build should display:

=============================== [SUCCESS] ===============================

▶️ Run the Wokwi Simulation

Open the project in Visual Studio Code with the Wokwi extension installed.

Build the firmware first:

pio run

Then start the Wokwi simulation using the Wokwi controls in Visual Studio Code.


📊 Configuration

The main configuration values are stored in:

include/config.h

Important settings include:

Hand Detection Distance : 20 cm
Bin Height              : 30 cm
Warning Threshold       : 75%
Full Threshold          : 90%
Servo Closed Angle      : 0°
Servo Open Angle        : 90°
Lid Open Time            : 3 seconds
Serial Baud Rate         : 115200

📟 Serial Monitoring

The system uses:

115200 baud

The Serial Monitor can be used to observe sensor and system information during testing.

Example information includes:

Hand Distance
Waste Distance
Fill Level
Lid Status
Bin Status

📸 Screenshots

Complete Circuit

Complete Circuit

Hand Detection

Hand Detection

Lid Open

Lid Open

Normal Waste Level

Normal Level

Warning Level

Warning Level

Full Bin Alert

Full Bin

Serial Monitor

Serial Monitor


📚 Documentation

Detailed documentation is available in the following folders:

Architecture

docs/architecture.md

Contains:

  • System architecture
  • GPIO mapping
  • Functional modules
  • System flow
  • Sensor operation
  • Servo operation
  • Fill-level calculation

Testing

docs/testing.md

Contains:

  • Test cases
  • Testing procedures
  • Expected results
  • Actual results
  • Final test summary

Project Report

reports/project_report.md

Contains the complete project report including:

  • Introduction
  • Problem statement
  • Objectives
  • Hardware
  • Software
  • Working principle
  • Results
  • Advantages
  • Applications
  • Future enhancements
  • Conclusion

Circuit Documentation

circuit_diagram/README.md

Contains the complete circuit connection details.


🌱 Applications

The Smart Dustbin concept can be used for:

  • Smart homes
  • Schools
  • Colleges
  • Offices
  • Hospitals
  • Public places
  • Smart-city projects
  • Waste-management systems

🔮 Future Enhancements

Future versions can include:

  • 📡 Wi-Fi connectivity
  • ☁️ IoT cloud monitoring
  • 📱 Mobile application
  • 🌐 Web dashboard
  • 🔔 Remote notifications
  • 📊 Historical waste-level analytics
  • 🗑️ Multiple dustbin monitoring
  • 🔋 Battery-powered operation
  • ☀️ Solar-powered operation
  • 🚛 Smart waste collection management

⚠️ Current Limitations

  • Current prototype is primarily tested using Wokwi simulation.
  • Fill percentage depends on the configured bin height.
  • Ultrasonic readings can vary depending on the waste surface.
  • Remote monitoring is not currently implemented.
  • Cloud connectivity is not currently included.

🎯 Project Highlights

Microcontroller : ESP32
Language        : C++
Framework       : Arduino
Build Tool      : PlatformIO
Simulation      : Wokwi
Sensors         : HC-SR04 × 2
Actuator        : Servo Motor
Indicators      : Green LED + Red LED
Alert           : Buzzer

👩‍💻 Author

Vaishnava Devi R

B.Sc. Digital & Cyber Forensic Science

Interested in:

  • Embedded Systems
  • IoT
  • Cyber Security
  • Digital Forensics
  • VLSI / FPGA
  • Software Development

📄 License

This project is licensed under the MIT License.

See the LICENSE file for details.


⭐ Support

If you find this project useful or interesting, consider giving the repository a ⭐ on GitHub.


About

ESP32-based Smart Dustbin with automatic lid control, ultrasonic waste-level monitoring, LED status indicators, and buzzer alerts, developed using PlatformIO and Wokwi.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages