Professional Documents
Culture Documents
Email Id -hemantv21@iitk.ac.in
Sensors
ltrasonic sensors: They use sound waves to detect the distance of objects
U
within their field of view. In the smart dustbin project, they can detect a
person's presence and distance from the sensor, triggering the lid to open.
Actuators
ervo motors: They are small and precise motors that can rotate to a specific
S
angle with high accuracy. They can be easily controlled using a microcontroller
board like Arduino Uno. In the smart dustbin project, servo motors are used to
move the lid of the dustbin up and down automatically in response to the
sensor inputs. This provides a hands-free and hygienic solution for waste
disposal.
Development boards
rduino Uno: It is a widely-used microcontroller board in the maker community
A
that features an ATmega328P microcontroller. It provides a simple and flexible
way to program and control various sensors and actuators used in DIY
electronics projects, including the smart dustbin. It is a cost-effective and
versatile platform for prototyping and developing embedded systems.
Code Used
Servo servo;
void setup() {
Serial.begin(9600);
servo.attach(servoPin);
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(trigPin2, OUTPUT);
pinMode(echoPin2, INPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
measure(trigPin1, echoPin1);
dist1 = dist;
Serial.print("Dist1 : ");
Serial.println(dist1);
servo.write(pos);
if ( dist1<35 ) {
for(pos=0;pos<=target;pos+=1)
{
servo.write(pos);
delay(8);
}
delay(3000);
for(pos=target;pos>=0;pos+=-1)
{
servo.write(pos);
delay(5);
}
}
duration = 0;
measure(trigPin2, echoPin2);
dist2 = dist;
Serial.print("Dist2 : ");
Serial.println(dist2);
// Check waste level and update RGB LED accordingly
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
} else {
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
delay(400);
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
delay(400);
}
delay(200);
}
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
}
Explanation and working of the entire assembly with block
Diagram
he ultrasonic sensor used in the smart dustbin operates by emitting high-
T
frequency sound waves and measuring the time it takes for the sound waves
to bounce back from an object. The sensor can detect its object within its
field of view and estimate their distance based on the time delay between the
emitted and received sound waves. When a person approaches the dustbin,
the ultrasonic sensordetects the motionand calculates the distance of the
person from the dustbin. If the person is within the trigger distance, which can
be set using the programming of the Arduino Uno board, the microcontroller
sends a signal to the servo motor toopen the lidof the dustbin.
In addition to motion detection, the ultrasonic sensor also detects the waste
level inside the dustbin. By placing the sensor at the top of the trash can and
measuring the distance between it and the top of the waste pile, it is made
possible. The sensor's distance measurement decreases as the waste level
rises, allowing the microcontroller to determine the waste level inside the bin.
If the waste level reaches a certain threshold, which can also be set using the
programming of the Arduino Uno board, the microcontroller activates an LED to
indicate that the dustbin is full. The LED can be programmed to change color
based on the waste level or other conditions, such as when the dustbin needs
to be emptied or when it's time for recycling. This feature provides a visual cue
to users that the dustbin needs to be emptied and encourages them to practice
responsible waste management.
his feature helps users keep track of the waste level and encourages
T
responsible waste management. The LED color can be customized to signal
other conditions, such as when it's time for recycling.
Reference