DIY Camera Lightning Trigger

Three Lightning Bolts
Three Lightning Bolts

Three Bolts (f/8, 15s, ISO400)

For some time now, I’ve been looking for a better way to capture incredible lightning photos other than pushing the shutter button over and over hoping to catch a bolt.  The image on the left was a 15-second exposure that luckily captured two lightning bolts in the same frame.  The third bolt was added from a second frame a few minutes later.

Some commercial lightning triggers are available, if you’re willing to part with a few hundred dollars, which I was not, for an experimental endeavor.  So I started researching home brew solutions that would allow me to tinker while also saving a bunch of money.  Enter: Arduino – a powerful open source prototyping platform utilizing ATmega programmable microcontrollers.

At this point I would like to thank Maurice Ribble for his incredible work on the original iteration of this shutter trigger, which over the last few years he has developed into a full blown automatic triggering solution using any number of inputs including light, laser, sound, or motion, now known as Camera Axe.

That all said, I didn’t need high speed flash/camera triggers for photographing things blowing up (although it sounds like a lot of fun), or the tons of features and options of the Camera Axe.  However, I did want a solution versatile enough to modify or add on to later, if I wanted.  So I bought an Arduino UNO board with an ATmega328, dusted off my old breadboard, and started experimenting with a few components.  In the end, I ended up with a circuit based on Maurice’s original design, but incorporating some of the tweaks from his newer circuits, and an optimized version of code.  Details below show how you can make your own.  Note that mine is based on inputs for my Canon 40D (now using the Canon 5D Mark III).

Breadboard with Arduino

Arduino board with my messy breadboard prototype

 

Circuits

There are three parts to the circuitry for this project.  First and foremost, the microcontroller mentioned above, which runs the code and powers the inputs and outputs.  Second, we need a sensor for detecting the lightning flashes.  Finally, we need the shutter trigger mechanism.

Trigger Circuit

Trigger Circuit Interface to Arduino Board

The circuits on the left show the input and output interfaces as they connect to the Arduino.  For added flexibility, instead of hard wiring everything, I decided to use 3.5mm stereo jacks for the sensor input and camera output.  This way, I can later connect different sensors for high speed photography without rebuilding the circuit board.

The input circuit provides 5V power to the sensor port, which in this case goes to a phototransistor.  The phototransistor detects light at time intervals determined by the programming and clocking of the processor.  When the light level changes from one interval to the next, there is a change in the voltage level which is detected on the analog port of the arduino.  Programming says “if the change is more than X threshold, trigger the camera”.

A signal is then sent to one of the Arduino’s digital ports, changing that port’s voltage from a low (off) state to a high (on) state.  The transistors on the output circuit act as solid state switches, which just mimic the mechanical switch of a tethered camera remote (cable release).  At this point, the digital output port is put back into low (off) state, and the light detecting loop continues.

The circuit shown here was done using Eagle, you can download my files here.

 

Parts List

I bought most of the parts I needed from Mouser Electronics, they have everything you might need and more, just be sure to buy a decent amount of stuff, otherwise it doesn’t really work out well on shipping.  Radio Shack might have some common components if you’re stuck needing something at the last minute, but I wouldn’t count on finding the exact part.  Outside of the list below, you’ll need some copper clad prototyping board, a power switch, and a box to stuff it all in (the one I bought was a bit cramped).

Part ID Part# / Description
D1-D4 SD101C-TR Schottky Diodes (1N4148 are ok also, not quiet as fast)
R1-R2 150 ohm 1/4 W Resistors
R3 30 ohm 1W Resistor
R4-R5 10 kohm 1/4W Resistors
R6 1 kohm 1/4W Resistor
T1-T2 2N2222 NPN Transistors
T3 2N2907 PNP Transistor
A0/D0 Pin Headers
n/a 3.5mm Stereo Jacks (2)
n/a 9V Battery holder / contacts

 

Code

The programming code for this is really basic, and is written using Arduino Programming Language.  The code below is optimized to read and modify ports directly, rather than use functions to do so.  While this isn’t really recommended, it shaves some precious time off each loop as the code runs.  Precious time, you ask?  A lightning strike on average lasts about 100ms.  The shutter lag for my camera, the Canon EOS 40D is about 59ms.  Add another few ms for the program to run, and there’s not that much spare time to capture a bolt in the frame.  So if I can get the code from milliseconds down to microseconds, it can make a difference.  The code is shown below, or download:

//beginning
#define SENSOR1_POWER_PIN     15
#define SENSOR1_APIN           2
#define SENSOR1_PIN           16
#define SENSOR1_TIP_PIN       17

#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 last_loop_light = 0;
int this_loop_light = 0;
int threshold = 10;      // light change threshold

void setup()
{
  pinMode(SENSOR1_PIN, INPUT);           // set sensor pin
  pinMode(SENSOR1_TIP_PIN, INPUT);       // set sensor pin
  pinMode(SENSOR1_POWER_PIN, OUTPUT);    // pinmode for powering sensor
  digitalWrite(SENSOR1_POWER_PIN, LOW);  // set transistor base to LOW to switch power on

  //Serial.begin(9600);  // uncomment for debugging

  sbi(ADCSRA,ADPS2) ;    // some digital conversions
  cbi(ADCSRA,ADPS1) ;
  cbi(ADCSRA,ADPS0) ;

  DDRD = DDRB | B10000000; // initialize digital registers

  PORTD = B00000000;       // initialize digital pins 0-7 low

  last_loop_light = analogRead(SENSOR1_APIN);  // read light level
}

void loop() {

  this_loop_light = analogRead(SENSOR1_APIN);  // read light level

  if ((this_loop_light - last_loop_light) > threshold) // compare light levels
  {
    PORTD=B10000000; // set pin6/7 high (trigger camera)
    delay(100);      // wait 100ms
    PORTD=B00000000; // set pin7 low (reset trigger)

    // uncomment following for debugging:
    //Serial.print("old:");
    //Serial.print(last_loop_light,DEC);
    //Serial.print(", new:");
    //Serial.println(this_loop_light,DEC);
  }

  last_loop_light = this_loop_light;  // set current light level
}
//end

 

Build

Only thing left to do now is build it!  There’s a few ways of putting together a circuit board, by either positioning and wiring components on a solderless proto board, using a proto board with solder points, like I did in this case, or etch your own copper clad PCB.  There are also companies that specialize in PCB creation, such as Batch PCB.  However, it can take many weeks to get a board, and if it ends up being a bad design you need to start all over.

Circuit Board Layout

Printed Circuit Board Layout

Completed Prototype Circuit Board

Completed Prototype Circuit Board

 

 

 

 

 

 

 

 

 

 

The circuit board above was designed as a Arduino “shield” or daughter card, that is placed on top of the UNO board, directly interfacing using the header pins.  Alternatively, you can use the UNO board to program the microcontroller, and build a more elaborate circuit around that so everything is on a single board.  Since I wanted to use my Arduino board for more things in the future, I opted for the shield design.

Circuit in Enclosure

Completed PCB in Enclosure

Interface Ports

USB Interface for Arduino, Camera Output, Sensor Input Ports  (I’ll admit, looks a little ghetto)

 

 

 

 

 

 

 

 

Stuff the completed circuit board into an enclosure (in which you’ll have to cut / drill some holes for interface ports), wire up the battery and power switch, and you’re finished!  Since I wanted programming access to the Arduino board without having to open the box, I cut a hole for the USB port.  The USB port on the Arduino board can also be used with external power, in case you don’t want to use the 9V battery.  I also mounted the 3.5mm stereo jacks on the same side so all of my cables are on one side.  Speaking of cables, that’s what needs to be made to interface with the camera.  The 40D, along with many other Canon cameras use a proprietary N3 connector.  I cut my Canon RS-80N3 cable release in half, and attached 3.5mm stereo jack and plug on the ends so that I can still use my remote while optionally using the N3 connector for the lightning trigger.

Lastly, assemble the light sensor per the circuit design previously shown.  The phototransistor and resistors can be hard wired and soldered together, or for a cleaner look, can be mounted to a tiny PCB.  This is what I did, and then protected the PCB with heat shrink tubing.

Canon N3 Connector Pinout

Canon N3 Connector Pinout

Canon RS-80N3

Modified RS-80N3 Cable Release

Light Sensor

Light Sensor

 

Shoot!

Time to get out and test the rig.. Perhaps in the near future I’ll write up a tutorial on night and lightning photography, but in the mean time, here’s the quick and dirty.  For my initial tests, I set my camera to manual f/8 for 10 seconds at ISO 100, based on metering the night scene.  As night turned to day, I changed my camera to Aperture Priority mode, still at f/8 and ISO 100.  The first storm of the spring season produced the results here:

Lighting Trigger Test

Lightning Photography with DIY Shutter Trigger