🗑Smart Automatic Dustbin
🎯 Objective of This Project
The goal of this project is to build a Smart Automatic Dustbin that:
-
Opens automatically when a hand is detected
-
Detects whether the dustbin is full or not
-
Works without touching the lid (Hygienic System)
This project uses:
-
Distance measurement
-
Servo motor control
-
ESP32 microcontroller logic
🌍 Real-World Application
-
Smart homes
-
Hospitals
-
Smart city waste management
-
Public places (malls, railway stations)
-
IoT-based garbage monitoring systems
🧩 Components Used in This Project
1️⃣ ESP32 Development Board
🔹 About ESP32
The ESP32 is a powerful microcontroller with:
-
Built-in WiFi
-
Built-in Bluetooth
-
Multiple GPIO pins
-
PWM support (for servo control)
🔹 Why We Use ESP32?
-
Future IoT upgrade possible
-
Fast processing
-
Ideal for smart automation projects
2️⃣ Ultrasonic Sensor (HC-SR04)
🔹 Function
Used to measure distance using sound waves.
🔹 How It Works
-
Sends ultrasonic sound
-
Sound reflects from object
-
Time taken is calculated
-
Distance is computed
🔹 In This Project
-
Sensor 1 → Detects Hand
-
Sensor 2 → Detects Garbage Level
3️⃣ Servo Motor (SG90)
🔹 Function
Rotates at specific angles (0°–180°).
🔹 In This Project
-
0° → Lid Closed
-
90° → Lid Open
4️⃣ Other Required Items
-
Breadboard
-
Jumper wires
-
External 5V supply (recommended)
-
Dustbin body
-
Mounting support for servo
🔌 Circuit Diagram & Connections
📌 Pin Configuration
🔹 Ultrasonic Sensor 1 (Hand Detection)
| Sensor Pin | ESP32 Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| TRIG | GPIO 5 |
| ECHO | GPIO 18 |
🔹 Ultrasonic Sensor 2 (Garbage Level)
| Sensor Pin | ESP32 Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| TRIG | GPIO 17 |
| ECHO | GPIO 16 |
🔹 Servo Motor
| Servo Wire | ESP32 Pin |
|---|---|
| Red | 5V (External recommended) |
| Brown | GND |
| Orange | GPIO 13 |
⚠ Important: Connect ESP32 GND and Servo GND together.
🔧 Setup Guide (Step-by-Step)
Step 1 – Mount Servo on Lid
-
Fix servo motor near hinge area
-
Connect servo arm to lid using plastic rod
Step 2 – Install Ultrasonic Sensor 1
-
Place outside front of dustbin
-
Facing outward to detect hand
Step 3 – Install Ultrasonic Sensor 2
-
Place inside top of dustbin
-
Facing downward toward garbage
Step 4 – Make Circuit Connections
-
Connect sensors to ESP32
-
Double-check VCC & GND
-
Avoid loose connections
Step 5 – Power On & Test
⚙ Working Principle Summary
-
Hand comes near dustbin
-
Ultrasonic sensor detects object
-
ESP32 processes distance
-
Servo rotates and opens lid
-
After delay → lid closes
-
Second sensor continuously monitors garbage level
-
If garbage reaches threshold → “Dustbin Full”