SMART DUSTBIN

 DESCRIPTION:

This is a small project that can be used to provide neatness at the public places and avoid touching of the dustbins for throwing garbage into it and also avoid the garbage to scatter here and there.

The more advanced version of it can also be helpful in segregating the biodegradable and non-biodegradable wastes.

USE:

This project is useful because the lid of the dustbin remains closed when not in use this avoids the  birth of flies and mosquitoes, and when you want to dispose the waste the lid opens automatically, making easy disposal of wastes.

 HARDWARE COMPONENTS REQUIRED:

·      ARDUINO UNO

·      ULTRASONIC SENSOR

·      SERVO MOTOR

·      BATTERY(9V)

·      JUMPER WIRES

 

STEPS TO MAKE THE DUSTBIN:

·       Step 1: Connect the servo motor and Arduino UNO

·       Step 2: Connect the ultrasonic sensor

·       Step 3: Connect the terminals of the battery

·       Step 4: All the connections will be made using jumper wires and check that the  connection are made according to the pin number defined in the code

·       Step 5: Upload the code on Arduino UNO

·       Step 6: All set! READY TO USE!!

IMAGE:

Connection of the output pin number may vary according to the code.



 

CODE:

#include <Servo.h>

Servo myservo; 

int pos = 20; 

const int trigPin = 5;

const int echoPin = 6;

const int led = 13;

 

long duration;

float distance;

 

void setup()

{

  myservo.attach(11);

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);

  pinMode(led, OUTPUT);

  myservo.write(pos);

  Serial.begin(9600);

}

 

void loop()

{

 

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

 

  duration = pulseIn(echoPin, HIGH);

  distance = 0.034*(duration/2);

  Serial.println(distance);

  if (distance < 27)

  {

    digitalWrite(led,HIGH);

    myservo.write(pos+160);

    delay(1000);

  }

  else

  {

    digitalWrite(led,LOW);

      myservo.write(pos);

  }

  delay(300);

}

 

 

Comments

Popular posts from this blog