
Introduction
In today’s world, automation is becoming part of daily life. A Smart Dustbin is a simple yet powerful project that opens automatically when someone comes near it. This helps maintain hygiene and supports cleanliness campaigns.
This project is perfect for:
- School Science Exhibition
- STEAM Lab Activities
- Beginner Arduino Learners
- IoT & Automation Basics
Let’s build it step-by-step
Components Required


- Arduino Uno
- HC-SR04 Ultrasonic Sensor
- SG90 Micro Servo Motor
- Jumper Wires
- Breadboard
- Small Dustbin with Lid
- External 5V Power Supply (Optional)
Working Principle
The system works on a simple logic:
- The Ultrasonic Sensor detects distance.
- When a hand comes within 20 cm:
- Arduino sends signal to Servo Motor.
- Servo Motor rotates (0° → 90°).
- Dustbin lid opens.
- After 3 seconds:
- Lid closes automatically.
Circuit Diagram Connections
📍 Ultrasonic Sensor Connections
| Ultrasonic Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| Trig | Pin 9 |
| Echo | Pin 10 |
Servo Motor Connections
| Servo Wire Color | Arduino Pin |
|---|---|
| Red | 5V |
| Brown | GND |
| Orange | Pin 6 |
Assembly Instructions
- Fix the Servo Motor near the dustbin lid.
- Attach a small rod or wire between servo horn and lid.
- Fix Ultrasonic sensor at the front/top of dustbin.
- Connect all wiring as shown above.
- Upload the code.
Arduino Code
#include <Servo.h>
Servo myServo;
const int trigPin = 9;
const int echoPin = 10;
const int servoPin = 6;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
myServo.attach(servoPin);
myServo.write(0); // Lid Closed
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.println(distance);
if (distance <= 20 && distance > 0) {
myServo.write(90); // Open lid
delay(3000); // Wait 3 seconds
myServo.write(0); // Close lid
}
delay(500);
}- Power ON Arduino.
- Open Serial Monitor.
- Move your hand near sensor.
- Lid should open automatically.
- After 3 seconds, lid closes.
Future Upgrade Version
You can upgrade this project by adding:
- IR sensor for more accuracy
- Load cell for weight detection
- IoT monitoring dashboard
- Smart Waste Management System
(Useful for Municipal Projects and Innovation Exhibitions)
Advantages
✔ Touch-free
✔ Hygienic
✔ Low Cost
✔ Easy to Build
✔ Beginner Friendly
Conclusion
The Smart Dustbin project is a perfect example of how simple electronics can solve real-life problems. Using Arduino UNO, Ultrasonic Sensor, and Servo Motor, we can create an automatic dustbin that promotes hygiene and cleanliness.
This project is ideal for school students, robotics beginners, and innovation labs.
