In this project, I’m going to show you about smart dustbin using Arduino and ultrasonic sensor (HC SR-04)Everywhere people are On investigating on several aspects in several fields for making smart cities to enhance civilization and human efforts.

smart dustbin
     This paper presents some basic ideas on smart dustbin which can he helpful to reduce human effort to make waste management more efficient. Now a days people are most interested to use such technologies to reduce their time and effort in efficient manner. Automation is the most dependable lecture now-a-day, for this purpose smart dustbins are much Suitable approach. This often can be used in places likes offices, schools, colleges and public places etc.

CONSTRUCTIONAL DETAILS:

Make the connections to this given below
 
In ultrasonic sensor (HC SR-04),
  • Echo pin is connected to Arduino pin 9
  • Trigger pin is Connected to Arduino pin 8
  • Vcc pin is connected to +5V Supply in arduino board
  • GND is connected to GND pin of Arduino Uno

In the servo motor,

  • Yellow wire is connected to the arduino pin 10
  • Red wire is connected to the +5V Supply in arduino board
  • GND wire is connected to GND pin of Arduino Uno

WORKING:

  • Let’s get into the details, First of all take a piece cardboard and mate it like a box with as shown in the video or plastic bucket.
  • Ultrasonic Sensor is placed outside of the plastic bucket or box which we had chosen why because when any Obstacle came across the ultrasonic Sensor (HC SR-04) then it give signals to the servomotor.
  • Then the servo motor which is placed inside the box operates to open the lid of the smart dustbin.
  • Dump the source code into the Arduino board, if you have any doubt check in the video

Arduino UNO:

It is used for building electronic projects. This Arduino is a solder less board with contains micro controller  (ATmega328p) which is used to be programmed to
and control objects in the physical world.

Ultrasonic sensor:

Ultrasonic Sensor Range is more than 20khz, (20khz to 2MHz)
We can not even listen to this ultrasonic Sensor signals why because Human Audible range is 20Hz to 20kHz. The working range of this sensor HC SR-04 is 2cm to 400 Cm.
If you have any doubts regarding ultrasonic sensor see the video.

REQUIREMENTS:

  1. Arduino Uno
  2. Ultrasonic sensor
  3. Servo motor
  4. plastic bucket or card board
  5. Connecting wires

CIRCUIT DIAGRAM:

smart dustbin

VIDEO:

 

PROJECT CODE:

Click here to DOWNLOAD

#include<Servo.h>
 const int trigPin  = 8;
const int echoPin  = 9;
const int servoPin = 10;  
// defines variables
 double SetDelay, Input, Output, ServoOutput; 
Servo myServo;            //Initialize Servo.
 void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
myServo.attach(servoPin);    //Attach Servo
Input = readPosition();  
}
 void loop() {
  Input = readPosition();   
  ServoOutput=Input;                                            
  myServo.write(ServoOutput);
  if(ServoOutput ==140) 
    {
      SetDelay=3000;
    }
    else{
      SetDelay=100;
    } 
  delay(SetDelay); 
}
 float readPosition() {
  delay(40);                                  
  long duration, var;
  int distance; 
  // 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
  duration = pulseIn(echoPin, HIGH);
  
  // Calculating the distance
   distance = duration/(29*2); 
  
  // Prints the distance on the Serial Monitor
  Serial.print(“Distance: “);
  Serial.println(distance);

  if(distance <68) {
    var=140;
  }
  else{
    var=50;
  } 
  //Returns distance value.
  return var;     
             
}

Added by

admin

SHARE

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