You are on page 1of 13

‭Arduino-Based Smart Dustbin‬

‭Name - Hemant Verma‬

‭Roll Number - 210435‬

‭Email Id -‬‭hemantv21@iitk.ac.in‬

‭Drive Link :‬‭Smart Dustbin‬


‭Ideation‬
‭ n Arduino-based smart dustbin with motion detection presents a promising‬
A
‭solution for hands-free waste disposal. The dustbin is equipped with sensors‬
‭that can detect the presence of a person approaching it, and the servo motors‬
‭will open the lid automatically, providing a touchless experience for users. This‬
‭smart dustbin can also monitor the waste level and send alerts when it needs to‬
‭be emptied. With the added convenience of a hands-free experience, users can‬
‭dispose of waste more efficiently and hygienically. This innovative solution‬
‭could significantly improve the waste management process and promote public‬
‭health and safety.‬

‭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‬

‭#include <Servo.h> //servo library‬

‭Servo servo;‬

‭const int trigPin1 = 6;‬

‭const int echoPin1 = 7;‬

‭const int servoPin = 8;‬

‭long duration, dist, dist1, dist2, average;‬

‭long aver[3]; //array for average‬

‭int pos =0;‬

‭int target = 120;‬

‭const int trigPin2 = 13;‬

‭const int echoPin2 = 12;‬

‭const int redPin = 4;‬

‭const int greenPin = 3;‬


‭const int bluePin = 2;‬

‭// Define threshold values for waste levels‬

‭const int lowThreshold = 7;‬

‭const int mediumThreshold = 15;‬

‭const int highThreshold = 90;‬

‭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);‬

‭int pos =13;‬

‭servo.write(pos);‬

‭if ( dist1<35 ) {‬

‭//Change distance as per your need‬

‭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‬

‭if (dist2 >= mediumThreshold) {‬

‭// Low waste level, illuminate LED green‬

‭digitalWrite(redPin, LOW);‬

‭digitalWrite(greenPin, HIGH);‬

‭digitalWrite(bluePin, LOW);‬

‭} else if (dist2 >= lowThreshold) {‬

‭// Medium waste level, illuminate LED yellow‬

‭digitalWrite(redPin, LOW);‬

‭digitalWrite(greenPin, LOW);‬

‭digitalWrite(bluePin, HIGH);‬

‭} else {‬

‭// Maximum waste level, blink LED red‬

‭digitalWrite(redPin, HIGH);‬
‭digitalWrite(greenPin, LOW);‬

‭digitalWrite(bluePin, LOW);‬

‭delay(400);‬

‭digitalWrite(redPin, LOW);‬

‭digitalWrite(greenPin, LOW);‬

‭digitalWrite(bluePin, LOW);‬

‭delay(400);‬

‭}‬

‭// Wait a short time before repeating loop‬

‭delay(200);‬

‭}‬

‭void measure (int trigPin, int echoPin) {‬

‭digitalWrite(trigPin, LOW);‬
‭delayMicroseconds(2);‬

‭digitalWrite(trigPin, HIGH);‬

‭delayMicroseconds(10);‬

‭digitalWrite(trigPin, LOW);‬

‭pinMode(echoPin, INPUT);‬

‭duration = pulseIn(echoPin, HIGH);‬

‭dist = (duration/2) / 29.1; //obtain distance‬

‭}‬
‭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 sensor‬‭detects the motion‬‭and 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 to‬‭open the lid‬‭of the dustbin.‬

I‭n 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.‬

I‭f 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.‬

‭ he microcontroller activates an LED to show the waste level in the smart‬


T
‭dustbin‬
‭●‬‭When the dustbin is empty, a green light illuminates‬
‭●‬‭When the dustbin is half full, a blue light illuminates‬
‭●‬‭When the waste level reaches a programmed threshold, the LED‬
‭changes to a red blinking light, indicating that the dustbin is full and‬
‭needs to be emptied‬

‭ 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‬

‭1. Kiriaki M Keramitsoglou and Konstantinos P Tsagarakis. Public‬


‭participation in designing the recycling bins to encourage‬
‭recycling.Sustainability, 10(4):1240, 2018.‬

‭2. Trushali S Vasagade, Shabanam S Tamboli, and Archana D‬


‭Shinde. Smart solid waste collection and management system. In‬
‭Techno- Societal 2018, pages 663–671. Springer, 2020.‬

You might also like