Calvin’s Motion Sensor Activated Trash Can

My project is a Motion Sensor Activated Trash Can. This uses an ultrasonic sensor to detect motion which activates a servo motor to open the lid of the trash can.


Calvin T


Basketball, Cooking, Software Engineering, and Gaming


George Washington High School

Program Reflection

At BlueStamp, I learned a lot about engineering that I never knew because I had no experience in engineering until this program. Learning about circuits and experimenting with parts was really intriguing, but I feel that I learned something else during this program: the importance of being independent. Because of my lack of experience in engineering, I was worried about doing the program from home because my school curriculum has a pretty heavy focus on teamwork, so I would normally depend on the help of others for help on bigger projects like the one I did during these three weeks. However, I learned to appreciate the learning opportunities this gave me because doing the research and experimenting with my own hands feels a lot more rewarding than if someone else helped me sail smoothly through the project. I believe this will apply to me later on in life because this certainly won’t be the last time I have to do things for myself. This doesn’t mean I didn’t receive any help from my teacher, but being able to accomplish tasks alone is just as important as working effectively in a team and this is something I want to keep in mind when I am presented with another difficult task later on in life.

Motion Sensor Activated Trash Can

Demo Night Video

Trash Can Demo

Final Milestone


In-Depth Look at Final Milestone

For my final milestone, I basically put the trash can together and soldered the parts onto the board. I soldered a total of six joints onto the perfboard and created two rails, each rail joining three of the joints. The purpose of this was to branch power out of the Arduino to the servo and the ultrasonic sensor because there’s not enough 5v outputs on the Arduino to power everything. One rail was positive and one rail was ground. This soldering was crucial to the project because there was no way the breadboard and Arduino could fit inside the trash can, so putting the wiring on a perfboard was a major help for fitting the parts in the trash can. After placing everything inside the trash can, I realized that the wires were really messy and a little bit delicate in some areas, so I bundled them together and taped it all up. I also added a touch of super glue on the part where the lid and servo meet to make sure the lid doesn’t shift around after a few jolts. I also added a power bank inside the trash can, so that’s how it’s being powered without being connected to the computer. For now I’m done with the bulk of the project, but there is still a lot to be improved. Two main modifications I might do in the future is making the circuit even smaller because right now there isn’t a lot of room for trash to be put in the can. The second modification I might do is adding a moisture sensor at the bottom of the trash can along with the piezo buzzer from the first milestone, so the trash can owner can be notified if there is a bag leakage.

Final Code


Final Circuit Diagram


Second Milestone


In-Depth Look at Second Milestone

For my Second Milestone, I removed the piezo buzzer and replaced it with a Servo motor. To get the Servo working, I had to connect the red wire on the motor to the positive rail, the brown wire to the negative rail, and the orange wire to the 12 pin on the arduino. The red and brown wire create a complete circuit which gives power to the motor while the orange wire is what transfers information back and forth between the computer and the motor. When my trash can received my trash can, I used tape to mark out areas I need to drill in order to attach the sensor and servo motor to the trash can. I also used wires to make the ultrasonic sensor a little more mobile because attaching it directly to the breadboard makes it hard to fit it into the trash can. After attaching the lid to the servo motor, I found that the servo turns too much. Thankfully, this was easily fixed with an edit to the servo.write(); command. Finally, after making sure the parts work together the way they should, I put all the pieces on the trash can. Because of the small size of the trash can, doing this was not the easiest task.

First Milestone


In-Depth Look at First Milestone

For my First Milestone, I got the UltraSonic Sensor and Piezo Buzzer functioning. For the Piezo Buzzer, I focused on hooking it up to a power source before trying to do anything else. I did this by connecting one end of a wire to the breadboard’s positive rail and the other end to the positive pin of the buzzer. I did the same for the other pin by connecting that to the negative rail. Then I connected the positive rail to the Arduino’s 3.3V output and the negative rail to the Arduino’s ground pin. This made the buzzer make a really loud and high pitched sound, so I had to add a potentiometer to lower the voltage going into the buzzer in order to reduce the volume. This sound is produced by the piezo material inside the buzzer because the electricity causes the material to deform and vibrate against the metal plate causing the high pitched sound to be amplified out of the buzzer. For the UltraSonic Sensor, I connected the VCC pin to the Arduino’s 5V pin, the trigPin to the Arduino’s 9 pin, the echoPin to the Arduino’s 10 pin, and the GND pin to the ground pin on the Arduino. The VCC and GND pin make a complete circuit to power the sensor while the trig and echo pins help the sensor and computer send information back and forth. The sensor uses ultrasonic sound to calculate the distance between itself and objects in a similar way bats use echolocation. It sends out an ultrasonic wave and calculates the distance based on the time it takes for the waves to come back to the sensor. 

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering