Smart Dustbin using Arduino

Are you looking for a way to make your waste management even more efficient? Look no further than the "Smart Dustbin using Arduino." In this blog post, we explore everything from what hardware is required to how it works. By combining the power of Arduino with cutting-edge sensors and analytics, this smart dustbin can revolutionize the way you dispose of your waste. Keep on reading to learn more about this exciting technology and how you can get started today.

Introduction

In this article, we will be looking at how to make a smart dustbin using Arduino, an ultrasonic sensor, and an SG-90 servo motor. Let's start!

Β 

Hardware Required

We will need the following components for making the smart dustbin

  1. Arduino Uno
  2. Ultrasonic Sensor- HC-SR-04
  3. SG-90 Servo
  4. Jumper Wires

If you don't have any of the hardware then you can click on the required component name and buy it from our store.

1. Arduino Uno

arduino uno

Β 

It is a development board used to do all the processing.

Β 

2. Ultrasonic Sensor HC-SR-04

It is used as an object detection sensor. It is used to measure the distance of the object from the sensor.

Ultrasonic Sensor HC-SR-04

3. SG-90 Servo

A Servo motor is used for moving the dust bin lid.

SG-90 Servo

4. Jumper Wires

Used to do circuit connections between different components.

Β 

Jumper Wires

Working Principle

Smart Dustbin works on the principle of object detection using an ultrasonic sensor.Β  The ultrasonic sensor transmits sound waves. These waves get reflected whenever an object comes into the vicinity of the sensor. This generates an electrical signal which is used to open the dustbin lid.

Working Principle smart dustbin

Circuit Diagram

Make the connections as shown in the diagram below.

Circuit Diagram for smart dustbin using arduino

Program Code



/*
  SMART DUSTBIN ARDUINO CODE

  Lid of the dustbin gets opened when a person comes in range of 30cm in front of the dustbin
*/

#include   //INCLUDES SERVO LIBRARY

Servo servo;
int trigPin = 5;
int echoPin = 6;
int servoPin = 9;
long duration, distance, average;
long averDist[3];

void setup() {
  Serial.begin(9600);
  servo.attach(servoPin);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  servo.write(0); //CLOSES CAP ON STARTING
  delay(100);
  servo.detach();
}

void measure() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(5);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(15);
  digitalWrite(trigPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1; //CALCULATES DISTANCE
}

void loop() {
  Serial.println(distance);   
  for (int i = 0; i <= 2; i++) { //CALCULATES AVERAGE DISTANCE
    measure();
    averDist[i] = distance;
    delay(10);
  }
  distance = (averDist[0] + averDist[1] + averDist[2]) / 3;

  if ( distance <= 30 ) {
    servo.attach(servoPin);
    delay(1);
    servo.write(180);
    delay(3500);
  }
  else
    servo.write(0);
    delay(1500);

    servo.detach();

}

Servo servo;

This creates servo object.

int trigPin = 5;
int echoPin = 6;
int servoPin = 9;


The above lines assign trigger and echo pins of the ultrasonic sensor to 5 and 6 respectively. Servo’s PWM pin is connected to pin 9 of Arduino.


long duration, distance, average;
long averDist[3];

Β 

These are the variables created for storing and processing data from ultrasonic sensor.

servo.attach(servoPin);
Β  pinMode(trigPin, OUTPUT);
Β  pinMode(echoPin, INPUT);
servo.write(0); //CLOSES CAP ON STARTING
Β  delay(100);
Β  servo.detach();


servo. Attach (servoPin) - attaches the servo variable which we created initially to the servo pin, set trigger and echo pins as Output and Input respectively, close the lid of the dustbin by setting servo to 0 positions, and then detach the servo object.

Β  Serial.println(distance);Β  Β 
Β  for (int i = 0; i <= 2; i++) { //CALCULATES AVERAGE DISTANCE
Β  Β  measure();
Β  Β  averDist[i] = distance;
Β  Β  delay(10);
Β  }
Β  distance = (averDist[0] + averDist[1] + averDist[2]) / 3;


Measure function calculates the distance and average calculates the average of 3 distances measured by ultrasonic sensor.

Β  if ( distance <= 30 ) {
Β  Β  servo.attach(servoPin);
Β  Β  delay(1);
Β  Β  servo.write(180);
Β  Β  delay(3500);
Β  }
Β  else
Β  Β  servo.write(0);
Β  Β  delay(1500);

Β  Β  servo.detach();


If the distance is less than 30 then the dustbin lid is opened by setting the servo to 180 position otherwise the dustbin’s lid is closed.

Conclusion

In this blog post, we have learned building a Smart Dustbin using Arduino is a fun and creative project that not only helps keep your surroundings clean but also enhances your tech skills. With the help of ultrasonic sensors and wireless communication, you can make your daily chores more efficient and eco-friendly. So why wait? Grab your Arduino kit and start building your own Smart Dustbin today! So take your first step towards becoming a tech-savvy and environmentally conscious individual. Start your journey towards a cleaner and smarter future today with this exciting project.

Β 

If you appreciate our work don't forget to share this post and leave your opinion in the comment box.

Β 

Please do check out otherΒ blog postsΒ aboutΒ Interfacing ACS712 with ArduinoΒ ,Β Arduino Interfacing with Ultrasonic SensorΒ ,Β LED Interfacing with ArduinoΒ ,Β Interfacing GSM Module with ArduinoΒ ,Β Interfacing MAX30100 Pulse Oximeter with ArduinoΒ ,Β IR Sensor Interfacing with ArduinoΒ ,Β How to connect ZMPT101B to ArduinoΒ andΒ Β How to use Buzzer with Arduino.

Β 

Make sure you check out our wide range ofΒ products and collectionsΒ (we offer some excitingΒ deals!)

Frequently Asked Questions

1. How does smart dustbin work with Arduino?

The smart dust bin, powered by Arduino, is equipped with sensors to identify objects in close proximity. A signal is then transmitted to a servo motor, which unhinges the lid. The motor is programmed to shut the lid after a certain duration. Additional sensors can detect the bin's filling level and send alerts to users for emptying. This technology boosts waste management efficiency.

2. Is smart dustbin an IoT device?

Yes, a smart dustbin is an IoT or Internet of Things device that uses sensors, wireless connectivity, and cloud-based analytics to monitor and optimize waste management. It can detect the level of trash in the bin and alert waste management teams when it's time to empty it, improving efficiency and reducing costs. Smart dustbins can also help cities and organizations track their waste generation and recycling rates, ultimately contributing to more sustainable and cleaner environments.

3. Which sensor is used in smart dustbin?

 The mystical smart dustbins use ultrasonic sensors to detect the presence of objects or beings, resulting in automatic lid activation. Furthermore, weight sensors conjure the ability to measure waste volume and alert owners of the need for disposal.

Components and Supplies

You May Also Like To Read:

Frequently Asked Questions

1. How does smart dustbin work with Arduino?

The smart dust bin, powered by Arduino, is equipped with sensors to identify objects in close proximity. A signal is then transmitted to a servo motor, which unhinges the lid. The motor is programmed to shut the lid after a certain duration. Additional sensors can detect the bin's filling level and send alerts to users for emptying. This technology boosts waste management efficiency.

2. Is smart dustbin an IoT device?

Yes, a smart dustbin is an IoT or Internet of Things device that uses sensors, wireless connectivity, and cloud-based analytics to monitor and optimize waste management. It can detect the level of trash in the bin and alert waste management teams when it's time to empty it, improving efficiency and reducing costs. Smart dustbins can also help cities and organizations track their waste generation and recycling rates, ultimately contributing to more sustainable and cleaner environments.

3. Which sensor is used in smart dustbin?

 The mystical smart dustbins use ultrasonic sensors to detect the presence of objects or beings, resulting in automatic lid activation. Furthermore, weight sensors conjure the ability to measure waste volume and alert owners of the need for disposal.

Leave a comment

Please note, comments must be approved before they are published