This instructable has been tested on the following cameras:
- Canon 350D
- Canon 50D
This instructable can damage your camera. Caution is advised. Proceed with this instructable at your own risk and responsibility.
A friend of mine asked me if I could build something that would automatically trigger his SLR camera every time a bird was around the nest he set in his garden. He is interested in birds but this time the bird that got to nest in his garden was a very peculiar one.
To get Arduino to trigger the shutter of a camera based on the signals received from a passive infrared sensor (PIR), aka motion sensor.
BUILD OF MATERIALS
- An Arduino Uno (tested on R3)
- An Arduino Ethernet shield
- A PIR (Passive InfraRed) sensor operating at 433.92MHz. (http://www.buysku.com/wholesale/portable-wireless-pir-motion-detector-dual-passive-infrared-detector-for-alarm-security-system-white.html)
- A 433.92MHz receiver: MX-JS-05V
- A 600Ohms resistor
- An optocoupler 4N35
- A 2.5mm female stereo phono socket
- The camera should support wired remote shutter.
This instructable does not offer information on how to built the physical connector cable to the SLR.
Step 1: The Circuit
Wire the diverse components as shown in the picture. Some notes:
- The audio jack shown in the picture is stereo and so it has has three legs. Two of them (left and right channels) are to be connected to the same leg of the 4N35.
- Arduino pin #8 to resistor
- Arduino pin #2 to Data pin on RX/RF module.
The logic of the solution is explained in the attached diagram picture.
Step 2: The Sketch
Here is the sketch that drives the solution:
The most important parameter to hardcode -defined as a constant in the sketch, is the maximum frames per second (FPS) supported by the camera. Please refer to the camera's manufacture manual for information on the maximum FPS of your camera. One parameter that can lead to missing frames is the shutter pulse duration. This parameter is configurable on the sketch's constants declaration section.
- Frames Per Second (FPS):
- Canon EOS 350D: 3
- Canon EOS 50D: 6 (RAW). Up to 60 JPEG Large/Fine images. Up to 90 JPEG Large/Fine images with UDMA 7-compatible CF cards
- Nikon D300: 6 with buil-in battery. 8 with AC adapter or MB-D10 pack and batteries other than EN-EL3e
- Canon EOS 350D: 40 (ms)
HOST IP ADDRESS
The sketch sets default IP address 192.168.1.100 to the Ethernet shield. This is done on the following line:
Please modify this IP address if needed based on your LAN setup.
SNIFFING PIR SKETCH
This instructable features an extra sketch to sniff the PIR identification number that has to be hardcoded in the sketch's variables declaration section of the ArduPhtographer (PIR_id). The accompanied sniffing sketch can decode the device ID of the above tested PIR device. However, there is no guarantee it would decode other PIR.
Here is the sketch:
To get the PIR ID you have to load this sketch to the Arduino and open the Serial Monitor at 9600bauds. Turn on the PIR and perform some motion in front of it so it gets triggered. Should should read the PIR ID on the Serial Monitor.
Step 3: The Web Interface
The ArduPhotographer can be configured via its web interface. The web interface also offers information on the amount of pictures has have been taken as well as it gives the possibility of manually releas the camera shutter. The IP address to be used in the URL to call the web interface is defined here:
In this case the URL to set on the web browser would be http://192.168.1.100
UNDERSTANDING THE WEB INTERFACE. PARAMETERS
ArduPhotographer is extremely versatile when it comes to different configuration parameters that can be set to trigger the shutter. The parameters that steer the way the pictures are taken are:
- Burst: number of consecutive pictures to be taken when motion is detected by the PIR.
- User Interleave: time between pictures when burst is bigger than one (1).
- Motion Delay Before: Waiting time between the moment the PIR detects motion until the burst is released.
- Motion Delay After: Waiting time after the burst has finished before start listening to the PIR signal again.
For more detailed information on how these four parameters go together please refer the attached document parameter_doc_1_1.pdf.
POINTS TO CONSIDER
- The Release Shutter on the web interface release the shutter to take one picture only, regardless the burst figure.
- Multiple concurrent web clients can produce an unpredictable state on the shutting behavior of the camera when releasing manually the shutter (Release Shutter button).
Step 4: Valuable Information
GOOD TO KNOW BEHAVIOR
- The Release Shutter button on the web interface is to act as defined by the manufacture of the camera when the shutter release is depressed without any further feature. For instance, the Canon 350D is to take one picture only every time the shutter is released via the remote control; no burst even when the button is kept depressed.
- The hardcoded parameter Shutter Pulse (ms) secures the shot triggering pulse sent to the camera is long enough to be correctly interpreted by the camera.
- The Shutter Pulse value has been found by trial-and-error using the Release Shutter button available on the web interface.
- The tested PIR produces a long burst of signaling, longer than the time required to take a picture therefore, taken more pictures than the amount indicated with "burst" can happen. This is because when the loop starts over it might still read PIR signals from the ongoing burst. This behavior can be counteracted with parameter "Motion Delay After".
- The shutter lag is based on camera's fps (1000 / fps).
- While having the camera on auto or semi-auto mode (Av, Tv or P) it is necessary to take into account the amount of time need by the camera to perform the needed calculations before taking the picture. This time might impact the expected burst and so being lower than expected (missing frames). To avoid this the camera should be set all manual (M) including the focus. For instance, having the Canon 350D set to manual and manual focus, I can take a 3 out of 3 pictures when configured with Burst=3, MotionDelayBefore=0 and MotionDelayAfter=25. The same configuration but on semi-auto with manual focus gives me a burst of 2 out of 3. To overcome you can play with MotionDelayBefore and/or MotionDelayAfter parameters to secure the camera releases the shutter when idle.
- The circuit makes use of a optocoupler. Optocouplers are generally used to isolate two parts of a circuit. In this sense, the mechanism that is to electronically trigger the shutter is inside the optocoupler. This is to basically act as a switch, setting together the two wires coming/going to the camera. The rest of the circuit behind this "switch" inside the optocoupler is totally isolated. With this we are to minimize the risk of getting current leaking into the shutter cable and so damaging the camera.
I would be interested in knowing your experience with other PIRs since the one I cite herein is relative slow for the original purpose that is, the time between the moment the motion is sensed to the time the PIR is ready to sense motion again is relatively long. An alternative to this is a possible way of hacking the PIR to have it to response in shorter intervals.