Remote Control Transmitter Trainer Port PPM Signal

Hi Guys

I am wanting to use an Arduino Uno to generate a Pulse Position Modulation (PPM) signal that I can send through the trainer port on my remote control transmitter. I need to generate a ‘frame’ which consists of a series of pulses (one for each channel) followed by a synchronisation pulse. From what I’ve read this frame differs depending on the transmitter. I have found the following image for the HK-T6A V2;

http://img401.imageshack.us/img401/8622/pinningvk8.jpg

I have written the following sketch to test the above but it doesn’t appear to be working;

int startFrame = 0;

void setup(){
  pinMode(13, OUTPUT);  
}

void loop(){
  startFrame = micros();
  for (int x = 0; x < 1; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }
  
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(1600);
    
  for (int x = 0; x < 2; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }  
    
  while (micros() - startFrame < 20000){
    delay(1000);
  }
}

Any suggestions would be greatly appreciated.

Kind Regards

Jason

What do you want to use the PPM Stream for ?

I might have something that will help

Duane B

rcarduino.blogspot.com

while (micros() - startFrame < 20000){
delay(1000);

“micros” is a time in microseconds, “delay” is a delay in milliseconds.
Waiting a second for a 20 millisecond frame timeout isn’t sensible.
“delayMicroseconds” is what you want, I suspect.

Edit: You don’t want a delay at all, you just need to idle until your frame time is up.

Hi Guys

Thanks for the replies.

@DuaneB: I would like to integrate a joystick with my remote control transmitter using just two channels via the trainer port.

@AWOL: I have made the changes you have suggested (see below). I have also added a synchronisation pulse. Still not working. :roll_eyes:

Cheers

Jase

//PPM Signal Test 1

int startFrame = 0;

void setup(){
  pinMode(13, OUTPUT);  
}

void loop(){
  
  startFrame = micros();
  
  //Channels 1 & 2
  for (int x = 0; x < 1; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }
  
    //Channel 3 (Should run motor at full speed)
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(1600);
    
  //Channels 4, 5 & 6
  for (int x = 0; x < 2; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }

  //Sync pulse
  digitalWrite(13, LOW);
  delayMicroseconds(400);
  digitalWrite(13, HIGH);  
    
  //Wait until frame of 20000 microseconds has passed
  while (micros() - startFrame < 20000){
    delayMicroseconds(1000);
  }
}

Still not working.

I wonder what that means.

//Channels 1 & 2
  for (int x = 0; x < 1

Comment and code should match.

Hi, If I understand correctly, you want to add an external joystick which will be connected to Arduino, the Arduino will then generate a PPM Stream which will be fed into your existing transmitter ?

How many channels is the transmitter, it probably expects a full set of channels coming in and will reject any pulse trains that do not include a full set.

As for generating the PPM, I would use interrupts, the clock signal from this project is very close to a PPM Stream, if I find some time later today I will modify the code slightly to generate a full PPM Signal.

http://rcarduino.blogspot.com/2012/08/arduino-serial-servos.html

Duane B

Hi AWOL

Thanks for getting back to me so quickly. The sketch I’m using should run the motor at full speed. Unfortunately it doesn’t run at all. :frowning:

I have made the changes to the ‘for’ loops as suggested (must have been up too late).

Cheers

Jason

//PPM Signal Test 1

int startFrame = 0;

void setup(){
  pinMode(13, OUTPUT);  
}

void loop(){
  
  startFrame = micros();
  
  //Channels 1 & 2
  for (int x = 0; x < 2; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }
  
    //Channel 3 (Should run motor at full speed)
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(1600);
    
  //Channels 4, 5 & 6
  for (int x = 0; x < 3; x++){
    digitalWrite(13, LOW);
    delayMicroseconds(400);
    digitalWrite(13, HIGH);
    delayMicroseconds(600);
  }

  //Sync pulse
  digitalWrite(13, LOW);
  delayMicroseconds(400);
  digitalWrite(13, HIGH);  
    
  //Wait until frame of 20000 microseconds has passed
  while (micros() - startFrame < 20000){
  }
}

Hi DuaneB

If I understand correctly, you want to add an external joystick which will be connected to Arduino, the Arduino will then generate a PPM Stream which will be fed into your existing transmitter?

Correct. :)

The sketch I have written 'should' be generating a full six channels (see link below).

http://img401.imageshack.us/img401/8622/pinningvk8.jpg

Am I correct in thinking that on inexpensive remote control transmitters when the master selects slave then all channels are accepted from the slave. In contrast on better remote control transmitters you can elect what channels to accept from the slave?

Cheers

Jase

Hi, If you PM Me your email address I will send you a variation of the Serial Servo library which outputs a pure PPM signal - I don't have anything to test it on at the moment.

Duane B

rcarduino.blogspot.com

DuaneB: Hi, If you PM Me your email address I will send you a variation of the Serial Servo library which outputs a pure PPM signal - I don't have anything to test it on at the moment.

Duane B

rcarduino.blogspot.com

Hi Duane, Did you ever get that working? If so, I could use a copy of your sketch please. I am trying to get a similar device working. Basically, it would listen to the rc transmitter trainer port output during a flight, print it to serial monitor on a pc. I want to be able to switch the transmitter to slave mode and then paste the previously captured serial data back in to send it over the trainer port to control the r/c model. This would be a sort of programmable autopilot which is taught a route via a manual flights.

At the very least this could be used to make preset stunt buttons.

Thanks in advance, - triops124