Design a development of a smart dustbin for street purpose

Published Dec 05, 2020
 17 hours to build
 Beginner

where the Ultrasonic sensor is placed on top of the dustbin's lid and when the sensor detects any object like a human hand, it will trigger Arduino to open the lid.

display image

Components Used

Ultrasonic Module HC-SR04
Ultrasonic module HC-SR04 is generally used for finding distance value and obstacle detection. It can operate in the range 2cm-400cm.
1
Arduino Nano
Arduino Nano
1
SG90 micro servo Motor
DFRobot Accessories 9g micro servo (1.6kg)
1
dustbin
To dump waste
1
Description

                                                   Smart dustbin

Working:-

Ultrasonic Sensors is used to calculate the distance from Dustbin. Whenever the distance between us and Dustbin dips below 30 cm the Lid opens up by turning Servo Motor. As we move away from the dustbin, the lid closes automatically. This can be done with the help of Arduino UNO and Arduino software

Arduino software

Libraries are provided by Arduino itself, but some Libraries are not present by default some we need to add them, in such case we can add them by putting them into the libraries folder. Take the code for Arduino , select Arduino UNO in Tool>Board option, further select COM port, and then burn the code.

Purpose

         1) To collect dustbins placed at public places in city.

         2) Automatic open-close lid for easy use.

         3) There is no contact touch between dustbin and Person so, prevention from germs and diseases.

         4) It gives more comfort to peoples

 

Flow chart

 

Circuit Diagram

 

Code

 

//Funtion : Automatically opens the lid of dustbin when you go near it.

//project title: develop a smart dustbin for street purpose



// Library included
#include<Servo.h> // library for Servo Motors


// defines pins numbers
const int trigPin = 9;//Connect trig pin of UltraSonic Sensor. 
const int echoPin = 10;//Connect Echo pin of UltraSonic Sensor.
const int servoPin = 3;//Connect Servo Motor to given pin ( select any PWM pin ) 

// defines variables
long duration;
int distance;
int Dist;
Servo Servo_Motor;

// Prototype Declaration Section.
int MeasureDistance();

void setup() {
     
    pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
    pinMode(echoPin, INPUT); // Sets the echoPin as an Input
    Servo_Motor.attach(servoPin); // We need to attach the servo to the used pin number 
    Serial.begin(9600); // Starts the serial communication
}

void loop()
{
      Dist = MeasureDistance();
      if (Dist < 30)// if distance is less than 30cm
      {
           open ();// opens the lid of Dustbin When you are near to it 
           delay (1000);
      }
      else
      {
        close(); // Closes the lid of Dustbin When you are far from it.
        delay(500); 
      }   
}

void open ()
{
   Servo_Motor.attach(servoPin); 
   Servo_Motor.write(90);   // turns the horn of Servo motor by 90 degree from intial position 
   delay(1000);
   Servo_Motor.detach();     
} 

void close()
{
   Servo_Motor.attach(servoPin);
   Servo_Motor.write(0);   // bring back th horn of servo motor back to its original position
   delay(1000);
   Servo_Motor.detach();     
   
}

int MeasureDistance () 
{
    // Clears the trigPin
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);
    // Sets the trigPin on HIGH state for 10 micro seconds
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);
    // Reads the echoPin, returns the sound wave travel time in microseconds
    duration = pulseIn(echoPin, HIGH);
    // Calculating the distance in cm
    distance= duration*0.034/2;
    return distance;
}

 

Codes

Downloads

Smart_dustbin_12022020174438 Download
Circuit Diagram Download
Flow chart Download

Institute / Organization

PSNACET
Comments
Ad