Dark Light

How to Make a Smart Dustbin Using Arduino UNO, Ultrasonic Sensor & SG90 Servo Motor Leave a comment

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

Image
Image
Image
  1. Arduino Uno
  2. HC-SR04 Ultrasonic Sensor
  3. SG90 Micro Servo Motor
  4. Jumper Wires
  5. Breadboard
  6. Small Dustbin with Lid
  7. External 5V Power Supply (Optional)

Working Principle

The system works on a simple logic:

  1. The Ultrasonic Sensor detects distance.
  2. When a hand comes within 20 cm:
    • Arduino sends signal to Servo Motor.
  3. Servo Motor rotates (0° → 90°).
  4. Dustbin lid opens.
  5. After 3 seconds:
    • Lid closes automatically.

Circuit Diagram Connections

📍 Ultrasonic Sensor Connections

Ultrasonic PinArduino Pin
VCC5V
GNDGND
TrigPin 9
EchoPin 10

Servo Motor Connections

Servo Wire ColorArduino Pin
Red5V
BrownGND
OrangePin 6

Assembly Instructions

  1. Fix the Servo Motor near the dustbin lid.
  2. Attach a small rod or wire between servo horn and lid.
  3. Fix Ultrasonic sensor at the front/top of dustbin.
  4. Connect all wiring as shown above.
  5. 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);
}
  1. Power ON Arduino.
  2. Open Serial Monitor.
  3. Move your hand near sensor.
  4. Lid should open automatically.
  5. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *