Hello everyone!
I´m beginner as far as circuit building is concerned. Some interesting problems occured, so i think that the best thing is to give you in detail description of my project: MY GOAL is to build sound trigger for camera flash. During my build, i followed some online descriptions of simmilar projects and build my own configuration.
1. At first, as shown in video 1, the trigger worked perfectly. As seen in code below, you hook up arduino, press button, LED turns on-to show you that it is ready, and when you make some noise, which is louder then treshold, the flash triggers and then light turns off. It worked perfectly.
When I moved my board in room where I wanted to take some pictures, I hooked arduino to my laptop. Just in case I launched arduino 1.0 software. I made sure that the port was the right one, and that it powers my arduino nano corectly. - that probably wasn't necesarry, but I wanted to be sure.
2. Then i set everything up. As shown in video 2: I hook up arduino, it turns on, but then the LED light turns on without any press of my button??? When sound goes above treshold, nothing happens. I try to push button, just in case. Then i try again to make some noise above treshold and nothing happens. Flesh doesnt trigger and LED light stays on. Something isn't right.
Here is my scheme:
The code is the same in video 1 as in video 2. Nothing was changed.
#define BUTTON_PIN 5
#define FLASH_TRIGGER_PIN 2
#define SENSOR_PIN 0
#define LED_PIN 10
#define STANDBY 0
#define ACTIVE 1
#define SENSOR_THRESHOLD 0
int mode = STANDBY;
long flashDelayMS = 10;
void setup() {
pinMode(BUTTON_PIN, INPUT);
pinMode(FLASH_TRIGGER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);
}
void loop() {
if (digitalRead(BUTTON_PIN) == HIGH)
{
mode = ACTIVE;
digitalWrite(LED_PIN, HIGH);
}
if ((mode == ACTIVE) && (analogRead(SENSOR_PIN) > SENSOR_THRESHOLD)) //
{
delay(flashDelayMS);
digitalWrite(FLASH_TRIGGER_PIN, HIGH);
delay(50);
digitalWrite(FLASH_TRIGGER_PIN, LOW);
mode = STANDBY;
digitalWrite(LED_PIN, LOW);
}
}
Picture of build circuit with my components:
On the left side you see amplifier circuit with microphone hooked up to it. In the centre is optoisolator, on which the flash is connected to. On the right side you see Arduino nano, LED light, and the switch in the right upper corner.
I really apreciate all your help! Thank you in advance, kotk.