Automatic trash-bot
0 kommentarer

Everything's getting smarter right? So why not your trash bin? This trash bin opens and closes its lid if it sees anything in front of it. You just need to go closer to it and it'll open automatically and will wait for you to feed it then after a certain time it'll close automatically.

Now lets have fun building it :D

Required Components

In order to make this project, you will need the components below. They can  be found here at ebits.se.

Amount

Components Photo

Components

1

Arduino Uno

1

1 Ultrasonic Sensor HC-SR04
1 9V battery to 5.5mm DC connector cable

7 Dupont cables
1 Trash bin
1 9V Battery

The trash bin can be made of cardboard or you can use one but the top lid needs to be flat so it is easy for the servo motor to open the lid.

Guide

You will need to install Arduino IDE from this Link. With this you can program your Arduino Uno and more other microcontrollers.

Setting up the Arduino Uno on Arduino IDE

First you need to set up your microcontroller on Arduino IDE, you can check this Link.

 

Building the Circuit

  • Servo data (yellow) to pin 3 of Arduino
  • Servo VCC (red) to 5v of Arduino
  • Servo ground (black/grey) to Arduino Gnd
  • Sonar sensor trig to Arduino 6
  • Sonar sensor echo to Arduino 5
  • Vcc to Arduino 5v
  • Gnd to Arduino Gnd
  • 9V Battery connected to Arduino Uno

Programming the Arduino

The code works like this. If it sees anything (literally anything) in a 25 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 then the upper lid gets closed.

#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
distance = (duration/2) / 29.1;
// if distance less than 0.25 meter and more than 0 (0 or less means over range) 
if (distance <= 25 && distance >= 0) {
	servo.write(50);
    delay(3000);
} else {
	
	servo.write(160);
}
// Waiting 60 ms won't hurt any one
delay(60);
}

Placing the parts to the trash bin

The servo motor is placed under the lid, and I added a plastic part to the servo motor so it can open the lid better.

The battery and Arduino are inside the trash bin, and try to have longer cables so when the trash bin has something inside the cables will not detach. And use a trash bag so the Arduino doesn't get dirty.

 

And lastly the ultrasonic sensor is in front of the trash bin so the sensor will be able to see you when you want to use the trash bin.

Working Video

 

Skriv en kommentar!

Relevanta produkter

TS101 digital loddekolbeTS101 digital loddekolbe i hånd
TS101 digital lödkolv med USB C-försörjning
Erbjudande prisFrån 1 107 kr
15 i lager
TS80P USB-C Loddekolbe kitTS80P Loddekolbe
TS80P USB-C mini Lödpenna sats
Erbjudande prisFrån 1 265 kr
2 i lager
bruge Loddekolbe Renser til at rengøre loddekolbespidsenLoddekolbe Renser
Lyxigt rengöringsmedel för lödkolv
Erbjudande pris141 kr
9 i lager