How to Use an Arduino to Trigger a Flash With Sound

Here a student uses a sound trigger to capture a photo as a balloon in the process of ripping apart as it pops. Note, there is a banana floating in space that has only just started falling when the balloon is popped. Photo by Grant Bush-Resko

The high-speed class at Rochester Institute of Technology learns Arduino programming and some simple circuits as an introduction on triggering high-speed flashes in complicated situations. One of the easiest high-speed events to study is a balloon popping. This simple event is also one of the safest high-speed events too.

To add more interest to the balloons as they are popping, a few milliliters of water is added to the balloon before it is inflated. The students pop the balloon by using a sharp tack to break the skin. As the balloon pops the internal pressure drops causing the water vapor to form a cloud for a few thousandths of a second. The idea is that the students will take a picture as the balloon is popping to show the cloud. The students typically enjoy this activity quite a bit.

A man in a blue suit and red shirt stands against a dark background, bursting a large pink and orange balloon with a needle. His expression is calm and focused as the balloon pops dramatically.

A vibrant purple and yellow balloon bursts in slow motion, creating a surreal cloud-like formation against a dark background. A hand holding a pin is just visible, capturing the dramatic moment of the popping balloon.

A man with white hair and a plaid shirt is holding a stick, manipulating a glowing, swirling pink and orange orb in his hand, against a dark background.

The total cost of the electronic involves an Arduino microprocessor, a sound trigger, and a reed switch is around 20 dollars with the most expensive component being the Arduino microprocessor. In the lab we often use the 640 Einstein flash on the 1/256 power setting which the students measure to be 195 microsecond duration.

Two electronic sensor modules are shown side by side. The left module is blue with a silver microphone and labeled pins. The right module is red with various components and labeled pins. Both have cylindrical metallic elements.
Two common sound detectors sold as microphone Shields for Arduinos

Not all sound detectors are the same. Above are two common types, and each has different levels of sensitivities. Each detector has an adjustable resistor that controls the output pin’s trigger level (labeled DO on the red unit and OUT on the blue unit). The digital out pins on these units send the output voltage to a logic high or 5 Volts when a sound is detected. The trigger level of the sound is set by the resistor on the amplifier. After testing, the red unit was found to be the most sensitive to low levels of sound. As the detectors change quite often, each device needs to be tested.

Above the red detector has an extra pin that supplies an analog output. This output is a variable voltage ranging from 0 to 5 volts. The Arduino uses a 10-bit analog converter that maps the voltage to integers from 0 to 1023 in values. The resulting integer values are used by the Arduino code to trigger the flash when the sound level goes above the ambient level. Since this pin supplies a changing voltage in response to different sound levels it is the easiest to program to trigger at different sound levels.

To test the response of the microphone I use the following sample code:

/*
Analog input, to trigger a flash by a reed switch

Reads an analog input pin, prints the results to the Serial Monitor.
Ted Kinsman [email protected]
*/

// These constants won’t change. They’re used to give names to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to

int sensorValue = 0; // variable to set the value read from the A0 (analog pin)

void setup() {
pinMode (analogInPin, INPUT); //pin A0 is an analog input
Serial.begin(9600);// initialize serial communications at 9600 bps:
}
void loop() {

sensorValue = analogRead(analogInPin);// read the analog in value:
// print the results to the Serial Monitor:
Serial.print(“Sensor Value = “);
Serial.println(sensorValue);
delay (100); // this delays the loop by 100ms and slows the text display

}

This program can display the output to the serial port, and the results are displayed as text.

15:26:31.008 -> Sensor Value = 72
15:26:31.107 -> Sensor Value = 72
15:26:31.204 -> Sensor Value = 71
15:26:31.303 -> Sensor Value = 71
15:26:31.402 -> Sensor Value = 71
15:26:31.500 -> Sensor Value = 72

The serial plotter can be used to display the data in a graphical format and is found under the tools directory.

A screenshot of the Arduino IDE showing a dropdown menu under the "Tools" tab. The menu lists options including "Serial Plotter," "Firmware Updater," and more. In the background, a code editor displays a file named "2024_SoundTrigger.

A line graph showing a sharp spike from below 100 to over 800, followed by a rapid decline and leveling out around 100. The X-axis values range from 15452 to 15511. The interface includes "SEND" and "STOP" buttons.
A sample plot of hands clapping. The room background noise for this detector is around 75 and the trigger level in the program is set to a value of 80. That is any loud sound that registered above 80 will trigger the flash.
Diagram of an Arduino circuit with a reed switch connected to a flash trigger. The circuit includes a resistor and additional components, with wires labeled for connections: red for power, black for ground, and blue for switch connections.
The schematic for the full circuits. Here a reed relay (switch) MEDER DIP05-1A57-BV350 is used to isolate the Arduino microprocessor from the flash trigger. The reed switch is not super-fast but it is inexpensive and easy for students to start out with as they are learning. Faster triggering systems will use an optical isolation circuit.

Below is the finished program:

/*
2024-Sound-TriggerA.ino
Ted Kinsman October 7, 2024
Analog input, to trigger a flash by an isolating reed switch

Reads an analog input pin, prints the results to the Serial Monitor.
Turn the serial port off when running for photography for speed.
Camera is set to bulb setting.

*/

// These constants won’t change. They’re used to give names to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int LED7 = 7; // a RED LED is on pin 7 this is the “Busy Signal”
const int FlashTrigger= 8; //pin to trigger the flash via reed switch

int sensorValue = 0; // variable to set the value read from the A0 (analog pin)
void setup() {
pinMode (analogInPin, INPUT); //pin A0 is an analog input
pinMode (LED7, OUTPUT ); //LED7 is an output
pinMode (FlashTrigger, OUTPUT); //flash trigger is connected to the reed switch is an output
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin); //read the A0 pin and write value to “sensorValue”

if (sensorValue >=80){
delay(0); //if the flash is set off too fast increase this time in milliseconds
digitalWrite (FlashTrigger, HIGH); //turn on pin to trigger the flash
digitalWrite (LED7, HIGH); // turn on led on pin 7
delay(1); // delay 1 ms to make a nice trigger pulse
digitalWrite (FlashTrigger, LOW); //turn off pin to trigger the flash
Serial.print(“Sensor Value = “);
Serial.println(sensorValue); //prints trigger value to serial port and does a line return

delay(4000); //four second delay to give the photographer time to close the shutter
digitalWrite (LED7, LOW); // The busy signal – RED led on pin 7 – is turned off
}
}

Note: The use of the serial port and the command “Serial.print” will slow the Arduino down, so it is best to only use the serial port when the high-speed event is over.

Here the flash has been triggered and there is plenty of time to send an analog read value to the serial port.

The RED led here is used to show that the circuit has been triggered, and if the LED is lit the photographer should wait until the LED turns off to proceed with the photoshoot. I call this the circuit “Busy Signal”.

The 4 second wait time after the flash trigger is used to allow the photographer to close the shutter when using the bulb setting on the camera. This delay allows the flash to only fire once on the first loud sound.

The sound sensor has a second pin which is a DO or stands for digital out. To use this pin, the screw potentiometer on the amplifier needs to be adjusted so that a loud sound will send this pin to a +5 volts. I have found many of these detectors to not be particularly sensitive, and the ones I have tested have often failed to trigger on the sound of a popping balloon so over the years I have moved to solely use the detectors that have an analog output and use the code posted above.

A person with long, two-toned hair blows a balloon, which bursts in an explosion of water, captured mid-splash against a dark background.
Here the student over inflates to cause the balloon to pop.
A person with long hair and a black T-shirt is excitedly using a stick to hold a glowing, colorful orb with pink and orange hues against a dark background.
Here a student demonstrates the use of more advanced lighting to optically color the cloud as the balloon is popped. Image by the author. The lighting diagram is shown below.
A diagram illustrating a photography setup with a camera, four lights labeled A, B, C, and D, and a black backdrop. Two additional elements, E and F, flank the center, where a black and an orange object are positioned under a yellow spotlight.
For a more complicated lighting setup, four lights are used. All set to the fastest settings of 195 microseconds and triggered all together. The flash A does most of the work illuminating the water vapor cloud with a colored gel as the balloon pops. The light B gives a white light to the balloon and adds a little to the model’s face. The flash C is the primary source of illumination for the model and the two baffles E and F block the flashes from causing lens flairs. Flash D is also used to fill in the model’s face.
A man in a plaid shirt sits on a stool against a dark background. He is bursting an orange balloon with a black stick, revealing a splash effect. A small device is on another stool nearby.
The author popping a large balloon. Note the trigger circuit glowing red with the “busy signal” red LED on.

About the author: Ted Kinsman is the 2019 recipient of the Schmidt Laureate for outstanding contributions to the progress of biocommunications. Kinsman has worked as an optical engineer, a physicist, and a physics instructor before joining the Photographic Sciences Dept. at RIT. His work has appeared on The Discovery Channel, Crime Scene Investigations (CSI), The X-Files, South Park, The Tyra Banks Show, and The Frozen Planet series. Kinsman is currently an Associate Professor in the School of Photographic Arts and Sciences (SPAS) where he teaches Photographic Instrumentation, Scanning Electron Microscopy, and High-Speed Imaging.

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Todays Chronic is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – todayschronic.com. The content will be deleted within 24 hours.

Leave a Comment