Saturday, 26 February 2011

Camera flash trigger project

When drops collide

OK so I've seen a few camera flash projects based on the Arduino, but here's my take on the problem: How to fire the flash to capture a very quick action on camera?

The first problem was 'how do I trigger a flash without frying my Arduino board and/or USB port?'...

Some digging around on the web and I eventually found that a camera flash simply works when its trigger pins/terminals are connected together, so no fancy digital signal generators etc required - unless you're talking to a modern flash with zoom, TTL etc :-/  That might be another project...

For my flash trigger I went wireless both for flexibility on where the flash can be positioned and because it meant I could trigger a nice low voltage wireless flash master instead of a buzzing, IC-melting, kilovolt flash unit :) My wireless trigger set is the el-cheapo Chinese type you can get from Amazon and Ebay.

It seems opto-isolators are popular as switches to de-couple the flash from the sensitive digital circuits. However, I used an NPN transistor with a common ground on the emitter and the other flash trigger terminal connected to the collector.

Next up, making a laser trigger to capture the action!

For this part of the system I hacked up an old laser pointer (sorry Raj) and bypassed its microswitch with my own leads. This was controlled by a digital output pin on the Arduino through another NPN transistor, switching the 3.3V rail to the laser module. A simple light dependent resistor (LDR) became the laser sensor. Making a voltage divider with a 1KR resistor, the Arduino reads in an analogue value that for the voltage across the LDR.

Now for the programming bit...

I didn't want the laser on continuously, so I set the laser to come on briefly, then read the LDR voltage, then shut off the laser all in the space of 1-2 microseconds. This was a vague intention to save power and limit the laser output both for eye safety and to reduce the light output that might be picked up on the camera. The programme checks if the light level has changed more than a set amount since the last pulse and if it has it fires the flash. Simples!

The trigger then waits for a second before starting up again. Note there are a few serial statements commented out that I used to check the LDR output.

Here's the code...
Matt Wright 2011

Flash trigger circuit with laser-beam-breaker


int pulse_timeout_ms = 1000;
int last_beam_value;
unsigned long beam_timer;
int beam_rate_ms = 50;
int last_beam_val = 0;
int curr_beam_val = 0;
boolean trig_last_cycle = false;

void setup()

//  Serial.begin(9600);
  //trigger pin
  pinMode(7, INPUT); 
  // signal pin to the flash tranny
  pinMode(8, OUTPUT);
  //light up an LED so we know its doing something
  pinMode(13, OUTPUT);

  // trigger for the beam breaker laser 
  pinMode(4, OUTPUT);

void loop()
  // check for beam break every 10 ms-1
  if((millis()-beam_timer > 10))
    beam_timer = millis();

void check_beam_switch()
  digitalWrite(4, HIGH);
  // wait a millisec to let valves warm up, light to get moving etc... :)
  curr_beam_val = analogRead(A0);
  // turn off the light source
  digitalWrite(4, LOW);
//  Serial.println("trig voltage: " + String(curr_beam_val));
  //check for a significant change in light level...
  if((abs((curr_beam_val - last_beam_val)) > 30) && !trig_last_cycle)
     //Serial.println("triggered by beam!");
     trig_last_cycle = true;
  }else if(trig_last_cycle)
     trig_last_cycle = false;
  last_beam_val = curr_beam_val;

void check_manual_trig()
 if(digitalRead(7) == LOW)

void trigger_flash()
   digitalWrite(13, HIGH);
   digitalWrite(8, HIGH);
   digitalWrite(8, LOW);
   digitalWrite(13, LOW);

Pics of the box and laser rig to follow... 8-]

No comments:

Post a Comment