High Speed Photography Flash Trigger by Sound or Laser Barrier (Arduino)

9,132

127

14

Introduction: High Speed Photography Flash Trigger by Sound or Laser Barrier (Arduino)

About: Photography enthousiast, DIYer, Drone amateur

Introduction

High-speed photography can be a game of trial and (much) error. When I started experimenting, I would repeat the same action (breaking bottles / popping balloons / dropping objects in water / ...) while my camera was on burst mode. Shooting at 7 frames per second sometimes gave me a few usable results, but it was hard to repeat and be consistent. At the end of a session, you end up with hundreds of pictures you have to sift through...

That's why I bought an Arduino to help me get the timing right. In this instructable (my first!) I will show you how to build an Arduino based flash trigger for high speed photography. The trigger can be activated by sound, vibration or by breaking a laser beam.

This build is not easy but the end result is worth it. You can buy similar systems but they will set you back hundreds if not thousands of euros / dollars. I found that this approach taught me something and gives me more options for customising and adding features, not to mention more money in the bank!

In high speed photography, you want to open the shutter of your DSLR camera (or another type of camera with full manual control which will accept a remote cable) in a pitch black room and trigger the flash at the exact moment the action you want to capture is happening. As the room is pitch black, the sensor will only capture light when the flash is fired for a few milliseconds, thus freezing the action perfectly.

Some examples of the applications I have used this setup for are:

  • shooting beer or soda cans with a pellet gun and catching the explosion (*)
  • water drop photography
  • paint dancing on a subwoofer

Other ideas I have yet to do:

  • catching a bird in mid-air as it comes in to land
  • catching a picture of lightning
  • ...

* funny story: did you know that when you are aiming your pellet gun to shoot full soda or beer cans you are directly in the spray line of said soda or beer? Turns out my buddy didn't know that and he got covered in beer from head to toe...

I'm entering this Instructable in the Arduino Competition, so please vote for me if you made this or if you liked the Instructable! Thanks!

Disclaimer: A flash gun uses very high voltages to flash. It's necessary to isolate this from your circuit or it could damage your Arduino or even worse, your expensive camera! You always do this on your own risk! I will not accept any liability or claims.

Warning: Working with lasers is dangerous to your eyes! Never look into the laser beam!

Parts

  • An Arduino (I am using the arduino UNO)
  • A DSLR camera (or a camera with similar features)
  • A tripod (or 2 so you can support your flash)
  • A breadboard and some jumper wires
  • A simple pushbutton (for breadboard) (pimp to foot-switch)
  • A few LEDs to light up your area of work while the lights are off
  • A few jumper wires with crocodile clamps to attach sensors in odd places
  • A Laser diode
  • A Photocell
  • A few optocouplers (I used the 4N35 type)
  • Two 2.5mm audio jack cables (not the same size as the 3.5mm jack of headphones!)
  • A Piezo
  • A few resitors
  • A computer with arduino software / USB cable / a USB powerbank to power your Arduino if you're not comfortable having your computer so close to the action (paint / water / pellet guns hazards / ...)

Step 1: Lights, Camera, Action! How Will We Use Lasers and Arduino?

What do we need for this to work?

  • The sensors need to talk to the Arduino
  • The Arduino needs to trigger the flash at the right time

What would be nice to have, but not necessary?

  • The Arduino should be able to communicate with the camera (spoilers: it can)
  • The Arduino should be able to dim the lights while the shot is taken and turn them back on afterwards (this will save me a lot of running around to the light switch)

How are we going to do this?

  1. You start with the lights on
  2. Push the pushbutton on your breadboard to dim the lights
  3. After a chosen delay, the shutter of your camera will open for a set time (use BULB, Manual or TV mode)
  4. You will start the action you want to capture
  5. Your sensor will be triggered:
    - The laser beam will be interrupted (eg: an object or Bigfoot passes in front of the laser beam)
    - A sound will be heard (eg: gunshot)
  6. The Arduino triggers the flash
  7. The camera shutter closes after its set delay (or by the Arduino's command)
  8. The Arduino turns the lights back on
  9. You are amazed at the awesomeness of the picture you took :-)
  10. Repeat

In the next step we will start building our circuit.

Step 2: Building the Laser Trap - Pushbutton

I found it useful to mount my breadboard and Arduino on a scrap piece of MDF. The last thing you need is for some of your cables to come loose and create a short circuit!

First up we will build the laser trigger. In a later step, we will add the Piezo for triggering by sound .

  • Connect ground and +5V to your breadboard
  • Add a pushbutton and connect the upper left leg to to +5V with a red jumper wire
  • Diagonally across from the +5V input, connect a signal wire (Yellow) to digital pin 2.

I included a wiring diagram for this step in the pictures, and you can find the full project on TinkerCad.
(Laser + Sound high speed Photography trigger with Arduino) https://www.tinkercad.com/things/31sHLXvtpbR-laser...

In the next step, we will add the laser and light sensor.

Step 3: Building the Laser Trap - Laser and Light Sensor

In this step, we will create a laser curtain using a laser beam and a light sensor to read when the laser beam is broken.

Installing the laser

  • Place the red lead (positive) from your laser in Digital pin 12 so we can turn it on and off.
  • We are using a potentiometer of 1kOhm in series with the laser so we can dim the brightness of the laser and regulate the trigger threshold. Connect the black lead (negative) of the laser to the left pin of the potentiometer. From the middle pin of the potentiometer, connect a black wire to ground.
  • It's useful to have extra long leads for the laser so you can place it further from your breadboard. I made some long leads with crocodile clamps on either side. This will give you extra room to work. But beware, the further your laser is away from the light sensor, the harder it is to align it properly. Vibrations and bumps can misalign the laser and cause false positives on the light sensor.

Installing the light sensor

  • Connect one of the legs of the light sensor with a red wire to +5V. You can use crocodile clamps on your jumper wires to do this.
  • Connect the other leg of the light sensor with a 1kOhm resistor to ground. This will serve to level out the signal. You don't need to worry about polarity as the light sensor is just a light sensitive resistor.
  • Connect a green wire between the resistor and the light sensor to Analog input A1. We will use this wire to measure the signal.

Warning: Working with lasers is dangerous to your eyes! Never look into the laser beam!
As you can see in the chart, even exposure from a long distance is dangerous!

Step 4: Building the Laser Trap - Potentiometer for Delay

In this step we will add a potentiometer to dial in how much delay we want between an object passing through the laser barrier and the flash firing. This is useful in some cases.

For example:

You are ready to drop something in liquid and want to capture the splash. The object you drop in liquid will first break the laser beam but if you take a picture at that exact moment, you will only see the object you dropped, since there is no splash yet! Fine tuning the delay will allow the object to sink in the liquid and the splash coming back up, so you can capture the splash at its maximum!

To do this, we will read the value of the potentiometer and use that as the delay. When you are very close to the perfect delay and want absolute precision, you can map the values of the potentiometer between two values you have found to work and give yourself pinpoint accuracy!

If you don't need any delay, you just turn the potentiometer all the way down.

Adding the potentiometer to the breadboard:

  • connect left lead of the potentiometer to +5V with a red wire
  • connect middle lead to analog input A0 with a yellow wire
  • connect right lead to ground with a black wire

In the next steps, we will arrange communication with the camera and the flash.

Step 5: Building the Laser Trap - Adding Optocouplers (Flash)

In this step, we will arrange communication between the Arduino and the flash. A lot of flashes can be controlled with a cable. Mine uses a stereo 2.5mm jack plug.

I used a homemade cable using a 2.5mm jack plug which came with 3 wires. When I short ground and the white cable (ignore the red wire here) while plugged into the flash, it will trigger the flash unit. This is exactly what we will do with the Arduino.

Because of the possibility of very (VERY!) high voltages used in flash units, it's important that we isolate this voltage from the rest of our circuit, or it could fry your Arduino or damage your camera. You always do this at your own risk!

An optocoupler is the best way we can isolate the voltage from the flash and from the circuit. Simply put, on the left side of an optocoupler is an LED which lights up when current passes through. At the right side of the optocoupler is a light sensor. When the light hits the optocouplers light sensor, it closes the connection on the right side of the optocoupler. This way, you can connect two circuits (left and right) without an actual electrical connection.

Enough talk, let's build this thing!

Left side of the optocoupler (Arduino side)

  • On an optocoupler you can see a little dot in the corner. Let's say this is top left. On your breadboard you can place this across the small gap in the middle with the dot in the top left.
  • Connect a 220 Ohm resistor to the top left pin of the optocoupler and to Digital pin 11.
  • Connect the second pin on the left of the optocoupler to ground.

Right side of the optocoupler (flash side)

  • On the right side, connect the middle pin to the white lead of your homemade flash cord
  • On the right side, connect the lowest pin to the ground of your homemade flash cord

Let's dive into the programming and breathe some life into this thing!

Step 6: Programming the Laser Trigger in Arduino

This is the code I used to run the trigger as we have built it so far.

You can copy it below or download the file.

If you want, you can stop right here. In the next steps I will add a few functionalities to make it easier to use.

/* This program is used as a laser trigger for high-speed photography
---> Made by Sander Vanhee <--  

push button to activate program
Activate laser
delay 
open camera shutter (manual for now)
drop an object
laser barrier gets triggered
laser off
wait the delay set by potentiometer
trigger flash
delay 
close camera shutter
delay 
*/

int laserPin = 12;        // red wire from laser
int potPin = 0;           // potentiometer to read delay
int optoPin = 8;          // towards the optocoupler
int buttonApin = 2;       // pushbutton
int photocellPin = A1;    // the cell and 10K pulldown are connected to A1
int photocellReading;     // the analog reading from the sensor divider

void setup(){
  // We'll send debugging information via the Serial monitor
    Serial.begin(9600);
    
    //#define photocellPin 1
    pinMode(laserPin, OUTPUT);
    pinMode(buttonApin, INPUT_PULLUP); 
    pinMode(photocellPin, INPUT_PULLUP);
    pinMode(optoPin, OUTPUT);
    pinMode(potPin, INPUT_PULLUP);
    }

void loop() {
  // check if button is pressed, only continue when pressed. 
    Serial.println("Waiting for buttonpress...");
  
if (digitalRead(buttonApin) == HIGH) {  // start program if button is pressed
    //start if(buttonpressed) loop 
    Serial.println("Button pressed");
      
// Read value of potentiometer    
    int reading  = analogRead(potPin);
    Serial.println("reading potentiometer");
    Serial.println(reading);
    reading = map(reading, 0, 1023, 1, 500);     // scale it to use it with the drops (delay between 1 and 500)

    delay(50);
    
  // Activate laser
    digitalWrite(laserPin, HIGH);
    Serial.println("Laser Activated");
    
delay(1000); // delay before open shutter
 
Serial.println("Drop object");
  
  // read the value of the photocellPin
    int photocellReading  = digitalRead(photocellPin); //read value photocell and print it
    Serial.println(photocellReading);
    
  //Check if laser is broken
while (digitalRead(photocellPin)==HIGH){ 
  Serial.println("Laser uninterrupted");
    int photocellReading  = digitalRead(photocellPin); //read value photocell
    Serial.println(photocellReading);
    }

    // as long as the laser is not broken, this "while" statement will loop. 
    // when the laser is broken, the program will continue. 
    
  // laser off
  // turn laser off to not show up in the picture
  // digitalWrite(laserPin, LOW); 
    
    
    // Wait the amount indicated by the value of potentiometer
    // give the waves time to rise back to the surface
delay(reading);
   
  //trigger flash - send signal from pin 8
    digitalWrite(8, HIGH);
    Serial.println("FLASH fired");
    delay(1000);
    digitalWrite(8, LOW);
    
    //wait for flash light to die down
    delay(200);
  
    //close camera shutter
    
    Serial.println("END");
    // END OF (buttonpressed) while loop
   
  digitalWrite(laserPin, LOW);
 
}}

Step 7: Extra: Make Yourself Some Stands for Your Laser Barrier

Using a few scrap blocks of wood you can make yourself a platform for your laser so you can adjust it on all directions. (see photos) This will help you align your laser to your photocell and keep the laser beam right in the action!

I used a slotted rail to mount the laser and the photocell so they stay in line.

Step 8: Adding Sound / Vibration Trigger

Now we have a fully working Laser trigger! Woop Woop!
Take a moment to pat yourself on the back...

But why stop here? There's more sensors you can use to trigger your flash!

A Piezo sensor will convert vibration / movement / sound into an electric signal.
You can use that to register when a pellet gun is fired* (recoil), a balloon is popped (loud bang) or an object is dropped on the table. (* be careful!)

In the same way your Laser + Light sensor are used as an input, we will now add the Piezo.

  • Connect the red and black leads from your piezo to the breadboard.
  • Connect a 1MOhm resistor across
  • Connect the red piezo lead to Analog input 2 from your Arduino (I used a blue wire)
  • Connect the black piezo lead to Ground

You can see all this in the schematic included.

Time to update the code and get this working.

Step 9: Programming the Sound Trigger in Arduino (piezo)

This is the code you can use to add the sound trigger functionality.
You can copy it below or download the file.

Now your code contains the information needed to use the laser trigger and the piezo.
You can switch between the sensors by placing the code for one sensor as a comment, so the Arduino will ignore it.
This is done by placing the text between /* COMMENT */

If you wanted to make it easier to switch between the two sensors, you could add a toggle switch. You can add a piece of code to check which state the switch is in and use the right sensor.

/* This program is used as a laser trigger and/or sound trigger for high-speed photography<br>  ---> Made by Sander Vanhee <--

push button to activate program
Activate laser or sound trigger
delay 
open camera shutter (manual for now)
drop an object
laser barrier or piezo sensor gets triggered
laser off
wait the delay set by potentiometer
trigger flash
delay 
close camera shutter
delay 
*/

int laserPin = 12;        // red wire from laser
int potPin = 0;           // potentiometer to read delay
int optoPin = 8;          // towards the optocoupler
int buttonApin = 2;       // pushbutton
int photocellPin = A1;    // the cell and 10K pulldown are connected to A1
int photocellReading;     // the analog reading from the sensor divider
int PiezoPin = 2;         // the Piezo is connected to a2
int PiezoReading;         // the analog reading from the sensor divider

void setup(){
  // We'll send debugging information via the Serial monitor
    Serial.begin(9600);
    
    //#define photocellPin 1
    pinMode(laserPin, OUTPUT);
    pinMode(buttonApin, INPUT_PULLUP); 
    pinMode(photocellPin, INPUT_PULLUP);
    pinMode(PiezoPin, INPUT);
    pinMode(optoPin, OUTPUT);
    pinMode(potPin, INPUT_PULLUP);
    }

void loop() {
  // check if button is pressed, only continue when pressed. 
    Serial.println("Waiting for buttonpress...");
  
if (digitalRead(buttonApin) == HIGH) {  // start program if button is pressed
    //start if(buttonpressed) loop 
    Serial.println("Button pressed");
      
// Read value of potentiometer    
    int reading  = analogRead(potPin);
    Serial.println("reading potentiometer");
    Serial.println(reading);
    reading = map(reading, 0, 1023, 1, 500);     // scale it to use it with the drops (delay between 1 and 500)

delay(50);


/* We'll put the laser parts in comments to isolate them from the Piezo code 

// Activate laser
    digitalWrite(laserPin, HIGH);
    Serial.println("Laser Activated");
    
delay(1000); // delay before open shutter
 
Serial.println("Drop object");
  
  // read the value of the photocellPin
    int photocellReading  = digitalRead(photocellPin); //read value photocell and print it
    Serial.println(photocellReading);
    
  //Check if laser is broken
while (digitalRead(photocellPin)==HIGH){ 
  Serial.println("Laser uninterrupted");
    int photocellReading  = digitalRead(photocellPin); //read value photocell
    Serial.println(photocellReading);
    
// as long as the laser is not broken, this "while" statement will loop. 
    // when the laser is broken, the program will continue. 
    
  // laser off
  // turn laser off to not show up in the picture
  // digitalWrite(laserPin, LOW); 
*/ 

// what follows is the piezo code
PiezoReading = analogRead(PiezoPin);  
Serial.print("Analog reading = ");
Serial.println(PiezoReading);     // the raw analog readingwhile (analogRead(PiezoPin)<1){ 
  Serial.println("no sound detected");
    int PiezoReading  = analogRead(PiezoPin); //read value photocell
    Serial.println(PiezoReading);
    }
    
    // Wait the amount indicated by the value of potentiometer
    // give the waves time to rise back to the surface
delay(reading);
   
  //trigger flash - send signal from pin 8
    digitalWrite(8, HIGH);
    Serial.println("FLASH fired");
    delay(1000);
    digitalWrite(8, LOW);
    
    //wait for flash light to die down
    delay(200);
  
    //close camera shutter
    
    Serial.println("END");
    // END OF (buttonpressed) while loop
   
  digitalWrite(laserPin, LOW);
}}

Step 10: Extra: Make Yourself a Foot Pedal

This step solves a few problems you may or may not have.

  • Depending on where you placed your "start code"-button on the breadboard, it can be hard to reach, especially in the dark
  • As is often the case in "studio" photography when you are doing a solo project, you could use a third hand. (and fourth and fifth hand in some cases)

To solve this, I made a foot pedal so I can use it to start my code handsfree. With a few scraps of wood, a pushbutton and some wire you can make yourself a foot pedal. If you want to be all fancy and keep your wire tangle-free, you can run your wires on the inside of an old shoelace or a piece of paracord.

See pictures with comments for the details.

Step 11: Extra: Adding an Optocoupler to Control Your Camera

While we are on a roll, wouldn't it be nice to have the Arduino open your camera shutter when it's needed? Of course! The benefits:

  • You won't have to remember to trigger the camera shutter manually (so you don't forget and miss your shot!)
  • It will free another hand

You can use another Optocoupler to do this. Most DSLR cameras (and I'm sure a lot of other cameras) can accept a remote control cable to focus and trigger the camera. This will also use a 2.5mm stereo jack like the one we used for the flash.

The three wires running through your stereo jack are ground, focus and shutter (see picture). Connect focus and ground and the camera will focus. Connecting ground and shutter will cause the camera to take a picture. I have done this before using optocouplers and have had no problems. I've read on forums that other people have experienced issues with cameras that froze up. So be careful and try on an old camera first!

As we will be working in a pitch black room when we take the picture, you will need to pre-focus your lens and disable autofocus (switch to manual focus). Consequently, we won't be using the focus wire, but you could use it in a future project.

* I found the scheme for the pinout on this forum (and the warnings too)

http://www.doc-diy.net/photo/eos_wired_remote/

Step 12: Extra: Add Some Lights to Your Setup

So up to now you've been flicking the light switch every time you're taking a picture. You could also add a few LEDs to create some ambient light. This will allow you to set up your shot. The Arduino can dim the LEDs when you push your button to start the code. After the picture is taken and your shutter is closed, the Arduino switches the LEDs back on.

You can power the LEDs straight from your Arduino with this little sketch. (but since you came this far, I assume you already know how to do this.) https://www.arduino.cc/en/Tutorial/Blink

It's recommended that you don't draw more than 20mA per Arduino pinout, so you may need to use multiple pins or you can use external power. When choosing to use external power, you could install another optocoupler to act as a switch, the principle remains the same as with the flash.

I'm entering this Instructable in the Arduino Competition, so please vote for me if you made this or if you liked the Instructable! Thanks!

Remote Control Contest 2017

Third Prize in the
Remote Control Contest 2017

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest

    14 Discussions

    Why am I getting this 2 instance of the same image??
    I am using a nikon 5200 and a yougnuo mark IV flash.
    every time I click I get 2 instance please help

    DSC_0358.JPGsaasasadsd.jpg
    1 more answer

    Hi Xecutioner, it looks like your flash is firing twice... that would explain the double exposure. Are you using the flash on manual mode? It seems like the first flash might be the flash doing a test fire to determine how much light it needs and flash a second time for real... Try turning it to manual without TTL metering.
    Hope this helps

    This is an exceptional 'ible. Here's why. It is well written, clear and amusing. It has lots of pictures. The steps are well laid-out and defined. Great job! My 15 year old daughter is into photography and we tried some water balloon popping which turned out okay but this 'ible will be the project this week! Well done!!

    1 reply

    Thanks! I hope your project turns out great, very cool that you will use my 'ible for some family bonding around Christmas!

    Well done. Great level of detail. Thanks for posting.

    1 reply
    0
    None
    xwania

    8 months ago

    amazing pictures. will have to make one

    1 reply

    Thanks! If you do make one, feel free to ask more questions!

    Wow! A great mix of sensors, programming and photography.

    1 reply

    Those are some awesome shots! Great tutorial :)

    1 reply