{"id":85,"date":"2010-04-20T07:34:14","date_gmt":"2010-04-20T02:04:14","guid":{"rendered":"http:\/\/coldsolder.wordpress.com\/?p=85"},"modified":"2026-05-28T16:55:36","modified_gmt":"2026-05-28T15:55:36","slug":"sound-activated-flash-trigger-for-high-speed-photography-2","status":"publish","type":"post","link":"https:\/\/sanjibmitra.ie\/blog\/2010\/04\/20\/sound-activated-flash-trigger-for-high-speed-photography-2\/","title":{"rendered":"Sound Activated Flash Trigger for High Speed Photography"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The primary problem when designing a sound sensor for a standard ADC input is to convert the amplified sinusoidal waveform into a corresponding stable DC voltage. This circuit here uses a common multimedia desktop microphone as the primary sensor, and a pre-amplifier along with a&nbsp; Arduino micro-controller to trigger an external camera flash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The feeble 1-3mV signal coming from the Electret microphone is pre-amplified by a single-stage 2N3904 transistor amplifier. The output is then passed through a 10uF Electrolytic capacitor and the rectified by a pair of diodes. This provides a DC output voltage in the range of 0.5V to 3.3V depending on the amplitude of the sound.<\/p>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\" style=\"grid-template-columns:48% auto\"><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" src=\"http:\/\/coldsolder.wordpress.com\/wp-content\/uploads\/2010\/04\/scan0001-1.jpg?w=300\" alt=\"\" class=\"wp-image-88 size-full\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"wp-block-paragraph\">The output from the diodes needs to be stabilized for a certain amount of time so that the ADC has enough time to get a sample reading. A simple RC circuit comprising of a 100K resistor and a 0.1uF disc ceramic capacitor is sufficient for this. The output &#8216;OUT&#8217; can be connected to A0 (Analog pin 0) on the Arduino board.<\/p>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The 8K2 resistor can be replaced by a 10K resistor. The 10uF electrolytic capacitor on the collector of the <a href=\"http:\/\/www.datasheetcatalog.org\/datasheet\/stmicroelectronics\/8850.pdf\">2N3904<\/a> has its positive terminal connected to the transistor. The circuit is powered by a regulated 5V supply which can easily be drawn from the main Arduino board.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Triggering the flash is really simple, using a commonly available CNY-17 opto-isolator. Use any digital pin from the Arduino configured as an output and feed that to trigger the internal photodiode. The photodiode cathode should be taken to ground via a 100 Ohm resistor. The CNY-17 datasheet is available <a href=\"http:\/\/svn.clifford.at\/metaparts\/trunk\/datasheets\/DS_fbecd240d8f4015bf2b9c4f9dd914e55.pdf\">here<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" src=\"http:\/\/coldsolder.wordpress.com\/wp-content\/uploads\/2010\/04\/scan0001.jpg?w=300\" alt=\"\" class=\"wp-image-89 size-full\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"wp-block-paragraph\">The collector and emitter of the internal photo-transistor is connect to the PC sync port of the flash. If the flash doesn&#8217;t have a PC port, it can be connected on a Hot-shoe adapter that does.<\/p>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The software constantly monitors analogue pin A0, and when it crosses a defined threshold, it pulls the output pin high for a brief (about 100ms is fine) time. This is enough to trigger the flash. After the flash fires, its advisable to add a delay of about 1-2 seconds so that stray noises (subsequent bounces\/impacts) can be eliminated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To connect the flash, its best to get a female PC sync cable, cut the other end and then use that to connect to the opto-isolator. Unfortunately, I didn&#8217;t have one of those, so had to connect the PC sync port with a bit of engineered PCB hook-up wire. Rustic, but it works until you find a proper cable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the completed circuit on&nbsp; a breadboard. The circuit works great for dropping coins, marbles, fruits and the like into a glass of water, but the microphone pre-amplifier is just not sensitive enough to detect a single drop of water falling from a height, unless you hold the microphone really close. Am still working on a more sensitive version that should be able to do that. Maybe a LM358 or 741 Op-Amp might provide the needed gain. Some folks have suggested using a standard acoustic microphone along with a guitar amplifier to act as a sound sensor. The output from the guitar amplifier needs to be rectified and stabilized before it can be fed into the Arduino ADC. I&#8217;m going to try this out at some point too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For now, this suffices quite well. Will probably try some cut fruit now&#8230;<br>\n<a title=\"Sound Sensor Flash Trigger with Arduino by sanjibm, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4536115026\/\"><img loading=\"lazy\" decoding=\"async\" style=\"margin:5px;\" src=\"http:\/\/farm5.static.flickr.com\/4066\/4536115026_fdd305945a.jpg\" alt=\"Sound Sensor Flash Trigger with Arduino\" width=\"300\" height=\"181\"><\/a><a title=\"Sound  Sensor Flash Trigger Circuit with Arduino by sanjibm, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4536114478\/\"><img loading=\"lazy\" decoding=\"async\" style=\"margin:5px;\" src=\"http:\/\/farm3.static.flickr.com\/2757\/4536114478_c071c29cf2.jpg\" alt=\"Sound Sensor Flash Trigger Circuit with Arduino\" width=\"300\" height=\"181\"><\/a><br>\n<a title=\"Its Raining Coffee, Hallelujah by sanjibm, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4538029723\/\"><img loading=\"lazy\" decoding=\"async\" style=\"margin:5px;\" src=\"http:\/\/farm5.static.flickr.com\/4058\/4538029723_e45632ae75.jpg\" alt=\"Its Raining Coffee, Hallelujah\" width=\"615\" height=\"460\"><\/a><br>\n<a title=\"Splash! by sanjibm, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4536113494\/\"><img loading=\"lazy\" decoding=\"async\" style=\"margin:5px;\" src=\"http:\/\/farm3.static.flickr.com\/2722\/4536113494_7de038d468.jpg\" alt=\"Splash!\" width=\"615\" height=\"780\"><\/a><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"http:\/\/farm5.static.flickr.com\/4012\/4544032770_8d9032944a.jpg\" alt=\"Water Drop I\" style=\"width:629px;height:auto\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4543398007\/\"><img decoding=\"async\" src=\"http:\/\/farm5.static.flickr.com\/4061\/4543398007_5620fea3ef.jpg\" alt=\"Water Drop II\" style=\"width:630px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a title=\"Water Drop I by sanjibm, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/sanjibm\/4544032770\/\"> <\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And here is the software&#8230;<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism off-numbers lang-python\" data-lang=\"Python\" data-show-lang=\"0\"><code>\/* Sound Activated Flash Trigger\n* by Sanjib Mitra\n*\n* Program using a Electret Microphone Preamplifier\n*\n* Listen to analog pin 0 and detect sounds that cross the\n* defined threshold. This needs to be calibrated depending\n* on ambient noise. Once detected, the program writes out\n* a HIGH on digital pin 12 for 100ms to trigger the flash\n* via an opto-isolator\n*\n*\/\n\nint flashPin = 12;\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ flash PC sync connected to control pin 12\nint soundSensor = 0;\u00a0\u00a0\u00a0 \/\/ the sound sensor will be connected to analog pin 0\nbyte event = 0;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ variable to store the value read from the sensor pin\nint THRESHOLD = 5;\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ threshold value to decide when the detected sound is a knock or not\n\nvoid setup() {\npinMode(flashPin , OUTPUT);\u00a0 \/\/ declare the flashPin as an OUTPUT\nSerial.begin(9600);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ use the serial port\n}\n\nvoid loop() {\nevent = analogRead(soundSensor);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ read the sensor and store it in the variable\nif (event &gt;= THRESHOLD) {\ndigitalWrite(flashPin, HIGH);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ take flashPin HIGH\ndelay(100);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ wait for 100ms to trigger the flash\ndigitalWrite(flashPin, LOW);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ take flashPin LOW\nSerial.println(&quot;Flash Triggered\\n&quot;);\u00a0\u00a0\u00a0\u00a0 \/\/ inform the computer that the flash was triggered\ndelay(10);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ 10ms delay to avoid overloading the serial port\n}\n}\n<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"color:#000000;\">This article was inspired by and based upon experiments described <a href=\"http:\/\/www.glacialwanderer.com\/hobbyrobotics\/?p=11\">here<\/a>. Thanks Glacial Wanderer!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The primary problem when designing a sound sensor for a standard ADC input is to convert the amplified sinusoidal waveform into a corresponding stable DC voltage. This circuit here uses<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6,9],"tags":[],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-create","category-technology","category-tinker"],"_links":{"self":[{"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":6,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanjibmitra.ie\/blog\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}