Combining sketches for an analog trigger for a Canon camera and a Nikon time-lapse infrared trigger, I created this simple PCB and sketch for triggering my Nikon D40 to take a picture upon a change in light (ie: Lightning strike).

Lightning auto-trigger for my Nikon D40 DSLR Created August 2, 2012

The purpose of this sketch is to remotely trigger my camera using an infrared signal in order to capture a lightning bolt. I borrowed a couple of different sketches from other folks, which I truly appreciate: http://www.glacialwanderer.com/hobbyrobotics/?p=16 : this site explains the code for actuating a cable-type trigger upon sensing a change in light. Since my Nikon does not use a cable input, I combined it with http://luckylarry.co.uk/arduino-projects/arduino-ir-remote-intervalometer-for-nikon-d80-that-means-timelapse-photography-yarrr/ in order to get the results I desired. This guy did the research into the required pulses for Nikon IR receivers, but instead of using it for lightning, he used it for a time lapse scene.

IR Pulse description for this particular model: - Wait for a start pulse (2000 usec) - There must be no pulse for 27830 usec (pause) - Receive a pulse (400 usec) - Pause (1580 usec) - Receive a second pulse (400 usec) - Longer pause (3580 usec) - Receive the last pulse (400 usec) (derived from http://www.bigmike.it/ircontrol/)