Have you ever wanted to take crisp photos of lightning during a storm without having to rely on chance or leaving the camera on a really long exposure. You have just under 200 milliseconds to see the lightning, push the camera’s shutter release and allow the camera time to take the photo which is next to impossible to get right once, never mind for a range of photos. You need an automatic camera trigger to get the shot.
The Arduino lightning trigger is the answer, it will detect the lightning strike and trigger your camera for your to ensure that you get the right timing and a clear photograph. All you need is an SLR camera which is able to be remotely triggered, an Arduino controller and a couple of cheap components.
You can also use this device to trigger your camera from far away using a laser pointer.
What You Will Need For An Arduino Lightning Camera Trigger
- An Arduino (Uno used here)
- An LDR (Light Dependent Resistor)
- A 10K Resistor
- A 220Ω Resistor
- An Optocoupler (4N35 Used Here)
- Camera Trigger Connection Lead
How To Build A Lightning Camera Trigger
The LDR is the sensor in this project, the light from the lightning changes the resistance of the LDR which the Arduino detects as a change in voltage and the Arduino then triggers the camera through the optocoupler. The optocoupler is not entirely necessary and you can get around using one by assigning the pins on the Arduino differently however, for the few cents it costs, it offers isolation and protection for the camera which can cost a few hundred or thousand to repair if the Arduino puts the wrong signal or voltage onto the cameras trigger terminals and damages the cameras circuitry.
Assemble The Components
First you need to assemble your components, if you are making a temporary trigger then a breadboard is perfect. Assemble the components as shown in the diagram below. Note that the LED and battery are merely used in this example to illustrate that the optocoupler has been triggered, in reality these shouldn’t be connected as you don’t want a voltage to be applied to the camera trigger.
Connect your camera trigger cable’s ground to the purple wire going to the black header and the cable’s shutter release to the orange wire on the header.
Note that the optocoupler is only used to trigger the shutter release pin on your camera, your camera’s trigger cable may have three wires, the third is to remotely trigger the focus. Triggering the focus has been omitted in this project as it generally takes too long for the camera to focus and trigger in the time that the lightning is visible. The camera should therefore be used in manual focus mode. If your camera insists on the focus pin being used to release the shutter then connect it to the ground pin and this keeps the camera focus locked.
Upload the Sketch
Now you can upload your sketch onto your Arduino, if you haven’t uploaded a sketch before then follow this guide on getting started.
//The DIY Life
//13 December 2016
int shutterPin = 2; //Assign the LDR and optocoupler pins
int triggerPin = 0;
int triggered =0;
pinMode(shutterPin,OUTPUT); //Define the shutter pin as an output
digitalWrite(shutterPin,LOW); //Set the shutter pin to low / off / no voltage
triggered = map(analogRead(triggerPin), 0, 1023, 0, 1023); //Read the output from the LDR
if (triggered >= 100) //If light is detected, trigger the camera
delay(50); //Wait for lightning to be the brightest
digitalWrite(shutterPin,HIGH); //Trigger camera
digitalWrite(shutterPin,LOW); //Reset camera trigger output for next photo
triggered = 0;
Here is the link to download the Lightning code.
The code first assigns the shutter release to pin 2 and sets the output to Low or Off.
Next the Arduino takes constant readings from the LDR until the reading exceeds the set point in Row 18 (100 in this case). The controller then activates the optocoupler which triggers the camera.
Calibrate the Set Point & Timing
There are two settings which need to be adjusted to suit your light conditions and your camera’s timing.
The first is the trigger sensitivity, the number in line 18 which is tested by the if statement. In this case, it is set to trigger on any value over 100 which is suitable for quite dark surroundings and will trigger with a small amount of light. If the sensitivity is too high, the camera will be set off all the time, adjust this parameter upwards with a higher number. If the sensitivity is too low and the camera is missing lightning strikes then adjust this parameter downwards with a lower number. This parameter will probably have to be changed every time you use the trigger as it is dependent on the current conditions.
The second parameter to adjust is the timing in line 20. This depends on two things, one is how bright and developed you want the lightning to appear in the photograph and the second is how fast your camera responds to the trigger command. More modern cameras react faster and therefore longer delays are needed to allow the lightning to fully develop before triggering the camera. Adjust the delay to be shorter if the camera is missing the lightning and longer if the camera is taking the photo before the lightning is fully developed.
Would you like to learn more about this project? Are you interested in projects similar to this one? Then Practical Arduino Projects is the book for you, available now on Amazon as an eBook or in Print form.
Have you tried any other methods for taking photos of lightning? Let us know in the comments section below.