Project tutorial
Arduino Trash-Bot (Auto-Open/Close Trash Bin)

Arduino Trash-Bot (Auto-Open/Close Trash Bin) © LGPL

An automatic trash-bot that opens its lid if it sees any trash and closes after a certain delay.

  • 13,950 views
  • 3 comments
  • 24 respects

Components and supplies

Apps and online services

About this project

Everything's getting smarter right? So why not your trash bin? This trash bin opens and closes its lid if it sees any rubbish in front of it. You just need to bring the rubbish to it and it'll open automatically and will wait for you to feed it more then after a certain delay it'll close automatically. Watch the video to see exactly what it can do.

Let's get started.

Step 1: Components

(2 More Images)

  • Arduino Uno (any board)
  • Servo motor (I'm using micro servo sg90)
  • HCSR04 ultrasound sensor
  • Servo arms (beside the servo in pic 2)
  • Cardboard (just slice piece)
  • Trash bin

Step 2: Build the Circuit

The circuit is so easy. As the servo and sonar only takes less power you can just power them directly from Arduino 5v source. Just remember to power the Arduino with more than 7.4 V DC or at least 7v.

  • Servo data (yellow) to pin 3 of arduino
  • Servo vcc (red) to 5v of Arduino
  • Servo ground (black/gray) to Arduino Gnd
  • Sonar sensor trig to Arduino 6
  • Sonar sensor echo to Arduino 5
  • Vcc to Arduino 5v
  • Gnd to Arduino Gnd

Step 3: Connect the Servo Arm

Just take this servo arm and connect it to a long cardboard piece with hot glue or other glues. You can also use ice cream stick instead of cardboard. Then connect the long servo arm to servo motor.

Step 4: Add Servo & Sonar Sensor to the Trash Bin

Connect the sonar sensor facing up to the bin like this. And then add the servo motor like this on pic 2 & 3, so that the servo can rotate to up.

Step 5: The Code

Code link: https://github.com/ashraf-minhaj/Trash-bot

I've programmed the Arduino so that if it sees any rubbish (literally anything) in a 50 cm range the servo goes to 50 degrees and hits the upper lid of the bin, so that the upper lid is opened, waits for three seconds, then automatically turns to 160 degrees and thus the upper lid gets closed. So now you see an auto open/close trash-bot.

#include<Servo.h>
Servo servo;
int const trigPin = 6;
int const echoPin = 5;
void setup()
{
pinMode(trigPin, OUTPUT); 
pinMode(echoPin, INPUT);     
servo.attach(3);
}
void loop()
{       
int duration, distance;
digitalWrite(trigPin, HIGH); 
delay(1);
digitalWrite(trigPin, LOW);// Measure the pulse input in echo pin
duration = pulseIn(echoPin, HIGH);// Distance is half the duration devided by 29.1 (from datasheet)
distance = (duration/2) / 29.1;// if distance less than 0.5 meter and more than 0 (0 or less means over range) 
if (distance <= 50 && distance >= 0) 
{	
servo.write(50);    delay(3000);
} 
else 
{		
servo.write(160);
}

Step 6: You Are Done

So now just power the Arduino with more than 7v and you have a trash bin robot.

Thank you.

[If you like my work, please support me by subscribing my YouTube channel]

Big functional Dinosaur Robot(motion activated)

Code

arduino trash-bot codeC/C++
#include<Servo.h>
Servo servo;
int const trigPin = 6;
int const echoPin = 5;
void setup()
{
pinMode(trigPin, OUTPUT); 
pinMode(echoPin, INPUT); 
    servo.attach(3);
}
void loop()
{       int duration, distance;
digitalWrite(trigPin, HIGH); 
delay(1);
digitalWrite(trigPin, LOW);
// Measure the pulse input in echo pin
duration = pulseIn(echoPin, HIGH);
// Distance is half the duration devided by 29.1 (from datasheet)
distance = (duration/2) / 29.1;
// if distance less than 0.5 meter and more than 0 (0 or less means over range) 
if (distance <= 50 && distance >= 0) {
	servo.write(50);
    delay(3000);
} else {
	
	servo.write(160);
}
// Waiting 60 ms won't hurt any one
delay(60);
}

Schematics

arduino trash-bot
Trash bot rn2jhmaxrg

Comments

Similar projects you might like

Arduino Automated Parking Garage

Project tutorial by ashraf_minhaj

  • 4,179 views
  • 11 comments
  • 24 respects

Smart Trash

Project showcase by Ömer Beden

  • 11,488 views
  • 2 comments
  • 29 respects

Security System Using Arduino Bluetooth Camera

Project tutorial by amrmostaafaa

  • 6,847 views
  • 4 comments
  • 26 respects

Parking Sensor with Arduino

Project showcase by Team VINICIUS LOPES

  • 9,976 views
  • 4 comments
  • 17 respects

IOT - Smart Jar Using ESP8266, Arduino and Ultrasonic Sensor

Project tutorial by Team Smazee

  • 6,212 views
  • 4 comments
  • 12 respects
Add projectSign up / Login