The STEM Makers

How to Build a Smart Dustbin using Arduino

A Smart Dustbin using Arduino uses an ultrasonic sensor to detect a person’s hand and automatically opens the lid using a servo motor. This project promotes hygiene and automation by minimizing direct contact with the bin. It’s an ideal Arduino project for beginners to learn sensor and motor integration. 

 ✅ Main Components Required 

  • Arduino Uno (or any compatible board) 
  • Ultrasonic Sensor (HC-SR04) 
  • Servo Motor (for lid movement) 
  • Dustbin with Hinged Lid 
  • Jumper Wires 
  • Breadboard (optional) 
  • Power Supply (Battery or Adapter) 

 ✅ What is a Smart Dustbin? 

A Smart Dustbin is an automated waste container that opens its lid automatically when it detects an object (like a hand) near the sensor. This touchless design enhances hygiene and prevents the spread of germs. 

 ✅ How Does the System Work? 

  • Ultrasonic Sensor detects the presence of an object within a set range (e.g., 15 cm). 
  • Arduino processes the signal and sends a command to the servo motor. 
  • Servo Motor rotates to open the lid for a few seconds and then closes it automatically. 

 ✅ Step-by-Step Setup Guide 

  • Mount the Components:
    Fix the ultrasonic sensor at the front of the dustbin.
    Attach the servo motor to the lid for opening and closing.
  • Make the Connections:
    Ultrasonic Sensor:
    VCC → 5V, GND → GND
    Trig → Pin 9, Echo → Pin 10
    Servo Motor:
    Signal → Pin 3, VCC → 5V, GND → GND
  • Upload the Code:
    Use Arduino IDE to upload the code for distance detection and servo control.
  • Test and Calibrate:
    Adjust the distance threshold for smooth operation. 

 ✅ Sample Arduino Code 

#include <Servo.h>
Servo myServo;

const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;

void setup() {
  myServo.attach(3);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  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;

  if (distance <= 15) {
    myServo.write(90); // Open lid
    delay(3000);
    myServo.write(0);  // Close lid
  }
}
 

 ✅ Advantages of Arduino-Based Smart Dustbin 

  • Hygienic and Touchless: Reduces the risk of germ transmission. 
  • Cost-Effective: Uses affordable components. 
  • Easy to Build: Suitable for beginners and students. 
  • Customizable: Adjustable distance and lid opening duration. 
  • Promotes Automation: A practical application of IoT and robotics. 

 ✅ Enhancements You Can Add 

  • LCD Display showing “Welcome” or “Full” status. 
  • IR Sensors for better accuracy. 
  • Buzzer to alert when bin is full. 
  • Wi-Fi Module (ESP8266) for IoT integration and notifications. 
  • Solar Power for eco-friendly operation. 

 ✅ The STEMMakers Capability in Arduino Projects 

At The StemMakers based out of Vijayawada near DV Manor Hotel,  we have successfully developed 20+ custom Arduino projects for student science exhibitions and innovation programs for various science fairs and competitions.

Contact us for kits, training, and project guidance:
📧 asha@thestemmakers.com | 🌐 www.thestemmakers.com

Discover additional Arduino projects by The STEM Makers through the links below.

Know More about Arduino Consulting at The STEM Makers
How to build a water level indicator Arduino
How to Build a Smart Dustbin using Arduino
How to Build a Smart Home Automation using Arduino
How to Build a Traffic Light System using Arduino
How to Build a Temperature & Humidity Monitor using Arduino
How to build an Obstacle Avoiding Robot using Arduino
How to build an Automatic Plant Watering System using Arduino 

Scroll to Top