Using camera flash sync output as a trigger for arduino code

Hello all,

I have a small project (using arduino UNO) that I am doing where I need to activate multiple external camera flashs but depending on what number photo it is, depends on which flash.

photo 1 triggers flash 1
photo 2 triggers flash 2
and so on…

So I have the flashes connected to digital pins 2 through 9 via 3.5mm aux connections. I am using the flash sync port also through a 3.5mm aux connection into pin A0. My plan was to use this sync port the same way as a push button as all that happens is the camera closes the connection between the two parts. Now this works perfectly fine normally.

But the issue I’m having is that when I plug the USB data cable from PC into the camera the signal doesn’t work. What seems to be happening is that the small current coming from the arduino gets “lost” (grounded) within the camera and doesn’t make it back to the arduino for it to register the “button push”.

I have tried many options including:

The default layout for a basic Push Button.

Having a seperate 5v current go through the camera to activate a transistor that then closes the circuit and acts like the pushbutton.

I even tried using an interupt. So instead of using pin A0 as the trigger I used pin 2 and moved the flash pins up one, long story short that didn’t help either. I got the same result.

All of these work fine when the camera is not plugged in via USB, the issue is I need it to be plugged in as I am transfering the images from the camera directly to the PC because to save time explaining it just has to be that way because of the amount of cameras I will be using and images that will be taken.

Is there a better way of detecting a closed circuit on the arduino that isn’t like using a push button?

I have attached my code but 1) its messy. 2) I don’t feel its the code thats the issue its the hardware (wiring) side thats the issue.

I have also attached a schematic, really bad one but just to give an idea of the current setup. This works, but not with the USB in.

This video is a quick demo of it working to just trigger one LED and the issue thazt happens with the USB. DEMO VIDEO

thanks for the help.

const int buttonPin = A0;


int buttonState = 0;
int buttonState2 = 0;

const int FlashLight1 =  2 ;
const int FlashLight2 =  3 ;
const int FlashLight3 =  4 ;
const int FlashLight4 =  5 ;
const int FlashLight5 =  6 ;
const int FlashLight6 =  7 ;
const int FlashLight7 =  8 ;
const int FlashLight8 =  9 ;

const int ReadyLight =  12 ;

int iSets = 1;
int ButtonCount = 0;
int Duration = 90;


void setup() {

  pinMode(FlashLight1, OUTPUT);
  pinMode(FlashLight2, OUTPUT);
  pinMode(FlashLight3, OUTPUT);
  pinMode(FlashLight4, OUTPUT);
  pinMode(FlashLight5, OUTPUT);
  pinMode(FlashLight6, OUTPUT);
  pinMode(FlashLight7, OUTPUT);
  pinMode(FlashLight8, OUTPUT);
  pinMode(ReadyLight, OUTPUT);

  pinMode(buttonPin, INPUT);

  digitalWrite(FlashLight1, LOW);
  digitalWrite(FlashLight2, LOW);
  digitalWrite(FlashLight3, LOW);
  digitalWrite(FlashLight4, LOW);
  digitalWrite(FlashLight5, LOW);
  digitalWrite(FlashLight6, LOW);
  digitalWrite(FlashLight7, LOW);
  digitalWrite(FlashLight8, LOW);
  digitalWrite(ReadyLight, LOW);
  
  //digitalWrite(buttonPin, HIGH);
  

  Serial.begin(9600);
  delay(1000);

  iSets = 2;
}




void loop() {

  buttonState = analogRead(buttonPin);

  if (buttonState >= 100) {

    //digitalWrite(BusyLight, HIGH);
    //digitalWrite(ReadyLight, LOW);

    ButtonCount = ButtonCount + 1;

    //************************************

    if (ButtonCount == 1) {
      digitalWrite(FlashLight1, HIGH);
      digitalWrite(FlashLight2, HIGH);
      digitalWrite(FlashLight3, HIGH);
      digitalWrite(FlashLight4, HIGH);
      digitalWrite(FlashLight5, HIGH);
      digitalWrite(FlashLight6, HIGH);
      digitalWrite(FlashLight7, HIGH);
      digitalWrite(FlashLight8, HIGH);
      delay(Duration);
      digitalWrite(FlashLight1, LOW);
      digitalWrite(FlashLight2, LOW);
      digitalWrite(FlashLight3, LOW);
      digitalWrite(FlashLight4, LOW);
      digitalWrite(FlashLight5, LOW);
      digitalWrite(FlashLight6, LOW);
      digitalWrite(FlashLight7, LOW);
      digitalWrite(FlashLight8, LOW);
    }
    if (ButtonCount == 2) {
      digitalWrite(FlashLight1, HIGH);
      delay(Duration);
      digitalWrite(FlashLight1, LOW);
    }
    if (ButtonCount == 3) {
      digitalWrite(FlashLight2, HIGH);
      delay(Duration);
      digitalWrite(FlashLight2, LOW);
    }
    if (ButtonCount == 4) {
      digitalWrite(FlashLight3, HIGH);
      delay(Duration);
      digitalWrite(FlashLight3, LOW);
    }
    if (ButtonCount == 5) {
      digitalWrite(FlashLight4, HIGH);
      delay(Duration);
      digitalWrite(FlashLight4, LOW);
    }
    if (ButtonCount == 6) {
      digitalWrite(FlashLight5, HIGH);
      delay(Duration);
      digitalWrite(FlashLight5, LOW);
    }
    if (ButtonCount == 7) {
      digitalWrite(FlashLight6, HIGH);
      delay(Duration);
      digitalWrite(FlashLight6, LOW);
    }
    if (ButtonCount == 8) {
      digitalWrite(FlashLight7, HIGH);
      delay(Duration);
      digitalWrite(FlashLight7, LOW);
    }
    if (ButtonCount == 9) {
      digitalWrite(FlashLight8, HIGH);
      delay(Duration);
      digitalWrite(FlashLight8, LOW);


      //************************************
      ButtonCount = 0;
      //digitalWrite(ReadyLight, HIGH);
      //digitalWrite(BusyLight, LOW);

    }

    delay(10);
    //digitalWrite(ReadyLight, HIGH);
  }
}

Karma for using code tags on a first post. Now include the schematics and any images that would be helpful if you think hardware is the issue. Do you use external pullups on the 'buttonpins'? The common way to use a button is to have it as input_pullup and ground it to activate.

thank you for reply.

I have made a schematic and uploaded it, I have also attached a link to a video demo.

Is it possible the camera is simply not triggering at the sync port when USB is connected. I don’t know why that would be the case, but I don’t see any electronic reason why the trigger would work without USB, but not with it. If you connect a flash directly to the sync port and plug in USB, does the flash fire when you press the shutter button?

Edit: Well, in your video it shows the LED is lit all the time when USB is connected, so I don’t know what’s going on. Your sync port setup seems strange to me. And it may be that the problem is no ground reference between the Arduino and the camera. Try connecting the sleve of the sync port connector to the Arduino ground, then connect the tip back to A0, with A0 set to INPUT_PULLUP. Then change the code so sync is detected when A0 goes low.

Hello, @ShermanP

Yeah I had the same thought but when I connect directly from camera to flash (no arduino) I can still trigger the flash while the USB is plugged in… I need to find out how the flash input unit handles the input and will probably be able to work how to to fix my issue… but can’t seem to find out that little bit of information.

Flash sync is almost universally active LOW. the way you have it wired, and the way you are testing is for a HIGH:

  if (buttonState == HIGH) {

Your pull down resistor should be a pull up resistor (non-signal end connected to 5V) not the pull down you have used, and you should test for a LOW.

Your pull down resistor should be a pull up resistor

ahhhh :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: This worked! Thanks a lot.

Just so its clear what I did.

pinMode(A0, INPUT_PULLUP);

and then in the loop I did:

if (sensorValue = digitalRead(buttonRead) == LOW) {

With this schematic.

Thanks everyone for the help!

Lol, see post 1

pmagowan:
Lol, see post 1

All roads lead to Rome.

lol, sorry 100% just didn’t understand. Mybad. <3 :slight_smile: