Trying to optimize a flash trigger

Hi everyone,
I have been working on a basic laser trigger for flash photography. Where a laser shines on a photodiode, and when the laser beam is broken, it triggers a flash.
The design works, but now I would like to optimize it and am looking for suggestions to increase the speed/ sensitivity, or any general tips for the design. Below is the a pic of the schematic. Any feedback would be awesome.


Thanks!

It is a miracle that it actually worked.

Why does the photoresistor have a wire going straight to ground, and A0? That might need a resistor. Are the X's nodes or not connected points? If so then I will add, Why does the photoresistor have a wire going straight to ground, A0 and VCC, thats a short.

Does it work?

Yes, it works fine. I got the wiring for the photoresistor from a couple of tutorials. It is wired the same in all of them.
http://playground.arduino.cc/Learning/PhotoResistor
PhotoR 10K
+5 o---///--.--///---o GND
|
Pin 0 o-----------

There is a resistor after the photoresistor (immediately to the right of the resistor 10Kohm).
The X nodes are not linkek, I was having a hard time not having wires cross. This was my first attempt at tinyCAD.

Below are a couple of pictures Ive taken with it.


Im sure it works correctly but your diagram is still wrong. Look at your diagram again, and look at this again, something is connected to the wrong spot.

PhotoR 10K
+5 o---///--(right here)--///---o GND
|
Pin 0 o-----------

Your A0 wire is connected to ground instead of being connected between the PR and ground.

Anyway, diagrams aside, How much faster do you want it to get, because it does have limitations based on the arduino's processing speed.

What is the purpose of the Arduino? You could speed the response time up by removing it.

Perhaps you are using it to insert delays between the time the LASER beam is broken and the time the flash occurs. If that is the case, you will need to post your code before anyone can suggest ways to optimize it.

It might be quicker reacting and more consistent if you could use a digital pin in interrupt mode to read a optical photo detector with logic output.

I chose this project and am using an arduino because I am interested in photography and also thought it would be really fun to learn how to use an arduino. I think the trigger is pretty fast as is (the colored vials were photographed before they even hit the water). But since this is my first project, I am really interested in how I could wire/ program things better, so that I can use the knowledge for future projects.
Riva- Thanks for the suggestion. Right now though I am not sure what you mean (just got home and haven't looked into it yet).
Also I was wondering, would using serial.println cause any delays in the process?
Below is my code. Thanks!

/* Laser triggered flash using pot for delay
*/

int photocellPin = A0;     //photocell and 10k pulldown resistor
int photocellReading;      //value of photocell reading
int LEDpin = 11;           //activate optoisolator
int laser = 3;             //activate transistor, complete current to laser
int delayPot = A5;         //get value from potentiometer to adjust delay from 0-1023 ms, gets recorded to delatTimer

int sensorValue = 0;       //phototransistor sensor value
int sensorMin = 1023;      //minimum sensor value
int sensorMax = 0;         //maxiumum sensor value

int delayTimer = 0;             //delay timing of flash



void setup(void)
 {
   Serial.begin(9600);

   pinMode(13, OUTPUT);   //LED light, on when calibrating
   pinMode(11, OUTPUT);   //Power to optoisolator to trigger FLASH OR ACTION
 
   digitalWrite(11, LOW);     //turn off current to optoisolator
   digitalWrite(13, HIGH);    //turn on Arduino LED while measuring high/low light
   digitalWrite(laser, HIGH);   //turn on laser
   while (millis() < 5000)      //during the first 5 seconds determine light range          
     {
       sensorValue = analogRead(photocellPin);      
       Serial.println("Calibrating");
       if (sensorValue >sensorMax)       //determine max sensor value
        {
          sensorMax = sensorValue;
        }
       if (sensorValue < sensorMin)      //determine min sensor value
        {
          sensorMin = sensorValue;
        }
     }
    digitalWrite(13, LOW);                   //turn off LED, indicates calibration is complete
    Serial.print("Max sensor Value = ");     //print max sensor value
    Serial.println(sensorMax);
    Serial.print("Min sensor Value = ");     //print min sensor value
    Serial.println(sensorMin);
    sensorMin = sensorMin - 2;               //adjust min sensor value  TRY REMOVING
    Serial.print("New sensorMin");
    Serial.println(sensorMin);
 }

void loop()
 {

   sensorValue = analogRead(photocellPin);    //read photocellPin;
   delayTimer = analogRead(delayPot);         //get delay before triggering flash from pot value
   Serial.println(delayTimer);                //print delay taken from pot
   
   if (sensorValue < sensorMin)                       //if light to phototransistor is reduced, begin flash procedure
     {
       Serial.print("FLASH Analog reading =  ");      //display sensorValue
       Serial.println(sensorValue); 
       digitalWrite(laser, LOW);                      //turn off laser so beam is not in photo
       Serial.print("Now delaying");                  //delay from potentiometer setting
       Serial.println(delayTimer);
       delay(delayTimer);
       Serial.println("delayed");
       digitalWrite(11, HIGH);       //current to optoisolator, trigger flash
       delay(100);                   //keep current going to make sure flash is triggered
       digitalWrite(11, LOW);        //turn off flash trigger
       digitalWrite(laser, HIGH);    //turn laser back on
       delay(500);                   
       Serial.println("READY");      //ready for next photo
     }
    else
     {
      }
  }

Oh, and HazardsMind- you are right. I checked my wiring, and did misdraw the wires/resistor in my diagram. Thanks!

Serial.println will most certainly slow it down.
You can use it for maybe debugging the system, but having all of them in will slow it down.

Riva- Thanks for the suggestion. Right now though I am not sure what you mean (just got home and haven't looked into it yet).
Also I was wondering, would using serial.println cause any delays in the process?

Serial .print statements between reading the trigger and firing the flash will slow things down and will make results less repeatable.
At the moment your reading an analogue pin to determine if beam is broken but analogue read takes slightly longer than digital read. If you could use a photo detector with a logic output connected to a digital pin then the detection will be quicker. If you use an external interrupt pin (2 or 3) then the detection of the trigger could probably be even quicker than polling and free your program to do other tasks while waiting (balance the economy maybe). I'm not sure how accurate you want the results to be but doing it this way would be more repeatable. Is this way worth all the hassle compared to your current setup...

Hi Riva, I like your idea on using an interrupt to trigger the flash. I found this code (tutorial), and was wondering if I could use use something like it. I am guessing that I would still need to calibrate the light sensor and use the minimum value as the threshold to trigger the interrupt. Am I on the right track? (I don't have my arduino with me, so I can't play with it yet).
Also, right now, the response time is pretty quick. taking pictures of things before they hit the water isnt quite as exciting. Once I have room, I would like to try and sense a bullet (or more likely a BB) passing through an IR detector and taking a picture of something getting shot. I definitely think this would help with accomplishing that.

// Definition of interrupt names
#include < avr/io.h >
// ISR interrupt service routine
#include < avr/interrupt.h >


// LED connected to digital pin 13
int ledPin = 13;
// This is the INT0 Pin of the ATMega8
int sensePin = 2;
// We need to declare the data exchange
// variable to be volatile - the value is
// read from memory.
volatile int value = 0;

// Install the interrupt routine.
ISR(INT0_vect) {
  // check the value again - since it takes some time to
  // activate the interrupt routine, we get a clear signal.
  value = digitalRead(sensePin);
}


void setup() {
  Serial.begin(9600);
  Serial.println("Initializing ihandler");
  // sets the digital pin as output
  pinMode(ledPin, OUTPUT);
  // read from the sense pin
  pinMode(sensePin, INPUT);
  Serial.println("Processing initialization");
  // Global Enable INT0 interrupt
  GICR |= ( 1 < < INT0);
  // Signal change triggers interrupt
  MCUCR |= ( 1 << ISC00);
  MCUCR |= ( 0 << ISC01);
  Serial.println("Finished initialization");
}

void loop() {
  if (value) {
    Serial.println("Value high!");
    digitalWrite(ledPin, HIGH);
  } else {
    Serial.println("Value low!");
    digitalWrite(ledPin, LOW);
  }
  delay(100);
}

I found this code (tutorial), and was wondering if I could use use something like it. I am guessing that I would still need to calibrate the light sensor and use the minimum value as the threshold to trigger the interrupt. Am I on the right track?

To use an interrupt pin you would really need a logic level photodetector that is either on or off depending on light level, unlike the version you appear to be using that has a varying value depending on light level. A logic level device should need no calibrating.
This idea raises potential problems with ambient light levels not causing the device to trigger unless you use one with filters fitted to mask ambient light like an IR Photodetector like this http://www.datasheetcatalog.org/datasheet/vishay/81571.pdf You may then need to switch to using a different wavelength laser or a suitably matched IR photodiode
The interrupt code could just use arduino command attachInterrupt() - Arduino Reference

but analogue read takes slightly longer than digital read

sp. "but analogue read takes a lot longer than digital read"

AWOL:

but analogue read takes slightly longer than digital read

sp. "but analogue read takes a lot longer than digital read"

Thanks AWOL, "13-260 µs Conversion Time" is a bit more than slightly.

Figure on a shade over 100microseconds for a normal conversion.