Wednesday, 1 October 2014

Nikon Hacks Part VI

Nikon Flash and Arduino

Runner Beans - Ring Flash
Check my other site !

Introduction 

In this section I aim to trigger the shutter of the camera and the Flash using the Arduino. I need to experiment with bits of code to get triggering and delay times just right.
So far I have established that the minimum trigger time for my flash is 12us (twelve microseconds). That is the minimum time the Trigger pin can be grounded to fire the flash.
Here is the simple code for that: --------------------------------------------------------------
 /*
  FLASH


  This example code is in the public domain.
 */


int flash = 11; // trigger pin

// the flash triggers once when you press reset after a short delay:

void setup() {               
  // initialize the digital pin as an output.
  pinMode(flash, OUTPUT);  
 
digitalWrite(flash, HIGH);

delay(3000);

// fire flash once------------------------------------------

digitalWrite(flash, LOW);   // 
  delayMicroseconds(12);               // wait 12us minimum trigger time
  digitalWrite(flash, HIGH);  
               // wait  
}

// the loop routine runs over and over again forever:
void loop() {
 
}

End Flash code:------------------------------------------------------

I want to use the camera in Bulb mode:

1.ensure IR is off and  prepare camera for bulb mode to receive IR
2. trigger IR and open shutter
3. wait for exposure eg 10 secs
4. trigger IR and close shutter
5. check result 

I decided to use the Transistor method for triggering the IR remote:

Code for IR:------------------------------------------------------------
/*
  shutter IR


  This example code is in the public domain.
 */

int shutter = 10; //IR shutter pin

int flash = 12; // Flash trigger pin


void setup() {               
  // initialize the digital pin as an output.
  pinMode(flash, OUTPUT);  
  pinMode(shutter, OUTPUT);
 
  Serial.begin(9600);
  digitalWrite(shutter, HIGH); // high is IR OFF

Serial.println ("Prepare Camera - 30 sec");

delay(30000); //pause 30sec

}

//
void loop() {
 
//bulb mode

digitalWrite(shutter, LOW); // low is IR on open shutter
Serial.println ("IR ON 1 - open shutter");
delayTenthsSeconds (2); // 0.2 seconds trigger shutter
 
  digitalWrite(shutter, HIGH); // high is IR OFF
  Serial.println ("IR OFF");
delayTenthsSeconds (100);// ten seconds

digitalWrite(shutter, LOW); // low is IR on close shutter
Serial.println ("IR ON 2 - open shutter");
delayTenthsSeconds (2);

 
  digitalWrite(shutter, HIGH); // high is IR OFF
   Serial.println ("IR OFF");
//delayTenthsSeconds (10);
Serial.println ("CHECK RESULT");
delay(50000); // hold for check

}

void delayTenthsSeconds (int multi){// delay multi x 0.1 sec

    for (int i = 1; i < (multi * 100); i++) //
    {
      delayMicroseconds(1000);   // multi x 100     }
}

End Code for IR:--------------------------------------------------

1 comment:

  1. Craig this is ed Taylor from Cardiff days I am on linked in if you want to get in contact

    ReplyDelete