Pages: [1]   Go Down
Author Topic: Remote Control Transmitter Trainer Port PPM Signal  (Read 1308 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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;

Code:
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
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you want to use the PPM Stream for ?

I might have something that will help

Duane B

rcarduino.blogspot.com
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
« Last Edit: November 30, 2012, 08:32:09 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-roll

Cheers

Jase

Code:
//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);
  }
}


« Last Edit: November 30, 2012, 06:31:03 pm by ilovetoflyfpv » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Still not working.
I wonder what that means.

Code:
//Channels 1 & 2
  for (int x = 0; x < 1
Comment and code should match.
« Last Edit: November 30, 2012, 06:33:34 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-sad

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

Cheers

Jason

Code:
//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){
  }
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi DuaneB

Quote
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. smiley

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
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: [1]   Go Up
Jump to: