Smart Dust Bin

I created a self sorting dust bin using a Raspberry pi and python coding.
Anirudh Vijayan
Grade 8

Problem

Can a garbage sorting dustbin positively affect the environment by making sure that waste gets sorted properly?  

 

Method

This is my procedure on how to install Python:

 

  1. With a Windows 10 computer, go to the Python website (python.org)
  2. On the homepage there will be a spot saying “Download the latest version for Windows” and below that is a button saying “Download Python” and the newest version, i am using version 3.11.4 but download whatever the newest version is.  
  3. Once it has downloaded, click the exe, this will open up the install prompt. Before clicking install, look at the bottom of the prompt, check the box that says “Add Python to PATH” and then click install.
  4. Wait for Python to install and once it's done, close the install prompt.
  5. To make sure that you have Python installed go to the Windows command prompt by searching it in the Windows search bar which is left of the taskbar.
  6. When you're in the command prompt, type this, “python --version” (make sure to have one space between “python” and the first dash and no spaces between the two dashes and “version). It should look like this:

  1. If you did everything correctly it should respond with the version of Python you have, which means you have successfully installed Python on your computer! 

 

 This is my procedure on how to build my model:

  1. With my 8ft by 4ft large MDF board piece, I cut two equal 2ft by 1.5ft pieces, one 2ft by 2ft piece, and two 0.5ft by 2ft rectangle pieces
  2. I used wood glue and glued the two equal 2ft by 1.5ft pieces and the one 2ft by 2ft  piece (the 2ft by 2ft piece needs to be connecting the other 2) together to make a box without one side, top and bottom
  3. To secure it, on each edge I put two 2.5in by 1.5in wood blocks and hammered in nails
  4. I glued one of the 0.5f by 2ft rectangle piece on the back piece of MDF board with the long part to the back (this is to hold the Hs-755MG servo motor in place)
  5. With the other 0.5f by 2ft rectangle piece, I glued it on the top of the empty side
  6. In the very middle of the 0.5f by 2ft rectangle piece, drill a hole that will perfectly fit the metal pipe
  7. Put the metal pipe through the hole and on the other side, connect it to the Hs-755MG servo motor
  8. Then secure the servo motor to the middle of the rectangle MDF piece
  9. On the metal pipe, tape the 1.6ft by 0.55ft foam piece on it
  10. Secure everything with the rest of the wood blocks
  11. With the 24in by 2.5in cardboard piece, thumb tack it with both thumb tacks on the back 
  12. Bend 6 inches from the top of the cardboard, this is where the Raspberry Pi camera will rest, this is the camera holder
  13. Then connect the servo motor to the Raspberry Pi with Jumper leads and connect the Raspberry Pi to the monitor

Analysis

     In the end, I have a working model that can detect if an item is garbage or recyclable and also sort it out accordingly. Here is what my model looks like after following the method above:

The foam piece labeled is where the object is placed and it will spin one way or the other depending on whether it is garbage or recycled. On top is a Raspberry Pi camera taking pictures of the image and comparing it to the images I took in the image library to determine which side it goes. To do all this I used Python coding in the Raspberry Pi terminal for my Raspberry Pi camera to take a picture, search in the image library for a match, and determine the amount of error it will go to one side or the other. To do this I used Machine learning and imported Many things into my code, this is machine learning in my project:

     I used Opencv and Numpy, these functions fall in the branch of machine learning. What is machine learning exactly, machine learning is a powerful form of AI and computer science, it's focused on the use of data algorithms.  In my project, Opencv is an extensive library for object detection, computer vision, motion tracking, and also camera calibration.  I used Opencv for object detection. Numpy is a package that is fundamental for scientific computing just for Python. It is a Python library (Like Opencv) that provides a multidimensional array object, different derived objects, and an assortment of routines for fast operations on arrays. It also includes mathematical things like logic, shape manipulation, sorting, selecting, basic linear algebra, basic statistical operations, etc. I also used Matplotlib and PIL (Python Imaging Library) which are both different libraries.

 

This is my code:

This is all the Machine learning imports I made at the top. Open cv2, Numpy, Matplotlib, and PIL. The images are the images I put into the image library and the ones that it compares to when I place an object on the smart dustbin.

Code part 2:

This shows what the error should be (20) and the code for searching the images for a match. The bottom part shows if the error is above 20 then it will go into 1 side.

Code part 3

This is the same thing but it's saying if the error is below 20 then it will go to the other side.

 

That was my code, these are some things I could've done to make it better and some sources of error in my project:

  • It wasn't completely accurate - I did object detection. This made it so I had to take many pictures of a paper for example and label it. But no matter how many pictures I take, there will be new newspapers or people might crumble it uniquely. So It won’t always be correct.
  • I could have made more segregations - I only made two segregations which were garbage or recycling. Next time I do this project I am planning to do more than one and add bottles and maybe even composite.
  • Lighting  - Even with lights on the camera didn’t seem to pick up any light and all the images appeared dark. This made it so they were all slightly similar. 
  • I had to wirely connect it - The Raspberry Pi won’t start without a monitor so even if the monitor doesn’t do anything else, I need it for the initial startup.

 


  

 

 

Conclusion

My hypothesis is correct, my project if expanded would have almost no error in segregation trash incorrectly, so indeed this would help the world, the environment, and other people.

 

This is why this project would help the environment, world, and other people:

  • Would decrease the amount of unwanted trash in landfills - So many people put the wrong trash in the wrong bins, this project makes it so even if people are lazy, everything will be segregated properly. With rates going so high to decontaminate recycling from garbage (up to $4 million), then I think that at this point, we have to try anything else. Not only is it in landfills, in countries with poverty and no access to a proper way of disposing of trash, it all just ends up on the streets, so if this project is expanded, it needs to be accessible for all countries and would make a huge difference on these people's lives.
  • Cost efficiency  - Costs would go way down, there would be such a small amount of error if this project gets expanded for the trash to segregate incorrectly. Making it less decontamination, meaning also less money wasted. Even though the cost would go way down, there will still be money put in for this. There will still be some people that would be too lazy to put trash in a machine that does the work for them or their not near a machine. I estimate that the cost would go from $1 million in Toronto now, to about $300,000 - $400,000, which is a big difference.  
  • To show change - If this can help the world, many years from now people will see the change that has occurred and realize how much damage and harm they have done to the planet. The a huge difference from between and now. Maybe then, people might become better people in general.
  • Relief to recycle factory people who knew how bad things were - These people are probably one of the only people who would actually know how bad things were exactly. This would give them relief knowing that the world could be in better hands.  

Citations

The remarkable evolution of trash and all its Dirty Secrets. Trash Cans Unlimited. (n.d.). https://trashcansunlimited.com/blog/the-remarkable-evolution-of-trash-and-all-its-dirty-secrets/ 

Unlimited, T. (2017, March 7). The history of the trash can (and all its dirty secrets). Medium. https://medium.com/@trashcansunlimitedoutreach/the-history-of-the-trash-can-and-all-its-dirty-secrets-b12c6853e81b#:~:text=First%20Appearance%20of%20the%20Garbage%20Bin&text=1875.,if%20the%20bin%20was%20empty

CBC/Radio Canada. (2018a, March 28). China looks to turn ban on foreign trash into growth opportunity | CBC news. CBCnews. https://www.cbc.ca/news/world/pollution-recycling-china-petricic-1.4593078 

CBC/Radio Canada. (2018b, April 9). Many Canadians are recycling wrong, and it’s costing US Millions | CBC News. CBCnews. https://www.cbc.ca/news/science/recycling-contamination-1.4606893 

Norman, H. (2018, April 11). Managing contaminated recyclables will cost Toronto Millions by end of year. The Globe and Mail. https://www.theglobeandmail.com/canada/toronto/article-changing-recycling-market-could-cost-toronto-92-million-this-year/#:~:text=Managing%20the%20increasing%20contamination%20will,to%20half%20of%20the%20cost

What is a Raspberry Pi?. Raspberry Pi Foundation. (2015, August 20). https://www.raspberrypi.org/help/what-%20is-a-raspberry-pi/#:~:text=It’s%20capable%20of%20doing%20everything,%2Dprocessing%2C%20and%20playing%20games

262588213843476, elktros. (2020). Python script for controlling a servo motor (Tower Pro SG90) using Raspberry Pi. Gist. https://gist.github.com/elktros/384443b57a33f399a4acba76191e0e63 

Computers, E. (2020, January 12). Raspberry Pi Servo Motor Control. YouTube. https://www.youtube.com/watch?v=xHDT4CwjUQE 

Deeluea, S. (2022, April 14). Smart trash bin with waste classification. Medium. https://medium.com/@saran.deeluea/automatic-waste-sorting-trash-bin-by-image-classification-79f22d96498e 

For Geeks, G. (2023, October 10). Detect an object with opencv-python. GeeksforGeeks. https://www.geeksforgeeks.org/detect-an-object-with-opencv-python/ 

Jolles, J. (2021). Installing opencv. The Raspberry Pi Guide. https://raspberrypi-guide.github.io/programming/install-opencv 

NumPy, T. (2020). What is numpy?#. What is NumPy? - NumPy v1.26 Manual. https://numpy.org/doc/stable/user/whatisnumpy.html 

Pi Hut, T. (2014, November 25). How to install and use The raspberry pi camera module. The Pi Hut. https://thepihut.com/blogs/raspberry-pi-tutorials/16021420-how-to-install-use-the-raspberry-pi-camera 

Python, R. (2023, January 25). Image processing with the python pillow library. Real Python. https://realpython.com/image-processing-with-the-python-pillow-library/ 

Slayer, D. (2021, September 24). The new method to setup Raspberry Pi (2023 update). YouTube. https://www.youtube.com/watch?v=jRKgEXiMtns&t=950s 

Stratvert, K. (2021, March 25). 👩‍💻 python for beginners tutorial. YouTube. https://www.youtube.com/watch?v=b093aqAZiPU&t=1134s 

Zamir, Z. (1969, January 1). How to Install NumPy on Raspberry Pi. How to install NumPy on Raspberry Pi. https://linuxhint.com/install-numpy-raspberry-pi/  

         udacity, U. (2023, September 25).Tensorflow for Deep Learning Training Course. https://www.udacity.com/course/intro-to-tensorflow-for-deep-learning--ud187


 


 

 

Acknowledgement

My parents for encouraging me and helping me in my project.

 

The CYSF for giving me this oppertunity.