Hi, this is my first posting to exhibition...
I made a high speed flash trigger using a laser and light dependent resistor. The relay is a 4N25 optoisolator with the codes below.
Feedback, comments and suggestions are welcome ![]()
/*
High Speed Flash Trigger with LCD output
Instructions for use :-
1. Align mirror to position beam to the light sensor (LDR).
2. When LCD notify that the laser is aligned, press the push button once
3. Now your laser sensor is ready to trigger the flash when laser is cut
4. Drop objects to cut the laser
5. Once the laser is cut, the flash will wait for flashDelay miliseconds
before firing the flash and wait for 5 seconds
6. If you need to test the flash trigger, press the button when the laser
is not align
Arduino pins :-
Analog Pin 0 - light sensor
Digital Pin 4 - laser
Digital Pin 9 - optoisolator
Digital Pin 10 - push button
Optoisolator (4N25) pins :-
Pin 1 - from Arduino Pin 9
Pin 2 - 220R to ground
Pin 4 & 5 connect to flash hotshoe
By Stanley
e-mail : stanleyseow@gmail.com
*/
#include <LiquidCrystal.h>
// My wiring for LCD on breadboard
LiquidCrystal lcd(12, 11, 5, 6, 7, 8);
/*
* High Speed Photography with Optoisolator, laser and LDR
*/
int ledPin = 13; // LED pin
int ldrPin = 0; // LDR Sensor connected to Analog
int flashPin = 9; // Optoisolator/Flash output
int laserPin = 4; // Laser pin
int buttonPin = 10; // Button pin
int ldr = 0;
int buttonStatus = 0;
int flashDelay = 0; // 1000 = 1 sec
void setup() {
pinMode(flashPin,INPUT); // Set the optoisolator as input
pinMode(buttonPin,INPUT); // Read the ready button
pinMode(laserPin,OUTPUT); // Turn laser on or off
pinMode(ledPin, OUTPUT); // Set the LED pin as output
// Serial.begin(9600);
// LCD format is Col,Row
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("HS Laser Trigger");
lcd.setCursor(0,1);
lcd.print("Version 1.0");
delay(2000);
lcd.clear();
}
void loop(){
digitalWrite(laserPin, HIGH); // turn on the laser
digitalWrite(flashPin,LOW);
ldr = analogRead(ldrPin); // read light value
if ( ldr < 100 && buttonStatus == 0 ) {
lcd.setCursor(0,0);
lcd.print("Laser aligned ");
lcd.print(ldr);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Press button now");
digitalWrite(ledPin,LOW);
} else {
lcd.setCursor(0,0);
lcd.print("Adjust mirror ");
lcd.setCursor(0,1);
lcd.print("till aligned ");
lcd.print(ldr);
}
if ( digitalRead(buttonPin) == HIGH ) {
buttonStatus = 1;
}
if ( buttonStatus == 1 ) {
// Sensor ready, read the LDR for any cut in the laser
lcd.setCursor(0,0);
lcd.print("Laser ready ");
lcd.setCursor(0,1);
lcd.print("Cut laser 4flash");
digitalWrite(ledPin,LOW);
if (ldr > 150) { // check if the laser is cut
digitalWrite(laserPin,LOW); // off the laser
delay(flashDelay);
digitalWrite(flashPin, HIGH); // triggered the flash
digitalWrite(ledPin, HIGH); // turn on the LED
lcd.setCursor(0,0);
lcd.print("Flash triggered"); // display message on LED
lcd.setCursor(0,1);
lcd.print("Wait for 5 secs "); // display message on LED
delay(5000); // Wait for 5 seconds
lcd.clear();
buttonStatus = 0; // Reset the button sensor
digitalWrite(ledPin,LOW); // Turn off the LED
} // End if
}
delay(10);
}