# 4N25 Resistor Value

I'm sorry if this seems a little elementary to you guys, but it's been about 18 years since I did any kind of electronics at all, so just getting back into all this. :)

My eventual goal is an intervalometer with LCD display and push buttons to be able to control all the settings out on a shoot, but for now I'm starting basic with all my values hardcoded into the sketch, just trying to trigger the camera (using a 4N25 to separate the arduino from the camera's remote shutter input).

I've ordered some components to get things up and running, and just wanted to check that I have things clear in my head and that I've figured all this lot out correctly while I wait for them to arrive.

If I'm reading the 4N25 spec sheet right, it requires 1.2v and draws 10mA. I planned to use pin 12 to trigger the 4N25 which outputs 5v. So, pin 1 on the 4N25 goes to pin 12 on the Arduino and pin 2 on the 4N25 goes to ground, right? Obviously I need to stick a resistor in there, so if my memory of Ohm's law serves correctly (and please tell me if it doesn't)...

r = v / i

?? = (5v - 1.2v) / 0.01 amps

So, 3.8v / 0.01 = 380 ohm (the nearest I can find being a 330ohm resistor).

Assuming that's correct, does it matter whether the resistor is placed between Ardiuno pin 12 & 4N25 pin 1 or between 4N25 pin 2 & ground? Assuming that's incorrect, please tell me where I went wrong in my maths. :)

I'm also figuring I can then just connect my camera's shutter to pin 5 on the 4N25 and the camera's ground to pin 6 on the 4N25, and all should be happy.

So, does this sound about right? Or should I start over? :)

Kaouthia , You did that exactly right.

There is an LED inside the 4N25 and so it's just like all the other LED stuff often discussed on this forum. The resistor is not critical... 330 is fine and even 270 won'y blow anything up.

On your project, have you seen this? http://www.mindspring.com/~tom2000/Projects/AI-1_Remote/AI-1_Remote.html

I have a version of this running, with RF Remote control added. His code fits in a 168 so LOTS of room for added function in a modern Arduino.

Photo of my early version here: http://yourduino.com/camera-control.htm I'm using small relays because I had them; the 4N25 should be good....

Have fun shooting! And if you want to be overawed at TL Photography, see http://timescapes.org

Thanks Terry :)

It's Tom's stuff over at timescapes that's partially inspired me to do this.

I shoot with D200 & D300s bodies, so I have been using the built in intervalometer feature, as well as the Yongnuo MC-36R 2.4Ghz wireless intervalometer when I need funky shutter lengths to get the right exposure or go beyond the 999 frame limit of the feature built into the camera.

I've been shooting timelapse for a while, but am looking to take things up to the next level. My ultimate plan is to have this control a motion control slider too on an Igus rail (I've been reading up on openmoco.org the last few months, but a lot of it's gone right over my head until recently), but taking things easy to start.

Hey, let’s keep in touch on this; I have 3 guys at the University here interested in adding motion control to the AI-1 Remote base…

I think a rudimentary crane could be moved with a mini winch based on one of these:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=130

15 Kg/cm should be enough for any almost-balanced crane. I think you want it a little unbalanced to minimize backlash…

And you’d want some position encoder…

The way I've been thinking this with the research I've done so far...

Playstation 2 controller for input (10 buttons, 8 way joypad and 2 analogue joysticks) 3 Pin output socket stolen from a Yongnuo RF-602 receiver (then I can trigger Nikon, Canon or other just by switching out a £3 cable) 4x20 LCD Panel (just arrived today) so I can see what settings I'm setting, and how far through the sequence I'm shooting) 1x Stepper motor for the slider truck to go along the rail 2x Stepper or Servo motors (haven't decided which route to go yet) for pan/tilt head

On the 3-pin socket from the RF-602 receiver, one pin is for AF, one is for the shutter release, and one is for ground. You need to connect gnd+AF before you can trip the shutter, but with the body set in manual focus mode, it doesn't do anything (except satisfy the requirement of being connected when you connect gnd+shutter). The AF + Shutter pins can actually be connected together so you trip both simultaneously. So, it only uses one pin + gnd on the Arduino. The code just sends it high, then 50ms later sets it low (I'm using millis() to check the time, so that my intervals are accurate and I don't have it locked up using delay()s). You need the 50ms delay to make sure that the LCD turns off and the camera actually takes the shot.

Really, I probably should be using 2 pins and controlling the AF and Shutter pins separately (then I don't need the 50ms delay before setting the pin LOW and the timings would be even more accurate), but until I know for sure I can afford to spare that extra pin, this method works. Btw, for those who shoot Nikon and are curious, regardless of whether I used 1 or 2 pins, the fastest shutter speed I could get the camera to shoot on bulb mode using the 10-pin socket is 1/6th of a second (even if it was only connected for an instant).

4 Pins for the Playstation 2 controller (figured I'd go for this one, then it'd give me an easy wireless option for the future, and it gives a lot of buttons for scrolling through menus and changing settings as well as the 2 analogue joysticks to control both the truck that runs across the slider rail and the pan/tilt head).

The 4x20 LCD panel is just because I'm greedy, I like bigger screens :D, so that's another 2 or 3 pins.

Still figuring out the motor stuff, so not sure how many pins that'll end up using. But, I'm thinking I'll have all I need on an Uno. If not, I suppose I'll just have to get a Mega. ;)

This is the code so far, and it seems to work ok. I probably could get away with setting triggerInterval as an unsigned int, as I rarely shoot at intervals shorter than 2 seconds, but I set it as a float in case I wanted 0.5 second intervals (if I hook it up to the D300s I can theoretically go as as fast as 0.125 intervals)

// triggerInterval is the number of seconds between shots (in seconds)
float triggerInterval = 3;

// The trigger pin for the shutter
const int triggerPin = 13;

// Time last shot was taken
unsigned long prevshotTime = 0;

// Is the shutter open, false by default
boolean shutterOpen = false;

void setup() {
// Setup the triggerPin as an output
pinMode(triggerPin, OUTPUT);
}

void loop() {
// Store the current time
unsigned long currentshotTime = millis();

if (currentshotTime - prevshotTime > triggerInterval*1000) {
// Store the time the shot was taken so we can compare in the future
prevshotTime = currentshotTime;
// Open the shutter, and set the shutterOpen boolean true.
digitalWrite(triggerPin, HIGH);
// Finally set the shutter open
shutterOpen = true;
}
if ((currentshotTime > (prevshotTime + 50)) && (shutterOpen == true)) {
// Turn the LED off, and set the shutterOpen boolean false.
digitalWrite(triggerPin, LOW);
// Set the shutter closed
shutterOpen = false;
}
}

Next job, as my HD44780 & 74HC164 shift registers arrived today, is to get it outputting stuff to the LCD, so I can keep a count of how many shot's it's taken since the device was turned on. Hopefully my Playstation 2 controller will turn up tomorrow or Monday and I can setup basic start, stop and reset buttons.