free html5 templates

ECE 5725 Smart Trash Can

Dec 4 2018 
by Zesun Yang (zy366) and Ye Kuang (yk749)

Introduction

Annoyed by the design of traditional trash cans where we need to open the lid ourselves even when our hands are full. We built a trash can that can "read the owner’s mind" and open the lid automatically. 

The trash can can detect the user's presense using sensors and opens its lid when the user is neary by. In addition, the trash can supports voice recognition. The user can also open or close the lid by telling it to "open" or "close". The trash can also has a status display that tells the owner whether it is empty, half full or full along with emoji displays based on its fullness. The fuller it gets, the unhappier the trash can will be. It can remind the user to take out the trash at the end of day if it gets full by sending the user an email. 

With the Raspberry pi, we turn the traditional trash can into a smart trash can and make life easier. 

Smart Trash Can

Make your life simpler and smarter

Hands-free system

Open and close the lid automatically when you are near by  

Emotion Display

The trash can has its emotion. Its happiness depends on how full your trash can is. The emptier, the happier.

Mobirise

Voice Recognition Support

Open and close the lid automatically when you tell it to "open" or "close"

Email Reminder

Send you an email at the end of the day to remind you to empty the trash can if it gets full

Objective

 Have the trash can open and close its lid when the user is nearby
 Have the trash can open and close its lid using voice commands 
Install sensors inside of the trash can and detect how full the trash can is 
Have the piTFT display emojis which represents the trash can's emotion 
• Have the trash can email the user when the trash can gets full 
Assemble all parts and have everything in place


Hardware Design

The hardware design of our smart trash can consists a Raspberry Pi with PiTFT display, a traditional pedal trash can, three pairs of break beam IR sensors, an ultrasonic distance sensor, a USB microphone, and a Parallax standard servo. 
First, we installed the standard servo inside of our trash can and have it lift the lid of trash can using a wood stick attached to it. The reason for choosing the standard servo instead of choosing a continuous rotation servo is that we want the servo to steadily hold at two designed position for open and close. The standard servo is bolted along the inside of the trash can. 

We then installed one ultrasonic sensor at the front of our trash can and have it measure the distance between the user and the trash can. After the installation, we calibrated the sensor and set it to only measure distance lesser than 70 cm, which we think is a reasonable detection threshold.

We also want to detect how full the trash can is. We choose to use break beam IR sensor and installed them inside of the trash. Originally we chose to use the ultrasnoc sesnor to measure the distance between garbage and trash can lid, and then convert this distance into trash can inside status. However, because the nature of ultrasonic wave, it will bounce around in the space of trash can, which lead to inaccurate measurement. After discussion with Prof.Skovira, we changed to use three pairs of break beam sensors to detect inside status of our trash can. We installed break beam IR sensors at different depths of the trash can (bottom, middle and top). Once there is garbage blocked IR beam, that IR sensor will send low level signal to the Rasberry Pi, marking garbage reached this level of the trash can. After installation, we did unit tests to make sure this design works.

Software Design 

As we mentioned in the hardware section, we have 1 ultrasonic sensor outside the trash can measuring the distance between the trash can and any object in front of the trash can; we have 3 sets of IR break beam sensors measuring how full the trash can is. When the ultrasonic sensor reads an input less than our threshold value, we will open the lid of the trash can and close the lid when the user has left. The 3 sets of IR break beam sensors were placed at a different level inside of the trash can. If the trash block the beam and the sensors will know that something is in the trash can. When the trash can is fairly empty, only the sensor placed at the bottom will be blocked and change its status; when the trash can is full, all 3 sets of sensors will be blocked. We used a PiTFT to display the trash can's emotion based on how full the trash can is from sensor readings. When the status of sensors change, our PyGame program will read the status and draw emojis and status bar based on the reading. 


For our voice recognition system, we used a software called SOPARE which is capable of performing offline speech recognition on the Raspberry Pi. We trained SOPARE with 2 hotword commands "open" and "close", by saying the corresponding command to the microphone and labeling the command. SOPARE will covert our voice into chunks of arrays representing our voice characteristics (tone, volume, pitch and etc.). We trained each word 15 times and each word had 15 voice records. In the recognition phase, we spoke to the microphone and SOPARE would still convert the voice to chunks of arrays. Then it would go to its record and tried to find a match with the current input. We set an 87% threshold for the similarity of records to be considered a match, in other words, only if the similarity of the current input and an existing record has 87% match, the current input will be considered to be a corresponding hotword. 


The system would ideally return either ['open'], ['close'] or [' '] in an array named "readable_result". [' '] means no match found with ['open'] and ['close'] are our hotwords. However, SOPARE would detect consecutive words as a sentence. We might have something like ['open', 'open', 'close'], ['close', ' '] or [' ', 'open'] as a result if we speak too fast or the testing environment is noisy. These command result caused problems in our system because the system would confuse and not performing actions due to extra words in the readable_result. Instead of only detecting the first word (array index 0) and use that as the command, we wrote something like:

if (' keyword' in readable_result):

    do the first matched keyword_action

and this solved our problem by reducing the impact of extra words recorded.  

Testing

Sensor Detections  
We have 2 sets of sensors: the ultrasonic sensor that is used to detect whether is the user is nearby; the IR sensors that are tracking how full the trash can is. 

For the ultrasonic sensor, we put hands and objects in front of the sensor and observed that the trash can was able to open in a short time (about 0.5 second). 

For the IR sensors, we threw trash into the trash can and observed that, as more trash was placed in the trash can, different outputs were printed out from different IR sensors indicating our IR sensors functioned correctly.



PyGame Display 
We have 4 sets of emojis representing the trash can's emotion based on how full the trash can is. Based on the IR sensors' readings from the previous part, we displayed a status bar as well as corresponding emojis on the Pi. We observed that, as we were filling the trash can with trash, the status bar and emoji displayed changed accordingly.



Voice Recognition Testing 
As a first step, we tested our voice recognition system with the two hot words 'open' and 'close'. We used the print command to print out words and see if the correct one was printed. Once we passed that check, we tested to see if is our voice recognition system is immune to non-hot words. We tried words such as 'cats', 'dog', 'pen', 'oh' (words have similar pronunciation as the hot words), and it turned out that our system was pretty good at filtering out these words.



Mobirise

Sensor Detection

Mobirise

PyGame testing 

Mobirise

Voice Recognition 

Results

Our end result shows that our smart trash can works well. There is no noticeable lags between voice command, sensor detections, and piTFT display and all functions worked as expected. Our voice recognition system has an accuracy of 90% on identifying 'open' and 'close' commands.   

In this project, we learned a lot on muti-processing, voice recognition on Raspberry Pi and process communications. We have also enhanced our soldering skills through the project as we need to solder some fragile wires and wires to IR sensors. We accomplished everything we set out to do except for the stretch goal due to time limitation. Our trash can has a wonderful user experience.

If we were given more time, we will work on our stretch goal which is to have our trash can catch trash on its own. We have some ideas on how we can implement this: we can have use a combination of the Pi camera and infra-red or ultrasonic sensors to detect flying objects with distance to the trash can. When the trash can sees an object is flying towards it and the distance is close enough, it will open its lid without voice command. 

Work Distribution 

Ye Kuang                                                Zesun Yang

yk749@cornell.edu

Designed trash can mechinal 

Ultrasonic sensor detection 

IR sensor programming

Muti-processing 

Circuit design 

Parts assembly 


zy366@cornell.edu

Designed trasn can mechincal 

PiTFT emotion display 

Trash can voice control 

Soldering 

Circuit design 

Web design

Parts List 

Raspberry Pi $35.00  (Not counted towards budget)

PiTFT $34.95 (Not counted towards budget)

Trash Can $14.95

2 x IR Break Beam Sensor - 3mm LEDs $4

2 x IR Sensor $3 

USB Microphone $10

Parallex Standard Servo $14.99

Coffee Sticks $0 



Total: $46.94


Acknowledgement

We would like to thank Professor Joe Skovira and all the TAs who guide us through out the semester. Thank you! 😊

Code Appendix

See our github repo