Saturday, October 6, 2018

Using Arduino Nano as a External Shutter Release (External Trigger) with DigiCamControl Software


External triggers can be used to extend camera(s) capture capabilities like bulb mode for cameras which don't support it or to trigger multiple cameras in same time without lag. In this project we using Arduino Nano and opto Isolator to interface Shutter release PC serial Port Cable.

Nikon DSLR Camera require the metering circuit (Auto Focus) signal to be present when the shutter release signal fires. If the shutter release button on the camera half pressed, its will focusing the metering circuit to focus the camera lens. To handle with these two signal controls without interfere each others, we need an opto isolator for each signal control.

Nikon camera has an interface terminal called "Nikon 10-pin remote terminal", which has connected to ground pin, release trigger pin, and wake up/ focus pin. We use those pins to interfacing with Arduino Nano with PC serial that will be able to triggering Nikon Camera externally.


From the Arduino Nano digital output pins to these Nikon shutter pin and focus pin, we need to add opto isolator circuit to separate the camera power and the arduino power. The opto isolator also use to separate the focus signal and the shutter signal to avoid interfere each others when internal shutter button pressed manually.

To work with DigiCamControl Software External device Trigger, we need to define its interface controller first. This can be done in Setting->Device->Add. The image below shows the setting for Arduino Shutter Release, more combinations shows in Setting->Devices.


After a device is defined, the Arduino Nano shutter release can be used in multiple places like in multiple camera control. If the camera has an attached device, all capture action will executed by the device, not by the normal PTP script utility. In this way if the arduino Nano connected to 2 cameras and if we click on capture, both cameras will capture.


The DigiCamControl Software using RS232 serial protocol with default baudrate 9600bps. The Command control is using ASCII text ended with "Carriage Return" and "Line New" codes. The first line coding is to setting the baudrate and define the shutter pin on Arduino:



int RLY_CAMERA = 12;
            int BAUDRATE = 9600;

void setup()
{               
  // initialize the digital pin as an output.
  pinMode(RLY_CAMERA, OUTPUT);
 
  Serial.begin(BAUDRATE);
  while(!Serial)
  {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  // reserve 200 bytes for the inputString:
  inputString.reserve(100);
  digitalWrite(RLY_CAMERA, LOW); // Ccamera off
}



And for the next step, we need to matching the command to "Shutter ON" and "Shutter OFF" as declared before in DigiCamControl Software.


·                            Shutter ON  : “A”
·                            Shutter OFF : “O”


Below are the coding to check the command sent from DigiCamControl Software to the Arduino Nano and trigger the Camera if a command found.



// the loop routine runs over and over again forever:
void loop()
{
            digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
            digitalWrite(PULSE, HIGH);   // turn the LED on (HIGH is the voltage level)
            delay(1);               // wait for a microsecond
            digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
            digitalWrite(PULSE, LOW);   // turn the LED on (HIGH is the voltage level)
            delay(1);               // wait for a microsecond

            if (stringComplete)
            {
                        if (inputString.startsWith("A"))
                        {          
      Serial.println(inputString);
      Serial.println("Trigger ON");
      inputString = "";
      stringComplete = false;
      digitalWrite(RLY_CAMERA, HIGH);  
                        }
                        else if (inputString.startsWith("O"))
                        {
      Serial.println(inputString);
      Serial.println("Trigger OFF");
      inputString = "";
      stringComplete = false;
      digitalWrite(RLY_CAMERA, LOW);  
                        }
            }
}


void serialEvent()
{
  while (Serial.available())
  {
    // get the new byte:
    char inChar = (char)Serial.read();
    //delay(10);
    // add it to the inputString:
    if (inChar != '\n')
    {
            inputString += inChar;
    }
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n')
    {
            stringComplete = true;
    }
  }
}























8 comments:

  1. Hi, nice post. I'm trying to figure what each pin is for the nikon d3400 which doesn't have this interface, but has only a micro-usb input. How do I test it, or find which is trigger, which is focus and which is ground?

    ReplyDelete
  2. How about with simples shutter release, example for Nikon D5200 or similar DSLRS?

    ReplyDelete
  3. How about controlling a turntable. Like the shutter stream 360 by iconasys.

    ReplyDelete
  4. you can control turntable+stepper motor using arduino nano, they have many pin left to control stepper motor+turntable and camera trigger

    ReplyDelete
  5. Nice blog very informative. For more information visit camera handle

    ReplyDelete
  6. I want to use MIOPS as camera trigger. Do you have any advice on this? It has positive comments as a camera trigger.

    ReplyDelete
  7. Sure you can buy MIOPS as camera trigger without any effort, just plug and play. This tutorial is about Do It Yourself (DIY) camera trigger.

    ReplyDelete
  8. Thanks and I have a neat offer: Where To Start House Remodeling house renovation exterior

    ReplyDelete