Smart Dustbin Arduino Tutorial
Hello guys, welcome back to another blog from the SriTu Hobby. So, In this article, we will learn how to make a Smart dustbin using Arduino. For that, we can use the knowledge presented in previous articles. So, now first we will simply identify the components that are mainly needed for this Arduino smart dustbin project.
This Arduino smart dustbin project is based on the Arduino UNO board and uses an ultrasonic sensor and a servo motor to operate it. Also, we can get distances with an ultrasonic sensor. That theory has been used for this. Click this link for more information about Ultrasonic Sensor. Next, a servo motor is used to open and close the lid of this smart dustbin. So, A servo motor is used for this purpose as we can rotate it to the required degree. also, Click this link to know more about servo motor. (Note – This project is designed to be low cost)
This smart dustbin process
When you get close to this smart dustbin, the lid will open automatically. Then you can put unwanted material in it. Afterward, the lid will close after a while.
The following is a list of components that can be used to create this and You can purchase these components using the affiliate links below.
- Arduino UNO board x 1 — Amazon / Our Store
- Ultrasonic sensor x 1 — Amazon / Our Store
- Servo motor x 1 — Amazon / Banggood
- Cardboard — Amazon / Banggood
- Jumper wires — Amazon / Our Store
- Phone batteries.
Step 1
Arduino UNO board.

Ultrasonic sensor.

Servo motor.




Step 2



Step 3


Step 4




Step 5


(adsbygoogle = window.adsbygoogle || []).push({});
Step 6


Step 7


Step 8
/*Smart dustbin with Arduino.
created by the SriTu Tech team.
Read the code below and use it for any of your creations.
*/
#include <Servo.h> //include servo library
#define Trig 2
#define Echo 3
#define servo 6
Servo myservo;
void setup() {
Serial.begin(9600);
pinMode(Trig, OUTPUT);
pinMode(Echo, INPUT);
myservo.attach(servo);
}
void loop() {
int dis = distance();
Serial.println(dis);
if (dis < 10) {
myservo.write(0);
delay(3000);
} else {
myservo.write(100);
}
}
int distance() {
digitalWrite(Trig, LOW);
delayMicroseconds(4);
digitalWrite(Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Trig, LOW);
long t = pulseIn(Echo, HIGH);//input pulse and save it veriable
long cm = t / 29 / 2; //time convert distance
return cm;
}
Code explanation
Step 9



Step 10


How to make a smart dustbin Arduino | Low-cost smart dustbin Arduino