Clap clap trigger

New layout

New layout

New diagram

New diagram

New wiring

New wiring

About consumption :  a short test (@9V) give 28mA under steady state and 72mA with relay + LED on. For the battery life, I take 30mA as an average value.

Problem : the 5V regulator of the chinese Arduino does not seems to handle 9V! I was feeding the board via the Vraw pin with 9V and 8.4V were measured on Vcc (supposed to be 5V regulated). Leading to strange and instable behaviour of the duino. I simply completly replaced the duino and place a regulator (78S05, I had othing else).

Also added a 100 ohm resistor for the blue led, to reduce a bit the load on the digital pin (should be under 25mA now).

clap clap trigger arduino

Electrical diagram

clap clap trigger arduino

Wiring overview

clap clap trigger arduino

Layout on the board

Arduino mini pro

Programmation of the arduino mini pro via an arduino uno (without chip)

Tests on a Canon 1000D

Tests on a Canon 1000D

Tests on breadboard

Tests on breadboard

Here the code (running on Arduino Mini Pro 5V 16MH)

!!!This code is functional but this is not the final version running on the board!!!

int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin1 = 13;      // select the pin for the LED (on Arduino board)
int ledPin2 = 9;      // select the pin for the LED (blue LED)
int relayJackPin=10;      //pin for the relay linked to the jack
int lightPin=12;      //pin used to trigger a relay that turn a light on for correct picture exposure (not used yet)
int sensorValue = 0;  // variable to store the value coming from the sensor

int clapDuration=0;
int intervalSinceLastClap=10000;
int lastClapTime=10000;
int intervalSinceLastTick=10000;
int lastTickTime=0;
int tickNb=0;
boolean tickDetected=false;
int countBlink=0;//pour le clignotement de la LED bleue

void setup() {
// declaring OUTPUTs:
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(relayJackPin, OUTPUT);
pinMode(lightPin, OUTPUT);

Serial.begin(9600);
}

void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);

//compteur pour clignotement de la LED bleu quand il ne se passe rien pour attirer l’attention
countBlink=countBlink+1;
if(countBlink>1000){
digitalWrite(ledPin2, HIGH);
if(countBlink>1200){
digitalWrite(ledPin2, LOW);
countBlink=0;
}
}

if(sensorValue<500){
lastTickTime=millis();
tickDetected=true;
tickNb=tickNb+1;
}

intervalSinceLastTick=millis()-lastTickTime;//check for overflow!

if(intervalSinceLastTick>200){//fin du son, attention au serial print et a la valeur min de declenchement du shoot

//Serial.print(“Interval since last tick : “);
//Serial.println(intervalSinceLastTick);
if(tickNb<25&&tickDetected==true){
//clap!!
Serial.println(“CLP”);
Serial.print(“Tk”);
Serial.println(tickNb);
tickNb=0;
intervalSinceLastClap=millis()-lastClapTime;//check for overflow!
lastClapTime=millis();
}
tickNb=0;
tickDetected=false;
}

//if interval is OK, start the shooting sequence
if(intervalSinceLastClap<750&&intervalSinceLastClap>250){

digitalWrite(lightPin, HIGH);//turn the light on for exposure (not used yet) during all the shooting sequence
digitalWrite(ledPin2, HIGH);//copy signal on the blue led

Serial.print(“Shoot ! Interval for triggering : “);
Serial.println(intervalSinceLastClap);

takePicture(3,2000);//let time to flash to load at full power (exp +2 and dark scene : tap on lens)
intervalSinceLastClap=0;

digitalWrite(lightPin, LOW);//turn the light off after shooting sequence
digitalWrite(ledPin2, LOW);//copy signal on the blue led
Serial.println(“End of shoot”);
}

}

/*
//photos de 18h à 4h du mat : serie de 3 toute les 5 mins : 10×60/5=120 series de 3
//durée allumée 8h //360 photos avec flash //mémoire : 360 x 4.0Mo -> 1440Mo
//29/04/2016 test avec batterie originale / flash corr 0 / ecran allumé luminosité max ->315 photos (450Mo) de 18h à 2h30 ->6h30
//30/04/2016 test avec batterie de secours / flash corr +2 / ecran allumé luminosité max -> test arreté : il faut faire les test avec bouchons sur l’objectif (le flash compense l’exposition)
void loop(){

takePicture(3,3000);//let time to flash to load at full power (exp +2 and dark scene : tap on lens)

//attendre entre les séries
for(int i=0;i<300;i++){
delay(1000);
}

}
*/

void takePicture(int nbShoot, int delayBetweenShots){
for(int i=0;i<nbShoot;i++){
digitalWrite(relayJackPin, HIGH);//signal to camera : shoot
digitalWrite(ledPin1, HIGH);//copy signal on the green led
delay(1000);
digitalWrite(relayJackPin, LOW);//signal to camera end shooting
digitalWrite(ledPin1, LOW);//copy signal on the green led
delay(delayBetweenShots);
}
}