Interrupt Pin interference from reading Pixhawk UART

I am not exactly sure if this is the correct thread in this forum or the right forum to ask this question. If it is not please let me know.

I have an arduino micro whose purpose is to read Telemetry data over the 3DR Pixhawk’s ('s Telemetry [Telem1 or Telem2] UART port. To accomplish this I connected the TX from the Pixhawk’s UART to the RX pin on the micro and GND ( I left out TX since I only need to receive serial). The arduino is constantly parsing the MAVLink packets with the telemetry information over serial and saving the current state in an object. This is done through Serial1. In addition, the telemtry information is to be written out to Serial when a USB camera I have takes a frame. To accomplish this, The camera has an internal Opto-isolator with two strobe pin’s that are shorted when an image is taken. I have one of the strobe wires attached to pin 2 on the Micro with INPUT_PULLUP set and the other connected to GND. I attached an interrupt handler to pin 2 on FALLING (since pin 2 gets pulled low when the opto-isolator shorts the strobe wires) this signals the micro to output its current telemetry state to Serial.

The interrupt seems to be in sync with the cameras shutter after adding a debouncer with capacitors and resistors. However, when I connect to the Pixhawk’s serial port, a few things start go wrong:

  1. I have issues uploading scripts to the arduino
  2. The interrupt does cause telemtry to be outputed over Serial. However, the interrupt is fired too many times. Thus it seems the pixhawk’s UART is causing some sort of ‘interference’. (when the pixhawk’s serial is detached it is fired the correct number of times)

Any ideas on how I could go about reducing the 'inteference`?

Here is the script I am using :

#include <Mavlink.h>

const unsigned TRIGGER_PIN = 2;
volatile bool trigger_state = 0;
//utilizes Ardupilot libraries to parse mavlink packets from pixhawk UART on Serial1
Mavlink mav(Serial1);

void setup() {
	//output telemtry to USB
	while(!Serial); // for arduino micro
	//used for receiving serial over the Pixhawks UART
	//interrupt pin to get pulled LOW when camera is triggered    	
      	//set state to HIGH with pullup

//on interrupt
void fct(){
trigger_state = true;

volatile  int pic_count = 0;
void loop() {

      //constantly read in mav packets and update attribute state;
    //if trigger interrupt occured
    if (trigger_state){
      //reset state
      trigger_state = false;
      //fetch telemetry state attributes
      Mavlink::attributes attribs = mav.getAttribs();
      //write them out to console USB
      Serial.print("   Lat: "); Serial.print(;
      Serial.print("   Lon: "); Serial.print(attribs.lon);
      Serial.print("   Rel Alt: "); Serial.print(attribs.rel_alt);
      Serial.print("   Roll: "); Serial.print(attribs.roll);
      Serial.print("   Pitch: "); Serial.print(attribs.pitch);
      Serial.print("   Yaw: "); Serial.println(attribs.yaw);


How long is the cable to the camera?

Some ideas:

Use a lower pullup resistor for the trigger (1k?), to reduce interference on the line. If you added a RC filter, tie this pullup to the line side, not to the input pin.

Check the polarity of the trigger connection. The emitter of the NPN transistor of the optocoupler goes to Gnd. If in doubt, consult the camera data sheet.