Archive for the ‘Electronics’ Category

Nikon D Series Lightning Trigger with Arduino

Lightning picture

Taken from inside garage

I wanted to make a lightning trigger for the D40 camera to capture some of nature’s most beautiful displays. I also thought it would interesting to capture some fireworks this 4th of July. So off to google I went. I saw several projects that pointed me in the right direction but I needed to get them all together. I started out with the code required to activate the  remote shutter for the Nikon. I found some code here: Thing-a-Day Site(code didn’t work) . The code on the page had some issues compiling. I then followed the replies  and I saw a poster with his own code that links to I followed the link that the code at (code that worked) looked very elegant and complete. So i decided to try it. It worked, and as advertised, every ten seconds it triggered the Nikon.  The only thing needed was to add the detector mechanism.

Lightning Detector:
**VERY IMPORTANT** For lightning safety visit: NWS Lightning Safety

I found a simple schematic to actually capture the sudden flash in light at this site. The schematic was simple and easy to build. They used a wired trigger for the Canon 3OD.  For this project I am adapting it to trigger the Nikon D40 using the infrared transmitter.

Parts List

1 – 220 Ohm resistor (IR LED Current Limiter)

1 – 100k Ohm resistor (for Photoresistor)

1- Arduino (Purchase an Arduino: Modern Devices, Spark Fun, adafruit)

1 – Photoresistor (recommended) or Phototransistor

1 – Green or Red LED (Triggering Status LED)

1 – Potentiometer (optional if you use Version 1.1)


Use the schematics below to wire the detector and IR Transmitter to the arduino. There are two versions available, one with an adjustable trigger setting and one that you can hard set in the code.

NOTE: You can modify the TRIGGER_THRESHHOLD value to get the best results for your situation.  You can also add a delay to tweak the actual follow-on shots.

Camera Setup

To setup the Nikon you must go to Menu; Custom Setting Menu; Release Mode; Change to Quick Repsonse Remote. You must then Change the Remote on Duration setting, it can be setup up to 15 minutes.

The code below is complete. No additional libraries are necassary.

Version 1.0:

Important: If you want to add a potentiometer to change the value of the TRIGGER_THRESHOLD use the below links for the PDE file and schematic

Version 1.1:

Thanks to Aurelien Antoine and Maurice Ribble!!

Project Pictures

(Includes submissions from other hobbyists)

Credit given below each image