Read PPM signal

retrolefty:
Keep in mind that a PPM stream decoding function requires two different process to happen, frame start/stop detection and the individual channel number's width information . First before it can accurately process the individual channel data it has to 'sync' up with the PPM framing rate so that it will knows which pulse represents which channel consistently. After the last channel there will always be a longer zero period that fills out to the end of the 20-25msec frame period. Only after your decoder's algorithm has detected the end of the frame will it know that the next 1 to 2msec wide pulse represents the channel 1 information, and each in order after that until the end of the PPM frame.

That make sense?

Lefty

Yes, I had found that out in the meantime as well, you mean like the synchronisation frame as shown is this picture right?

I have since then adapted my code to further decode the signal:

volatile int signal = LOW;
volatile boolean signalIn = false;
volatile long timeBetweenPulse1 = 0; //pulse lenght channel 1
volatile long timeBetweenPulse2 = 0; //pulse lenght channel 2
volatile long timeBetweenPulse3 = 0; //pulse lenght channel 3
volatile long timeBetweenPulse4 = 0; //pulse length channel 4
volatile long timeBetweenPulse5 = 0; //pulse lenght of the synchronisation pulse
volatile long timeLastPulse = 0; //time in microseconds of the last pulse
volatile int counter = 1; //counts from 1 to 5, and makes the channel correspond with the pulse


void setup()
{
  Serial.begin(9600);
  attachInterrupt(0, state, RISING);
}

void loop()
{
  if(signalIn == true)
  {
    Serial.print(timeBetweenPulse1);
    Serial.print(" ");
    Serial.print(timeBetweenPulse2);
    Serial.print(" ");
    Serial.print(timeBetweenPulse3);
    Serial.print(" ");
    Serial.print(timeBetweenPulse4);
    Serial.print(" ");
    Serial.println(timeBetweenPulse5);
    signalIn = false;
  }
}

void state()
{
  if (counter == 1)
  {
  timeBetweenPulse1 = (int)(micros() - timeLastPulse);
  timeLastPulse = micros();
  counter = 2;
  } else if(counter == 2)
    {
      timeBetweenPulse2 = (int)(micros() - timeLastPulse);
      timeLastPulse = micros();
      counter = 3;
    } else if(counter == 3)
      {
        timeBetweenPulse3 = (int)(micros() - timeLastPulse);
        timeLastPulse = micros();
        counter = 4;
      } else if(counter == 4)
        {
          timeBetweenPulse4 = (int)(micros() - timeLastPulse);
          timeLastPulse = micros();
          counter = 5;
        } else
          {
            timeBetweenPulse5 = (int)(micros() - timeLastPulse);
            timeLastPulse = micros();
            counter = 1;
            signalIn = true;
          }
}

I'm still having trouble with getting the right signal, even when the cables aren't connected to anything I still get signals with about 20000 of microseconds time between them. How should I connect the arduino to my transmitter in a way that there is a common ground?