# Using camera flash sync output as a trigger for arduino code

**URL:** <https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647>\
**Category:** General Electronics\
**Created:** [August 31, 2020, 6:49pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647 "2020-08-31T18:49:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheRealFredd](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@TheRealFredd](https://forum.arduino.cc/u/TheRealFredd)\
**Post date:** [August 31, 2020, 6:49pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/1 "2020-08-31T18:49:03Z")

</div>

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](https://drive.google.com/file/d/1n-EmSOh8AzTo-oSUodlQsjZNDgRccpCU/view?usp=sharing)

thanks for the help.

```cpp
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);
  }
}

```

 ![Capture.JPG](https://europe1.discourse-cdn.com/arduino/original/4X/6/8/6/6863ef39fbe7c691e4971b869e2930457ab77d22.jpeg)

---

<div class="post-metadata">

**Author:** ![pmagowan](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@pmagowan](https://forum.arduino.cc/u/pmagowan)\
**Post date:** [August 31, 2020, 7:24pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/2 "2020-08-31T19:24:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TheRealFredd](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@TheRealFredd](https://forum.arduino.cc/u/TheRealFredd)\
**Post date:** [August 31, 2020, 9:19pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/3 "2020-08-31T21:19:58Z")

</div>

thank you for reply.

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

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [August 31, 2020, 9:36pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/4 "2020-08-31T21:36:12Z")

</div>

![Capture.JPG](https://europe1.discourse-cdn.com/arduino/original/4X/6/8/6/6863ef39fbe7c691e4971b869e2930457ab77d22.jpeg)

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [August 31, 2020, 10:24pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/5 "2020-08-31T22:24:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TheRealFredd](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@TheRealFredd](https://forum.arduino.cc/u/TheRealFredd)\
**Post date:** [August 31, 2020, 10:33pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/6 "2020-08-31T22:33:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [September 1, 2020, 1:43am UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/7 "2020-09-01T01:43:52Z")

</div>

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

```cpp
  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.

---

<div class="post-metadata">

**Author:** ![TheRealFredd](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@TheRealFredd](https://forum.arduino.cc/u/TheRealFredd)\
**Post date:** [September 1, 2020, 9:51am UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/8 "2020-09-01T09:51:00Z")

</div>

> Your pull down resistor should be a pull up resistor

ahhhh 🙂 🙂 🙂 🙂 🙂 This worked! Thanks a lot.

Just so its clear what I did.

```arduino
pinMode(A0, INPUT_PULLUP);

```

and then in the loop I did:

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

```

With this schematic.

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/e/e/6/ee6aaeffe5dd9bb0acb2e0f16db10629bc7ad705.png)

Thanks everyone for the help!

---

<div class="post-metadata">

**Author:** ![pmagowan](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@pmagowan](https://forum.arduino.cc/u/pmagowan)\
**Post date:** [September 1, 2020, 10:46am UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/9 "2020-09-01T10:46:00Z")

</div>

Lol, see post 1

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [September 1, 2020, 1:14pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/10 "2020-09-01T13:14:27Z")

</div>

> pmagowan:  
> Lol, see post 1

All roads lead to Rome.

---

<div class="post-metadata">

**Author:** ![TheRealFredd](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@TheRealFredd](https://forum.arduino.cc/u/TheRealFredd)\
**Post date:** [September 1, 2020, 1:35pm UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/11 "2020-09-01T13:35:03Z")

</div>

lol, sorry 100% just didn't understand. Mybad. \<3 🙂

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 2:35am UTC](https://forum.arduino.cc/t/using-camera-flash-sync-output-as-a-trigger-for-arduino-code/672647/12 "2021-05-06T02:35:46Z")

</div>

Closed on May 6, 2021, 2:35am UTC


