×

Smart Trash Bin

2024 | Completed

A bin made to gamify recycling, students would throw their trash/recycling into their desired bin. A camera and sensors within the garbage can will determine whether they threw their waste into the right target. Then, a servo will deposit the piece of waste into the correct bucket. Correct or incorrect guesses were added to a student's total stored on a flask server

Code Structure:

Check out the code

This was a multi-faceted project that involved hardware running on an ESP32 microcontroller, a phone camera running openCV and communicating with the hardware through serial, and a flask server displaying a database of user scores. Combining all of these aspects was arguably the most challenging part of this project.

Sensors:

For this project, we only needed two motion sensors but only had access to one. To solve this, I coded an ultrasonic sensor to act as a boolean motion sensor that would return true when nothing was in front of it and false when it detected an object

To do this:

  1. Read a value, convert it from signaltime to distance
  2. Take the average of the past 50 readings to get the "default value"
  3. Wait for a reading that deviates from the average
    • Start a timeout, if the reading has deviated from the average for more than 10 clock cycles, return false
    • This is done to filter out noise