How to DIY A Mini Smart Trash Can with Crowbits
Posted: March 04, 2021
There will be a lot of trash in our daily life. How to classify all kinds of trash has become a headache for us! Have you ever thought of building your very own affordable mini smart trash can at home? You can actually do so with our Crowbits-UNO, Crowbits-Color sensor and 9G servo. Watch videos and tutorials to get started.
What you’ll be required to have before starting with this project:
1. Crowbits UNO module x1
2. Servo module x4
3. Crowbits color sensor module x1
4. Trash can x4
5. Small colored card or brick x4
6. Trash sorting label x4
7. Round stick（5mm）x4
8. Hot melt glue gun x1
9. Double-side tap x1
Crowbits is on kickstarter Now
Don't know crowbits? Crowbits is a line of magnetic, programmable, electronic blocks, which empower children of all STEM skill levels to move their STEM education forward today.
Click below to access more infos about crowbits modules. Welcome to back us on kickstarter.
1. Attach the round stick to the 9G Servo (use a hot glue gun to fasten the round stick to the 9G Servo)
2. Install the 9G Servo on the dustbin cover with hot melt glue gun
3. Stick the garbage sorting label on the trash can
The Crowbits-UNO mainboard is a microcontroller board that completely compatible with the Arduino UNO. It is based on the Atmega328P, which is widely also used in the Arduino Uno.
5.Crowbits color sensor module
The color sensor can recognize the color of the surface of the object.
6.Programming with Letscode
Initialize the Color sensor (find Setup blocks and Color Sensor Initialization in the Crowbits Uno block)
Note: Due to the influence of the surrounding environment, the value range of the Color sensor needs to be adjusted according to the actual situation
Define R, G, B variables to store the color value returned by the color sensor, and declare R, G, B variables as int integer type
The pins of the servo are defined as 2,11,13 and A0 respectively, and the initialization angle of each servo is set as 20 degrees
Store the value obtained by the color sensor in R, G and B variables
If the value of red (R) detected by the color sensor is greater than 80, then control No. 1 servo to open the cover of No. 1 trash can. (Find if...then...and wait...seconds program in the Control block. Find the comparison operator ">" in the Operations block)
If the value of red (R) detected by the color sensor is greater than 2 and the value of green (G) is greater than 23, then control No. 2 servo to open the cover of No. 2 trash can. Find the
logical operator “and” and comparison operator ">" in the Operations block
If the value of blue (B) detected by the color sensor is greater than 5 and less than 10, then control No. 3 servo to open the cover of No. 3 trash can.
If the value of blue (B) detected by the color sensor is greater than 10 and less than 15, then control No. 4 servo to open the cover of No. 4 trash can.
7.Download the program (click the Upload button to download the program to the Crowbits Uno module)
8.Circuit connection (The 4 servo and color sensor modules are respectively connected to the Crowbits UNO module)
In the project, we used Letscode software to program the project with Crowbits-UNO, Crowbits-Color sensor and servo module. Of course, you can also use the Crowbits-ultrasonic sensor to replace the Crowbits-Color sensor in the project and see what kind of effect it will have!