Back to Advanced Projects

🗑️ Touchless Smart Dustbin

Keep your hands clean. A servo automatically opens the lid when it detects your hand.

📋 Overview

This is a classic utility project. An ultrasonic sensor constantly pings for objects within 30cm. If it detects a hand, it sweeps a servo to open the lid and holds it open for 3 seconds.

What you'll learn: Ultrasonic timing, servo mechanical linkages, and delay-based state holding.

Estimated time: 2-3 hours. Difficulty: ⭐⭐ Easy.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
HC-SR04Ultrasonic1
Servo MotorSG901For light lids
DustbinSmall/Desktop size1With a hinged lid

📖 Step-by-Step Tutorial

1

Mount Sensor

Cut two holes in the front of the bin for the ultrasonic "eyes".
2

Mount Servo

Glue the servo near the hinge. Attach a stiff wire or paperclip from the servo horn to the lid.
3

Upload Code

Upload the logic. Adjust the opening angle so the lid doesn't snap backward.
💡
If the lid is heavy, you will need a standard-sized servo (like an MG996R) and a separate 5V power supply, as the Arduino cannot provide enough current.

💻 Code / Configuration

smart_dustbin.ino
INO
// Smart Dustbin
#include <Servo.h>

Servo lidServo;
int trigPin = 9;
int echoPin = 10;
long duration, distance;

void setup() {
  lidServo.attach(8);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  lidServo.write(0); // Closed position
}

void loop() {
  digitalWrite(trigPin, LOW); delayMicroseconds(2);
  digitalWrite(trigPin, HIGH); delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;
  
  if (distance < 30) {
    lidServo.write(90); // Open

Reviews & Ratings

0 reviews
5★
0
4★
0
3★
0
2★
0
1★
0
...

Loading reviews...

volt-X / Touchless Smart Dustbin — Advanced IoT Tutorial