Every year Santa slides down the chimney, leaves presents, consumes the milk and cookies and disappears without a trace. For most believers in Santa Claus, the sudden appearance of presents and the disappearance of the milk and cookies is proof enough, but there are some out there who insist on hard evidence. To satisfy these doubters, I have designed a simple motion activated camera rig that will capture pictures of Santa in action and prove once and for all that Santa is, in fact, real.
Materials:
Camera (with an external shutter switch)
Arduino Microcontroller
PIR Motion Sensor Module
Diode
Jumper Wires
Breadboard
Connecting to the Camera's Shutter Switch Terminals
Many cameras are able to connect to an external shutter switch. For instance, my Canon Rebel can connect to an external shutter switch with a 2.5mm stereo plug. The barrel of the plug connects to ground on the camera. The center ring connects to the focus function. The end contact controls the shutter. These functions are activated by connecting the contacts to the ground contact. Different camera models may use different connectors and activate the functions differently. So consult your camera's manual to be sure that you know how everything works.
Connecting the Camera's Shutter Switch to the Arduino
We will be controlling the camera with an Arduino microcontroller. To do this we need to connect the ground pin on the camera's remote shutter switch to the GND pin on the Arduino with a jumper wire. This will give the two devices a common reference ground.
Then we need to connect the shutter contact on the camera to one of the digital pins on the Arduino with a diode. The cathode of the diode should be connected to the digital pin on the Arduino and the anode of the diode should be connected to the shutter contact of the camera. With the diode in this configuration, the Arduino will be able to activate the shutter when the digital pin sends out a LOW signal but when the Arduino sends out a HIGH signal, the diode will block it and protect the circuits in the camera.
Connecting the Motion Sensor to the Arduino
To detect when someone is in front of the camera, I am using a passive infrared (PIR) motion sensor. This module has three pins. The GND pin on the module connects to the GND pin on the Arduino. The Vcc pin on the module connects to the 5V pin on the Arduino. The OUT pin on the module connects to one of the digital pins on the Arduino. When the sensor detects motion, it sends a HIGH signal to the digital pin that can be read with a digitalRead function.
The Arduino Code
The code for this project is really simple. The Arduino uses the digitalRead function on pin 10 to monitor the output of the motion sensor. If a HIGH signal is detected (motion is present), then the digital pin that is connected to the shutter (pin 6) is set LOW. This activates the shutter function on the camera. There is a short delay to allow for the camera to focus and take the picture. Then digital pin 6 is set HIGH again to reset the shutter on the camera.
Here is a simple example code that you could use:
int shutterPin = 10; // shutter contact connected to digital pin 10 int sensorPin = 7; // motion sensor connected to digital pin 6 int val = 0; // variable to store the read value void setup() { pinMode(shutterPin, OUTPUT); // sets the digital pin 13 as output pinMode(sensorPin, INPUT); // sets the digital pin 7 as input } void loop() { val = digitalRead(sensorPin); // read the signal from the motion sensor if(val == HIGH) { digitalWrite(shutterPin, LOW); // sets the shutter pin LOW to activate the shutter delay(3000); //delay for camera to focus and take picture digitalWrite(shutterPin, HIGH); // sets the shutter pin HIGH to de-activate the shutter } }
Cornelius
2017/2/23 0:00:00
Really appreciate your content. It quite benefits my learning and it has solved my puzzles completely. Thanks.