Introduction: Arduino PIR Motion Trigger for Nikon
In this project I wanted to capture elusive little creatures in the woods. Or catch my son stealing cookies! This project will work with most Nikon cameras on the market. I stress some tinkering may be required to gain the correct "trigger" and "Focus" wires coming from the cameras usb plug. You can buy usb plugs on ebay or the likes or if you have an old timelapse trigger to fit your camera then use that. Make sure you know you wont use the timer again!
The project is pretty straight forward and so is the coding.
Wire the 2 transistors in a darlington pair configuration and then just solder the wires to them.(I recommend you solder the transistors first to a strip board, then you can solder the wires to them without overheating transistors).
The PIR is easy bought for arduino from ebay at a few $ or £ if you are in the UK.
The sketch is attached to this project.
To adjust the distance the PIR detects movement just simply swap the jumper to H on the PIR board.
Simple and easy and works perfectly.
Hope you enjoyed this project and any questions message me below, Ill do my best to resolve any issues.
Attachments
Step 1: The Code
#define FOCUS_PIN 6
#define SHUTTER_PIN 7 int pirPin = 10;
int calibrationTime = 20;
void setup() {
Serial.begin(9600);
pinMode(pirPin, INPUT);
digitalWrite(pirPin, LOW);
Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++)
{ Serial.print("."); delay(1000); }
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
pinMode(FOCUS_PIN, OUTPUT);
pinMode(SHUTTER_PIN, OUTPUT);
digitalWrite(FOCUS_PIN, LOW);
digitalWrite(SHUTTER_PIN, LOW);
delay(1000); // May want to adjust this depending on shot type
}
void loop() {
- if(digitalRead(pirPin) == HIGH){ digitalWrite(SHUTTER_PIN, HIGH); //Wake up camera after a long time of no movement ready to take picture if motion detected.
- delay(200); //delay for time after wakeup, if motion is still detected picture is taken. digitalWrite(FOCUS_PIN, HIGH); digitalWrite(SHUTTER_PIN, HIGH); delay(200); //adjust as needed between shutter releases(1000 = 1sec) digitalWrite(FOCUS_PIN, LOW);
- digitalWrite(SHUTTER_PIN, LOW);
- }
- }