Build Your Motion-Fired
Nikon Camera Remote
Time: An Afternoon Complexity: Easy-Moderate
Webcams Can See Infrared LEDs
My first step debugging was to make sure the
infrared LED was working. A webcam will see a lit
IR LED even if you can’t, so I used the Photo Booth
webcam application on my Mac to take a look.
When I held my Arduino up to the camera, I saw the
LED blink onscreen as it should, so I knew the code
was controlling the LED (Figure A, following page).
This meant either the bug was in the timing of the
library code, or something was wrong with the
camera. Checking the latter sounded much easier.
Read the Manual — Really!
It Can Help!
I pointed Nikon’s own mini remote at the camera
and pressed the button. Nothing happened; time
to read the manual. Sure enough, the Nikon DSLRs
don’t listen to the remote by default! A little fiddling
with the camera settings, and the Arduino had
control of the camera. A little reading can save
hours of needless pain.
The Design
For the camera trap’s motion detector, I connected
a passive infrared (PIR) sensor from RadioShack to
a digital input of the Arduino. The PIR sensor was
very sensitive to even the slightest movement, and
stayed on for several seconds after being triggered
by motion. This is pretty typical for most PIR sensors I’ve encountered. So I wrote the code to trigger
the camera only when the sensor changes from off
to on, using a state change detection routine:
MATERIALS
Get everything you need for this project in the
Project Pack #MKS1 at
makershed.com.
Arduino Duemilanove #MKSP4 at
makershed.com
PIR motion sensor
10kΩ resistors ( 2) and 4.7kΩ resistors ( 3)
3mm LEDs ( 3)
IR LED
Male headers, 0.1" spacing ( 15)
Female headers, 0.1" spacing ( 7)
Slide switches ( 3)
10kΩ potentiometer and matching knob
Project box
9V battery snap and 9V battery
PCB standoffs with #4-40 bolts ( 4)
#1-64 bolts, washers, and nuts ( 8)
void checkMotionSensor() {
// read the motion sensor:
motionSensorReading =
digitalRead(motionSensorPin);
// if the sensor has changed since last reading:
if (motionSensorReading != lastSensorReading) {
//... and the sensor is HIGH, then take a picture:
if (motionSensorReading == HIGH) {
}
}
// save the current state of the sensor
// to compare the next reading to:
lastSensorReading = motionSensorReading;
}
This handled motion detection. To let the user
switch Sensor Mode on and off, and to easily see
when it’s on, I added a switch, an LED, and a bit
of code to 2 more digital input/output pins in the
Arduino.
An intervalometer would be handy too, so that
I could trigger the camera at regular intervals to
make time-lapse series. I added a potentiometer to
set the rate, and 2 switches to control which function was active. As with the motion sensor, I threw
in a power switch and an indicator LED to complete
the physical interface for Intervalometer Mode.
A third visible-light LED indicates that the unit is
on. Figures B and C show the trap’s physical interface and its circuit on a breadboard; you can see a
schematic at
makezine.com/22/cameratrap.
Measure Thrice, Cut Once
I got a project box from RadioShack, because
fabrication is not my strength. I tend to make a
horrible mess when I get my hands on a saw or
a Dremel. A friend of mine had a laser cutter in his
shop, and was happy to do me a favor.
I measured my switches, potentiometer, sensor,
and LEDs with a caliper, opened Adobe Illustrator,
and drew up a plan. To make sure I had spaced
things well, I printed the layout on paper, cut the
holes out with a mat knife, and fitted the components. This turned out to be a wise move, because
I hadn’t left proper space between the potentiometer
and the switches, and the IR sensor hole was too
close to the box’s screw mounts.
A few changes in Illustrator, another paper model,
and we were ready to use the laser cutter. We did a
test run on some scrap plastic first. More mistakes:
this time my labels weren’t readable. They’d printed
61 Make: