Mouse Trap

Legit Log

posted Jan 7, 2010, 8:34 AM by Unknown user

Today, we got caught going on a game website. So we decided it was time to start working. We researched the program gobetwino. This program can do many things such as start a program on the computer, send an e-mail with an attached file, copy a file on the computer, and many more things. We are going to use it sending an e-mail to Mr. Dickie if it has caught a mouse in the greenhouse. We've also come up with the idea for it to take a picture and send it in the e-mail, but that is still under discussion. Because gobetwino only works with windows we had to move to the computer next to our right...inconvient. For that reason I have copied our program onto here so that we can get it off when we move computers.

// by BARRAGAN <>

#include <Servo.h>
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
int pos = 0;    // variable to store the servo position
 int photocellPin = 0;     // the cell and 10K pulldown are connected to a0
int photocellReading;

void setup()
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
void loop() {
  photocellReading = analogRead(photocellPin); 
  Serial.print("Analog reading = ");
if (photocellReading<950)
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position

Final Project finished!!!

posted Dec 16, 2009, 8:36 AM by Unknown user

Our project isn't necessarily finished, but we have the program written and all we need to do now is assemble the mousetrap, but that's the easy part. Mr. Dickie helped with writing the program, working in the light sensor. We used the serial monitor to help find the right number change and set off the servo to trap the mice.

change from tilt sensor to photocell

posted Dec 15, 2009, 9:09 AM by Unknown user

Today we looked over the photocell link from the sensors in the arduino lessons. We wrote the program so that the servo would behave according to the light in the room. Soon we will change the numbers on the resistor so that it will be adaptable to a laser pointer instead of a light.

its a photoshoot. =)

posted Dec 10, 2009, 8:26 AM by Unknown user

Today we started setting up the actual finished model of the mouse trap. All that is needed continues to be the tilt and photocell sensors

project intro.

posted Dec 9, 2009, 8:19 AM by Unknown user   [ updated Dec 9, 2009, 8:50 AM by Unknown user ]

So basically we're doing an arduino mousetrap using a piezo to pull a peg from under a tupperware container, letting it fall on top of the mouse or whatever else we might catch. We're using a tilt sensor we made form a pen cap and a BB. The BB sits at the top of the pen cap, but when the mouse walks into the trap the BB falls down to the bottom of the tube, touches two wires, closes the circuit, which triggers the piezo, and finally pulls the lid shut. the weight of the arduino on top of the lid will snap it shut. We are also using a photocell sensor. A laser beam will be on the sensor at all times, but when the mouse walks in and breaks the beam, the circuit will close and the same events will occur.

Tuesday, December 8, 2009

posted Dec 8, 2009, 8:35 AM by Unknown user   [ updated Dec 8, 2009, 9:15 AM ]

code:       delay(1000);                       // waits 1s for the servo to reach the position

corrected code;     delay(15);                       // waits 15ms for the servo to reach the position

We shortened the delay so that the mouse would have no time to escape when the sensor is set off.

Also, we are starting to add a photocell sensor to accompany the tilt sensor. We are learning how to use both of them in the same circuit. We're not sure how to write the code yet, but we will by the end of the week.

changed angle.

posted Dec 7, 2009, 8:33 AM by Unknown user

code:  for(pos = 30; pos < 150; pos += 1)  // goes from 30 degrees to 150 degrees 

corrected code:   for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees

By making the range of the servo rotation further and adding a tongue depressor to the top of the servo we provided more leverage and strength to pull the peg holding up the lid of the mousetrap.

1-7 of 7