Physics_project[2]
Physics_project[2]
Physics_project[2]
Section:-213-B
UID
23BCS11748
23BCS12669
23BCS11072
23BCS11111
23BCS10434
23BCS10142
Appratus :-
1. Arduino Uno
2. Ultrasonic Sensor
3. Servo Motor
4. Jumper Wires
5. Battery
6. Dustbin
7. Cardboard
8. Adhesive
9. Scissor
Connections: –
1. To Open The Lid, We Thus Use A Servo Motor. Though, Fix A Small Plastic Tube To The Servo Horn.
Also, Make Sure The Lid Is Parallel To The Ground Or Else It Will Require More Energy To Push The Lid.
2. Thereafter The Servo Is Successfully Placed, Attach The Ultrasonic Sensor At The Front Of The Dustbin.
3. Now Make All The Necessary Connections Using Jumper Wires As Per The Circuit Diagram And Secure
The Wires So That They Don’t Hang Around.
4. Upload The Code In Arduino By Connecting It To Your Laptop Thus Using A USB Wire.
Circuit diagram :-
Code:-
#include <Servo> //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);
}
Working: –
Arduino Senses Any Things That Come Near The Ultrasonic Sensor. When Ultrasonic Sensors Detect Any
Object For Example Like A Hand Or Others, Here Arduino Calculates Its Distance And If It Is Less Than A
Certain Predefined Value Then Servo Motor Gets Activated First And With The Support Of The Extended
Conclusion: –
Hence, Smart Dustbin Using Arduino Was Designed Successfully. In This Way, People Can Dispose Of
Garbage Without Touching The Dustbin And The Lid Also Remains Closed To Avoid Flies.Arm Of The Lid.
The Lid Will Open For A Given Time Then It Will Automatically Close.