India Automation Challenge 2021
OR
Smart Dustbin as its name represents it works smartly or we can say that it is an automatic dustbin. smart Dustbin is a very good project from the Arduino board. it works likewise smart things. We can say that, It is a decent gadget to make your home clean and attractive. kids spread trash to a great extent by paper, rappers and numerous different things at home. They will have fun with this dustbin they play with the dustbin and in the play of them they clean your home as well because every time they use the smart Dustbin and it attracts the kids. They generally will be utilized to throw all trash and waste into this smart dustbin. if your hands are full of trash or junk and you're unable to open it manually this can be used. As it open automatically without touching, this can help to control the spread of Coronavirus and even mosquitoes will not move around it so that it help from preventing the spread of new diseases.
Arduino UNO, Jumper Wires, Servo Motor, Ultrasonic Sensor
Arduino IDE
1] Arduino UNO: As you know that Arduino is a microcontroller-based open source electronic prototyping board which can be programmed with an easy-to-use Arduino IDE. The UNO is one of the most popular boards in Arduino family and a great choice for beginners.
2] Ultrasonic Sensor: are those sensor which use Ultrasonic waves to detect object or to measure the distance between itself and the object
3] Servo Motor: is an electrical device which can push or pull and also rotate an object with great precision. if you want to rotate an object at some specific angles or distance, then you use servo motor. It is made up of simple motor which run through servo mechanism. We can get very high torque servo motor in a small and light weight packages.
Circuit Diagram
#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 average
void setup() {
Serial.begin(9600);
servo.attach(servoPin);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servo.write(0); //close cap on power on
delay(100);
servo.detach();
}
void measure() {
digitalWrite(10,HIGH);
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration/2) / 29.1; //obtain distance
}
void loop() {
for (int i=0;i<=2;i++) { //average distance
measure();
aver[i]=dist;
delay(10); //delay between measurements
}
dist=(aver[0]+aver[1]+aver[2])/3;
if ( dist<50 ) {
//Change distance as per your need
servo.attach(servoPin);
delay(1);
servo.write(0);
delay(3000);
servo.write(150);
delay(1000);
servo.detach();
}
Serial.print(dist);
}