My
group initially wanted to build a remote controlled car for the final project.
However, we figured that it would not be ideal with the limited time and
materials we had and decided to build a toy mouse trap instead. The idea behind the final project is relatively
straightforward: a block of ‘cheese’ is placed within the trap to seduce the
mouse. When the mouse sees the cheese, it will walk towards it, entering the
box and when it is inside (close enough to the sensor) the servo motor is
triggered and the trap door shuts the mouse inside.
First, we cut an opening in the box to create the sliding
door for the mousetrap. We cut off one of the flaps on the box and used it as
the door for the trap. Second, we wired the Servo-Motor to the breadboard and
the Arduino. The GND pin connected to GND, VCC to the 5V, and the third pin to
PIN 9 on the Arduino. Third, we attached the single-sided arm attachment to the
servo motor, taped the servo motor on its side on the top of the box, and attached
the arm to the makeshift cardboard door using scotch tape. I used the servo
motor sweep code learned in class, to make the servo move. Next, we attached
the ultrasonic sensor to the breadboard (Trig pin to Pin 11, and Echo to pin
12). Followed by writing the code for the ultrasonic sensor which allowed it to
display distance in cm. Then, we attached LED to breadboard, as well as a 100-ohm
resistor. The most difficult part of the project was writing the code to
activate the servo motor once the ultrasonic sensor sensed the mouse at a
certain distance. However, we figured it out after doing some research and listening
to explanations from our helpful instructors. After that, we secured the
breadboard inside the box with the sensor facing the door. Next, we attached
the string to the mouse’s nose and taped a loop to the side of the box to pull
the string through. Then, we cut an opening at the back of the box for the wires
and string on the mouse to go through. Finally, we uploaded the code and tested
it several times. The door of the trap should be open when attempting to
operate the trap. The string on the mouse should be slowly pulled through the
backside of the box towards the sensor and into the box. The approaching mouse
should trigger the servo motor to rotate the door, shutting the door and
trapping the mouse. Pressing the reset button on the Arduino board will reset
the trap door to the opening position to use it again.
We
faced two major issues when building this project. Our first issue was writing
the code since none of us had ever written a code this long and complex before.
We finally achieved a working code through trial and error, as well as several
tests. The second issue was that the ultrasonic sensor was detecting the string
attached to the mouse instead of the mouse itself. This problem annoyed us
greatly and we tried every possible method until we finally attached a loop to
the side of the box and pulled the string through it. This method seemed to
solve the issue and resulted in a fully functioning mouse trap.
My
personal contributions to the project included the writing of the code, as well
as brainstorming and trying out different ideas to solve our issues. I have
learned a great deal from the time spent building this project. I learned that
even a simple mouse trap project such as ours requires more effort and time
than one would expect. With more time we could have improved upon our project
by adding more features and making it more aesthetically pleasing. We were
going to add a DC motor inside the box to imitate the sound of the mouse being
crushed by it, but unfortunately did not have enough time to make it a reality.
Most importantly, the course and the project has taught me that almost any task
can be accomplished when circuitry is combined with the right code.