(Note: these photos were taken not by me but by my friend David Lindes, who has a ton of other amazing photos on Flickr)
It’s 3 a.m. and a phone rings in the White House…
Or actually, it was about 3 p.m. and a phone rang in my pocket. By luck the phone happened to be mine and on the other end of it was 3ric asking if I’d be able to help with a project that evening. Seems he had acquired about 10 liters of liquid nitrogen and among other things was hoping to use it to do some high-speed flash photography of frozen things shattering into a million pieces upon being shot with a pellet rifle.
All was well and good and according to plan, except for the flash trigger, which was stuck in the mail somewhere. Could I hack one together by evening? Thus is how I got my project for the day.
A flash trigger for high-speed photography is a really simple device. Basically all you need to do is take an audio signal and use that to trigger a flash if the signal exceeds a certain level. Rather than muck about with $10 worth of op-amps, transistors, voltage dividers and a bunch of so-called “electrical engineering”, I splurged for the $2 solution and threw the equivalent of a mid-1980’s personal computer at the problem… i.e. a microcontroller. Specifically, a AVR ATMega168 (mounted on a $30 Arduino).
Long story short and after overcoming two rather significant obstacles (#1 being not having a microphone, #2 being not having a flash) we were able to kludge together a workable flash trigger in just a couple hours. With the flash trigger in place and David at the camera, by the end of the evening we had walked away with some decent shots.
(and made one *hell* of a mess)
Ok, short story long, about those obstacles:
I didn’t have a microphone for the audio part of the trigger and was taking apart various junk devices I could find looking for something that could be used. I tried a a headset from a cell phone, a mouthpiece from an old telephone, and the miniature microphone from a junked CVS-brand single-use video camera. Unfortunately I wasn’t able to get any of them to make any meaningful wiggles on the oscilloscope but that’s probably because I had no idea how to properly drive a microphone (and little time to research it).
Thankfully, Jon boldly came to the rescue and brought in a couple of microphones, one of which was perfect. Also 3ric picked up a old guitar amp from a pawn shop which had a mic in port as well as a headphone out port so that took care of the problem of driving the mic and amplifying the signal. The mic went into the amp, and the amp fed directly into the Arduino via the headphone-out port. The oscilloscope showed that shouting into the amp resulted in a signal ranging between -2.5V to 2.5V on the headphone port. Since the Arduino can’t stomach a voltage below -0.5V on any of its pins, I had to bias the input +2.5V using a capacitor and a couple resistors.
The flash proved to be the stickier wicket. By around 7 p.m. I still hadn’t located a flash and the one in the disposable camera I had planned on using turned out to have been already destroyed through previous mischief. Thankfully Jon once again swept to the rescue by running out to the store and bringing back a new disposable camera. Taking it apart, we quickly discovered a new challenge: the trigger circuit requires you to short two wires that have a 300V potential difference across them. The common approach I’ve seen in other circuits people have made is to use an SCR to gate the flash pulse, but of course we didn’t have one (see a trend yet?). To the rescue this time was Phil who picked one up from Fry’s on his way in.
Since I already had my hands full integrating the audio signal and writing the firmware, Phil stepped up and took a swing at the problem of hooking up the SCR to the flash. The first attempt resulted in the unfortunate destruction of pin 7 on the Arduino. Apparently a significant negative voltage (-10V) had developed on the gate of the SCR and, as mentioned previously, the Arduino couldn’t stomach it. Unfortunately in the chaos I can’t remember Phil’s explanation of what went wrong but he quickly got to the bottom of it and the flash was soon triggering perfectly off of a different pin.
Don’t ask me why the universe works this way but at just the moment when the flash situation had been resolved, David walks into the lab and hands me a professional type flash. His flash will not only trigger with a 5V signal but will fire 10-20 times before the little disposable flash has recovered from firing once. Hooking this up to the Arduino was no harder than making a two-wire cable so we went with this flash instead.
The rest of the night was spent blowing to frozen smithereens anything we could get our hands on.
Here’s a screenshot of the simple GUI I wrote to control the flash trigger, written in Processing. The red lines signify trigger events. The white dots signify the audio level being read by the Arduino and the green line is the trigger threshold (adjustable by dragging with the mouse).
… and, for completeness, the source code for the firmware for Arduino and the GUI, in case anybody wants to horrify themselves with the abomination that is my rushed code.