RC-Receiver PPM Signal having large glitches/peaks [semi-SOLVED]

Hi Folks,

I currently try to read a PPM signal with an Arduino (Nano v3) for further processing in a Quadrocopter.

Setup:

  • Nano V3 supplying RC-Receiver
  • they share a common ground
  • using inerrupt pin D3 on nano with signal line on arduino
  • Turnigy TGY-i6 + iA6 AFHDS 2A
  • Turnigy TGY-i6 + FlySky FS-R6B AFHDS

What I basically do is:

onInterrupt(){
  readPPMAndCalculateThrust(); //values between ~1000 to 2000
}

loop(){
  readSomeSensors();
  calculateThrustForEngines();
  updateEnginesThrust();
}

Problem:

The signal has random really large peaks (see attachement). I already tried dozens of implementations for reading PPM signals by interrupt and every implmentation is facing the same problem.

Semi-Solution:

At the end of my loop I added a routine to have a constand round-trip-time.

  //ensure desired round trip time is not too tight
  if(millis() - start > RTT)
    abort("RTT to small");

  //wait
  while(millis()-start < RTT)
    delay(1);

Seems like the interrupt cannot go together with 1ms delay. I changed it to delay(5) and it’s working perfectly with some minor glitches which can be filtered easy.

Update:

I tried waiting the remaing time at once delay(RTT-millis()+start); wich brings up my old problem. So I’ll stick to delay(5) - still don’t know whats causing this :frowning:

Regards,
BlubBlubClub