Tempat sampah otomatis

Post on 23-Jan-2018

210 views 3 download

Transcript of Tempat sampah otomatis

By :

Haris Panca

Muhammad Efantama

Kenanga Ayu Nirmala

This idea we got when we pay attention

to our surroundings clean, some people less

lazy throw away trash in its place amongst other

things because, if we have to throw away trash

pressing or touching the dumpster, therefore we

have an idea to make project of the

instrumentation, entitled "Trash" that can open

and close automatically so that people will dump

need not be touching or tapping the dumpster.

To bring back the community will want to

dispose of the waste in place, some of the trash made

as attractive as possible so that the public are

interested to dump garbage at the venue. One of them,

namely the trash with an automated system where to

open the dumpster, users do not need to touch the

dumpster. Users only need to stand in front of the

Ultrasonic sensors on the front, then the bin will open

automatically. In addition the bin is equipped with LEDs

so that when the bin is open green light will turn on and

when the trash can close the light is red.

SolderSciccorsCutterGlueLaptopRuler

Arduino Uno

Sensor Ultrasonik

Servo TowerPro SG90

Buzzer

Resistor 220Ohm

LED (Red and Blue)

PCB

Acrylic

Cable (M to M, M to F, and F to F)

Trash Bin

http://www.farnell.com/datasheets/1682209.pdf

http://www.micropik.com/PDF/SG90Servo.pdf

http://www.micropik.com/PDF/HCSR04.pdf

http://www.tek.com/sites/tek.com/file

s/media/media/resources/Cables2.p

df

• Male to Male

• Male to Female

• Female to Female

#include <Servo.h>

Servo myservo;

#define buzzer 3

int sound;

#define trigPin 11

#define echoPin 10

#define led 6

#define led2 4

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(buzzer, OUTPUT);

pinMode (led, OUTPUT);

pinMode(led2, OUTPUT);

myservo.attach(9);

}

void loop() {

long duration, distance;

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/1) / 29.1;

if (distance >=0 && distance <= 20)

{

myservo.write(160);

tone(buzzer, 3000,150);

digitalWrite(led, LOW);

digitalWrite(led2, HIGH);

}

else if (distance > 20 || distance < 0){

myservo.write(0);

noTone(buzzer);

Serial.println("Jarak diluar jangkauan!");

digitalWrite(led, HIGH);

digitalWrite(led2, LOW);

}

else {

Serial.print(distance);

Serial.println(" cm");

}

delay(250);

}