Camera slider and trigger woes

Hi brains trust,
I’ve got motorized camera slider project that I need help troubleshooting please. I am relatively inexperienced at Arduino builds so I’d appreciate some guidance. I've posted this in the code section but I'm not sure if it's a hardware or software issue.

Project brief: The project is designed to trigger a camera x number of times, then move a stepper y steps and then repeat. Within each stage there are various delays for shake etc. No great task I know.

My problem is that the system will run just fine, then at some random stage it will stop triggering the camera and only execute the stepper part of the loop. The old intermittent fault scenario. Being new to this I cant tell if it's a hardware or code issue.

I have a full set of replacement hardware components in various stages of delivery to make sure it isn’t a fried component.

Hardware:
Arduino nano (bought a while ago so not sure if it’s genuine or knockoff. Genuine Nano Every is in the mail).

EasyDriver v4.4 with a NEMA 17 stepper

Trigger pins for the camera are routed through 4N25 optoisolators with appropriate resistors on the Arduino side to manage the forward current of internal opto LEDs.

Camera is a Panasonic GH5s. The Panasonic trigger signal is an annoyingly non-standard one, relying on 2 pins only with changes in resistance triggering the shutter. I purchased a manual remote trigger unit including appropriate resistors so I didn't have to deal with the prospect of frying the inside of my camera with using the incorrect resistors. The manual unit triggers the shutter reliably simply by closing the shutter and focus contacts to ground with a pushbutton. My optoisolator outputs go to the manual contacts in the manual trigger unit with the same effect.

Code is below, parts I have constructed, other parts I have borrowed from various examples/tutorials. Comments are so I can bumble my way around my own code.

Any advice on which parts of the hardware or code to look at for the fault would be greatly appreciated. I'm banging my head on a wall here at the moment and will need this kit working soon or I'll miss my opportunity until next year.

Thanks, Mat

int smDirectionOut = 9;   //Direction pin out
int smDirectionIn = 5;    //Direction Pin in (switch)
int smStepPin = 11;       //Stepper pin
int smEnablePin = 10;     //Motor enable pin
int camFocusPin = 3;      //optoisolated focus pin
int camShootPin = 2;      //optoisolated shoot pin
int waitSwitch = 8;       //wait switch pin
 
 
//SETUP STATE
void setup() {
 
  pinMode(smDirectionOut, OUTPUT);
  pinMode(smDirectionIn, INPUT_PULLUP);
  pinMode(smStepPin, OUTPUT);
  pinMode(smEnablePin, OUTPUT);
  pinMode(camFocusPin, OUTPUT);
  pinMode(camShootPin, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(waitSwitch, INPUT_PULLUP);
 
  Serial.begin(9600);
}
//MAIN LOOP
void loop() {
 
  int frames = 300;                     // how many frames are required?
  Serial.println("waiting for go");
  delay(100);
 
  if (digitalRead(waitSwitch) == 0) {
    digitalWrite(smEnablePin, LOW);     //engage stepper
    for (int f = 0; f < frames; f++) {
      rotate(135, 0.1);                 //number of steps, speed between -1 and 1
      Serial.println("move");
      shoot (1000, 5, 3000);            //shake delay Ms, number of stacked shots,intershot delay Ms *exposure plus rest*
      Serial.println(f + 1);
 
    }
  }
}
 
 
//START OF FUNCTION DEFINITIONS
 
 
//Stepper function 'rotate'
//accepts 2 arguments : 'steps' and 'speed'
void rotate(int steps, float speed) {
  //  digitalWrite(smEnablePin, LOW); //Enabling the motor
 
  int direction;
 
  if (digitalRead(smDirectionIn) == HIGH) {
    direction = HIGH;
  } else {
    direction = LOW;
  }
 
  speed = 1 / speed * 70; //Calculating speed
  steps = abs(steps); //Stores the absolute value of the content in 'steps' back into the 'steps' variable
  digitalWrite(smDirectionOut, direction); //Writes the direction (from the if statement above), to the EasyDriver DIR pin
 
  //Actual stepping loop
  for (int i = 0; i < steps; i++) {
    digitalWrite(smStepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(smStepPin, LOW);
    delayMicroseconds(speed);
  }
}
//Camera function 'shoot'
//accepts 3 arguments 'preshotDelay', 'stackNumber', 'intershotDelay',
int shoot(int preshotDelay, int stackNumber, int intershotDelay) {
  delay(preshotDelay);                   // wait to minimise stepper shake.
  for (int s = 0; s < stackNumber; s++) {
    digitalWrite (camFocusPin, HIGH);    //focus actuation 
    Serial.println("FocusPin");
    delay(200);                          //focus duration 
    digitalWrite (camShootPin, HIGH);    //shutter actuation
    Serial.println("ShootPin");
    delay(200);                          //shutter duration
    digitalWrite (camFocusPin, LOW);     //returning focus pin to low 
    digitalWrite (camShootPin, LOW);     //returning shutter pin to low 
    delay(intershotDelay);               // delay between shutter actuations 
  }
}

Hi,
How are you powering your project?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

+1.

@TomGeorge may have been implying what is clear: there is nothing in your program that should cause the symptoms, so we are looking at something that is coming out of your hardware setup.

Your code with careful modification to make it go a bit faster (delay-less delays!) is cranking away merrily and would do, I expect, until the power failed.

Also… if it’s not too secret, what opportunity will you miss for a year if it can’t work soon? Inquiring minds want to know. :wink:

a7

Thanks Tom and a7,

Good to hear my code is in order at least, I guess that narrows down my search to hardware issues.

I've attached a copy of my circuit schematic. EDIT: diagram error: the pin labelled "6" on the optos in my diagram should be "4". location and wiring is as shown, just the label of the pin is incorrect.
Power is a 2S 18650 Lipo pack, 8.4v peak voltage.

In terms of the project...
I do a lot of macro video and photography for my YT channel and I have a curved slider that I love to use. It creates a macro version of a drone orbit shot. The problem is that it's manual.

Normally I can make it work just by hand, but for my next shoot I'll be doing long exposure timelapse of Omphalotus nidiformis, a bioluminescent ghost fungus. it's only around for a month or so and each clump is only strongly bioluminescent for a few days before it dried or rots.

I'll also be borrowing a trick from the astro photography guys and doing up to 10 stacked exposures per frame for noise reduction. Up to 3000 frames worth of precise manual long exposures all night sounds like a perfect task for automation. :o

Now the delay commands make sense?

I expect that the automation will also be useful for normal operations providing I can make the stepper smooth enough for the macro footage to not look jittery.

Thanks for your advice folks
Mat

Hi,
Can you post a link to the specs of your stepper, Nema17 tells us the physical size but not the electrical characteristics.

Thanks.. Tom.... :slight_smile:

Hi Tom,
Apologies, it is a NEMA14.

This is the link
NEMA14 1.8 Deg 35MM 2-phase 4-wire Precision Stepper Motor CNC Reprap 3D Printer | eBay

Mat

The 35HS27MF07 stepper, with 4.5 Ohm coils, is rated at 0.5 A/phase.

To what value did you set the all-important current limit on the EasyDriver?

After it stops triggering the camera, does it ever resume on its own? Have you measured the voltages on the optocoupler pins when it's working properly, and after it has stopped? In other words, what exactly isn't working? Is the 4N25 being triggered, but the camera doesn't respond, or what?

Also, I'm confused about your 4N25 connections on the camera side. It seems camera ground should be connected to pin 4, not pin 6. Are the pins just numbered wrong in the drawing?

Edit: Is there any possibility that your camera is unable to focus, either at all or quickly enough, and therefore refuses to take the shot? My Canon does that if there isn't enough light, or if there isn't enough contrast in the scene. Have you tried it using manual fixed focus instead of autofocus, to see if that makes any difference? If in autofocus, you might try increasing the delay after activating the focus line before activating the shutter line. And then I would deactivate the shutter line first, then the focus line, after taking the picture.

jremington, I must admit I must have missed that step. I have looked up how to change the current limit and will change it to the appropriate value given your specs on the motor. thank you.
I assume this will be easier on the motor and prevent coil / driver burnout, but would this setting have any bearing on the symptoms I am seeing with the shutter trigger?

ShermanP, for my optocoupler wiring I have followed this tutorial
Using an Arduino and a optocoupler to activate a camera shutter | Martyn Currey
You are completely correct, I have mislabelled pin 4 on the optos.
I have checked the actual wiring and I have it correctly wired, pins 4 are ground and pins 5 are the release contacts.

Once the shooting stops, it does not start again, but the stepper continues until the end of loop.
Interestingly, because the commercial remote trigger is still part of the system, once the aruino trigger has stopped triggering I can manually press the button to make the contact and the camera will trigger as expected, essentially a manual parallel switch to make the contact that the opto makes. This does not jumpstart the arduino shutter trigger again.

In terms of focus, I am using completely manual vintage lenses for this shoot, and the camera is set to manual focus to accommodate this. Autofocus isn't part of the mix in this case. I have also tried playing with the delays between focus and shoot, and have also tried commenting out the the focus line completely, to the same result.

It's still unclear to me what's going wrong. Does "Shoot Pin" continue to serial print in the shoot function even though the camera has stopped triggering, or does that print stop too? Do you have a multimeter? If so, do you still get the high voltage pulses on pin 1 of the optocouplers when triggering has stopped? And do you continue to get low pulses on pin 5 of the optocouplers (relative to camera ground) when triggering has stopped?

Can you tell us more about the manual release device you bought, including a link to it? Perhaps that's where the problem is.

OK, I think I have some more information to add to the mix and a possible diagnosis.

I have run the full setup until it started to fail then measured/observed a few points in sequence.
Camera intermittently misses shots but this time didn't fail altogether.

So these observations are when the camera should have shot but didn't.
Arduino was still printing to serial "FocusPin" and "ShootPin" as expected.
Arduino LED was giving a flash as expected.
Voltage change occurred across Arduino Pin2 and Arduino ground as expected.
Voltage change occurred across Optoisolator Pin1 and Pin2 as expected.
Voltage change occurred across Optoisolator Pin4 and Pin5 as expected.
Manually making the contacts at the commercial trigger will shoot as expected.

So the camera is receiving a signal but not shooting.

My current working theory is that perhaps the camera isn't receiving the signal it expects from the arduino.
The GH5s expects to see a base high resistance when the jack is plugged in across the two contacts, the "focus" signal is a lower resistance across the same two contacts, and "shoot" is a lower resistance again across those same two contacts.

Perhaps the pin4-5 contact on the optoisolator or somewhere in the wiring between the opto and the commercial trigger is introducing an additional resistance into the circuit that is making the "Shoot" signal marginal. This would make sense because the pin 4-5 contact on the opto is the only component that's being bypassed when the camera is failing to shoot on the arduino, but will correctly shoot on the manual contact.

Does this sound plausable?
I will alter the code to make the high/low signal longer duration so my multimeter can effectively stabilise and accurately measure the resistances between the required points.

One test to perform when the camera is not responding as it should is to see if shorting pins 4 and 5 of the opto together will trigger the camera the same way pressing the button does. If it does, then indeed the opto is not producing the right result. If it doesn't, then something may be wrong with your connection into the commercial trigger.

Here's one possibility. As you say, the camera is somehow sensing the resistance between the two lines. But do we know that one of those lines is actually camera ground? That would make sense because the camera could simply sense the voltage on the other line, which would be the midpoint of a voltage divider. The voltage there would change depending on whether the resistance is 42K, 5K, or 2K to ground.

But when the opto is turned on, it actually generates a small base current that flows into the emitter, which is connected to the camera "ground". If it's really ground, that shouldn't matter. But if it's not really ground, that current could be messing things up. If that's the problem, using a relay instead might work.

But first try changing the 470R resistor to something higher or lower, and see if that makes a difference.

And if you can get inside the trigger device, you might compare the voltage across the two lines when the button is pressed manually versus when the opto triggers it.

Hi,
The spec for the 4N25 says that the volt drop for the input LED is 1.3V typically.

So with 5V you will have using Ohms Law.

Voltage across the resistor;
V= I x R
Current through the resistor and thus through the opto LED will be;
I = V / R
So;
(5 - 1.3)/470 = 0.007 mA of current.

This is very low for that type of opto.
You need more than that to reliably trip the opto transistor.
Buried in the specs they show a test circuit/spec and they use 10mA, the LED can take 60mA as an absolute maximum.

Try 20mA. This can be supplied directly by the Nano output pins.

R = V / I
R = (5 - 1.3) / 0.02 = 185 Ohms

So try a 180R resistor in both cases instead of the 470R you have at the moment.

I hope I explained the maths/Ohms Law.

Tom.... :slight_smile:

OK, update on this project.
I found that I was getting inconsistent errors, which only increased when I swapped out the 470Rs for 180Rs. At this point I suspected that I had either fried a component or had some dodgy soldering going on.

I rebuilt the project with almost identical fresh components, and now it works as expected.
The only changes were:

  • the optos which were changed to 4N28s because that's what was readily available.
  • the arduino which is now a genuine "nano every".

This is all just on a breadboard so I could eliminate any issues of dodgy soldering on a prototyping pcb.

This is still Mk1 but it will allow me to capture my ghost mushrooms while they are in season. I don't want to mess with it too much now that it's working but I will be adding menus and a LCD to change the settings on location in Mk2.

Thanks to all who helped me with my slider woes. :slight_smile:

Mat

1 Like

Yay!

And thanks for coming back… would you please plan to come back once more after you capture the ghost mushrooms and share a link to your photos or video?

a7

1 Like

Absolutely!
Hopefully I'll have the footage shot and edited within the next 4-6 weeks.

thanks again

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.