Introduction: Building Block - Arduino Nano Remote Camera Trigger

I've built a number of projects over the years that revolve around my other hobby: Photography.

A number of these projects include facilities for remote control of my camera's. It was always a concern that a simple wiring error or other minor issue in the circuits I built would result in a catastrophic incident. I'm driving some very expensive camera equipment with my experimental circuitry.

Using relay's as switches works, but they consume a phenomenal amount of power. They're not suitable for projects that I hope to run from batteries. They're not teribly consistent when it comes to triggering high-speed event's either.

I needed something that consumes little power, offers a fast, consistent response time and great electrical isolation to protect my cameras equipment.

One answer is to use optocouplers. The offer great speed, they're low cost, low power and offer great isolation between my dodgy electronics projects and my camera.

This instructable is geared towards offering an understanding of the circuit I use as an interface between other projects and my camera kit. The example here is using the circuit as an electronic remote shutter trigger, but the technique lends itself to other photography tasks too; flash triggers for example.

Supplies

Bill of Materials


1 Arduino Nano (Rev3.0)

2 Optocoupler - 4N35 6 pin DIP (See Optocoupler 4N35 Below)

2 220R Resistor power 0.25 * (See Current Limiting Below)

2 2K2 Resistor power 0.25 * (See Current Limiting Below)

2 Tactile Switch - Momentary Close

1 Breadboard & a selection of hookup wires

1 Camera Remote Control Lead * (See Camera Hookup Below)

1 Generic female header - 3 pins

Optional

There's multiple ways of putting the circuit together, but we'll use a breadboard and a 9V battery for prototyping, so:

1 9V PP3 Battery and battery clip

2 Additional LED's for testing/indication

Optocoupler 4N35

The 4N35 optocoupler is ostensibly a light emitting diode and an NPN BJT (Bipolar Junction Transistor) photo transistor built into a 6-Pin DIP (Dual-Inline Package) chip.

A common or garden NPN transistor would normally be driven by using a voltage applied between the base and emitter of the transistor, thereby switching the transistor on and allowing a current to pass from the collector (pin 5 of the 4N35 IC) through the junction into the emitter (pin 4 of the 4N35 IC) to ground.

In this case, however, the junction breakdown is facilitated by the illumination of the base - emitter junction with a gallium arsenide infrared LED.

There are a number of great benefits of using an optocoupler in this project, they key one being that there is no direct electrical connection between the LED itself and the transistor that is acting as the switch. The optocoupler is working as an optoisolator, with an effective isolation voltage of 5000v.

By using the isolation properties of the 4N35, we've built a pretty effective firewall between our experimental projects and our expensive camera equipment.

Current Limiting - Input

Like any other LED, we need to limit the current being supplied to the infrared LED built into the 4N35.

Looking at the data-sheet (attached), we can see that the LED will operate with a nominal forward voltage of somewhere between 0.9 and 1.7 volts (see Electrical Characteristics > Forward Voltage), with a forward current requirement of around 10mA.

Initially I wasn't sure what minimum current that my camera would need to sink to trigger the focus and shutter mechanism, though having measured it I knew it was using a 5 volt supply in circuit. I wanted to make sure that the 4N35 transistor was switched on quickly and succinctly, however, to ensure that the photograph was taken reliably every time, so we need to maximize the current flow in the camera to emulate the push-button switch which is the usual remote trigger device.

Looking at the graphs in the data-sheet we can see that the transistor is 'on' with a nominal 10mA supply and has a maximum forward current of 50mA. That's probably pushing the bounds a little, so I've assumed that we'll drive the diode with a 15mA forward current. That should drive the diode hard, but well within the acceptable range of the device, and switch on the transistor quickly and allow a sufficient current to flow, triggering the focus and shutter on the camera.

We know that the Arduino of choice uses 5V logic, so we need to calculate a value for a suitable resistor that will limit a 5V supply to a 15mA draw across the diode that we know to have a maximum forward voltage drop of 1.7 volts. The equation is basic ohms law:

R = ((Vs - Vled) / Iled)

Vs =  Supply voltage (5V), Vled = LED voltage drop (1.7V), Iled = LED current (15mA)

The end result is 220 Ohms.

What power resistor do we need?

P = IV

15mA through our 200R resistor gives us our voltage drop of 3.3V. We know the current through the resistor is 15mA so...

15mA x 3.3V = 0.0495 Watt.

A 1/4 watt resistor will do the trick nicely.

Current Limiting - Output

For the output circuit, looking at the datasheet for the 4N35, we can see that the maximum current for the output transistor is given as 50mA, with a maximum supported current of 100mA assuming that the throughput is equal to or less that 1 millisecond.

Now this could represent an issue. Having measured the current that the camera passes through each of the circuits (focus & shutter), the camera will drive around 500mA. We need to restrict the current flow through the circuit to ensure the reliability of the 4N35 chip.

I found, however, that the electronics in my camera demand a minimum current of around 300mA or the circuitry in the camera won't work. It won't focus and the shutter won't fire if the current is too restricted.

Through experimentation, I found that a 2K2 resistor will allow enough current to flow through the circuit to drive the camera while still limiting the current draw significantly.

So, where the ratings we've looked at are defining technical maximum values, the real world concern is the transistor cooking because it's dissipating too much heat.

Having measured the Collector-Emitter voltage in-circuit while the resistor is in place, I measure a 5.5mV drop across the transistor. With a 300mA current throughput the 4N35 is therefore absorbing some 1.7mW of power. That's well below the 70mW maximum rating of the device. Happy days!

Camera Hookup

The lead I'm using is the proprietary Nikon 10-Pin connector but many camera's will have a trigger control system that utilities a similar system.

Like many cameras, my Nikon cameras have a two stage shutter release button, where half pressing the button will activate the camera and start the auto-focus mechanism.

The second stage will fire the shutter when fully depressing the shutter button.

This process needs to be mirrored in our circuit, which is why we have two optocoupler circuits, where one is activating the camera and enabling the auto-focus. The other is triggering the shutter.

For all my camera's both circuits need to be engaged to fire the shutter. The shutter will not fire unless the Activate/Focus circuit is also switched on.

You'll need to ascertain which lead is which on any connectors you use. The Nikon 10-Pin connector pin-out is described here, so just check with a meter (ohms or continuity will do the trick) to ascertain which lead is what for your particular connector.

Attachments

Step 1: Building the Circuit

Assemble the breadboard as detailed in the figure above.

My preferred assembly workflow with breadboards is to fit the bigger components on to the breadboard first; the Arduino Nano, the tactile switches and the 4N35 chips. Set the spacing between the components to give enough space to facilitate the balance of the wiring. The exact layout is not crucial.

There are some critical elements, however:

  1. Make sure that the Arduino is correctly wired in to the breadboard.
  2. Make sure that the 4N35 IC's are in the correct orientation. Pin 1 on the package will be delineated with a dot, and/or the top of the package will be identifiable with a notch.
  3. Make sure that you have the tactile switches in the correct orientation. The Fritzing diagram attached assumes that the switches are mounted on a breakout-board. If you're using switches straight onto the breadboard, then you need to adjust your wiring. See the image of the naked tactile switch for reference.
  4. In the Fritzing Diagram, I've removed the links from the emitter on the optocouplers and replaced them with some LED's. This makes testing the circuit very easy, as the LED's will light up when the buttons are pressed.

You can leave the LED's in place for a working example, of course, but you may have to recalculate the value of the current limiting resistors. Now there is two voltage drops to consider:

R = ((Vs - V4N35led - VRedled) / Iled)

However, I've found that the 220R resistor we have in place, even with the additional LED's in circuit, causes no problems at all for the device. So, it's up to you if you want to leave the LED's in play, or reduce costs and remover them.

Once you have confirmed that the circuit is built correctly, you can load the code.

Step 2: Enter the Code


// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial

// Define pins
const int trigFocus = 10;
const int trigShutter = 9;
const int camFocus = 3;
const int camShutter = 2;

void setup() {

 // Start up the USB Serial port for debugging
 Serial.begin(115200);      // opens serial port, sets data rate to 115200
 while (!Serial) {
   ; // wait for the serial port to connect
 }

 // Setup the serial pins 
 pinMode (trigFocus, INPUT_PULLUP );
 pinMode (trigShutter, INPUT_PULLUP );
 pinMode (camFocus, OUTPUT);
 digitalWrite(camFocus, LOW);
 pinMode (camShutter, OUTPUT);
 digitalWrite(camShutter, LOW);

} // end of setup()

void loop() {
 // Main code here, to run repeatedly:
 if (digitalRead(trigFocus)==LOW)
  { digitalWrite(camFocus, HIGH);
   Serial.println("Focus Triggered");
   if (digitalRead(trigShutter)==LOW)
   { digitalWrite(camShutter, HIGH);
    Serial.println("Shutter Triggered");  
   } else { digitalWrite(camShutter, LOW); }  
 } else {
  digitalWrite(camShutter, LOW);   
  digitalWrite(camFocus, LOW);   
 }

} // end of loop()

Step 3: Testing Notes

  • Before you upload the code, make sure you picked the correct board from the IDE board selection manager.
  • For me, with the Arduino Nano boards I have, the code won't upload unless the Old Bootloader option has been selected from the list that's populated under the board selection in the Tools menu too.

Once the code is loaded, then the circuit should start working.

Remember: Pressing the 'Focus' button will light up the focus LED, but the Shutter LED will only light up if he Focus button is pressed as well. If you're only pressing the Shutter button, then the Shutter LED will not light by design.

I'm confident the circuit works, so if it's not working for you, check your hookup connections are accurate.

Step 4: Remote Trigger

In the last breadboard view, the circuit is wired up in accordance with the original schematic. I've taken out the LED's and replaced them with jumper wires. Now that you know the circuit is working, you can hook up the outputs to your camera.

IMPORTANT!

Please note that if you're going to run your project from an external power source, then you need to change the connection on the Nano.

Make sure that the Arduino is correctly wired to the external source. In the example here, I'm using a 9V battery.

Pin 29 on the Nano is still used for the ground connection, but Pin 30 (VIn) is used for the +Ve connection. Pin 30 connects to an LM1117 regulator IC, which will reduce the voltage to the 5V that the Arduino requires. If you plug the 9V battery into the wrong pin you may damage your circuit.

DO NOT RUN YOUR BREADBOARD ON THE 9V BATTERY WITH THE USB LEAD PLUGGED IN! USE ONE POWER SOURCE OR THE OTHER , NEVER BOTH TOGETHER!

Leads & Cables

The lead set I have has three colours: White, which is the activate/focus lead. Red is the shutter trigger and black, which is the common lead. You'll need to confirm which is which on the leads you're using, however. Don't assume, even if your lead has the same color wires that they will perform the same function as mine.

There are numerous leads on the market for camera remote triggers. The ones I use are invariably ripped out of cheap triggers bought on ebay. The 'professional' leads, like the Nikon MC-22 Remote Cord with Banana Plugs will certainly do the trick, but they're obscenely expensive. The cable from a cheap manual switched remote will serve just as well, and will cost a fraction of the price, so don't feel you have to splash out to get an expensive 'original' item.

The pin-outs I've defined above are for my Nikon camera's, but I found an excellent resource some time ago (https://www.doc-diy.net/photo/remote_pinout/) that defines the connector pin-outs for a wide variety of camera models: Canon, Fuji, Olympus, Panasonic/Lumix, Pentax, Sigma, Sony and even Hasselblad. The site has lots of other very interesting products and ideas in there too, so it's well worth a look-see.

Step 5: More Ideas

Once I had the circuit tested, I put together the first working model on some veroboard and mounted it in a little box to make it more robust. I also designed a PCB that uses a slight variation of the two-LED theme that also works very well and I've used those in a number of experiments.

This basic module lends itself to all sorts of purposes and many different processors. The Nano is an inexpensive, cheap processor module and works, but adding something more sophisticated, an ESP32, for example, lends itself to a far wider range of possibilities.

I built a circuit using Blynk (https://blynk.io/) to create a sophisticated, wireless remote control system that facilitated the remote control of my camera and synchronized the shot with flashes and some water valves to create water drop photographs.

I've thought of building a wireless intervalometer too, for long exposure and/or time-lapse experiments.

I'm currently building a motorized linear slide platform for macro-photography. I want to try my hand at creating an image using stacked photographs. That should be fun.

I hope that gives you some ideas, anyway. Have fun.