Sunday, March 31, 2013

Catch a Squirrel with Arduino Electronics

There are lots of squirrel in my town, and I want to catch one of them for fun. So I made a laser trap using Arduino to catch a squirrel.

The electronics circuit is very simple. It goes: 3.3V pin -> Photoresistor -> Pull-down resistor -> Ground, so digital I/O pin measures voltage between the photoresistor and pull-down resistor. I used 5V pin and another digital pin  to run the servo that closes the trap if the reading from photoresistor drops too much (i.e. laser is blocked by the presence of squirrel.). This is the photo of the arduino setup. Notice how I try to entice a squirrel with Korean food. 

I will post the photo of the unfortunate squirrel later. Here goes the Arduino sketch.

Servo myservo;  
int pos = 0; 

void setup()

void loop()
  float v = analogRead(0)* .004882814;  

if (v > .5)
  for(pos = 0; pos < 180; pos += 1) 

No comments:

Post a Comment