Open Trash Can

Want to buy one? Sign up for our preorder list!

* indicates required

This project started out serious, then I kept thinking of funny things I wanted to make it do, so this turned out to be a pretty complicated trash can. The only way I could think to present it was a corny infomercial style video. It talks, sends you an email when its full, and I made an accompanying Android App for more control over its functionality.

You need:

A cheap trash can (this one is from Target)

Computer Speakers

An Arduino Leonardo

An Iduino Yun Shield

An Elechouse MP3 Shield

Googly Eyes (don't skimp on these, get the good ones)

A 4GB SD Card

A Micro Servo Motor

2 HC-Sr04 Range Sensors

Some Jumper Wires

A Hot Glue Gun

A Mini Breadboard

An Bluetooth Module

A 9V battery or Wall Adapter (to power the Arduino board)

Full Instructions can be found here: Open Trash Can Instructable




//Trash Can
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h"
#include <Servo.h>
#include <SoftwareSerial.h>
// software serial #1: TX = digital pin 10, RX = digital pin 11
SoftwareSerial portOne(10, 11);
SoftwareSerial Geno(7,8); // Rx , Tx

Servo trashServo;
int trigPin = 2;
int echoPin = 4;
long duration, cm, inches;

unsigned char Data[10];
unsigned char i;

int counter = 0;

int trigPin1 = 5;
int echoPin1 = 6;
long duration1, cm1, inches1;

void setup() {
  portOne.begin(9600);
  Serial.begin (9600);
  Serial.println("bridge opening...");
  Bridge.begin();
  Serial.println("bridge OPEN!!");
  Geno.begin(9600);
  SetVolume(25); 
       
  trashServo.attach(9);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
    pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  delay(5000);
  Serial.println("Initiate Smart Trash Can...");

}


void playTrack(int track){

  delay(1000); 
    Data[0] = 0x7E; 
    Data[1] = 0x04; 
    Data[2] = 0xA0; 
    Data[3] = 0x00;
    Data[4] = 0x00 + track; 
    Data[5] = 0x7E; 
   Command(Data,5);
  play_pause();
  delay(3000);
  
}

void playTrackFULL(int track){

  delay(1000); 
    Data[0] = 0x7E; 
    Data[1] = 0x04; 
    Data[2] = 0xA0; 
    Data[3] = 0x00;
    Data[4] = 0x00 + track; 
    Data[5] = 0x7E; 
   Command(Data,5);
  
    trashServo.write(160);       
    play_pause();
    delay(300);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(200);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(600);
    trashServo.write(160);
    delay(200);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(200);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(300);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(300);
    trashServo.write(180);
    delay(200);

}

void playTrackHEY(int track){

  delay(1000); 
    Data[0] = 0x7E; 
    Data[1] = 0x04; 
    Data[2] = 0xA0; 
    Data[3] = 0x00;
    Data[4] = 0x00 + track; 
    Data[5] = 0x7E; 
   Command(Data,5);
  
    trashServo.write(150);       
    play_pause();
    delay(400);
    trashServo.write(180);
    delay(300);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(200);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(400);
    trashServo.write(180);
    delay(400);
}


void playTrackHI(int track){

  delay(1000); 
    Data[0] = 0x7E; 
    Data[1] = 0x04; 
    Data[2] = 0xA0; 
    Data[3] = 0x00;
    Data[4] = 0x00 + track; 
    Data[5] = 0x7E; 
   Command(Data,5);
  
    trashServo.write(150);       
    play_pause();
    delay(400);
    trashServo.write(180);
    delay(300);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(100);
    trashServo.write(160);
    delay(200);
    trashServo.write(180);
    delay(200);
    trashServo.write(160);
    delay(100);
    trashServo.write(180);
    delay(300);
    trashServo.write(160);
    delay(400);
    trashServo.write(180);
}


void SetVolume( int vol){
   Data[0] = 0x7E;          // START
   Data[1] = 0x03;          // Length Not 0x02
   Data[2] = 0xA7;          // Command
   Data[3] = vol;          // new volume
   Data[4] = 0x7E;          // END
   Command(Data,5);
}

void Command(unsigned char *Data, int length){
    for(int i=0; i<length; i++){
    Geno.write(Data[i]);
    }
    
}

void play_pause(){
  Data[0] = 0x7E;          // START
  Data[1] = 0x02;          // Length
  Data[2] = 0xA3;          // Command
  Data[3] = 0x7E;          //Mode parameter
  Command(Data,4);
}


void loop()
{
  trashServo.write(180);

  portOne.listen();
  int incoming = portOne.read();
  delay(100);
  
  
  digitalWrite(trigPin, LOW); // Outside Sensor
  delayMicroseconds(1);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  inches = (duration / 2) / 74;
  
  //Serial.println(inches); 
  
  if (inches < 20 || inches > 1000) {
  trashServo.write(80); //Lid open
  delay(5000);
  }


  digitalWrite(trigPin1, LOW); //Inside Sensor
  delayMicroseconds(1);
  digitalWrite(trigPin1, HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin1, LOW);

  pinMode(echoPin1, INPUT);
  duration1 = pulseIn(echoPin1, HIGH);

  inches1 = (duration1 / 2) / 74;
  
  Serial.println(inches1); 
  
  if (inches1 < 3 && counter == 0) {
       counter ++;
       playTrackFULL(2);
       Serial.println("Sending Email...");
       TembooChoreo SendEmailChoreo;

    // Invoke the Temboo client
    SendEmailChoreo.begin();
  
    // Set Temboo account credentials
    SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
    SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
    
    // Set profile to use for execution
    SendEmailChoreo.setProfile("EmailTest");
    
    // Identify the Choreo to run
    SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
    
    // Run the Choreo; when results are available, print them to serial
    SendEmailChoreo.run();
    
    while(SendEmailChoreo.available()) {
      char c = SendEmailChoreo.read();
      Serial.print(c);
    }
    SendEmailChoreo.close();
    Serial.println("Email Sent...");
  }                       



  //Serial.println(incoming);
  if (incoming == 111){    //Open Lid from App
  trashServo.write(80);
  delay(2000);
  }

   //Serial.println(incoming);
  if (incoming == 49){ 
  playTrackFULL(2);               //I have reached capacity 
  }

   //Serial.println(incoming);
  if (incoming == 50){ 
  playTrackHEY(1);                //hey get out of there
  }

   //Serial.println(incoming);
  if (incoming == 51){
      playTrackHI(3);            //Hi, I am open Trash Can
  }

  


}//ends loop

//header file


/*
IMPORTANT NOTE about TembooAccount.h

TembooAccount.h contains your Temboo account information and must be included
alongside your sketch. To do so, make a new tab in Arduino, call it TembooAccount.h,
and copy this content into it. 
*/

#define TEMBOO_ACCOUNT "*******"  // Your Temboo account name 
#define TEMBOO_APP_KEY_NAME "********"  // Your Temboo app key name
#define TEMBOO_APP_KEY "**********************************'"  // Your Temboo app key

/* 
The same TembooAccount.h file settings can be used for all Temboo SDK sketches.  
Keeping your account information in a separate file means you can share the 
main .ino file without worrying that you forgot to delete your credentials.
*/




Download App Here

Parts

Hey !!!

about us (me).

My name is Matthew and I attend the University of Pittsurgh. Currently I am a junior, going for a bachelors in Information Science. I am always looking for someone that would like to embark on a new project or startup. I work as a food server when I am not at school, but would love something a little more technical, if anyone is hiring.

  • Pittsburgh, PA
  • MatthewHallberg@gmail.com

Drop us a line