Automated Dustbin

Rithic Hariharan
3 min readJun 29, 2021

Introduction of the project

This project was the first community project that I had executed. The project was an efficient project and gave an astonishing 98% efficiency. The project mainly used 2 different types of sensors and actuators. One of it is an Ultrasonic interference sensor and an actuator Servo motor

Introduction to Ultrasonic sensor

The sensor works on the principle of ultrasound similar to the sonar technology. It has a receiver and a transmitter the transmitter transmits the ultrasound and the receiver receives the ultrasound. This is a very accurate sensor with very good accuracy

Introduction to Servo Motor

This is an actuator. This is generally used in the field of robotics. The working of this actuator is similar to dc motors but it is different from the dc motors as the degree of rotation using the Arduino. Due to this feature of the servo motor, it is widely used in the field of robotics.

Cause of the project

We came to work on this project because of the problems faced by civic workers in our society. And due to improper disposal of the waste due to which there was a boom of birth of mosquitoes. Which in turn gave a chance of increased spread of diseases like malaria and dengue.

Working on the project

In this project, we will be making a custom-built dustbin using tinker cad and the sensors that we had discussed above. In this project, I will be using the Blynk IoT cloud platform to interface with the message systems. We can also use the GSM module which is a sim card module that can send SMS via the module notifying the user but due to the unavailability of the module, I used the Blynk IoT cloud. In this project, I have fitted 2 ultrasonic sensors in which one of which is for object detection and the other is for determining the amount of dust present in the dustbin. We will be placing the 2nd ultrasonic sensor in such a way that it will trigger a message when the dustbin becomes half full. The opening and closing of the lid are also automatic and will be controlled by the servo motor.

Circuit connection using Tinker Cad

The microcontroller I am using is a nodemcu but due to the availability of the node MCU library I am using an Arduino UNO library

Circuit Connection for automated dustbin

Code of the setup

#define BLYNK_PRINT Serial
#define echoPin 2
#define trigPin 3
#define echoPin 4
#define trigPin 5
#include<Servo.h>
Servo myservo;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "YourAuthToken";char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
long distance;
long distance1;
long duration;
long duration1;
void setup()
{

Serial.begin(9600);
Blynk.begin(auth, ssid, pass);

pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);

myservo.attach(9);


}
void loop()
{
Blynk.run();
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034 / 2;

Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");

digitalWrite(trigPin1, LOW);
delayMicroseconds(2);

digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);

duration1 = pulseIn(echoPin1, HIGH);

distance = duration1 * 0.034 / 2;

Serial.print("Distance: ");
Serial.print(distance1);
Serial.println(" cm");
if(distance1<=15)
{
myserso.write(270);


}
else
{
myservo.write(0);
}
if(distance <=radius)
{
Blynk.notify(“The Dustbin is Full”);
}
}

--

--

Rithic Hariharan

Tech Enthusiast Blogger Writer Aviation Enthusiast Student