Lightning Shutter Trigger for a Camera

Update: Check out my latest Camera Axe project for a much more robust device that handles this.

From Public DomainI knew there were devices that could trigger a camera to fire during a lightning strike, but their circuits were more complicated than I wanted to make. I’m a software guy not a hardware guy so I decided to use an Arduino and that allowed me to write a little code that made the circuit much simpler.

Before I got started I looked at this wikipedia article about lightning so that I could verify this project would work. It has a lot of interesting information about lightning, but the most useful piece of data in the wikipedia article is the time lapse shot of a lightning strike. From the time lapse photo I was able to determine the duration of a lightning strike is about 100 ms. Then from this page I found my Canon 30d camera has a shutter lag of 65 ms. I know from a past project that if I use a reverse biased photo transistor to detect light it has a response time under 1 ms. The last piece of delay is the software running on the Arduino board and since it’s running at 16 MHz I am sure I can run a tight loop that takes under 1 ms. Adding up all the delays, I get 67 ms which is still much less than the 100 ms duration of a lightning strike so I was pretty confident this would work before I started work on the prototype.

The circuit I used to detect the light from the lightning was a very simple circuit that looked like the above circuit diagram. I used a cheap infrared photo transistor because that’s what Radio Shack had. I noticed that the sun, my house lights, and lightning all pump out plenty of infrared light for this circuit to detect. If this circuit is not sensitive enough try changing the value of the resistor. Larger resistance values should help sensitivity when there is only a little infrared light and smaller resistance values should help sensitivity when there is a lot of infrared light.

I also needed a circuit to trigger the camera. I already have written a short tutorial about how to do that here.

The last thing I needed to do was write some software. At first I thought I’d just have a threshold value that triggered the camera. That would work, but I’d need to calibrate the threshold value to different values depending on the environment. Instead I have the software look for a rapid change in the amount of infrared light detected. This works great because lightning causes a very rapid change.

Here is the code.

// Maurice Ribble
// 6-1-2008
// http://www.glacialwanderer.com/hobbyrobotics

// This code uses my camera trigger and lightning detector.
// It waits for a sudden change in the light intensity
// and then triggers the camera.

#define SHUTTER_PIN 7
#define LIGHTNING_TRIGGER_ANALOG_PIN 0
#define TRIGGER_THRESHHOLD 5

int lightningVal;

void setup()
{
  pinMode(SHUTTER_PIN, OUTPUT);
  digitalWrite(SHUTTER_PIN, LOW);
  Serial.begin(9600); // open serial

  lightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
}

void loop()
{
  int cmd;
  int newLightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
  Serial.println(lightningVal, DEC);

  if (abs(newLightningVal - lightningVal) > TRIGGER_THRESHHOLD)
  {
    digitalWrite(SHUTTER_PIN, HIGH);
    delay(1000); // May want to adjust this depending on shot type
    digitalWrite(SHUTTER_PIN, LOW);
    Serial.println("Shutter triggered");
  }

  lightningVal = newLightningVal;
}

Here are a few example pictures from Adam Bell. He used this blog to make a lightning shutter trigger. Traditionally lightning is captured at night. This lightning shutter trigger could do that (while you sleep), but where this device creates new opportunities is photographing lightning during the day. Peoples’ reflexes just are fast enough to get pictures like these. Thanks for the examples Adam!

Here’s a link to John’s Flicker page where he’s used this method to take some really nice lightning photos.

94 Comments

  1. Travis said,

    January 7, 2009 @ 9:42 am

    So how did your arduino lightning detector work out? Do you have any examples?

    Thanks!

  2. Glacial Wanderer said,

    January 12, 2009 @ 10:57 am

    It’s worked well with all my test cases (used a camera flash to simulate lightning), unfortunately I don’t get much lightning so I don’t have an example yet. I do know of someone else who built the trigger and used it. I’ll check with him to see if he is willing to share a few pictures he took with this lightning shutter trigger.

  3. cheekygeek said,

    January 27, 2009 @ 12:41 pm

    Curious as to whether this will only work at night, or if it is sensitive enough to capture lightning in daylight?

  4. Glacial Wanderer said,

    January 28, 2009 @ 8:11 am

    I think so, but I have not tested it. You might want to add a pot to help adjust sensitivity. It is also helpful if you put the photo transistor on the viewfinder where your eye goes as that lets it focus on only the light the camera is seeing.

  5. Scott Rutledge said,

    February 25, 2009 @ 8:09 pm

    I used your code last fall and am happy to report it worked great. Now i am waiting on spring to find a good location to shoot from.

  6. Scott Rutledge said,

    February 25, 2009 @ 8:10 pm

    Yes it worked in daylight wonderfully.

  7. Marco said,

    April 3, 2009 @ 3:38 am

    Hello, I realized all the circuit, however i used Arduino 2009 instead of Arduino 10000, which is not availbale any more. Using the program listed, anyway, the circuit fires the camera continously, even if the ohoto transistor covered. What do you think about it? Thank you very much for help

  8. Maurice Ribble said,

    April 3, 2009 @ 5:12 am

    I don’t know what you mean by Adruino 2009 and Adruino 10000, but that probably does not matter. I don’t think Adruino version is the problem. Try using printf to display what is happening to newLightningVal. It might be that your circuit is working, but there is more noise with your phototransistor. If this is the case you can just increase the value of TRIGGER_THRESHHOLD. If the circuit isn’t working you’ll need to debug what is happening there.

  9. Roberto said,

    May 27, 2009 @ 5:30 am

    Very nice post. which is the exposure settings of your camera for these shots? (Lens, shutter, aperture)? Do you keep “pressed” the focus to get faster response? in this case, is it ok to keep the focus “pressed” for a very long time? isn’t there some risk of frying something? (playing this way with a 30D seems a bit frightening for me…)

  10. Maurice Ribble said,

    May 27, 2009 @ 5:41 am

    I didn’t take the picture above so I can’t give all the info you want, but I can help with your question. When you press the shutter half way down you are pre-focusing the camera. For these sorts of photos you want to manually set the focus and disable autofocus. Then the camera won’t spend any time focusing. This project also uses a trigger release which lets you bypass auto-focus even if it’s on, but you should still use the manual focus trick or your images might not be in focus.

  11. Orce Popovski said,

    July 2, 2009 @ 7:11 am

    Hello

    I create lighting trigger with your code and arduino, but from 20 to 25 lighting I manage to capture
    only one. Trigger reacts on light emitted by the lighting but it’s probably to slow to catch on the camera.
    I have canon eos 40d (Shutter Lag Prefocused 0.061 second) and 16-35 f2,8 lens on.
    I put light transistor on the top of the lens and pointed on the front of the camera
    Maybe it will work much better if there is faster microcontroller because you have optimized the code
    Today I will try to take pictures with mirror lockup and photo transistor on the viewfinder, I hope I will have more luck. If you wont I can send you my photo of lighting.
    Best regards
    Orce

  12. Maurice Ribble said,

    July 3, 2009 @ 4:50 am

    Dave found that his trigger is getting activated twice. By changing this line:

    if (abs(newLightningVal – lightningVal) > TRIGGER_THRESHHOLD)

    to this:

    if ((newLightningVal – lightningVal) > TRIGGER_THRESHHOLD)

    The trigger should only happen once (when it goes from dark to light). Thanks Dave!

  13. Maurice Ribble said,

    July 3, 2009 @ 5:00 am

    Orce, I think the trigger is actually fast enough since it is working for myself and others. I don’t know what you mean by faster microcontroller, but unless it’s really slow it should be fast enough. On the Arduino the slowest part of this code by far is the analog read and that only takes 0.1 ms which is 400 times less delay than my camera adds.

    Thanks you could try are:
    1) Making sure you have the lens set to manual focus
    2) Disable all power off features on your camera to see that it isn’t going to sleep
    3) Activate the focus pin on your camera trigger. This should be equivalent to #2 since it will prevent your camera from going to sleep, but if #2 didn’t work try this

  14. Kevin Fogarty said,

    July 15, 2009 @ 9:15 am

    Hi, I am 16 years old and part of the high school robotics team. Photography is one of my hobbies and I was wondering how hard it is to build this. If needed I think there are a couple of mentors on the team that could help me but I am really looking to do this myself as a project over the summer. I really don’t have any experience programming but I was hoping I could copy the code you wrote and use it for the arduino. I would also like to know where to get this stuff, I have a radioshack down the street so I think the photo transistor, arduino, and microcontroller could be purchased there along with a program to write the actual code.
    Any help is appreciated, I just figured give this a shot before spending $300+ on a store bought one.
    Thanks, Kevin

  15. John Groseclose said,

    July 21, 2009 @ 3:38 pm

    I bypassed the “activate the focus pin” by using a D80 pre-trigger cable from FlashZebra designed to work with a Pocket Wizard, and putting a female mini-jack (Radio Shack #274-0248) on the box containing my Arduino controller. The cable shorts the focus control pins on the D80, so there’s no need to mess about with the circuit.

    It is important, though, to make sure you get the tip/ring polarity correct, or it won’t work.

    I also mounted the IR phototransistor (Radio Shack #276-0142 – they were sold out of the individual phototransistors) in a panel-mount LED holder (Radio Shack #276-080) to help “snoot” the sensor a bit.)

  16. Lee said,

    July 30, 2009 @ 11:01 pm

    Kevin,

    I didn’t see anyone write you back…
    I put this together in an afternoon… I don’t know any programing languages, but have been tinkering with arduino for about 1 months.
    I had a spare photo resister (taken out of a night-light). A couple radioshack NPN transistors, a spare resistor (I have an electronics part box).
    I bought a RBBB (Really Bare Bones Board) a couple of weeks ago and have been experimenting with it.
    So what you need…
    1. Arduino Board (check out some of the Freeduino boards as they can be cheaper especially if you want to assemble them yourself)
    2. (2) NPN transistors see the above schematic for specifics although others will work as well. (radio shack)
    3. A resistor (100k ohm) is in the example; other values may work as well. (radio shack)
    4. A camera remote. I have an olympus E-3 so I used the optika remote for <$10 from amazon.
    (look up "opteka remote shutter release cord" most are less than $20, nikon and olympus for <$10)
    I recommend that you test your remote before wiring it. Mine had red-shutter, white-ground, and yellow-focus. I used a multimeter to test DC voltage between the leads, mili amps at trigger, and discovered that my camera needed both focus and shutter pins HIGH to take a picture.
    5. Some type of prototyping board (breadboard) $2-10.
    6. Wire.

    take a look at the photo and diagrams, it really is easy and arduino is a fun micro-controller.

  17. Pascal said,

    July 31, 2009 @ 1:03 pm

    I’m currently building this project and it’s just great ! A note for those of you building it. You might have to adjust the trigger threshold as i did. Because i found out that in my basement with all the normal light open the project was triggered almost always. Now i have to test it outside. Light must be more intense or the light in my basement are emitting more infra red than normal. ( fluocompact and fluorescent ). Note that i’m using a Arduino 2009. Everything seems to work great. A tip if you want to simulate a lighting strike you can use a camera flash. My SB-600 juste does the job great.

  18. cherokee said,

    August 10, 2009 @ 12:43 pm

    Do you know where I can buy the Ardino 2009 and other components necessary to make a lightning trigger?

  19. Pascal said,

    August 11, 2009 @ 6:21 am

    Arduino simple : http://arduino.cc/en/Main/Buy

    look at this link it will tell you where to buy it in your country. Otherwise for the parts… it depend where you live. If you live in the continental Canada / US you can buy the parts at The Source. There is also Active Component which sell them.

  20. helion said,

    August 17, 2009 @ 2:15 am

    This is just what I am looking for. How much do you charge for one of these gizmos?
    My photo equipment dealer charges over $300. I thing it’s a major ripoff.
    A photo sensitive switch can’t cost more then $30 to $50.
    I have seen a lot of cirquit diagrams for DIY, but I am no good at assembling tiny
    components and soldering them. Used to experiment when I was a teen, but kept
    burning up stuff or it simply did not work.
    I have a Canon Rebel XTi D-SLR.
    Thanks.

  21. John Groseclose said,

    August 22, 2009 @ 7:40 pm

    After last night’s fun, I’ve gone ahead and collated my best shots with the Arduino-based trigger here:

    http://www.flickr.com/photos/iaincaradoc/sets/72157621660951255/

  22. Eric said,

    August 26, 2009 @ 11:59 am

    I too am interested in this if you are selling a basic kit….soldering is not a talent of mine…

    thanks

  23. Photography - BANNED » Archive » Daylight Lightning Photography said,

    August 26, 2009 @ 5:05 pm

    [...] the past month or so, I’ve been playing with a lightning trigger that I build based on this DIY page’s instructions, slightly modified to take into account the fact that I shoot with a Nikon D80 and the original [...]

  24. Sam said,

    August 31, 2009 @ 9:41 am

    Hi,

    I’m building this circuit but am a little confused.

    Does this circuit run on battery power or does it use the camera’s power?

    Thanks!

  25. Maurice Ribble said,

    August 31, 2009 @ 10:13 am

    The circuit and arduino run off a battery.

  26. Sam said,

    August 31, 2009 @ 3:10 pm

    Ok so I can use a 9v battery to run the whole thing correct?

  27. Maurice Ribble said,

    August 31, 2009 @ 4:09 pm

    Correct.

  28. John Groseclose said,

    August 31, 2009 @ 8:53 pm

    I recommend keeping spare 9v batteries in the camera bag. Nothing sucks like finding a perfect spot with wonderful strikes going on, good foreground, and finding out that the battery in the trigger box is dead…

  29. Sam said,

    September 4, 2009 @ 9:06 am

    Hey guys..got my trigger build and it works but I’ve got a couple issues.

    With room lights on the camera is triggered constantly. If I shield the IR transistor with my hand it will stop however. If the lights are off in the room and I turn them on the unit triggers the camera but it will keep triggering if the lights are left on.

    With room lights off, my 580ex will trigger the camera however only if the flash is very close to the photo transistor. If I dial in 1/4 power on the flash and hold the flash 10ft from the IR transistor the unit doesn’t trigger.

    I’m not using the radio shack IR transistor so perhaps it’s the photo transistor. I’ve ordered a few different phototransistors and should have them next week to play around with. I’m also going to try the code mods that are mentioned above as well as adjusting the trigger threshold.

    Anyone have a similar problem with their build or have any suggestions?

  30. Maurice Ribble said,

    September 6, 2009 @ 9:33 pm

    Sam, I’m almost certain you have figured this out yourself. It sounds like you just have to go and adjust the threshold in the code (as you suggested).

  31. Sam said,

    September 8, 2009 @ 9:02 am

    Thanks Maurice!

    I did a little tinkering with it last night and found that a photo resister works much better than the phototransistor I was using…no false triggers and much more sensitive without any code modifications required.

    Hoping for some september T-storms!

  32. Thuy Nguyen said,

    December 10, 2009 @ 11:05 pm

    You got a good idea here, although your implementation is too complex. I found a much simpler way:

    http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!274.entry

    and:

    http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!279.entry

    I have to wait for a stormy day to try out my board, but I can use it for many other kind of pictures too.

  33. Thuy Nguyen said,

    December 13, 2009 @ 5:08 pm

    I posted a blog on another use of the shutter release board:

    http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!288.entry

  34. Thuy Nguyen said,

    December 17, 2009 @ 3:54 pm

    For a complete implementation with application to other situations, see:

    http://thuytnguyen.spaces.live.com/blog/cns/fakehandlerpage.aspx?sa=692503166

  35. John Groseclose said,

    December 28, 2009 @ 9:57 pm

    I tried using a simple trigger like the one you describe, Thuy, but it wouldn’t do what I needed it to do.

    Many times, the initial strike would trigger it, but just one frame would fire. By having the Arduino controller hold that pin high for a longer period and trigger multiple frames, shots like this become possible:

    http://www.flickr.com/photos/iaincaradoc/3846107512/in/set-72157607043209736/

  36. Thuy Nguyen said,

    December 29, 2009 @ 1:07 am

    My apologies for those who are specifically interested in this topic: somehow my previous link leads to the wrong page. The correct one is:

    http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!310.entry

  37. Thuy Nguyen said,

    December 29, 2009 @ 1:51 am

    Answer to:
    John Groseclose said,

    December 28, 2009 @ 9:57 pm

    Yes, the simple solution works as soon as enough light is detected. In my series of about 5 blogs, I describe the full implementation which involves also a microcontroller. There are 3 pieces:

    1/ The simple sensor that can be mounted directly on the camera. It triggers as soon as enough light is detected as taking pictures of lightning.

    2/ The microcontroller that you can program to do many things. I made pictures of drops of water. (see pictures on http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!310.entry and http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!321.entry : copy and paste the full link!)

    3/ The triggering circuit commanded by the microcontroller.

    Well the full implementation is more flexible, the light sensor can be replaced by other sensors such as a microphone, thermometer etc. Of course the microcontroller will have to be reprogrammed. There is no such thing as a free lunch, the full course requires more work!

  38. Thuy Nguyen said,

    December 29, 2009 @ 3:52 am

    Thanks to John Groseclose comment, I browsed through the store given by the link on the right hand side at the top. The store carries interesting items, a tad expensive, but if you don’t have an EE background, it is safer just to get your stuff from the store since you don’t have to figure out how and why things work.

    For my part, I have already a few components I bought a few years back for other purposes, I just use them. In fact I did not think of connecting a digital camera to the electronic until I noticed this site indicated on Flicker. After reading this blog, it dawned on me that it isn’t that difficult to connect my camera to the electronic! After a few days, I thought about the various other possibilities than taking pictures of lightning. I just found out by browsing through the store that some of the possibilities I thought about were already described in the pages linked to items carried by the store. I am glad that there is still a minority interested in doing things!

    Thanks also to Maurice Ribble who wrote this blog. It prompted me to find out how to connect the electronic to my camera.

  39. John Groseclose said,

    December 29, 2009 @ 8:46 am

    Thuy,

    Please show us a photograph of lightning that you’ve taken using your “simple circuit.”

    I don’t believe the timing will work quite the way you seem to think it will.

  40. Thuy Nguyen said,

    December 29, 2009 @ 11:39 am

    As I mentioned before, I have to wait for a stormy day to try it out. I did not say it explicitly but in one of the blogs I posted, I showed how I used a diffuser to cut down the amount of light i.e. if you want a picture of daylight lightning, you have to filter out some visible light by putting a piece of paper or some tinted piece of something.

    Now about your mention of timing, I did measurements with an oscilloscope which show that as long as the light level is above the firing threshold of the camera, the shutter is held open. This is quite suitable for taking pictures of lightning. In other kind of pictures, the simple circuit would not work correctly because when the shutter is held open for too long, the CCD of the camera saturates and the camera would lock-up. Tell me what kind of pictures you want to take so that I understand why you have problems and why you want to hold your shutter open for longer than the time the detector gets above the firing threshold.

    I posted on your other pages pictures of single drop of liquid I took with the circuits I built. In those situations, proper timing is necessary and in the blog for the full solution, I showed how to program the microcontroller for the task.

  41. Thuy Nguyen said,

    December 29, 2009 @ 11:46 am

    Answer to:
    John Groseclose.

    I forgot to put the link to your other page where I put two pictures:

    http://www.flickr.com/photos/iaincaradoc/3846107512/

    I took over a thousand of such pictures to make sure of the consistency of the results.

  42. Thuy Nguyen said,

    December 29, 2009 @ 12:17 pm

    I should repeat that I use a PENTAX camera (not a CANON as you all seem to have) and in the circuit, I chose a high resistor value to limit the current and avoiding messing up the camera in case of accident.

    In the full solution for general pictures taking, I took a further precaution by electrically isolating the control from the camera through the use of optical coupling the controller to the camera.

    In the blog http://thuytnguyen.spaces.live.com/blog/cns!DA7A6E9DDF81F274!339.entry I described another use of camera in a non-imaging case.

    I though that this is about robotics and photography so I posted my comments. I do not sell anything. I even advise people to buy stuff from you guys if they don’t have the appropriate engineering background to venture on their own!

  43. Thuy Nguyen said,

    December 29, 2009 @ 1:36 pm

    Now a big idea: there are a whole bunch of signals processors in cameras, it should not be too hard for manufacturers to add some software to read files from SD cards, this way you can load your code onto the camera and make it do what you want. All you need is to connect to the camera a sensor and bypass all the external processors.

    The challenge would be to hack such a piece of code!

  44. Maurice Ribble said,

    December 29, 2009 @ 2:05 pm

    Take a look at CHDK. It allows people to load custom software onto many canon point and shoot cameras. http://chdk.wikia.com/wiki/CHDK_in_Brief

    The point about plugging in sensors is a bit tricky and it would be best if camera makers would support both custom software and sensor ports, but I don’t really think that will happen since the market isn’t large enough to interest big companies like Canon. Hope I’m wrong :)

  45. Thuy Nguyen said,

    December 29, 2009 @ 2:14 pm

    Thanks Maurice for the link. I have to confess that in my function as baby sitter, I don’t go out much in the wide world so I just dream of stuff when babies let me some free time for it!

  46. Thuy Nguyen said,

    December 29, 2009 @ 2:37 pm

    Oh, I just skimmed through the link. Actually there is usually a USB port. I don’t use it since the kids always play with my stuff and I can’t never find the cord. That USB port may be used to plug in sensors. The remaining is a problem of knowing how to squeeze in the custom software!

    In the pre-micro era, we used to joke about software and said that the day will come when you buy a piece of code and get the hardware as bonus. It seems to be the case today. Maybe that manufacturers do not care about letting people fooling around with their products or even worse, they did not think of the possibility!

  47. John said,

    December 30, 2009 @ 3:42 pm

    Where can I get a Lightning trigger for my Canon Rebel XTi 40d 10.1 mega pixil? How much do they cost.

  48. Anonymous said,

    February 23, 2010 @ 5:00 am

    Take a look at this:

    http://shop.ebay.com/patch_master/m.html?_nkw=&_armrs=1&_from=&_ipg=&_trksid=p3686

  49. ThierryD said,

    June 17, 2010 @ 3:42 pm

    Hello
    I can speak on this post because I made a lightning detector for SLR photography.
    This small electronic assembly costs less than 10 dollars and is very easy to achieve.
    All details of installation, drawing, explanations and examples of photos are available on my website:
    rienquepourlesyeux.free.fr

  50. Dan said,

    July 8, 2010 @ 9:41 am

    Try the following for a less expensive commercial trigger:

    http://www.pmgadgets.com

  51. cbrux71 said,

    July 27, 2010 @ 6:05 am

    Would this idea work in conjunction with an IR remote to trigger a pentax k-x? The pentax k-x doesnt have a jack for a cable so I was thinking of usung a IR remote and removing the depressable button and soldering 2 wires to the button contacts so the arduino could activate the IR remote? Any and all thought on this idea will be appreciated!

  52. Maurice Ribble said,

    July 27, 2010 @ 8:10 am

    cbrux71, that might work. It depends on how much extra lag this IR remote adds. My guess is that it would be fast enough, but I’m not sure.

    Also note that the remote’s button might work at a different voltage than the auduino. It’s best to check this. If it is the same voltage then as long as you connect the ground of the remote to the ground of auduino it should work. Another perhaps simpler option would be to use a transistor as a switch.

  53. cbrux71 said,

    July 27, 2010 @ 9:26 am

    Thanks for responding so quickly! I’m not sure what the voltage the remote works on would be but i can figure that out when I get it. I am somewhat uneducated in the workings of electronics so could you clarify what you mean by using a transistor as a swith? Like what kind of transistor and where would the transistor be locataed in the diagram?

  54. Maurice Ribble said,

    July 27, 2010 @ 3:26 pm

    Take one pin from the microcontroller and have it go through a 10K resistor and that goes to the base of the transistor. When you supply 5V current can flow from the collector to emitter otherwise no current flows. Here is a page that describes it: http://www.electronics-tutorials.ws/transistor/tran_4.html

    Here is a transistor I commonly use for this purpose: http://www.mouser.com/ProductDetail/Fairchild-Semiconductor/PN2222ATFR/?qs=sGAEpiMZZMtdAabcSkQOl4wFpopiDzZs

  55. Bob said,

    August 10, 2010 @ 2:15 pm

    cbrux71 … I was going to do this with my Nikon D50 that only has an IR trigger. The ir pulse train sequence for the Nikon ir remote is just about .2 seconds long from start to finish. Only chance on a Nikon would be to catch a secondary flash following close behind the first flash. Your Pentax is certainly different, but I bet it still is looking for a specific ir pulse train sequence. Good luck.

  56. Enlightening the Capture and Processing of Lightning said,

    September 10, 2010 @ 5:22 pm

    [...] a program which runs the camera from a laptop (DSLR Remote). Some photographers even wire up an Arduino Circiut which detects the feeler strike and trips the shutter just before the main [...]

  57. Desert Lightning said,

    October 22, 2010 @ 7:39 pm

    [...] prototyping logic board that can do anything you can write code for. This dude made one as a lightning trigger for DSLRs. If you are a DIY'er you could probably build one for $75 or so, maybe less. [...]

  58. justin said,

    October 23, 2010 @ 3:09 pm

    read the post and love the idea, being a photographer that hasn’t had much luck with lightning to this point. i understand the basics of the circuitry and mechanics of the project enough to get by. I understand what the code does but how do you actually get the code onto the Arduino chip?

  59. Andrew said,

    December 5, 2010 @ 6:43 pm

    I’m probably going to try building this soon, but I have a few questions.

    1) Has anyone tried building this for a nikon? Nikon’s 10 pin cable is more complex than the canon’s 3 pin cable. Nikon has a “signal ground” and a “power ground.” Not quite sure what to do with them.

    2)Does anybody have pictures of the final product? What kinda of case do you put the circuitry in?

  60. Maurice Ribble said,

    December 5, 2010 @ 8:25 pm

    I suggest looking at http://www.cameraAxe.com. It should have all the info you asked for including a pinout for the Nikon 10 pin cable. In the store I sell kits, but all the schematics/code are freely available if you’d rather build your own.

  61. John Groseclose said,

    January 14, 2011 @ 1:57 pm

    Yes, it works with a Nikon 10-pin.

    I had to slightly modify things because the tip and ring polarity on the regular “Pocket Wizard” shutter cables are reversed between the D80 cable and the 10-pin cable.

    Here’s my shot with a D80:

    http://www.flickr.com/photos/iaincaradoc/4870373245/

    And here’s a friend’s shot (about 100 feet to my right) of the same strike using a D300:

    http://www.flickr.com/photos/ckschweiger/4873301242/

    As you can see, the trigger-to-shutter delay makes for interesting differences.

  62. Larry Shields said,

    January 17, 2011 @ 11:54 pm

    I purchased an “Dale Beam IR and Audio” camera trigger back in the 80′s. I understand it’s no longer available. However, I was wondering if I could modify it some way and turn it into a “Lightning Trigger”? It looks and works like brand new. It’s a shame to see it go to waste…. Thanks…

  63. ThierryD said,

    February 17, 2011 @ 3:38 am

    There is another technics to capture ligthning.
    It’s to use the radio detection. The advantage of the radio detection, that is more speed from the light dectection.
    You can look that on this link : http://rienquepourlesyeux.free.fr/Detecteur%20de%20foudre/Lightning%20detector.htm.
    It is a lightning trigger sensor for DSLR camera.

  64. Gandalf said,

    March 24, 2011 @ 4:59 am

    Hi, nice arduino project any particular spec for the IR Phototransistor ? OP804 ? PT331 ?
    Angles ? rise time ?
    just found 15µ rise time IR Phototransistors !

    Thanks

  65. HolyDivar said,

    March 25, 2011 @ 12:12 am

    Essentially, you are monitoring the slope of the voltage waveform produced by the diode.
    I tested this code and it actually took the Arduino Uno about 2.37 ms to loop between reads.
    You can get this “slope sampling” down to a 115 microsecond sampling rate (loop duration) if you modify the code by removing the unnecessary serial prints.
    Also, I removed the “int cmd;” line and the “abs” in the ‘if’ statement since you are only interested in a steep increasing slope and the abs value will cause a trigger on both increasing and decreasing slopes.

    The analog read takes 100 microseconds so that takes up the majority of the loop duration.
    You can always add more delay by a “delayMicroseconds(n);” line.

    Here is the modified code:

    #define SHUTTER_PIN 7
    #define LIGHTNING_TRIGGER_ANALOG_PIN 0
    #define TRIGGER_THRESHOLD 5

    int lightningVal;

    void setup()
    {
    pinMode(SHUTTER_PIN, OUTPUT);
    digitalWrite(SHUTTER_PIN, LOW);

    lightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
    }

    void loop()
    {
    int newLightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);

    if ((newLightningVal – lightningVal) > TRIGGER_THRESHOLD)
    {
    digitalWrite(SHUTTER_PIN, HIGH);
    delay(1000); // May want to adjust this depending on shot type
    digitalWrite(SHUTTER_PIN, LOW);
    }

    lightningVal = newLightningVal;
    }

  66. HolyDivar said,

    March 25, 2011 @ 12:19 am

    Gandalf,
    I put a powered photodiode with an internal op amp in the camera’s viewfinder. The diode is made by TAOS. model: TSL13S. It has a 9 us rise time from 0 – 90%. I also added a potentiometer to vary the threshold in my version. It takes another analog read, but the loop is still only 220 microseconds.

  67. Gandalf said,

    March 25, 2011 @ 10:54 am

    Oh ! i’ve got a lag time of 0.98 ms with Canon EOS350D ! I think it will be difficult to have impressive results !

    Regards

  68. Gandalf said,

    April 4, 2011 @ 3:51 am

    ok seems to work well but my phototransistor is IR sensitive centered on 940nm, damn !
    Changing this from my french supplier !

  69. David said,

    April 21, 2011 @ 11:44 am

    Instead the 2N2222 i used the Optocoupler 4N3
    and instead the 100kohm resistor i use 10kohm.

    I have some lag in the circuit. The camera (40D and 7D) trigger doesn’t capture the flash (430ex ii or YN460-ii).

    What could be the problem?
    Thank you.

  70. John Groseclose said,

    April 24, 2011 @ 1:46 am

    The flash duration of many battery-powered flashes at full power (the longest duration) is 1/1000 or shorter – the trigger detects the flash, and then your camera takes 45-70ms (the Canon 40D checks in at 59ms) to actually open the shutter. So, the flash is actually “over” by the time the shutter opens.

    Lightning strikes last 100-200ms, so you can actually get some of the strike in frame while the shutter is open.

  71. Maurice Ribble said,

    April 24, 2011 @ 5:48 am

    I just made a video about lightning photography: http://www.techphotoblog.com/tpb1-lightning-photography/

  72. David said,

    April 28, 2011 @ 9:14 am

    Thanks you John and Maurice.

    Now i will have to wait several months to test it (at real) :(
    I don’t get lightnings here so often.

  73. Lex Augusteijn said,

    May 4, 2011 @ 3:21 pm

    I have made the circuit and the shutter was triggered constantly in artificial indoor lighting (fluorescent).
    I found out that the light flicker (50Hz here, 60 in US), together with the long latency of the loop is the problem. The analogue read will sample the slope of the lighting every few ms and therefore trigger frequently. By increasing the threshold and the sample frequency (remove the serail print) it is also stable indoors.

    Lex

  74. Holydivar said,

    June 2, 2011 @ 12:48 am

    Yes, fluorescent lights will trigger it if the threshold is not set correctly, as will plasma/LCD screens, even with a very quick loop. It doesn’t matter whether it is an LCD that refreshes at 120 Hz, a plasma at 600 Hz, or a fluorescent bulb at 60 Hz, because it is the very quick rise time of the light turning on each time that causes the trigger. I have now gotten the loop duration down to 18 microseconds and the rise time of fluorescent/LCD/plasma will still trigger it. It’s actually a good test of the circuit. I demonstrate the circuit by waving a flashlight in front of the diode to show that I can never cause a quick enough change in light to trigger the shutter in this way, but if you point the flashlight directly at the diode and turn the light on, the quick change in light will trigger the shutter.

    A simple way around false triggering is to sense for near infrared light but not visible light by putting a long pass or band pass optical filter in front of the diode. (a cheap long pass filter >700′ish’ nanometers can be made from a piece of developed unexposed film, the part that looks pitch black to your eyes). Since lightning emits a broadband spectrum of light, the photodiode will still see lightning in the wavelengths longer than visible light waves but it won’t see the visible spectrum produced by fluorescent lighting/tv screens.

    To make the loop perform at the aforementioned 18 microseconds,
    you must change the prescaler for the Analog/Digital converter. The prescale value simply sets a divisor for the system clock (which is 16MHz for the arduino) to give the ADC a slower operating clock. By default, the prescale is set to 128 (16MHz/128 = 125 KHz). Since a conversion takes 13 ADC clocks, the sample rate is about 125KHz/13 or 9615 Hz.
    Setting the prescale to 16 will give the ADC a sample rate of 76900 Hz.

    An A/D conversion would normally take 100 microseconds and would take up a majority of the loop duration. This code will make it do a conversion in 1/8 of that time at 12.5 microseconds with no noticeable change in ADC accuracy.

    Also, this code eliminates the lag associated with using the ‘digitalwrite’ command by replacing that call with a direct port manipulation code. A digitalwrite command takes 10 microseconds to compute, while direct port manipulation takes 1/20 of that time at 0.5 microseconds.

    In my testing with an oscilloscope (http://www.flickr.com/photos/13900274@N02/5788769681/),
    I found that by using this code, the circuit response time from the time the diode senses a quick change in light to the time the shutter trigger signal was sent to the camera was about 15 microseconds, or 1/66,666 of a second.

    At a 15 microsecond response time, the circuit is about 14,000 times faster than the average human could respond. (assuming the average human response time is 215 milliseconds which is data obtained from http://www.humanbenchmark.com, go ahead – see what yours is.)

    Here is the code,

    //beginning
    #ifndef cbi
    #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
    #endif
    #ifndef sbi
    #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
    #endif

    int LIGHT_ANALOG_PIN = 0;
    int last_loop_light = 0;
    int this_loop_light = 0;
    int threshold = 10;

    void setup()
    {
    sbi(ADCSRA,ADPS2) ;
    cbi(ADCSRA,ADPS1) ;
    cbi(ADCSRA,ADPS0) ;

    DDRD = DDRB | B10000000;

    PORTD = B00000000;

    last_loop_light = analogRead(LIGHT_ANALOG_PIN);

    }

    void loop() {

    this_loop_light = analogRead(LIGHT_ANALOG_PIN);

    if ((this_loop_light – last_loop_light) > threshold)
    {
    PORTD=B10000000;
    delay(100);
    PORTD=B00000000;
    }

    last_loop_light = this_loop_light;
    }
    //end

  75. Troy said,

    June 3, 2011 @ 9:30 am

    I built this circuit, but haven’t had the opportunity to test it out with actual lightning. I did measure the response on an oscilloscope. With the two Serial.println commands included in the loop() section the response time to an led input was about 20 ms. If you remove the Serial.println commands then the response time becomes 0.2 ms! A big improvement!

  76. Holydivar said,

    June 3, 2011 @ 10:02 pm

    hmm, not sure why you might have gotten a 20ms response time.

    I got 4-5 ms response with original code http://www.flickr.com/photos/13900274@N02/5788769787/

    0.150 ms without serial http://www.flickr.com/photos/13900274@N02/5789323212/

    and 0.015 ms with the faster ADC code in my previous post http://www.flickr.com/photos/13900274@N02/5788769681/

  77. Florian said,

    June 13, 2011 @ 5:39 pm

    Hi guys

    Do you know if I could use such a setup to take pictures at nightclubs, using the strobe lights to trigger the shots? Or are those kind of flashes too fast?

    Florian

  78. Maurice Ribble said,

    June 13, 2011 @ 5:50 pm

    Florian, the problem would be shutter lag. The lag on your camera is much too long to capture strobes at a nightclub.

  79. Florian said,

    June 13, 2011 @ 7:27 pm

    Too bad.

    But maybe I could measure the time between the flashes, and activate the trigger on the 3rd flash just early enough? Or are they so fast I won’t be able to get the timing right?

    That’d make the project even more interesting…

  80. Maurice Ribble said,

    June 13, 2011 @ 7:41 pm

    Trying to get the 3rd flash is a really cool idea and it should work if the strobes are evenly spaced and far enough spaced that you have time to account for shutter delay. If the flashes are too closely spaced that isn’t a problem if there are more and you could hit a later flash. If you do anything like that please post the results. You might be interested in my more modern extension of this over at http://www.CameraAxe.com.

  81. Holydivar said,

    June 13, 2011 @ 8:47 pm

    Florian, try this circuit and play around with your camera’s exposure time to try to capture just one strobe flash. Start off with your camera’s quickest exposure and step it down until you capture the image you want.

    There is no need to know your exact measurements, however, you can find a close value to your camera’s shutter lag at:
    http://www.imaging-resource.com/CAMDB/compare_cameras.php
    and this circuit’s lag is negligible in comparison.
    If the shutter lag is consistent, you should be able to find the right exposure time to capture a single flash event.

    Good Luck!

    P.S. the above circuit that uses a photodiode in reverse bias can generate more than 5 volts (which is the maximum voltage suggested for arduino’s input pins.), so you are better off using a powered photodiode from TAOS or the like that will produce voltages within a restricted range of 0 to 5 volts.

  82. stephen said,

    November 17, 2011 @ 4:20 pm

    so how hard do you think it would be to set this up with the wireless function of the rebel xti?

  83. Frank said,

    February 2, 2012 @ 6:41 pm

    Holydivar, I am waiting on my Arduino Uno to arrive to begin my first such project. I plan on using the code you posted based on the expert research that went in to it.
    Two things… You mention using a “Powered Photo Diode” which would be less stressful on the Arduino inputs. Can you please be more specific with a recommendation?
    Ultimately I plan to move my project to a ATtiny 45 or 85 microcontroller…. See here>>(http://hlt.media.mit.edu/?p=1229)
    These chips run at 20MHz vs the 16MHz the Arduino runs at. Are there any changes to your code that I would have to make?

  84. Tony Roberts said,

    February 15, 2012 @ 10:29 am

    Hi
    I’m a little confused by the use of reverse biasing. In the first diagram of this blog, the word is phototransistor but the symbol is a diode. Everything I read about phototransistors says you don’t reverse bias them. Perhaps this is why people were complaining about low sensitivity?
    Regards
    Tony Roberts

  85. DIY Pentax IR Lightning Trigger « New Hardpan said,

    February 27, 2012 @ 3:14 pm

    [...] The page I found that contained his early lightning trigger using Arduino is here. [...]

  86. DIY Lightning Trigger for Digital Cameras « Hardpan.com said,

    March 14, 2012 @ 10:42 am

    [...] There are many other people on the internet that have used micro-controllers to make triggers. My inspiration for this trigger is based on information I found online (here). [...]

  87. 555 timer Tutorials said,

    March 15, 2012 @ 12:52 pm

    great job. now i know how to use infrared photo transistor and arduino.. thanks for this project
    if you have time check out my lens on BJT..also expectin a comment…
    http://www.squidoo.com/how-bipolar-junction-transistor-works

  88. DIY Pentax IR Lightning Trigger Version 3 « Hardpan.com said,

    March 19, 2012 @ 8:55 pm

    [...] The input code is based on information from Maurice Ribble who makes the CameraAxe (a wonderful camera trigger for anyone who has a wired connection for the shutter trigger, and would rather purchase a complete trigger mechanism).  The page I found that contained his early lightning trigger using Arduino is here. [...]

  89. DIY Pentax Wireless IR Lightning Trigger Version 4 « Hardpan.com said,

    March 19, 2012 @ 10:45 pm

    [...] The input code is based on information from Maurice Ribble who makes the CameraAxe (a wonderful camera trigger for anyone who has a wired connection for the shutter trigger, and would rather purchase a complete trigger mechanism). The page I found that contained his early lightning trigger using Arduino is here. [...]

  90. grubbs said,

    May 30, 2012 @ 5:06 pm

    how hard is this for someone who has no experience in this area at all?

  91. ayasystems said,

    June 1, 2012 @ 5:21 am

    Hi.

    I want share with you my modifications with you. Thanks!

    // Maurice Ribble
    // 6-1-2008
    // http://www.glacialwanderer.com/hobbyrobotics

    // This code uses my camera trigger and lightning detector.
    // It waits for a sudden change in the light intensity
    // and then triggers the camera.

    #define SHUTTER_PIN 7
    #define LIGHTNING_TRIGGER_ANALOG_PIN 0
    #define TRIGGER_THRESHHOLD 5
    #define STATE_LED 13

    int lightningVal = 0;
    // Variables will change:
    int shootTime = 1000; // May want to adjust this depending on shot type ms
    long previousMillis = 0; // will store last val was update
    long interval = 5000; // interval to update light reference value ms

    void setup()
    {
    pinMode(SHUTTER_PIN, OUTPUT);
    pinMode(STATE_LED, OUTPUT);
    digitalWrite(STATE_LED, LOW);
    digitalWrite(SHUTTER_PIN, LOW);
    Serial.begin(9600); // open serial
    readValue();
    }

    void loop()
    {
    int cmd;
    int newLightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
    Serial.println();
    Serial.print(“Store light: “);
    Serial.print(lightningVal, DEC);
    Serial.print(” Actual light: “);
    Serial.print(newLightningVal, DEC);
    Serial.println();
    if (abs(newLightningVal – lightningVal) > TRIGGER_THRESHHOLD)
    {
    Serial.println(“=================”);
    Serial.println(“Shutter triggered”);
    Serial.println(“=================”);
    digitalWrite(SHUTTER_PIN, HIGH);
    digitalWrite(STATE_LED, LOW);
    delay(shootTime); // May want to adjust this depending on shot type
    digitalWrite(SHUTTER_PIN, LOW);
    digitalWrite(STATE_LED, HIGH);

    }

    unsigned long currentMillis = millis();

    if(currentMillis – previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;
    readValue();
    }
    }

    void readValue(){
    Serial.println(“Refresh Value”);
    lightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
    }

  92. Melani said,

    July 26, 2012 @ 2:35 pm

    I have the first original program for the lightning trigger in my arduino. If I want to modify it to work with a laser trigger and fire the camera when the beam is broken instead of when it reconnects, how would I do that?

  93. lacrosse1991 said,

    August 14, 2012 @ 5:42 pm

    Hello, with the photo transistor you use in this project, could someone please post a link to it as i’ve tried one that I bought from radioshack, but while testing it, it only seemed to work if the lightsource was pointed directly at the top of the transistor, from the side it did nothing, here is the one I’ve used http://www.radioshack.com/product/index.jsp?productId=2049724 which did not work well, although i gave a photocell/photoresistor a try and it worked perfectly, although when the time comes for capturing lightning i would prefer to have a faster response time, so if someone could give me a link to the phototransistor that they have used I would really appreciate it, thanks!

  94. Daniel said,

    August 16, 2013 @ 6:30 am

    Hi, my nikon can only be triggered by connecting the yellow adn the red wiring together with the white cabel at the same typ, will this circuit be able to do so?

    /Daniel

RSS feed for comments on this post