Offline
Newbie
Karma: 0
Posts: 12
|
 |
« on: December 04, 2012, 08:22:04 pm » |
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!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #1 on: December 04, 2012, 08:24:45 pm » |
It is a miracle that it actually worked.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 31
Posts: 1731
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #2 on: December 04, 2012, 08:25:06 pm » |
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?
|
|
|
|
« Last Edit: December 04, 2012, 08:28:14 pm by HazardsMind »
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #3 on: December 04, 2012, 09:37:04 pm » |
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.   
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 31
Posts: 1731
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #4 on: December 04, 2012, 10:36:36 pm » |
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.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Dallas, TX
Offline
Sr. Member
Karma: 10
Posts: 318
|
 |
« Reply #5 on: December 05, 2012, 11:45:21 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Norfolk UK
Offline
Edison Member
Karma: 25
Posts: 1421
|
 |
« Reply #6 on: December 05, 2012, 12:43:33 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #7 on: December 05, 2012, 08:24:10 pm » |
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 { } }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #8 on: December 05, 2012, 08:26:49 pm » |
Oh, and HazardsMind- you are right. I checked my wiring, and did misdraw the wires/resistor in my diagram. Thanks!
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 31
Posts: 1731
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #9 on: December 05, 2012, 11:25:22 pm » |
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.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Norfolk UK
Offline
Edison Member
Karma: 25
Posts: 1421
|
 |
« Reply #10 on: December 06, 2012, 02:30:26 am » |
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...
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #11 on: December 06, 2012, 07:25:04 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
Norfolk UK
Offline
Edison Member
Karma: 25
Posts: 1421
|
 |
« Reply #12 on: December 07, 2012, 02:51:08 am » |
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 http://arduino.cc/en/Reference/AttachInterrupt
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Online
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #13 on: December 07, 2012, 05:21:06 am » |
but analogue read takes slightly longer than digital read sp. "but analogue read takes a lot longer than digital read"
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Norfolk UK
Offline
Edison Member
Karma: 25
Posts: 1421
|
 |
« Reply #14 on: December 07, 2012, 05:47:02 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|