Introduction: ARDUINO Sound Activated Flash or Camera Trigger

This instructable will show you how to build a simple circuit to connect to a ARDUINO micro controller that will detect sound and trigger your camera or flash for high speed photography. This is easy to assemble and only cost a few $$$ for the parts...

Step 1: Build the Circuit..

Step 2: The Code

int flash = 9; //flash or camera triger pin
int mic;
int lvl = 0;
int trig;
void setup() {
pinMode(flash, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (lvl == 0)
{
Serial.println("What Sound Trigger LVL do you want? ");
lvl = 9000; //sets trigger lvl high so it wont trigger till you enter a value
}
if (Serial.available())
{
lvl = Serial.parseInt();
lvl = constrain(lvl, 25, 9000); //stops you from setting sound detection lvl to low and cause continuous
Serial.print("Sound Trigger LVL is "); //triggering, you can change the 25 to a lower # but dont go under 15
Serial.println(lvl);
Serial.println("What Sound Trigger LVL do you want? ");
trig = 0;
}
mic = analogRead(A0);
if (mic >= lvl)
{
digitalWrite(flash, HIGH);
delay(1);
digitalWrite(flash, LOW);
trig = trig + 1;
Serial.print("Flash has been Triggered ");
Serial.print(trig);
Serial.println(" Times!");
delay(1000); //delay so your camera or flash only triggers one time from a sound
}
}

--------------------------------------------------------------------------------------------------------------------

After you get the code loaded onto the arduino power it up then plug it into your flash or camera. It wont hurt the camera or flash to have it connected when you power up the arduino but it will trigger it one or two times when its first starting up...

next open up your serial monitor, you can use the one on your computer or if you have a android smart phone & a USB OTG cable you can down load a free serial monitor from the play store.. Just follow the instructions on the serial monitor and your good to go, if you have any problems leave a comment below and ill try to help you out...

Comments

About This Instructable

3,943views

24favorites

License:

More by Z-HUT:How to Add a Audio Alarm to Your Mouse TrapANDROID Bluetooth Controlled ARDUINO Universal Infrared Remote ControlARDUINO how to build your own universal IR remote control
Add instructable to: