Mercredi 20 Novembre 2024
taille du texte
   
Vendredi, 12 Août 2011 18:00

Build a Camera Trap

Rate this item
(0 Votes)

Ever wondered what your cat gets up to when you leave each day for work? Or have a sneaking suspicion that your roommate has been going into your room when he’s not supposed to? We can use an Arduino and a pretty simple assemblage of supplies to create a camera trap to try to catch them in the act.

To do this, we’ll use an infrared emitter and phototransistor detector. When the line of sight between the two is broken and re-established, it will signal the camera to snap a picture.

This is a wiki anyone can edit. If you have advice to add, please log in and contribute.

Materials

  • Arduino
  • Breadboard
  • Jumper wire kit
  • Stranded hookup wire
  • Infrared Emitter and Phototransistor Detector
  • 220 Ohm resistor
  • 10k Ohm resistor
  • Cheap mini digital camera (can be found at a local drugstore like Walgreens or CVS)
  • Soldering iron

Disassembling the Camera

Using either your nails or a thin flathead screwdriver (like the ones that come in eyeglass kits), pry off the plastic front piece of the camera. It should just be attached by glue. On some keychain digital camera models, there is a screw underneath that you will need to unscrew. Next, pry apart the plastic casing of the camera and unscrew the circuit board from the casing.

Solder Your Wires

Identify the shutter switch and its ledes, and the power mode switch and its ledes. Solder stranded wire to the shutter switch ledes (you can optionally solder wires to the power mode ledes as well). This will be a delicate affair, since the ledes on the circuit board may be very tiny: If you’re new to soldering, see if you can get a veteran to help you out with this part.

You’ll also want to identify the positive and negative battery terminals on the circuit board. Solder wires to each of those points as well.

The Arduino Code

Copy and paste the code below into the open source Arduino software interface. Plug in your Arduino to your computer, compile the code, and upload.

int IR_LED_PIN = 2; // BLACK - LONG LEG GOES INTO PIN 2

int IR_DETECTOR_PIN = 3; // CLEAR - LONG LEG GOES TO GROUND

int CameraSwitch = 4;


void setup() /****** SETUP: RUNS ONCE ******/ {

Serial.begin(9600);
pinMode(IR_LED_PIN, OUTPUT);
pinMode(CameraSwitch, OUTPUT);
digitalWrite(IR_LED_PIN, HIGH); // Turn on Opto LED

}//--(end setup )---


void loop() /****** LOOP: RUNS CONSTANTLY ******/ {

if  (digitalRead(IR_DETECTOR_PIN) == 0)  //Beam is crossed
{
  digitalWrite(CameraSwitch, HIGH);
  Serial.write("H");
}
else
{
  digitalWrite(CameraSwitch, LOW);
  Serial.write("L");
}  

delay(200); }//--(end main loop )---

Arduino Sketch courtesy of Psy Tek from User:Alpha One Labs

Hook Up the Circuit

The circuit itself is fairly straightforward. If you watch the video, you’ll notice that the Arduino board looks slightly different from a normal Arduino — I’m using a Volksduino, an Arduino Duemilanove clone (that I soldered myself).

First, to Pin 2 of the Arduino, we’ll connect the longer, positive leg of the IR emitter (the darker LED). Place the 220 Ohm resistor in series with the emitter, and connect that to ground. Tip: To check that the IR emitter is working properly, use a CCD sensor camera (like that in the iPhone), to check that it’s glowing.

Next, we’ll connect a 10k resistor to the 5V pin of the Arduino. Connect the other end of the resistor to Pin 3. From the end of the resistor that is connected to Pin 3, wire up the IR detector (the clear LED), with the longer leg going to ground.

Now we’re going to connect our camera to the circuit. Connect the positive and negative terminals of the battery (our camera was powered by a single AAA battery) to one set of rails along the breadboard, and connect the wires you soldered onto the camera circuit to the appropriate rail. Connect the negative lede of the shutter switch to Pin 4, and the positive lede to ground.

Now, run your Arduino code and test your circuit by waving a finger or object in the path of the infrared beam. You should hear the camera beep or snap as it takes a picture!

When you’re just testing the circuit, it’s fine that everything is connected on the breadboard. But if you want to make this more practical, you’ll need to at least solder some wire to the ends of the IR emitter and detector so that you can set them up in a place where your subject will cross the IR beam.

Note:Make sure, when you transfer images from the camera to the computer, that you keep the battery on — if you unplug the camera circuit from the battery, the images will be deleted!

More ideas

This is a very basic version of a camera trap circuit. If you want to take it to the next level (making it more practical, sturdier... and more fun!) you can:

  • Control the power mode button of the camera with a diode, so when someone crosses the IR beam, the camera turns on, shoots a photo, then turns off again, so battery life is saved.
  • Place the camera and the circuit components in a project box. You can drill holes into the box for the camera lens.
  • If you want to catch pictures of an animal, you can try using something sturdy like PVC tubing to create a more physical “camera trap.” Slide the IR emitter and detector into the tubing, setting the height so that the IR detector sees the IR beam from the emitter. You could try setting some dog food, leftovers, or cat treats in the middle of your setup as bait. I personally didn’t need to -- my cat was interested enough in the IR emitter that I had to shoo her away! (And I decided that perhaps I shouldn’t leave it running without human supervision.)
My cat, Leeloo testing out the final product. Photo by Christina Bonnington/Wired.com

Helpful Links

Hacking A Keychain Digital Camera for Arduino Control

Arduino Duemilanove

Cheap Motion Detection Wildlife Camera

Volksduino, A Complete Low-Cost Arduino Clone


Original article by Christina Bonnington, Wired.com.


This page was last modified 15:37, 12 August 2011 by howto_admin.
 
My cat, Leeloo testing out the final product. Photo by Christina Bonnington/Wired.com


Navigation

Welcome to the Wired How-To Wiki, a collaborative site dedicated to the burgeoning DIY culture. Here you'll find all kinds of projects, hacks, tricks and tips on how to make each day better than the last. Anyone can contribute new items or edit an existing item.

Create an Article
Build a Camera Trap - Wired How-To Wiki

Authors:

French (Fr)English (United Kingdom)

Parmi nos clients

mobileporn