Triggering a Camera’s Flash with Sound and Light

Update: Check out my latest Camera Axe project for a much more robust device that handles this or my store where I sell the Camera Axe.

For those just wanting to see the pretty pictures, click here.

This article focuses on making the sensors used to trigger a camera’s flash using a microphone or a cheap laser pointer. Since I’ve already described how to do the actual firing of a camera’s flash here I won’t focus on that part of this project today.

There are a lot of places on the web that describe how to trigger a flash with an electrical circuit, but I feel that using a microcontroller like Arduino offers big benefits. For instance you can easily add new sensors, or even run multiple sensors at once. Since the triggering of the flash is done in software it’s easy to add delays, or make a more complicated triggering algorithm based on multiple sensors. Lastly while the microcontroller does add some cost, it’s not much because boards like Arduino can be bought for around $35 and some of this cost for the microcontroller is offset by simpler circuits.

Now let’s talk about why we’re triggering the flash. The main reason is to help capture those moments that require extremely accurate timing. Computers are many orders of magnitude faster at waiting around for something to happen and then triggering the flash when that something does happen. Humans can try to compensate for this by watching the event and then trying to plan when to trigger the flash. For example when photographing a balloon popping, you can tell your friend to pop the balloon on the count of three and then take the picture on three. This sort of works, but this electronic flash trigger works much more consistently and it’s always ready to take the picture of those less predictable events.

Most SLR and DSLR cameras let you attach a cable to trigger the camera directly. Why not interface that camera trigger directly and just attach the flash to the camera if it’s dark? This would let you use the camera’s built in flash (my method requires an external flash unit). The reason we can’t do this is because camera’s are too slow. I’ve done some measuring of the delay between when you tell a camera to take a picture and when it actually takes a picture and found on my camera it’s around 20 ms. To a person this delay isn’t noticeable, but to a popping balloon it’s way too long. So instead of of triggering the actual camera we must trigger the much more quickly responding flash.

When I’m using this flash trigger I work in a dim room and set my shutter speed to 10 seconds. Since it’s nearly dark in the room the camera’s picture is still black after these 10 seconds. However if I trigger the flash for 1/1000th of a second that short burst of high intensity light is enough to light up the scene. So even though my shutter speed is 10 seconds, I’m effectively only taking a picture while the flash is active because that’s where all the photograph’s light is coming from.

Laser Sensor

This first sensor uses a cheap laser pointer and a photo resister to detect the laser’s light. The software is setup to trigger the flash when the laser beam is broken. The software also turns off the laser so it doesn’t show up in your photograph. Think of it as an electronic trip wire. This is great for catching moving objects. Add a small delay between the detection and triggering of the flash and you can catch cool things like a light bulb that is is smashing into the ground.

Since I didn’t have an extra laser pointer sitting around I bought this cheap laser card module. It’s very low power so I can run it off a digital output on the Arduino board. Originally I powered the laser directly from Arduino’s +3 volt output, but I found that it was better to run it off a digital pin so that the laser could be turned on/off. Since this laser runs on 3 volts and Arduino outputs 5 volts I used a voltage divider in my circuit to get the needed voltage. To sense the laser I used another voltage divider circuit with a photoresistor. An analog input on the Arduino was used to detect the if the laser was hitting the photoresistor or not.

Here’s the circuit.

Sound Sensor

This sensor detects noise. It’s very useful for detecting things like a drop of water splashing, or anything that makes noise. There are lots of places on the web that discuss how to build your own microphone and amplifying circuits, but I liked the idea in this article about using a guitar amplifier. A karioki machine or any other device that has a microphone input and an output line should work. You can pick up a low quality amp and microphone pretty cheaply on ebay or in a retail store. Sometimes you can get them really cheap at a garage sale.

The signal you get from an amplifier is going to be an electrical AC wave representation of the sound going into the microphone. This often means something like a 5 volt 8 kHz wave. The only thing I did was to add a diode to protect the analog input I was using on my Arduino board from the negative portion of this wave. Here are some pictures from my oscilloscope of the wave being generated by the amp. The first one is the full wave of my voice (I was singing “Twinkle Twinkle Little Star”), and the second picture is what it looks like with a diode.

You can see that the bottom half of the waves are getting chopped off, but that should be fine. The Arduino is more the fast enough to detect the voltage spikes. You could even make more sophisticated software to only trigger on certain frequencies of sound, but for now my software just looks for any sound spike over a certain threshold voltage.

Here’s the circuit.

Flash Trigger

I’ve already discussed this part of the system in this article, but for completeness here’s the circuit.

Building a Box to Hold it All

After understanding how all of these circuits worked it was time to put them all together and build a box that would handle all my flash triggering needs. Here are some photos of what I created.

Software

Last, but not least here is the software I wrote to run it.

// Maurice Ribble
// 4-12-2008
// http://www.glacialwanderer.com/hobbyrobotics

// This code is designed to to tune (see PRINT_MESSAGE define) and
// to run a sound sensor and a laser sensor.  Both of these sensors
// Are used to trigger a flash.  It should be easy to add additional
// sensors if you want.

// These enable the different types of triggers
//#define ENABLE_LASER_TRIGGER
#define ENABLE_SOUND_TRIGGER

// The threshhold values for the different triggers.
// These may need to be changed depending on evironment and sensors being used.
// Using PRINT_MESSAGES can help determine the correct value for these.
#define LASER_THRESHHOLD 500
#define SOUND_THRESHHOLD 100

// This prints messages to the serial port.  This is good to enable while determining
// the threshholds for your trigger, but these communications are very slow and
// when using these sensors to actually take pictures this should be turned off.
//#define PRINT_MESSAGES

// The digital pins being used
#define CAMERA_FLASH_PIN 4
#define LASER_PIN 5

// The analog pins being used
#define LASER_TRIGGER_ANALOG_PIN 0
#define SOUND_TRIGGER_ANALOG_PIN 1

void setup()
{
  pinMode(CAMERA_FLASH_PIN, OUTPUT);
  digitalWrite(CAMERA_FLASH_PIN, LOW);
  pinMode(LASER_PIN, OUTPUT);
  digitalWrite(LASER_PIN, LOW);

#ifdef ENABLE_LASER_TRIGGER
  digitalWrite(LASER_PIN, HIGH);  // Turn on the Laser
#endif

#ifdef PRINT_MESSAGES
  Serial.begin(9600); // open serial
#endif
}

void loop()
{
  int soundVal;
  int laserVal;

  ////////////////////////////////////////////////////////////
  // SOUND TRIGGER
  ////////////////////////////////////////////////////////////
#ifdef ENABLE_SOUND_TRIGGER
  soundVal = analogRead(SOUND_TRIGGER_ANALOG_PIN);
  if (soundVal > SOUND_THRESHHOLD)
  {
     digitalWrite(CAMERA_FLASH_PIN, HIGH);
#ifdef PRINT_MESSAGES
     Serial.println("Flash Triggered!!!");
#endif
     delay(100);
     digitalWrite(CAMERA_FLASH_PIN, LOW);
   }
#ifdef PRINT_MESSAGES
  Serial.print("Sound: ");
  Serial.println(soundVal, DEC);
#endif
#endif // ENABLE_SOUND_TRIGGER

  ////////////////////////////////////////////////////////////
  // LASER TRIGGER
  ////////////////////////////////////////////////////////////
#ifdef ENABLE_LASER_TRIGGER
  laserVal = analogRead(LASER_TRIGGER_ANALOG_PIN);
  if (laserVal < LASER_THRESHHOLD)
  {
     digitalWrite(CAMERA_FLASH_PIN, HIGH);
     digitalWrite(LASER_PIN, LOW);  // Turn off laser during picture
#ifdef PRINT_MESSAGES
     Serial.println("Flash Triggered!!!");
#endif
     delay(100);
     digitalWrite(CAMERA_FLASH_PIN, LOW);
     digitalWrite(LASER_PIN, HIGH);  // Turn laser back on after picture
   }
#ifdef PRINT_MESSAGES
  Serial.print("Laser: ");
  Serial.println(laserVal, DEC);
#endif
#endif // ENABLE_LASER_TRIGGER
}

109 Comments

  1. Arduino et la photographie | Le blog du Lord said,

    October 24, 2012 @ 2:23 pm

    […] Triggering a Camera’s Flash with Sound and Light […]

  2. CrazeUK said,

    October 24, 2012 @ 9:11 pm

    Hi Maurice. Fantastic project.
    I want to use an extrenal laser pointer. Will this work with one?
    Also what if i dont use the sound or the ldr?

    Will the code account for that?
    Thanks

  3. CrazeUK said,

    October 24, 2012 @ 9:12 pm

    Peter my aim is also the same for a D7000, how did you get on?

  4. Moses said,

    November 18, 2012 @ 2:09 am

    Hello friends, nice post and fastidious arguments commented at this place, I
    am truly enjoying by these.

  5. High speed foto’s maken met Arduino - Mancave said,

    November 19, 2012 @ 5:07 am

    […] namelijk te traag. En je dacht nog wel dat jouw dure camera zo goed was…Bouwen dan!De mysterieuze Glacial Wanderer (hij heet gewoon Maurice Ribble) heeft precies omschreven hoe je dit project moet bouwen. Zowel de […]

  6. Jameson said,

    November 22, 2012 @ 6:52 am

    Very nice project, i’m buildin a light trigger myself at the moment and i was wondering if you measured the reaction time of the photo-resistor? it seems they have quite a delay, so perhaps i should better use a photo-transistor. source: http://www.resistorguide.com/photo-resistor/

  7. Cliff C. said,

    March 12, 2013 @ 10:26 pm

    Hey I tried making the Flash trigger using a PS7113-2A and cant seem to get it to fire……any thoughts?
    http://www.mouser.com/ds/2/286/ps7113-57025.pdf

  8. Robomore Blog » En Ä°yi Arduino Projeleri said,

    April 22, 2013 @ 2:32 am

    […] Arduino ile Yüksek Hızla FotoÄŸraf Çekimi […]

  9. Triggering pictures with an Arduino / Aura-Blog said,

    August 27, 2013 @ 4:57 pm

    […] Source: Hobby Robotics […]

RSS feed for comments on this post