Interaction Lab Midterm Project – Smart Trash Can by Abdullah Mobeen

Abdullah Mobeen

Professor Marcela Godoy

Interaction Lab

Midterm Project


For my stupid pet trick, I used a temperature sensor and a servo motor. The idea was to make the servo rotate when the temperature is high. I made a stupid version of this by letting the servo motor rotate even when the temperature is not very high. So I stick a small cardboard on the servo motor, with one side of it showing a smiley face and the other one showing a shocked emoji with a word ‘RUN!’. For my midterm, I wanted to further develop this prototype of human-computer interaction.

After having a discussion with other people, I finally decided on an idea that I think would be a great way to implement human-computer interaction. The idea was to build a trash can that would open itself once the user is close enough and then will also close itself once the user is gone. I called it “Smart Trash Can”. For this, I worked with an Ultrasonic sensor and a servo motor.

Who will use it and why?

When you carry a lot of stuff, it sometimes becomes harder for you to open the trashcan and if you drop the stuff in your attempt to open the trashcan, it’s a lot of hassle. It may not sound much of a problem, but trust me it is. Ever saw a drunk guy throwing up ‘on’ the trash can rather than in it, well that’s another reason why we need a trashcan that can assist us in making our lives a lot easier. This trashcan that I call the smart trashcan will solve these problems for you. Built using an ultrasonic sensor and a servo motor, this trashcan will ‘see’ you coming towards it and will greet your garbage by opening itself. Once you’re done throwing everything you had, this trashcan will wait for you to leave and then close itself. It’s a miracle… really.

First Draft:  20170401_17363820170401_173631







I ordered a trash can off Taobao to begin working on it. However, once the trash can arrived I found out that my servo motor was too weak to lift the plastic lid on the top of it. Another complication was drilling holes in the plastic for the placement of the ultrasonic sensor (facing the user). After experimenting a bit with different placements of the servo, I then decided to use a wire and a hook to connect the servo motor with the plastic lid. This actually did solve the problem, and the lid began moving due to the servo and the wire attached to it. Unfortunately, the trash can was too big and I was facing difficulty in placing wires and boards due to the hard structure of the can.

My first prototype could be seen in the pictures above.

Second Draft:

After failing at my first attempt, I decided to change the structure of my trash can. I then used a cardboard box as my trash can. This is because this new trash can was small in size and it was easier for the servo motor to lift the lid made of cardboard.

A difficulty I faced in this structure was the placement of the servo again, as the cardboard was too weak to hold it. So in order to solve this, I used a pair of chopsticks. One to hold the servo motor against the box and the other one to make it easier for the servo to move the lid. This structure could be seen in the sketches below.

20170401_175414 20170401_175423


I only used Arduino to implement this prototype. I made use of the ultrasonic sensor to detect the presence of a user and subsequently decide when to move the lid at the top.  Below are the pictures of the low-level implementation. You can see many different stages (some failed ones) that I went through in order to make it work.

20170330_125225 20170329_153701(0) 20170329_154828 20170329_162744 20170329_155823(0) 20170329_154836

After all this hassle, I finally made a complete model. It could be seen in the media file attached below.

The code I used:


#include<Servo.h> //Adding the Servo library

Servo myservo; //Define an object named MyServo
const int eko = 8;
const int trig = 7;
int min_dis;
int sure;

void setup() {
myservo.attach(9); //We introduced the ninth pin arduino to the servo motor

void loop() {

digitalWrite(trig, LOW);
digitalWrite(trig, HIGH);
digitalWrite(trig, LOW);
sure = pulseIn(eko, HIGH);
min_dis = (sure/29.1)/2;

if(min_dis <= 20){

if(min_dis > 200)
min_dis = 200;
Serial.print(“current distance is: “);

Further Development:

In future, I intend to add the ability to receive voice commands in this model. I also need to solve the problem of trash can opening and closing merely on the judgment that a person standing close or not. This leads to waste of energy.

So I hope you enjoyed reading about my work and the idea that I implemented.


One thought on “Interaction Lab Midterm Project – Smart Trash Can by Abdullah Mobeen

  1. Hi Abdullah,

    as I mentioned in my email.
    This documentation is better than the previous ones you have posted. But it would be better if you include more personal comments like conclusions, reflexions and all about the things you learned in the process.
    It is also good to include a sketch or diagram of your Arduino circuit, this will help you to remember how you connected the components and also help other students to get information about it.

Leave a Reply