Hey,
I am currently stuck with a problem that deals with the decoding of PPM-signals(i suppose) coming from an RC Remote. My RC Transmitter model is a Robbe Futaba F-14, with the corresponding Robbe Futaba FP-R118F Receiver, which is hooked up to my Arduino Zero.
I can in fact already decode the Pitch/Roll/Yaw/Throttle stick signals given in seperate channels, but my Remote Control is expandable with a Multi-Switch module with 8 switches which gets encoded onto a single RC channel which i have to decode. I suspected it would be PPM and informed myself a bit, but the signal doesn't really look like normal PPM to me.
(Attached Files: PseudoOscilloscopeCHANGE.png shows the state of the pin, as returned by an Interrupt routine, TimeCHANGE.png shows the time between one pin change; CHANGE indicates that the interrupt Routine was set to CHANGE)
My code:
volatile unsigned long f_start_time = 0L;
volatile unsigned long f_now = 0L;
volatile unsigned long f_val = 0L;
volatile short f_values[9];
volatile int f_index = 0;
volatile boolean f = false;
int min_f = 200000;
int max_f = 0;
const int rc_functionPin = 12;
//############################################################################
void setup() {
Serial.begin(19200);
setupInterrupts();
}
//############################################################################
void loop() {
// Serial.println(f_val);
Serial.println(f);
// Serial.print('\t');
// Serial.print(max_f);
// Serial.print('\t');
// Serial.println(min_f);
// Serial.print('\t');
// for(int i = 0; i < 7; i++) {
// Serial.print(f_values[i]);
// Serial.print('\t');
// }
// Serial.println(f_values[7]);
}
//############################################################################
void setupInterrupts() {
pinMode(rc_functionPin, INPUT);
attachInterrupt(rc_functionPin, functionHandler, CHANGE);
}
void functionHandler() {
f = !f; /*f shows the state of the pin when the interrupt is set to CHANGE, so that the Arduino can act as an Oscilloscope*/
f_now = micros();
f_val = f_now - f_start_time;
f_start_time = f_now;
//
// if(f_val >= 18000) {
// f_index = 0;
// }else {
// f_values[f_index] = f_val;
// f_index = ((f_index + 1) % 9);
// }
}
The commented out stuff in loop() is for debugging various things, in functionHandler(), the comments were my idea of parsing the PPM-channels, but this really didnt work since it only filled the first index in the array.
What is the correct way to decode this extra function of an RC Transmitter? Is this normal PPM and i am just kinda dumb or is this something special? If any of these cases apply, can anyone explain my mistake/give me directions to work with?
Any help would be really appreciated, and feel free to ask something,
TheBeast