FacebookInstagramYouTube
logoIIST,Bihar
HomeProjectsIdeaAboutBlogComponentsTeamTutorialsContact
Log In
HomeProjects
0
Cart
Account
Logo

Stay connected with us! Follow and subscribe to our social media platforms for regular updates on learning new skills. Happy Learning!

Quick Links

  • About Us
  • Blog
  • Contact Us

Community

  • Terms & Conditions
  • Privacy Policy
  • Refund Policy
  • Career

More

  • Certificate verification
  • FAQ
  • Management
  • Student Panel

Contacts

+91-7295890160
support@iistbihar.com

COPYRIGHT IIST BIHAR. All rights reserved | Designed & Maintained BY TechnotrickywithByte4ge

How to Make a Smart Dustbin Using Arduino Uno, Servo Motor and an Ultrasonic Sensor

How to Make a Smart Dustbin Using Arduino Uno, Servo Motor and an Ultrasonic Sensor

How to Make a Smart Dustbin Using Arduino Uno, Servo Motor and an Ultrasonic Sensor

January 17, 2025

Key Features

  • ✓
    Complete source code included
  • ✓
    Detailed documentation
  • ✓
    6 months technical support

Description

How to Make a Smart Dustbin Using Arduino Uno, Servo Motor and an Ultrasonic Sensor

 

Introduction

In this tutorial, we will learn how to make a smart dustbin using Arduino Uno, Servo motor and an ultrasonic sensor. This project introduces a touchless solution for waste disposal, which is particularly useful in maintaining hygiene during the COVID-19 era and beyond.

Hardware Required

  • Arduino Uno
  • Ultrasonic Sensor HC-SR04
  • SG-90 Micro Servo Motor
  • Dustbin
  • Full Kit
 

Software Required

  • Arduino IDE
 

Component Details

1.    Arduino Uno


Arduino Uno is an open-source microcontroller board based on the ATmega328P processor. Key features include:

  • 14 digital input/output pins, 6 of which support PWM output
  • 6 analog inputs
  • USB connection, power jack, ICSP header, and reset button

It is economical and ideal for beginner-level projects, allowing users to experiment freely without worry.

 

2.    Ultrasonic Sensor HC-SR04


The HC-SR04 sensor measures distance using SONAR principles.

  • Components: Transmitter (emits ultrasound) and Receiver (listens for echo)
  • Applications: Obstacle avoidance, distance measurement
  • Working Principle: Emits an ultrasonic wave that bounces back after hitting an object. The time taken for the wave's return determines the distance.
 

3.    SG90 Micro Servo Motor


The SG90 is a lightweight, fast, and reliable servo motor, commonly used in:

  • Remote-controlled vehicles (cars, boats, planes)
  • Robotics projects
    It operates smoothly with most radio control systems and provides precise motion for the dustbin lid.
 

Working Concept

The smart dustbin automates the process of opening the lid when an object is detected. Here's how it works:

1.    Detection: The ultrasonic sensor HC-SR04 detects an object in front of the dustbin.

2.    Signal Processing: The sensor sends data to the Arduino Uno, which processes the signal.

3.    Actuation: The Arduino signals the servo motor to open the dustbin lid for a specified time (default: 3 seconds).

This project provides a contactless solution, making trash disposal more hygienic and efficient.

 

Circuit Diagram


The main components of the circuit are:

1.    Arduino Uno

2.    Ultrasonic Sensor HC-SR04

3.    SG90 Servo Motor

Connections:

  • HC-SR04:
    • Trig → Pin 5
    • Echo → Pin 6
    • VCC → 5V
    • GND → GND
  • Servo Motor:
    • Signal → Pin 7
    • VCC → 3.3V
    • GND → GND
  • Power Supply:
    • A 9V battery is connected to the VIN pin on Arduino Uno, with grounds connected together.
 

Program Code

Here’s the code for the smart dustbin. Upload it to the Arduino Uno using the Arduino IDE.

 

#include <Servo.h> // Servo library

Servo servo;

int trigPin = 5;

int echoPin = 6;

int servoPin = 7;

int led = 10;

long duration, dist, average;

long aver[3]; // Array for averaging distance measurements

 

void setup() {

    Serial.begin(9600);

    servo.attach(servoPin);

    pinMode(trigPin, OUTPUT);

    pinMode(echoPin, INPUT);

    servo.write(0); // Close the lid on startup

    delay(100);

    servo.detach();

}

 

void measure() {

    digitalWrite(led, HIGH);

    digitalWrite(trigPin, LOW);

    delayMicroseconds(5);

    digitalWrite(trigPin, HIGH);

    delayMicroseconds(15);

    digitalWrite(trigPin, LOW);

 

    duration = pulseIn(echoPin, HIGH);

    dist = (duration / 2) / 29.1; // Calculate distance

}

 

void loop() {

    for (int i = 0; i <= 2; i++) { // Average distance calculation

        measure();

        aver[i] = dist;

        delay(10);

    }

    dist = (aver[0] + aver[1] + aver[2]) / 3;

 

    if (dist < 50) { // Change threshold distance as needed

        servo.attach(servoPin);

        delay(1);

        servo.write(0); // Open the lid

        delay(3000); // Keep it open for 3 seconds

        servo.write(150); // Close the lid

        delay(1000);

        servo.detach();

    }

    Serial.print(dist);

}

 

Final Assembly

1.    Attach the Arduino Uno and the 9V battery to the dustbin wall using double-sided tape.

2.    Upload the code to the Arduino board via the Arduino IDE.

3.    Power on your setup, and your smart dustbin is ready to use!

 

Conclusion

With this smart dustbin, you have created a hygienic and contactless solution for waste disposal. Experiment further by customizing the code to adjust lid timings or sensor sensitivity. Enjoy building!

 

 

Similar Projects

Smart Dustbin
100% OFF

Smart Dustbin

₹1₹1,499
Smart Stick for Blind People
100% OFF

Smart Stick for Blind People

₹1₹1,999
Automatic Street Light
100% OFF

Automatic Street Light

₹1₹3,999
PIR Sensor based light
25% OFF

PIR Sensor based light

₹1,499₹1,999
Gas Leakage Detector
33% OFF

Gas Leakage Detector

₹1,999₹2,999
Automatic Plant Watering System
50% OFF

Automatic Plant Watering System

₹2,499₹4,999
Gas Level Indicator for LPG Cylinders
26% OFF

Gas Level Indicator for LPG Cylinders

₹2,599₹3,499
Fire and Smoke Detection System
43% OFF

Fire and Smoke Detection System

₹1,999₹3,499
LDR-based Automatic Light Control System
20% OFF

LDR-based Automatic Light Control System

₹1,999₹2,499
Test name project2

Test name project2

₹399₹400
Test name project2

Test name project2

₹399₹400
Test name project2

Test name project2

₹399₹400